|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.todoroo.andlib.utility.Preferences
public class Preferences
Helper class for reading and writing SharedPreferences
Constructor Summary | |
---|---|
Preferences()
|
Method Summary | |
---|---|
static void |
clear(java.lang.String key)
Clears a preference |
static boolean |
getBoolean(int keyResources,
boolean defValue)
Gets a boolean preference (e.g. |
static boolean |
getBoolean(java.lang.String key,
boolean defValue)
Gets a boolean preference (e.g. |
static java.lang.Float |
getFloatFromString(int keyResource)
Gets an float value from a string preference. |
static int |
getInt(java.lang.String key,
int defValue)
Gets a int preference |
static int |
getIntegerFromString(int keyResource,
int defaultValue)
Gets an integer value from a string preference. |
static long |
getLong(java.lang.String key,
long defValue)
Gets a long preference |
static android.content.SharedPreferences |
getPrefs(android.content.Context context)
Get preferences object from the context |
static java.lang.String |
getStringValue(int keyResource)
Gets an string value from a string preference. |
static java.lang.String |
getStringValue(java.lang.String key)
Gets an string value from a string preference. |
static boolean |
isSet(java.lang.String key)
|
static void |
setBoolean(int keyResource,
boolean value)
Sets boolean preference |
static void |
setBoolean(java.lang.String key,
boolean value)
Sets boolean preference |
static void |
setIfUnset(android.content.SharedPreferences prefs,
android.content.SharedPreferences.Editor editor,
android.content.res.Resources r,
int keyResource,
boolean value)
Helper to write to editor if key specified is null |
static void |
setIfUnset(android.content.SharedPreferences prefs,
android.content.SharedPreferences.Editor editor,
android.content.res.Resources r,
int keyResource,
int value)
Helper to write to editor if key specified is null. |
static void |
setInt(java.lang.String key,
int value)
Sets int preference |
static void |
setLong(java.lang.String key,
long value)
Sets long preference |
static void |
setString(int keyResource,
java.lang.String newValue)
Sets string preference |
static void |
setString(java.lang.String key,
java.lang.String newValue)
Sets string preference |
static void |
setStringFromInteger(int keyResource,
int newValue)
Sets string preference from integer value |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Preferences()
Method Detail |
---|
public static void setIfUnset(android.content.SharedPreferences prefs, android.content.SharedPreferences.Editor editor, android.content.res.Resources r, int keyResource, int value)
prefs
- editor
- r
- keyResource
- value
- public static void setIfUnset(android.content.SharedPreferences prefs, android.content.SharedPreferences.Editor editor, android.content.res.Resources r, int keyResource, boolean value)
prefs
- editor
- r
- keyResource
- value
- public static android.content.SharedPreferences getPrefs(android.content.Context context)
public static boolean isSet(java.lang.String key)
public static java.lang.String getStringValue(java.lang.String key)
context
- key
-
public static java.lang.String getStringValue(int keyResource)
context
- key
-
public static int getIntegerFromString(int keyResource, int defaultValue)
keyResource
- resource from string.xml
public static java.lang.Float getFloatFromString(int keyResource)
keyResource
- resource from string.xml
public static void setString(int keyResource, java.lang.String newValue)
public static void setString(java.lang.String key, java.lang.String newValue)
public static void setStringFromInteger(int keyResource, int newValue)
public static boolean getBoolean(java.lang.String key, boolean defValue)
key
- defValue
-
public static boolean getBoolean(int keyResources, boolean defValue)
keyResource
- defValue
-
public static void setBoolean(int keyResource, boolean value)
key
- value
- public static void setBoolean(java.lang.String key, boolean value)
key
- value
- public static int getInt(java.lang.String key, int defValue)
key
- defValue
-
public static void setInt(java.lang.String key, int value)
key
- value
- public static long getLong(java.lang.String key, long defValue)
key
- defValue
-
public static void setLong(java.lang.String key, long value)
key
- value
- public static void clear(java.lang.String key)
key
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |