diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2011-11-08 14:21:08 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2011-11-08 15:32:57 +0100 |
commit | 5ce29151e122a140915e2971ba7219381f4fcc43 (patch) | |
tree | a74c90d57dc9c64bc1088bfb7fc03f4ad0fd27e1 /main/src/cgeo/geocaching/Settings.java | |
parent | 7b7d1f4d6da3503ba13d93f6efb699fc4b285699 (diff) | |
download | cgeo-5ce29151e122a140915e2971ba7219381f4fcc43.zip cgeo-5ce29151e122a140915e2971ba7219381f4fcc43.tar.gz cgeo-5ce29151e122a140915e2971ba7219381f4fcc43.tar.bz2 |
Do not use deprecated methods
Diffstat (limited to 'main/src/cgeo/geocaching/Settings.java')
-rw-r--r-- | main/src/cgeo/geocaching/Settings.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java index 4da2314..3d96baf 100644 --- a/main/src/cgeo/geocaching/Settings.java +++ b/main/src/cgeo/geocaching/Settings.java @@ -1,5 +1,6 @@ package cgeo.geocaching; +import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.maps.google.GoogleMapFactory; import cgeo.geocaching.maps.interfaces.MapFactory; @@ -275,14 +276,18 @@ public final class Settings { return sharedPrefs.getString(KEY_COOKIE_STORE, null); } - public static String setCacheType(final String cacheTypeIn) { + public static CacheType setCacheType(final CacheType cacheType) { editSharedSettings(new PrefRunnable() { @Override public void edit(Editor edit) { - edit.putString(KEY_CACHE_TYPE, cacheTypeIn); + if (cacheType == null) { + edit.remove(KEY_CACHE_TYPE); + } else { + edit.putString(KEY_CACHE_TYPE, cacheType.id); + } } }); - return cacheTypeIn; + return cacheType; } public static void setLiveMap(final boolean live) { @@ -806,8 +811,8 @@ public final class Settings { return sharedPrefs.getString(KEY_WEBDEVICE_NAME, null); } - public static String getCacheType() { - return sharedPrefs.getString(KEY_CACHE_TYPE, null); + public static CacheType getCacheType() { + return CacheType.getById(sharedPrefs.getString(KEY_CACHE_TYPE, null)); } public static int getWayPointsThreshold() { |