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.
This commit is contained in:
Philipp Schaefer 2013-12-22 13:36:59 +01:00
parent ca5e7a890a
commit 1e75353eb3

View File

@ -12,6 +12,16 @@ import java.io.File;
* getContext().getCacheDir(); to decide where to store and read cached files. * getContext().getCacheDir(); to decide where to store and read cached files.
*/ */
public class IITC_Application extends Application { 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 @Override
public File getFilesDir() { public File getFilesDir() {
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("pref_external_storage", false)) { if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("pref_external_storage", false)) {
@ -20,4 +30,5 @@ public class IITC_Application extends Application {
return super.getFilesDir(); return super.getFilesDir();
} }
} }
} }