public class AtakPreferences
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected android.content.Context |
_context |
protected android.content.SharedPreferences |
_prefs |
Constructor and Description |
---|
AtakPreferences(android.content.Context appContext)
Construct an ATAK core preference manager
|
AtakPreferences(MapView mapView)
Construct an ATAK core preference manager
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.lang.String key)
Check if a preference exists in the set
|
boolean |
get(java.lang.String key,
boolean defVal)
Retrieve a boolean value from the preferences.
|
double |
get(java.lang.String key,
double defVal)
Retrieve a double value from the preferences.
|
int |
get(java.lang.String key,
int defVal)
Retrieve an int value from the preferences.
|
long |
get(java.lang.String key,
long defVal)
Retrieve a long value from the preferences.
|
java.lang.String |
get(java.lang.String key,
java.lang.String defVal)
Retrieve a String value from the preferences.
|
java.util.Map<java.lang.String,?> |
getAll()
Get the map of all shared preferences
|
android.content.SharedPreferences |
getSharedPrefs()
Get the underlying shared preferences object
|
java.util.Set<java.lang.String> |
getStringSet(java.lang.String key)
Retrieve a string set from the preferences
|
void |
registerListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener l)
Registers a shared preference listener with the AtakPreferences.
|
void |
remove(java.lang.String key)
Remove a preference value from the set
|
boolean |
set(java.lang.String key,
java.lang.Object value)
Set and apply a preference
|
void |
unregisterListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener l)
Unregisters a shared preference listener with the AtakPreferences.
|
protected final android.content.Context _context
protected final android.content.SharedPreferences _prefs
public AtakPreferences(android.content.Context appContext)
appContext
- the application contrext used by the preference managerpublic AtakPreferences(MapView mapView)
mapView
- the map view in order to get the application contrext
used by the preference managerpublic android.content.SharedPreferences getSharedPrefs()
public boolean set(java.lang.String key, java.lang.Object value)
key
- Preference keyvalue
- Preference value (any type)public void remove(java.lang.String key)
key
- Preference keypublic boolean contains(java.lang.String key)
key
- Preference keypublic java.lang.String get(java.lang.String key, java.lang.String defVal)
key
- The name of the preference to retrieve.defVal
- Value to return if this preference does not exist.public int get(java.lang.String key, int defVal)
key
- The name of the preference to retrieve.defVal
- Value to return if this preference does not exist.public long get(java.lang.String key, long defVal)
key
- The name of the preference to retrieve.defVal
- Value to return if this preference does not exist.public double get(java.lang.String key, double defVal)
key
- The name of the preference to retrieve.defVal
- Value to return if this preference does not exist.public boolean get(java.lang.String key, boolean defVal)
key
- The name of the preference to retrieve.defVal
- Value to return if this preference does not exist.public java.util.Set<java.lang.String> getStringSet(java.lang.String key)
key
- Preference keypublic java.util.Map<java.lang.String,?> getAll()
public void registerListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener l)
l
- the shared preference change listenerpublic void unregisterListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener l)
l
- the shared preference change listener