1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-25 22:02:08 +01:00

Add an option to clear WebView cache

This commit is contained in:
Dmitriy Bogdanov 2016-07-27 00:52:26 +04:00
parent dd98ce4389
commit 1fead42868
No known key found for this signature in database
GPG key ID: F396CC2653B8F64D
4 changed files with 15 additions and 0 deletions

View file

@ -111,6 +111,7 @@ public class MainActivity extends AppCompatActivity
public static final String ACTION_OPEN_URL = "com.github.dfa.diaspora_android.MainActivity.open_url"; public static final String ACTION_OPEN_URL = "com.github.dfa.diaspora_android.MainActivity.open_url";
public static final String ACTION_CHANGE_ACCOUNT = "com.github.dfa.diaspora_android.MainActivity.change_account"; public static final String ACTION_CHANGE_ACCOUNT = "com.github.dfa.diaspora_android.MainActivity.change_account";
public static final String ACTION_CLEAR_CACHE = "com.github.dfa.diaspora_android.MainActivity.clear_cache";
public static final String URL_MESSAGE = "URL_MESSAGE"; public static final String URL_MESSAGE = "URL_MESSAGE";
private App app; private App app;
@ -438,6 +439,8 @@ public class MainActivity extends AppCompatActivity
} else if(ACTION_CHANGE_ACCOUNT.equals(action)) { } else if(ACTION_CHANGE_ACCOUNT.equals(action)) {
app.resetPodData(webView); app.resetPodData(webView);
Helpers.animateToActivity(MainActivity.this, PodSelectionActivity.class, true); Helpers.animateToActivity(MainActivity.this, PodSelectionActivity.class, true);
} else if(ACTION_CLEAR_CACHE.equals(action)) {
webView.clearCache(true);
} }
} }

View file

@ -94,6 +94,9 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
}) })
.show(); .show();
return true; return true;
case "pref_key_clear_cache":
intent.setAction(MainActivity.ACTION_CLEAR_CACHE);
break;
default: default:
intent = null; intent = null;
break; break;

View file

@ -46,4 +46,7 @@
<string name="pref_desc_change_account">Erase local session data and switch to another Diaspora pod/account</string> <string name="pref_desc_change_account">Erase local session data and switch to another Diaspora pod/account</string>
<string name="pref_warning_change_account">This will erase all cookies and session data. Do you really want to change your account?</string> <string name="pref_warning_change_account">This will erase all cookies and session data. Do you really want to change your account?</string>
<string name="pref_title_clear_cache">Clear cache</string>
<string name="pref_desc_clear_cache">Clear WebView cache</string>
</resources> </resources>

View file

@ -52,6 +52,12 @@
android:summary="@string/pref_desc_load_images" android:summary="@string/pref_desc_load_images"
android:defaultValue="true" /> android:defaultValue="true" />
<Preference
android:title="@string/pref_title_clear_cache"
android:key="pref_key_clear_cache"
android:summary="@string/pref_desc_clear_cache">
</Preference>
<CheckBoxPreference <CheckBoxPreference
android:title="@string/pref_title_proxy_enabled" android:title="@string/pref_title_proxy_enabled"
android:key="pref_key_proxy_enabled" android:key="pref_key_proxy_enabled"