commit 7b25c10d75652b201086694184566d2117055093 Author: Hashik Donthineni HashikDonthineni@gmail.com Date: Fri Jul 24 14:25:25 2020 +0530
Chagend ET summary to null when switch is off in preference - on start up --- .../org/torproject/snowflake/fragments/AppSettingsFragment.java | 9 ++++++--- app/src/main/res/xml/app_settings.xml | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java index 528d8b5..0be5e9b 100644 --- a/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java +++ b/app/src/main/java/org/torproject/snowflake/fragments/AppSettingsFragment.java @@ -33,13 +33,16 @@ public class AppSettingsFragment extends PreferenceFragmentCompat implements Sha String editT = settingMap.get(settingSwitch);
boolean isEnabled = sharedPreferences.getBoolean(settingSwitch, false); - if (!isEnabled) - findPreference(settingSwitch).setSummary(SettingsConstants.DEFAULT); - Preference editText = findPreference(editT); editText.setEnabled(isEnabled); editText.setSummary( sharedPreferences.getString(editT, SettingsConstants.DEFAULT)); + + if (!isEnabled) { + findPreference(settingSwitch).setSummary(SettingsConstants.DEFAULT); + //Setting the summary of EditText to empty when the switch is off. + editText.setSummary(""); + } } }
diff --git a/app/src/main/res/xml/app_settings.xml b/app/src/main/res/xml/app_settings.xml index d3a110e..ab321ac 100644 --- a/app/src/main/res/xml/app_settings.xml +++ b/app/src/main/res/xml/app_settings.xml @@ -14,7 +14,6 @@ android:key="stun_edit_text" android:selectAllOnFocus="true" android:singleLine="true" - android:summary="Using Default" android:title="Custom STUN server" app:iconSpaceReserved="false" />
@@ -27,7 +26,6 @@ android:key="broker_edit_text" android:selectAllOnFocus="true" android:singleLine="true" - android:summary="Using Default" android:title="Custom broker URL" app:iconSpaceReserved="false" />