removed default cache, since we cache tiles on our own it's not needed anymore

This commit is contained in:
Philipp Schaefer 2013-12-21 17:25:31 +01:00
parent fa89fc67d8
commit 3e5124022d
6 changed files with 2 additions and 74 deletions

View File

@ -97,8 +97,8 @@
<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_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.
<string name="pref_external_storage">Move tiles cache to external storage</string>
<string name="pref_external_storage_sum">Restart required! Write cache to sdCard.
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_sum">Avoids accidental exits</string>
@ -116,10 +116,6 @@
<string name="pref_select_iitc">IITC source</string>
<string name="pref_select_iitc_sum">Load IITC main script from url or use local script. Currently used source:</string>
<string name="pref_caching">Aggressive Caching</string>
<string name="pref_caching_sum">Prefer cached values even if they are expired…saves traffic but
may result in login issues</string>
<string-array name="pref_hide_fullscreen">
<item>System Bar</item>
<item>Action Bar</item>
@ -133,17 +129,6 @@
<item>16</item>
</string-array>
<string-array name="pref_caching_array">
<item>Always</item>
<item>Mobile data only (default)</item>
<item>Never</item>
</string-array>
<string-array name="pref_caching_array_vals">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string name="menu_clear_cookies">Clear Cookies</string>
<string name="menu_search">Search</string>
<string name="choose_account_to_login">Choose account to login</string>

View File

@ -112,14 +112,6 @@
<PreferenceCategory
android:key="pref_advanced_tweaks_cat"
android:title="@string/pref_tweaks_cat">
<ListPreference
android:defaultValue="1"
android:entries="@array/pref_caching_array"
android:entryValues="@array/pref_caching_array_vals"
android:key="pref_caching"
android:summary="@string/pref_caching_sum"
android:title="@string/pref_caching"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_fake_user_agent"

View File

@ -12,15 +12,6 @@ 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)) {

View File

@ -127,8 +127,6 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
return;
} else if (key.equals("pref_fake_user_agent")) {
mIitcWebView.setUserAgent();
} else if (key.equals("pref_caching")) {
mIitcWebView.updateCaching(false);
} else if (key.equals("pref_press_twice_to_exit")
|| key.equals("pref_share_selected_tab")
|| key.equals("pref_messages")
@ -251,8 +249,6 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// enough idle...let's do some work
Log.d("iitcm", "resuming...reset idleTimer");
mIitcWebView.updateCaching(false);
mUserLocation.onStart();
if (mReloadNeeded) {

View File

@ -56,9 +56,7 @@ public class IITC_WebView extends WebView {
mSettings.setDomStorageEnabled(true);
mSettings.setAllowFileAccess(true);
mSettings.setGeolocationEnabled(true);
mSettings.setAppCacheEnabled(true);
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir + "/databases/");
mSettings.setAppCachePath(getContext().getCacheDir().getAbsolutePath());
mJsInterface = new IITC_JSInterface(mIitc);
addJavascriptInterface(mJsInterface, "android");
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mIitc);
@ -271,34 +269,6 @@ public class IITC_WebView extends WebView {
return mJsInterface;
}
public void updateCaching(boolean login) {
switch (Integer.parseInt(mSharedPrefs.getString("pref_caching", "1"))) {
case 0:
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
break;
case 2:
mSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
break;
default:
if (getUrl() != null) {
login |= getUrl().contains("accounts.google.com");
}
// use cache if on mobile network...saves traffic
if (!isConnectedToWifi() && !login) {
Log.d("iitcm", "not connected to wifi...load tiles from cache");
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
} else {
if (login) {
Log.d("iitcm", "login...load tiles from network");
} else {
Log.d("iitcm", "connected to wifi...load tiles from network");
}
mSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
}
break;
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private boolean isConnectedToWifi() {
ConnectivityManager conMan = (ConnectivityManager) getContext()

View File

@ -195,8 +195,6 @@ public class IITC_WebViewClient extends WebViewClient {
@Override
public void onReceivedLoginRequest(WebView view, String realm, String account, String args) {
Log.d("iitcm", "Login requested: " + realm + " " + account + " " + args);
Log.d("iitcm", "logging in...updating caching mode");
((IITC_WebView) view).updateCaching(true);
mIitcInjected = false;
//((IITC_Mobile) mContext).onReceivedLoginRequest(this, view, realm, account, args);
}
@ -329,10 +327,6 @@ public class IITC_WebViewClient extends WebViewClient {
+ url);
mIitc.loadUrl(url);
}
if (url.contains("logout")) {
Log.d("iitcm", "logging out...updating caching mode");
((IITC_WebView) view).updateCaching(true);
}
return false;
} else {
Log.d("iitcm",