mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +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 )
|
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 )
|
public static int getDefaultBoardSize( Context context )
|
||||||
|
@ -233,26 +233,27 @@ public class CommonPrefs {
|
||||||
|
|
||||||
public static boolean getDefaultTimerEnabled( Context context )
|
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 )
|
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 )
|
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 )
|
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,
|
public static boolean getPrefsBoolean( Context context, int keyID,
|
||||||
boolean defaultValue )
|
boolean defaultValue )
|
||||||
{
|
{
|
||||||
String key = context.getString( keyID );
|
String key = context.getString( keyID );
|
||||||
SharedPreferences sp = PreferenceManager
|
SharedPreferences sp = PreferenceManager
|
||||||
|
@ -260,6 +261,17 @@ public class CommonPrefs {
|
||||||
return sp.getBoolean( key, defaultValue );
|
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 )
|
private static String getString( Context context, int keyID )
|
||||||
{
|
{
|
||||||
String key = context.getString( keyID );
|
String key = context.getString( keyID );
|
||||||
|
|
Loading…
Reference in a new issue