public class LocalePreference extends Object implements Preference<Locale>
| Modifier and Type | Method and Description |
|---|---|
Locale |
getDefaultValue() |
String |
getKey()
Method returns key of preference used in android: the key with which current preference is saved in persistence
|
Locale |
getPreference(android.content.SharedPreferences preferences)
NOTE: this method can throw runtime exceptions if errors occurred while extracting preferences values
|
Locale |
getPreferenceNoError(android.content.SharedPreferences preferences)
NOTE: this method SHOULD not throw any runtime exceptions BUT return default value if any error occurred
|
boolean |
isSameKey(String key) |
boolean |
isSet(android.content.SharedPreferences preferences) |
static LocalePreference |
of(String id,
Locale defaultValue) |
static LocalePreference |
of(String id,
Locale defaultValue,
org.solovyev.common.text.Mapper<Locale> localeMapper) |
void |
putDefault(android.content.SharedPreferences preferences)
Method saves default value in
preferences container. |
void |
putPreference(android.content.SharedPreferences preferences,
Locale value)
Method puts (saves) preference represented by
value in preferences container |
boolean |
tryPutDefault(android.content.SharedPreferences preferences)
Method applies default value to preference only if explicit value is not set
|
@Nonnull public static LocalePreference of(@Nonnull String id, @Nullable Locale defaultValue, @Nonnull org.solovyev.common.text.Mapper<Locale> localeMapper)
@Nonnull public String getKey()
PreferencegetKey in interface Preference<Locale>public Locale getDefaultValue()
getDefaultValue in interface Preference<Locale>public Locale getPreference(@Nonnull android.content.SharedPreferences preferences)
PreferencegetPreference in interface Preference<Locale>preferences - application preferencespublic Locale getPreferenceNoError(@Nonnull android.content.SharedPreferences preferences)
PreferencegetPreferenceNoError in interface Preference<Locale>preferences - application preferencespublic void putDefault(@Nonnull android.content.SharedPreferences preferences)
Preferencepreferences container.
Should behave exactly as p.putPreference(preferences, p.getDefaultValue())putDefault in interface Preference<Locale>preferences - preferences containerpublic void putPreference(@Nonnull android.content.SharedPreferences preferences, @Nullable Locale value)
Preferencevalue in preferences containerputPreference in interface Preference<Locale>preferences - preferences containervalue - value to be savedpublic boolean isSet(@Nonnull android.content.SharedPreferences preferences)
isSet in interface Preference<Locale>preferences - preferences containerpublic boolean tryPutDefault(@Nonnull android.content.SharedPreferences preferences)
PreferencetryPutDefault in interface Preference<Locale>preferences - preferences containerpublic boolean isSameKey(@Nonnull String key)
isSameKey in interface Preference<Locale>key - preference keyCopyright © 2014 se.solovyev. All Rights Reserved.