Declarative dependencies for proxy settings too

This commit is contained in:
Ciaran Gultnieks 2014-08-28 17:46:23 +01:00
parent b4d8ee08dc
commit 77419183ec
2 changed files with 4 additions and 11 deletions

View File

@ -65,11 +65,13 @@
<EditTextPreference
android:key="proxyHost"
android:title="@string/proxy_host"
android:summary="@string/proxy_host_summary" />
android:summary="@string/proxy_host_summary"
android:dependency="enableProxy" />
<EditTextPreference
android:key="proxyPort"
android:title="@string/proxy_port"
android:summary="@string/proxy_port_summary" />
android:summary="@string/proxy_port_summary"
android:dependency="enableProxy" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/other">
<CheckBoxPreference android:title="@string/cache_downloaded"

View File

@ -152,15 +152,6 @@ public class PreferenceFragment
} else if (key.equals(Preferences.PREF_ENABLE_PROXY)) {
CheckBoxPreference pref = (CheckBoxPreference) findPreference(key);
pref.setSummary(R.string.enable_proxy_summary);
Preference h = findPreference(Preferences.PREF_PROXY_HOST);
Preference p = findPreference(Preferences.PREF_PROXY_PORT);
if (pref.isChecked()) {
h.setEnabled(true);
p.setEnabled(true);
} else {
h.setEnabled(false);
p.setEnabled(false);
}
} else if (key.equals(Preferences.PREF_PROXY_HOST)) {
EditTextPreference textPref = (EditTextPreference) findPreference(key);