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

@ -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",