diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2011-10-03 13:47:07 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2011-10-03 13:47:07 +0200 |
commit | f52b1f0c1a58978efd5e8478f29484cb1f3b421e (patch) | |
tree | 39080018d83b12407a7df47153431464173e5e19 /main/src/cgeo/geocaching/StaticMapsProvider.java | |
parent | e99ed4d71470da9efe59f4b363762d105dbfdc6d (diff) | |
download | cgeo-f52b1f0c1a58978efd5e8478f29484cb1f3b421e.zip cgeo-f52b1f0c1a58978efd5e8478f29484cb1f3b421e.tar.gz cgeo-f52b1f0c1a58978efd5e8478f29484cb1f3b421e.tar.bz2 |
fix #120: make settings static (no singleton)
* Settings can no longer be instantiated, everything is static instead.
* Most option values are no longer cached in fields. This has been done
for clarity during the refactoring. I will add some performance tests
afterwards and may re-introduce those fields for caching the option
values.
Sorry, if anyone gets merge issues afterwards. There was no easier way
to implement this...
Diffstat (limited to 'main/src/cgeo/geocaching/StaticMapsProvider.java')
-rw-r--r-- | main/src/cgeo/geocaching/StaticMapsProvider.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java index a33e8b2..0c21912 100644 --- a/main/src/cgeo/geocaching/StaticMapsProvider.java +++ b/main/src/cgeo/geocaching/StaticMapsProvider.java @@ -40,7 +40,7 @@ public class StaticMapsProvider { } private static void createStorageDirectory(final cgCache cache) { - File dir = new File(cgSettings.getStorage()); + File dir = new File(Settings.getStorage()); if (dir.exists() == false) { dir.mkdirs(); } @@ -51,7 +51,7 @@ public class StaticMapsProvider { } private static String getStaticMapsDirectory(final cgCache cache) { - return cgSettings.getStorage() + cache.geocode; + return Settings.getStorage() + cache.geocode; } private static void downloadMap(cgCache cache, int zoom, String mapType, int level, String latlonMap, int edge, String waypoints) { @@ -70,7 +70,7 @@ public class StaticMapsProvider { for (int i = 0; i < 3; i++) { if (i > 0) - Log.w(cgSettings.tag, "cgMapImg.getDrawable: Failed to download data, retrying. Attempt #" + (i + 1)); + Log.w(Settings.tag, "cgMapImg.getDrawable: Failed to download data, retrying. Attempt #" + (i + 1)); try { client = new DefaultHttpClient(); @@ -99,7 +99,7 @@ public class StaticMapsProvider { fos.flush(); ok = true; } catch (IOException e) { - Log.e(cgSettings.tag, "cgMapImg.getDrawable (saving to cache): " + e.toString()); + Log.e(Settings.tag, "cgMapImg.getDrawable (saving to cache): " + e.toString()); } finally { is.close(); fos.close(); @@ -114,13 +114,13 @@ public class StaticMapsProvider { break; } } catch (Exception e) { - Log.e(cgSettings.tag, "cgMapImg.getDrawable (downloading from web): " + e.toString()); + Log.e(Settings.tag, "cgMapImg.getDrawable (downloading from web): " + e.toString()); } } } - public static void downloadMaps(cgCache cache, cgSettings settings, Activity activity) { - if (settings.storeOfflineMaps != 1 || cache.coords == null || StringUtils.isBlank(cache.geocode)) { + public static void downloadMaps(cgCache cache, Activity activity) { + if (!Settings.isStoreOfflineMaps() || cache.coords == null || StringUtils.isBlank(cache.geocode)) { return; } |