Bug 1258971 - Preferences: Replace some checkboxes with switches. r=grisha
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 31 Mar 2016 14:13:10 +0200
changeset 291320 a73c2c9f6872dab1423744a4aa905a826dcd3f49
parent 291319 f06df39f560f722c2d98376b3be769c7a97aead0
child 291321 7a71674ba4dd50bfaa2795bf2f7583ccf75a964c
push id74545
push userkwierso@gmail.com
push dateFri, 01 Apr 2016 23:05:42 +0000
treeherdermozilla-inbound@c410d4e20586 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgrisha
bugs1258971
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1258971 - Preferences: Replace some checkboxes with switches. r=grisha MozReview-Commit-ID: Fjam9Dn20sY
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/resources/xml/preferences_accessibility.xml
mobile/android/base/resources/xml/preferences_advanced.xml
mobile/android/base/resources/xml/preferences_general.xml
mobile/android/base/resources/xml/preferences_general_tablet.xml
mobile/android/base/resources/xml/preferences_privacy.xml
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -68,16 +68,17 @@ import android.os.Bundle;
 import android.preference.CheckBoxPreference;
 import android.preference.EditTextPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceGroup;
+import android.preference.SwitchPreference;
 import android.preference.TwoStatePreference;
 import android.support.design.widget.Snackbar;
 import android.support.design.widget.TextInputLayout;
 import android.text.Editable;
 import android.text.InputType;
 import android.text.TextUtils;
 import android.text.TextWatcher;
 import android.util.Log;
@@ -177,17 +178,17 @@ OnSharedPreferenceChangeListener
 
     // Result code used when a locale preference changes.
     // Callers can recognize this code to refresh themselves to
     // accommodate a locale change.
     public static final int RESULT_CODE_LOCALE_DID_CHANGE = 7;
 
     private static final int REQUEST_CODE_TAB_QUEUE = 8;
 
