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_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">Move tiles 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_sum">Restart required! Write cache to sdCard.
External storage has to be mounted.</string> 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>
@ -116,10 +116,6 @@
<string name="pref_select_iitc">IITC source</string> <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_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"> <string-array name="pref_hide_fullscreen">
<item>System Bar</item> <item>System Bar</item>
<item>Action Bar</item> <item>Action Bar</item>
@ -133,17 +129,6 @@
<item>16</item> <item>16</item>
</string-array> </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_clear_cookies">Clear Cookies</string>
<string name="menu_search">Search</string> <string name="menu_search">Search</string>
<string name="choose_account_to_login">Choose account to login</string> <string name="choose_account_to_login">Choose account to login</string>

View File

@ -112,14 +112,6 @@
<PreferenceCategory <PreferenceCategory
android:key="pref_advanced_tweaks_cat" android:key="pref_advanced_tweaks_cat"
android:title="@string/pref_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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="pref_fake_user_agent" 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. * 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)) {

View File

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

View File

@ -56,9 +56,7 @@ public class IITC_WebView extends WebView {
mSettings.setDomStorageEnabled(true); mSettings.setDomStorageEnabled(true);
mSettings.setAllowFileAccess(true); mSettings.setAllowFileAccess(true);
mSettings.setGeolocationEnabled(true); mSettings.setGeolocationEnabled(true);
mSettings.setAppCacheEnabled(true);
mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir + "/databases/"); mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir + "/databases/");
mSettings.setAppCachePath(getContext().getCacheDir().getAbsolutePath());
mJsInterface = new IITC_JSInterface(mIitc); mJsInterface = new IITC_JSInterface(mIitc);
addJavascriptInterface(mJsInterface, "android"); addJavascriptInterface(mJsInterface, "android");
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mIitc); mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(mIitc);
@ -271,34 +269,6 @@ public class IITC_WebView extends WebView {
return mJsInterface; 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) @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private boolean isConnectedToWifi() { private boolean isConnectedToWifi() {
ConnectivityManager conMan = (ConnectivityManager) getContext() ConnectivityManager conMan = (ConnectivityManager) getContext()

View File

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