added option: move cache to external storage
This commit is contained in:
parent
9248fe6221
commit
437a33f1d5
@ -14,8 +14,10 @@
|
|||||||
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
|
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".IITC_Application"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_iitcm"
|
android:icon="@drawable/ic_iitcm"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
@ -84,6 +84,8 @@
|
|||||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
||||||
<string name="pref_force_https">Force https</string>
|
<string name="pref_force_https">Force https</string>
|
||||||
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
||||||
|
<string name="pref_external_storage">Move cache to external storage</string>
|
||||||
|
<string name="pref_external_storage_sum">Restart required! Write cache to sdCard. Saves internal storage. External storage has to be mounted.</string>
|
||||||
<string name="pref_press_twice_to_exit">Press back button twice to exit</string>
|
<string name="pref_press_twice_to_exit">Press back button twice to exit</string>
|
||||||
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
|
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
|
||||||
<string name="pref_advanced_options">Advanced settings</string>
|
<string name="pref_advanced_options">Advanced settings</string>
|
||||||
|
@ -56,6 +56,11 @@
|
|||||||
android:title="@string/pref_force_https"
|
android:title="@string/pref_force_https"
|
||||||
android:summary="@string/pref_force_https_sum"
|
android:summary="@string/pref_force_https_sum"
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_external_storage"
|
||||||
|
android:title="@string/pref_external_storage"
|
||||||
|
android:summary="@string/pref_external_storage_sum"
|
||||||
|
android:defaultValue="false" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="pref_press_twice_to_exit"
|
android:key="pref_press_twice_to_exit"
|
||||||
android:title="@string/pref_press_twice_to_exit"
|
android:title="@string/pref_press_twice_to_exit"
|
||||||
|
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 com.cradle.iitc_mobile.IITC_NavigationHelper.Pane;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -130,7 +131,8 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
mIitcWebView.updateCaching(false);
|
mIitcWebView.updateCaching(false);
|
||||||
} else if (key.equals("pref_press_twice_to_exit")
|
} else if (key.equals("pref_press_twice_to_exit")
|
||||||
|| key.equals("pref_share_selected_tab")
|
|| key.equals("pref_share_selected_tab")
|
||||||
|| key.equals("pref_messages"))
|
|| key.equals("pref_messages")
|
||||||
|
|| key.equals("pref_external_storage"))
|
||||||
// no reload needed
|
// no reload needed
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -481,6 +483,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getCacheDir() {
|
||||||
|
return getApplicationContext().getCacheDir();
|
||||||
|
}
|
||||||
|
|
||||||
public void reloadIITC() {
|
public void reloadIITC() {
|
||||||
mNavigationHelper.reset();
|
mNavigationHelper.reset();
|
||||||
mMapSettings.reset();
|
mMapSettings.reset();
|
||||||
|
@ -44,10 +44,8 @@ public class IITC_WebView extends WebView {
|
|||||||
mSettings.setAllowFileAccess(true);
|
mSettings.setAllowFileAccess(true);
|
||||||
mSettings.setGeolocationEnabled(true);
|
mSettings.setGeolocationEnabled(true);
|
||||||
mSettings.setAppCacheEnabled(true);
|
mSettings.setAppCacheEnabled(true);
|
||||||
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir
|
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir + "/databases/");
|
||||||
+ "/databases/");
|
mSettings.setAppCachePath(getContext().getCacheDir().getAbsolutePath());
|
||||||
mSettings.setAppCachePath(getContext().getCacheDir()
|
|
||||||
.getAbsolutePath());
|
|
||||||
mJsInterface = new IITC_JSInterface((IITC_Mobile) mContext);
|
mJsInterface = new IITC_JSInterface((IITC_Mobile) mContext);
|
||||||
addJavascriptInterface(mJsInterface, "android");
|
addJavascriptInterface(mJsInterface, "android");
|
||||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user