-    private CheckBoxPreference tabQueuePreference;
+    private SwitchPreference tabQueuePreference;
 
     /**
      * Track the last locale so we know whether to redisplay.
      */
     private Locale lastLocale = Locale.getDefault();
     private boolean localeSwitchingIsEnabled;
 
     private void startActivityForResultChoosingTransition(final Intent intent, final int requestCode) {
@@ -792,17 +793,17 @@ OnSharedPreferenceChangeListener
                         @Override
                         public boolean onPreferenceClick(Preference preference) {
                             GeckoPreferences.this.restoreDefaultSearchEngines();
                             Telemetry.sendUIEvent(TelemetryContract.Event.SEARCH_RESTORE_DEFAULTS, Method.LIST_ITEM);
                             return true;
                         }
                     });
                 } else if (PREFS_TAB_QUEUE.equals(key)) {
-                    tabQueuePreference = (CheckBoxPreference) pref;
+                    tabQueuePreference = (SwitchPreference) pref;
                     // Only show tab queue pref on nightly builds with the tab queue build flag.
                     if (!TabQueueHelper.TAB_QUEUE_ENABLED) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
                 } else if (PREFS_ZOOMED_VIEW_ENABLED.equals(key)) {
                     if (!AppConstants.NIGHTLY_BUILD) {
--- a/mobile/android/base/resources/xml/preferences_accessibility.xml
+++ b/mobile/android/base/resources/xml/preferences_accessibility.xml
@@ -9,27 +9,27 @@
 
     <org.mozilla.gecko.preferences.FontSizePreference
                     android:key="font.size.inflation.minTwips"
                     android:title="@string/pref_text_size"
                     android:positiveButtonText="@string/pref_font_size_set"
                     android:negativeButtonText="@string/button_cancel"
                     android:persistent="false" />
 
-    <CheckBoxPreference android:key="browser.ui.zoom.force-user-scalable"
-                        android:title="@string/pref_zoom_force_enabled"
-                        android:summary="@string/pref_zoom_force_enabled_summary" />
+    <SwitchPreference android:key="browser.ui.zoom.force-user-scalable"
+                      android:title="@string/pref_zoom_force_enabled"
+                      android:summary="@string/pref_zoom_force_enabled_summary" />
 
-    <CheckBoxPreference android:key="ui.zoomedview.enabled"
-                        android:title="@string/pref_magnifying_glass_enabled"
-                        android:summary="@string/pref_magnifying_glass_enabled_summary" />
+    <SwitchPreference android:key="ui.zoomedview.enabled"
+                      android:title="@string/pref_magnifying_glass_enabled"
+                      android:summary="@string/pref_magnifying_glass_enabled_summary" />
 
-    <CheckBoxPreference android:key="android.not_a_preference.voice_input_enabled"
-                        android:title="@string/pref_voice_input"
-                        android:summary="@string/pref_voice_input_summary"
-                        android:defaultValue="true"/>
+    <SwitchPreference android:key="android.not_a_preference.voice_input_enabled"
+                      android:title="@string/pref_voice_input"
+                      android:summary="@string/pref_voice_input_summary"
+                      android:defaultValue="true"/>
 
-    <CheckBoxPreference android:key="android.not_a_preference.qrcode_enabled"
-                        android:title="@string/pref_qrcode_enabled"
-                        android:summary="@string/pref_qrcode_enabled_summary"
-                        android:defaultValue="true"/>
+    <SwitchPreference android:key="android.not_a_preference.qrcode_enabled"
+                      android:title="@string/pref_qrcode_enabled"
+                      android:summary="@string/pref_qrcode_enabled_summary"
+                      android:defaultValue="true"/>
 
 </PreferenceScreen>
--- a/mobile/android/base/resources/xml/preferences_advanced.xml
+++ b/mobile/android/base/resources/xml/preferences_advanced.xml
@@ -42,31 +42,31 @@
                         android:title="@string/pref_show_web_fonts" />
 
     <ListPreference android:key="plugin.enable"
                     android:title="@string/pref_plugins"
                     android:entries="@array/pref_plugins_entries"
                     android:entryValues="@array/pref_plugins_values"
                     android:persistent="false" />
 
-    <CheckBoxPreference android:key="media.autoplay.enabled"
-                        android:title="@string/pref_media_autoplay_enabled"
-                        android:summary="@string/pref_media_autoplay_enabled_summary" />
+    <SwitchPreference android:key="media.autoplay.enabled"
+                      android:title="@string/pref_media_autoplay_enabled"
+                      android:summary="@string/pref_media_autoplay_enabled_summary" />
 
     <ListPreference android:key="browser.menu.showCharacterEncoding"
                     android:title="@string/pref_char_encoding"
                     android:entries="@array/pref_char_encoding_entries"
                     android:entryValues="@array/pref_char_encoding_values"
                     android:persistent="false" />
 
-    <CheckBoxPreference android:key="devtools.remote.usb.enabled"
-                        android:title="@string/pref_developer_remotedebugging_usb" />
+    <SwitchPreference android:key="devtools.remote.usb.enabled"
+                      android:title="@string/pref_developer_remotedebugging_usb" />
 
 
-    <CheckBoxPreference android:key="devtools.remote.wifi.enabled"
-                        android:title="@string/pref_developer_remotedebugging_wifi" />
+    <SwitchPreference android:key="devtools.remote.wifi.enabled"
+                      android:title="@string/pref_developer_remotedebugging_wifi" />
 
     <org.mozilla.gecko.preferences.AlignRightLinkPreference android:key="android.not_a_preference.remote_debugging.link"
                                                             android:title="@string/pref_learn_more"
                                                             android:persistent="false"
                                                             url="https://developer.mozilla.org/docs/Tools/Remote_Debugging/Debugging_Firefox_for_Android_with_WebIDE" />
 
 </PreferenceScreen>
--- a/mobile/android/base/resources/xml/preferences_general.xml
+++ b/mobile/android/base/resources/xml/preferences_general.xml
@@ -19,19 +19,19 @@
 
     <PreferenceScreen android:title="@string/pref_category_language"
                       android:summary="@string/pref_category_language_summary"
                       android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment" >
         <extra android:name="resource"
                android:value="preferences_locale" />
     </PreferenceScreen>
 
-    <CheckBoxPreference android:key="browser.chrome.dynamictoolbar"
-                        android:title="@string/pref_scroll_title_bar2"
-                        android:summary="@string/pref_scroll_title_bar_summary" />
+    <SwitchPreference android:key="browser.chrome.dynamictoolbar"
+                      android:title="@string/pref_scroll_title_bar2"
+                      android:summary="@string/pref_scroll_title_bar_summary" />
 
-    <CheckBoxPreference android:key="android.not_a_preference.tab_queue"
-                        android:title="@string/pref_tab_queue_title"
-                        android:summary="@string/pref_tab_queue_summary"
-                        android:defaultValue="false" />
+    <SwitchPreference android:key="android.not_a_preference.tab_queue"
+                      android:title="@string/pref_tab_queue_title"
+                      android:summary="@string/pref_tab_queue_summary"
+                      android:defaultValue="false" />
 
 </PreferenceScreen>
 
--- a/mobile/android/base/resources/xml/preferences_general_tablet.xml
+++ b/mobile/android/base/resources/xml/preferences_general_tablet.xml
@@ -25,19 +25,19 @@
 
     <PreferenceScreen android:title="@string/pref_category_language"
                       android:summary="@string/pref_category_language_summary"
                       android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment" >
         <extra android:name="resource"
                android:value="preferences_locale" />
     </PreferenceScreen>
 
-    <CheckBoxPreference android:key="browser.chrome.dynamictoolbar"
-                        android:title="@string/pref_scroll_title_bar2"
-                        android:summary="@string/pref_scroll_title_bar_summary" />
+    <SwitchPreference android:key="browser.chrome.dynamictoolbar"
+                      android:title="@string/pref_scroll_title_bar2"
+                      android:summary="@string/pref_scroll_title_bar_summary" />
 
-    <CheckBoxPreference android:key="android.not_a_preference.tab_queue"
-                        android:title="@string/pref_tab_queue_title"
-                        android:summary="@string/pref_tab_queue_summary"
-                        android:defaultValue="false" />
+    <SwitchPreference android:key="android.not_a_preference.tab_queue"
+                      android:title="@string/pref_tab_queue_title"
+                      android:summary="@string/pref_tab_queue_summary"
+                      android:defaultValue="false" />
 
 </PreferenceScreen>
 
--- a/mobile/android/base/resources/xml/preferences_privacy.xml
+++ b/mobile/android/base/resources/xml/preferences_privacy.xml
@@ -3,20 +3,20 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:title="@string/pref_category_privacy_short"
                   android:enabled="false">
 
-    <CheckBoxPreference android:key="privacy.donottrackheader.enabled"
-                        android:title="@string/pref_donottrack_title"
-                        android:summary="@string/pref_donottrack_summary"
-                        android:persistent="false" />
+    <SwitchPreference android:key="privacy.donottrackheader.enabled"
+                      android:title="@string/pref_donottrack_title"
+                      android:summary="@string/pref_donottrack_summary"
+                      android:persistent="false" />
 
     <org.mozilla.gecko.preferences.AlignRightLinkPreference
             android:key="android.not_a_preference.donottrackheader.learn_more"
             android:title="@string/pref_learn_more"
             android:persistent="false"
             url="https://www.mozilla.org/firefox/dnt/" />
 
     <CheckBoxPreference android:key="privacy.trackingprotection.pbmode.enabled"