added option: move cache to external storage
This commit is contained in:
17
mobile/src/com/cradle/iitc_mobile/IITC_Application.java
Normal file
17
mobile/src/com/cradle/iitc_mobile/IITC_Application.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.cradle.iitc_mobile;
|
||||
|
||||
import android.app.Application;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.cradle.iitc_mobile.IITC_NavigationHelper.Pane;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Locale;
|
||||
@ -130,7 +131,8 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
||||
mIitcWebView.updateCaching(false);
|
||||
} else if (key.equals("pref_press_twice_to_exit")
|
||||
|| key.equals("pref_share_selected_tab")
|
||||
|| key.equals("pref_messages"))
|
||||
|| key.equals("pref_messages")
|
||||
|| key.equals("pref_external_storage"))
|
||||
// no reload needed
|
||||
return;
|
||||
|
||||
@ -481,6 +483,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getCacheDir() {
|
||||
return getApplicationContext().getCacheDir();
|
||||
}
|
||||
|
||||
public void reloadIITC() {
|
||||
mNavigationHelper.reset();
|
||||
mMapSettings.reset();
|
||||
|
@ -44,10 +44,8 @@ public class IITC_WebView extends WebView {
|
||||
mSettings.setAllowFileAccess(true);
|
||||
mSettings.setGeolocationEnabled(true);
|
||||
mSettings.setAppCacheEnabled(true);
|
||||
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir
|
||||
+ "/databases/");
|
||||
mSettings.setAppCachePath(getContext().getCacheDir()
|
||||
.getAbsolutePath());
|
||||
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir + "/databases/");
|
||||
mSettings.setAppCachePath(getContext().getCacheDir().getAbsolutePath());
|
||||
mJsInterface = new IITC_JSInterface((IITC_Mobile) mContext);
|
||||
addJavascriptInterface(mJsInterface, "android");
|
||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
|
Reference in New Issue
Block a user