mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
add setPrefsBoolean
This commit is contained in:
parent
95f5c2e023
commit
8db6c7ad7f
1 changed files with 19 additions and 7 deletions
|
@ -170,7 +170,7 @@ public class CommonPrefs {
|
|||
|
||||
public static boolean getVolKeysZoom( Context context )
|
||||
{
|
||||
return getBoolean( context, R.string.key_ringer_zoom, false );
|
||||
return getPrefsBoolean( context, R.string.key_ringer_zoom, false );
|
||||
}
|
||||
|
||||
public static int getDefaultBoardSize( Context context )
|
||||
|
@ -233,26 +233,27 @@ public class CommonPrefs {
|
|||
|
||||
public static boolean getDefaultTimerEnabled( Context context )
|
||||
{
|
||||
return getBoolean( context, R.string.key_default_timerenabled, false );
|
||||
return getPrefsBoolean( context, R.string.key_default_timerenabled,
|
||||
false );
|
||||
}
|
||||
|
||||
public static boolean getHideTitleBar( Context context )
|
||||
{
|
||||
return getBoolean( context, R.string.key_hide_title, true );
|
||||
return getPrefsBoolean( context, R.string.key_hide_title, true );
|
||||
}
|
||||
|
||||
public static boolean getClickLaunches( Context context )
|
||||
{
|
||||
return getBoolean( context, R.string.key_click_launches, false );
|
||||
return getPrefsBoolean( context, R.string.key_click_launches, false );
|
||||
}
|
||||
|
||||
public static boolean getShowBonusSumms( Context context )
|
||||
{
|
||||
return getBoolean( context, R.string.key_show_bonussum, false );
|
||||
return getPrefsBoolean( context, R.string.key_show_bonussum, false );
|
||||
}
|
||||
|
||||
private static boolean getBoolean( Context context, int keyID,
|
||||
boolean defaultValue )
|
||||
public static boolean getPrefsBoolean( Context context, int keyID,
|
||||
boolean defaultValue )
|
||||
{
|
||||
String key = context.getString( keyID );
|
||||
SharedPreferences sp = PreferenceManager
|
||||
|
@ -260,6 +261,17 @@ public class CommonPrefs {
|
|||
return sp.getBoolean( key, defaultValue );
|
||||
}
|
||||
|
||||
public static void setPrefsBoolean( Context context, int keyID,
|
||||
boolean newValue )
|
||||
{
|
||||
SharedPreferences sp = PreferenceManager
|
||||
.getDefaultSharedPreferences( context );
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
String key = context.getString( keyID );
|
||||
editor.putBoolean( key, newValue );
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
private static String getString( Context context, int keyID )
|
||||
{
|
||||
String key = context.getString( keyID );
|
||||
|
|
Loading…
Reference in a new issue