mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
add default robot name to prefs
This commit is contained in:
parent
9886d5a6e6
commit
8486bad44b
8 changed files with 717 additions and 730 deletions
File diff suppressed because it is too large
Load diff
|
@ -50,9 +50,7 @@
|
|||
<string name="key_default_language">key_default_language</string>
|
||||
<string name="key_default_dict">key_default_dict</string>
|
||||
<string name="key_player1_name">key_player1_name</string>
|
||||
<string name="key_player2_name">key_player2_name</string>
|
||||
<string name="key_player3_name">key_player3_name</string>
|
||||
<string name="key_player4_name">key_player4_name</string>
|
||||
<string name="key_robot_name">key_robot_name</string>
|
||||
<string name="key_default_robodict">key_default_robodict</string>
|
||||
<string name="key_default_phonies">key_default_phonies2</string>
|
||||
<string name="key_default_timerenabled">key_default_timerenabled</string>
|
||||
|
|
|
@ -795,15 +795,18 @@
|
|||
<!-- clarification of the above -->
|
||||
<string name="prefs_names_summary">Default player names</string>
|
||||
|
||||
<!-- Label for the first "player name" preference -->
|
||||
<!-- Label for the first player color preference -->
|
||||
<string name="pref_player1_name">First player</string>
|
||||
<!-- Label for the second "player name" preference (unused)-->
|
||||
<!-- Label for the second player color preference -->
|
||||
<string name="pref_player2_name">Second player</string>
|
||||
<!-- Label for the third "player name" preference (unused) -->
|
||||
<!-- Label for the third player color preference -->
|
||||
<string name="pref_player3_name">Third player</string>
|
||||
<!-- Label for the fourth "player name" preference (unused)-->
|
||||
<!-- Label for the fourth player color preference -->
|
||||
<string name="pref_player4_name">Fourth player</string>
|
||||
|
||||
<!-- Label for the first "human player" name preference -->
|
||||
<string name="pref_human_name">Human player</string>
|
||||
|
||||
<!-- Used to indicate that a preference is not enabled, i.e. not
|
||||
part of the game and that the user should ignore it. -->
|
||||
<string name="tell_unused">Not used yet…</string>
|
||||
|
|
|
@ -13,33 +13,15 @@
|
|||
|
||||
<org.eehouse.android.xw4.XWEditTextPreference
|
||||
android:key="@string/key_player1_name"
|
||||
android:title="@string/pref_player1_name"
|
||||
android:title="@string/pref_human_name"
|
||||
android:capitalize="words"
|
||||
android:defaultValue=""
|
||||
/>
|
||||
<org.eehouse.android.xw4.XWEditTextPreference
|
||||
android:key="@string/key_player2_name"
|
||||
android:title="@string/pref_player2_name"
|
||||
android:capitalize="words"
|
||||
android:defaultValue="ignored"
|
||||
android:summary="@string/tell_unused"
|
||||
android:enabled="false"
|
||||
/>
|
||||
<org.eehouse.android.xw4.XWEditTextPreference
|
||||
android:key="@string/key_player3_name"
|
||||
android:title="@string/pref_player3_name"
|
||||
android:key="@string/key_robot_name"
|
||||
android:title="@string/robot_label"
|
||||
android:capitalize="words"
|
||||
android:defaultValue=""
|
||||
android:summary="@string/tell_unused"
|
||||
android:enabled="false"
|
||||
/>
|
||||
<org.eehouse.android.xw4.XWEditTextPreference
|
||||
android:key="@string/key_player4_name"
|
||||
android:title="@string/pref_player4_name"
|
||||
android:capitalize="words"
|
||||
android:defaultValue=""
|
||||
android:summary="@string/tell_unused"
|
||||
android:enabled="false"
|
||||
android:defaultValue="@string/button_default_robot"
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
|
||||
|
|
|
@ -678,14 +678,16 @@
|
|||
<string name="prefs_names">Reyalp seman</string>
|
||||
<!-- clarification of the above -->
|
||||
<string name="prefs_names_summary">Tluafed reyalp seman</string>
|
||||
<!-- Label for the first "player name" preference -->
|
||||
<!-- Label for the first player color preference -->
|
||||
<string name="pref_player1_name">Tsrif reyalp</string>
|
||||
<!-- Label for the second "player name" preference (unused)-->
|
||||
<!-- Label for the second player color preference -->
|
||||
<string name="pref_player2_name">Dnoces reyalp</string>
|
||||
<!-- Label for the third "player name" preference (unused) -->
|
||||
<!-- Label for the third player color preference -->
|
||||
<string name="pref_player3_name">Driht reyalp</string>
|
||||
<!-- Label for the fourth "player name" preference (unused)-->
|
||||
<!-- Label for the fourth player color preference -->
|
||||
<string name="pref_player4_name">Htruof reyalp</string>
|
||||
<!-- Label for the first "human player" name preference -->
|
||||
<string name="pref_human_name">Namuh reyalp</string>
|
||||
<!-- Used to indicate that a preference is not enabled, i.e. not
|
||||
part of the game and that the user should ignore it. -->
|
||||
<string name="tell_unused">Ton desu tey…</string>
|
||||
|
|
|
@ -678,14 +678,16 @@
|
|||
<string name="prefs_names">PLAYER NAMES</string>
|
||||
<!-- clarification of the above -->
|
||||
<string name="prefs_names_summary">DEFAULT PLAYER NAMES</string>
|
||||
<!-- Label for the first "player name" preference -->
|
||||
<!-- Label for the first player color preference -->
|
||||
<string name="pref_player1_name">FIRST PLAYER</string>
|
||||
<!-- Label for the second "player name" preference (unused)-->
|
||||
<!-- Label for the second player color preference -->
|
||||
<string name="pref_player2_name">SECOND PLAYER</string>
|
||||
<!-- Label for the third "player name" preference (unused) -->
|
||||
<!-- Label for the third player color preference -->
|
||||
<string name="pref_player3_name">THIRD PLAYER</string>
|
||||
<!-- Label for the fourth "player name" preference (unused)-->
|
||||
<!-- Label for the fourth player color preference -->
|
||||
<string name="pref_player4_name">FOURTH PLAYER</string>
|
||||
<!-- Label for the first "human player" name preference -->
|
||||
<string name="pref_human_name">HUMAN PLAYER</string>
|
||||
<!-- Used to indicate that a preference is not enabled, i.e. not
|
||||
part of the game and that the user should ignore it. -->
|
||||
<string name="tell_unused">NOT USED YET…</string>
|
||||
|
|
|
@ -174,14 +174,7 @@ public class CommonPrefs extends XWPrefs {
|
|||
public static String getDefaultPlayerName( Context context, int num,
|
||||
boolean force )
|
||||
{
|
||||
int id = 0;
|
||||
switch( num ) {
|
||||
case 0: id = R.string.key_player1_name; break;
|
||||
case 1: id = R.string.key_player2_name; break;
|
||||
case 2: id = R.string.key_player3_name; break;
|
||||
case 3: id = R.string.key_player4_name; break;
|
||||
}
|
||||
String result = getPrefsString( context, id );
|
||||
String result = getPrefsString( context, R.string.key_player1_name );
|
||||
if ( null != result && 0 == result.length() ) {
|
||||
result = null; // be consistent
|
||||
}
|
||||
|
@ -197,6 +190,11 @@ public class CommonPrefs extends XWPrefs {
|
|||
return getDefaultPlayerName( context, num, true );
|
||||
}
|
||||
|
||||
public static String getDefaultRobotName( Context context )
|
||||
{
|
||||
return getPrefsString( context, R.string.key_robot_name );
|
||||
}
|
||||
|
||||
public static void setDefaultPlayerName( Context context, String value )
|
||||
{
|
||||
setPrefsString( context, R.string.key_player1_name, value );
|
||||
|
|
|
@ -103,8 +103,9 @@ public class CurGameInfo {
|
|||
int count = 0;
|
||||
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||
LocalPlayer lp = players[ii];
|
||||
if ( lp.isLocal && !lp.isRobot() ) {
|
||||
lp.name = CommonPrefs.getDefaultPlayerName( context, count++ );
|
||||
if ( lp.isLocal ) {
|
||||
lp.name = lp.isRobot() ? CommonPrefs.getDefaultRobotName( context )
|
||||
: CommonPrefs.getDefaultPlayerName( context, count++ );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue