add new pref controlling whether networked games have hints enabled by

default.
This commit is contained in:
Eric House 2012-04-10 07:53:39 -07:00
parent 90bca47e1b
commit e703685021
5 changed files with 24 additions and 4 deletions

View file

@ -40,6 +40,7 @@
<string name="key_logging_on">key_logging_on</string>
<string name="key_show_sms">key_show_sms</string>
<string name="key_init_hintsallowed">key_init_hintsallowed</string>
<string name="key_init_nethintsallowed">key_init_nethintsallowed</string>
<string name="key_init_autojuggle">key_init_autojuggle</string>
<string name="key_board_size">key_board_size</string>
<string name="key_initial_player_minutes">key_initial_player_minutes</string>

View file

@ -386,6 +386,11 @@
generated based on his tray. Can be used to cheat. -->
<string name="hints_allowed">Allow hints</string>
<!-- text of checkbox. If this checkbox is checked, games created
for network play will by default have the hint feature
enabled. -->
<string name="nethints_allowed">Allow hints (networked)</string>
<!-- text of checkbox controlling whether there's a game timer -->
<string name="use_timer">Enable game timer</string>
@ -851,6 +856,11 @@
in this file) -->
<string name="hints_allowed_sum">Enable the hint feature</string>
<!-- clarification on hints_allowed, whether new NETWORKED games
will default to having the hint feature enabled(string
elsewhere in this file) -->
<string name="nethints_allowed_sum">Enable hints for two-device games</string>
<!-- Will new games, on default, randomly rearrange the start
order of players. -->
<string name="init_autojuggle">Juggle players</string>

View file

@ -65,6 +65,12 @@
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_init_nethintsallowed"
android:title="@string/nethints_allowed"
android:summary="@string/nethints_allowed_sum"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_init_autojuggle"
android:title="@string/init_autojuggle"
android:summary="@string/init_autojuggle_sum"

View file

@ -292,10 +292,12 @@ public class CommonPrefs {
false );
}
public static boolean getDefaultHintsAllowed( Context context )
public static boolean getDefaultHintsAllowed( Context context,
boolean networked )
{
return getPrefsBoolean( context, R.string.key_init_hintsallowed,
true );
int key = networked ?
R.string.key_init_nethintsallowed : R.string.key_init_hintsallowed;
return getPrefsBoolean( context, key, true );
}
public static boolean getAutoJuggle( Context context )

View file

@ -73,7 +73,8 @@ public class CurGameInfo {
players = new LocalPlayer[MAX_NUM_PLAYERS];
serverRole = isNetworked ? DeviceRole.SERVER_ISCLIENT
: DeviceRole.SERVER_STANDALONE;
hintsNotAllowed = !CommonPrefs.getDefaultHintsAllowed( context );
hintsNotAllowed = !CommonPrefs.getDefaultHintsAllowed( context,
isNetworked );
phoniesAction = CommonPrefs.getDefaultPhonies( context );
timerEnabled = CommonPrefs.getDefaultTimerEnabled( context );
allowPickTiles = false;