categories for advanced settings

This commit is contained in:
Philipp Schaefer 2013-10-13 14:11:53 +02:00
parent 6589cd454f
commit c405b626d3
5 changed files with 46 additions and 34 deletions

View File

@ -70,6 +70,8 @@
<string name="pref_ui_cat">UI</string>
<string name="pref_misc_cat">Misc</string>
<string name="pref_developer_options_cat">Developer options</string>
<string name="pref_tweaks_cat">Tweaks</string>
<string name="pref_plugins">IITC Plugins</string>
<string name="pref_plugins_title">Available plugins</string>
<string name="pref_user_loc">Display user location</string>
@ -84,7 +86,6 @@
<string name="pref_force_https_sum">Disabling may improve performance</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_developer_options_cat">Developer options</string>
<string name="pref_advanced_options">Advanced settings</string>
<string name="pref_enable_dev_mode">Enable developer mode</string>
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.

View File

@ -10,7 +10,7 @@
android:dialogTitle="@string/pref_about_title"/>
<PreferenceCategory
android:key="pref_about_cat"
android:key="pref_ui_cat"
android:title="@string/pref_ui_cat">
<CheckBoxPreference
android:key="pref_user_loc"
@ -72,13 +72,15 @@
android:title="@string/pref_advanced_options"
android:persistent="false">
<ListPreference
android:key="pref_caching"
android:title="@string/pref_caching"
android:summary="@string/pref_caching_sum"
android:defaultValue="1"
android:entries="@array/pref_caching_array"
android:entryValues="@array/pref_caching_array_vals" />
<CheckBoxPreference
android:key="pref_dev_checkbox"
android:title="@string/pref_enable_dev_mode"
android:summary="@string/pref_enable_dev_mode_sum"
android:defaultValue="false" />
<PreferenceCategory
android:key="pref_advanced_ui_cat"
android:title="@string/pref_ui_cat">
<CheckBoxPreference
android:key="pref_advanced_menu"
@ -91,11 +93,19 @@
android:title="@string/pref_disable_splash"
android:defaultValue="false" />
<CheckBoxPreference
android:key="pref_dev_checkbox"
android:title="@string/pref_enable_dev_mode"
android:summary="@string/pref_enable_dev_mode_sum"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory
android:key="pref_advanced_tweaks_cat"
android:title="@string/pref_tweaks_cat">
<ListPreference
android:key="pref_caching"
android:title="@string/pref_caching"
android:summary="@string/pref_caching_sum"
android:defaultValue="1"
android:entries="@array/pref_caching_array"
android:entryValues="@array/pref_caching_array_vals" />
<CheckBoxPreference
android:key="pref_fake_user_agent"
@ -103,6 +113,8 @@
android:summary="@string/pref_fake_user_agent_sum"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceScreen>
<ListPreference

View File

@ -127,7 +127,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
} else if (key.equals("pref_fake_user_agent")) {
mIitcWebView.setUserAgent();
} else if (key.equals("pref_caching")) {
mIitcWebView.updateCaching();
mIitcWebView.updateCaching(false);
} else if (key.equals("pref_press_twice_to_exit")
|| key.equals("pref_share_selected_tab")
|| key.equals("pref_messages"))
@ -271,7 +271,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// enough idle...let's do some work
Log.d("iitcm", "resuming...reset idleTimer");
mIitcWebView.updateCaching();
mIitcWebView.updateCaching(false);
if (mIsLocEnabled) {
// Register the mSharedPrefChangeListener with the Location Manager to receive

View File

@ -159,7 +159,7 @@ public class IITC_WebView extends WebView {
return mJsInterface;
}
public void updateCaching() {
public void updateCaching(boolean login) {
switch(Integer.parseInt(mSharedPrefs.getString("pref_caching", "1"))) {
case 0:
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
@ -168,7 +168,6 @@ public class IITC_WebView extends WebView {
mSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
break;
default:
boolean login = false;
if (getUrl() != null) {
login = getUrl().contains("accounts.google.com");
}

View File

@ -160,8 +160,8 @@ 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...set caching mode to default");
view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
Log.d("iitcm", "logging in...updating caching mode");
((IITC_WebView) view).updateCaching(true);
//((IITC_Mobile) mContext).onReceivedLoginRequest(this, view, realm, account, args);
}
@ -284,8 +284,8 @@ public class IITC_WebViewClient extends WebViewClient {
((IITC_Mobile) mContext).loadUrl(url);
}
if (url.contains("logout")) {
Log.d("iitcm", "logging out...set caching mode to default");
view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
Log.d("iitcm", "logging out...updating caching mode");
((IITC_WebView) view).updateCaching(true);
}
return false;
} else {