This commit is contained in:
Jon Atkins 2013-12-23 03:10:12 +00:00
commit 271d4fa1f3

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();
} }
} }
} }