From 1e75353eb3f5dc07493d18a1e9821f08d4617751 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Sun, 22 Dec 2013 13:36:59 +0100 Subject: [PATCH] added back possibility to move webviews cache to external storage * in theory, this is not needed anymore since iitcm now has its own * tile cache. But the user may want to use tiles loaded by an external * plugin and cache them on sdCard. This would make use of the webviews * cache...to stay consistent with our external storage preference we * need this method. --- .../src/com/cradle/iitc_mobile/IITC_Application.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Application.java b/mobile/src/com/cradle/iitc_mobile/IITC_Application.java index e618da55..4b2a8fcf 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Application.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Application.java @@ -12,6 +12,16 @@ import java.io.File; * getContext().getCacheDir(); to decide where to store and read cached files. */ public class IITC_Application extends Application { + + @Override + public File getCacheDir() { + if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("pref_external_storage", false)) { + return (getExternalCacheDir() != null) ? getExternalCacheDir() : super.getCacheDir(); + } else { + return super.getCacheDir(); + } + } + @Override public File getFilesDir() { if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("pref_external_storage", false)) { @@ -20,4 +30,5 @@ public class IITC_Application extends Application { return super.getFilesDir(); } } + }