[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake-mobile/master] Chagend ET summary to null when switch is off in preference - on start up



commit 7b25c10d75652b201086694184566d2117055093
Author: Hashik Donthineni <HashikDonthineni@xxxxxxxxx>
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" />
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits