Bug 1275880 - Give preferences action bar the correct config & delete unused. r=liuche, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 26 May 2016 10:28:33 -0700
changeset 333217 1f4a8e832810598b9800fcd6602ac89bf403ac78
parent 333216 ebc5b4222c2b48a9d6a0a9dbc47c053a637f8f6a
child 333218 1d0f99529b3109563afb853d45ab26b602718e17
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche, sledru
bugs1275880
milestone48.0a2
Bug 1275880 - Give preferences action bar the correct config & delete unused. r=liuche, a=sledru MozReview-Commit-ID: DavXaecwtux
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/resources/values-v11/styles.xml
mobile/android/base/resources/values-v21/styles.xml
mobile/android/base/resources/values-v21/themes.xml
mobile/android/base/resources/values/styles.xml
mobile/android/base/resources/values/themes.xml
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -349,18 +349,16 @@ OnSharedPreferenceChangeListener
                 // Affected by Bug 1015209 -- no detach/attach.
                 // If we try rejigging fragments, we'll crash, so don't
                 // enable locale switching at all.
                 localeSwitchingIsEnabled = false;
                 throw new IllegalStateException("foobar");
             }
         }
 
-        initActionBar();
-
         // Use setResourceToOpen to specify these extras.
         Bundle intentExtras = getIntent().getExtras();
 
         EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener) this,
             "Sanitize:Finished");
 
         EventDispatcher.getInstance().registerGeckoThreadListener((NativeEventListener) this,
             "Snackbar:Show");
@@ -399,37 +397,16 @@ OnSharedPreferenceChangeListener
         if (intentExtras != null && intentExtras.containsKey(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) {
             Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
             Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, Method.BUTTON, "notification-settings");
             Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
         }
     }
 
     /**
-     * Initializes the action bar configuration in code.
-     *
-     * Declaring these attributes in XML does not work on some devices for an unknown reason
-     * (e.g. the back button stops working or the logo disappears; see bug 1152314) so we
-     * duplicate those attributes in code here. Note: the order of these calls matters.
-     *
-     * We keep the XML attributes because not all of these methods are available on pre-v14.
-     */
-    private void initActionBar() {
-        if (Versions.feature14Plus) {
-            final ActionBar actionBar = getSupportActionBar();
-            if (actionBar != null) {
-                actionBar.setHomeButtonEnabled(true);
-                actionBar.setDisplayHomeAsUpEnabled(true);
-                actionBar.setLogo(R.drawable.logo);
-                actionBar.setDisplayUseLogoEnabled(true);
-            }
-        }
-    }
-
-    /**
      * Set intent to display top-level settings fragment,
      * and show the correct title.
      */
     private void setupTopLevelFragmentIntent() {
         Intent intent = getIntent();
         // Check intent to determine settings screen to display.
         Bundle intentExtras = intent.getExtras();
         Bundle fragmentArgs = new Bundle();
--- a/mobile/android/base/resources/values-v11/styles.xml
+++ b/mobile/android/base/resources/values-v11/styles.xml
@@ -40,23 +40,17 @@
         <item name="android:paddingLeft">12dip</item>
         <item name="android:paddingRight">7dip</item>
         <item name="android:checkMark">?android:attr/listChoiceIndicatorMultiple</item>
         <item name="android:ellipsize">marquee</item>
     </style>
 
     <!-- ActionBar -->
     <style name="ActionBar" parent="android:style/Widget.Holo.ActionBar" />
- 
-    <!-- GeckoPreferences ActionBar -->
-    <style name="ActionBar.GeckoPreferences">
-         <!-- Partially duplicated in GeckoPreferences.initActionBar - look there for more details. -->
-         <item name="android:displayOptions">showHome|homeAsUp|showTitle|useLogo</item>
-    </style>
- 
+
     <!-- TabsLayout ActionBar -->
     <style name="ActionBar.TabsLayout">
          <item name="android:visibility">gone</item>
     </style>
 
     <!-- DropDown List View -->
     <style name="DropDownListView" parent="@android:style/Widget.Holo.ListView.DropDown">
          <item name="android:listSelector">@drawable/action_bar_button</item>
--- a/mobile/android/base/resources/values-v21/styles.xml
+++ b/mobile/android/base/resources/values-v21/styles.xml
@@ -4,14 +4,9 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <resources>
 
    <style name="ActionBarTitleTextStyle" parent="@android:style/TextAppearance.Material.Widget.ActionBar.Title">
       <item name="android:textColor">#fff</item>
    </style>
 
-   <style name="ActionBarThemeGeckoPreferences">
-       <!-- Icon color -->
-       <item name="colorControlNormal">#fff</item>
-   </style>
-
 </resources>
--- a/mobile/android/base/resources/values-v21/themes.xml
+++ b/mobile/android/base/resources/values-v21/themes.xml
@@ -21,20 +21,16 @@
         <item name="android:colorAccent">@color/fennec_ui_orange</item>
     </style>
 
     <style name="ActionBar.FxAccountStatusActivity" parent="@android:style/Widget.Material.ActionBar.Solid">
         <item name="android:displayOptions">homeAsUp|showTitle</item>
         <item name="android:titleTextStyle">@style/ActionBarTitleTextStyle</item>
     </style>
 
-    <style name="ActionBar.GeckoPreferences" parent="@android:style/Widget.Material.ActionBar.Solid">
-        <item name="android:titleTextStyle">@style/ActionBarTitleTextStyle</item>
-    </style>
-
     <style name="GeckoAppBase" parent="Gecko">
         <item name="android:actionButtonStyle">@style/GeckoActionBar.Button</item>
         <item name="android:listViewStyle">@style/Widget.ListView</item>
         <item name="android:spinnerDropDownItemStyle">@style/Widget.DropDownItem.Spinner</item>
         <item name="android:spinnerItemStyle">@style/Widget.TextView.SpinnerItem</item>
         <item name="menuItemSwitcherLayoutStyle">@style/Widget.MenuItemSwitcherLayout</item>
         <item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
         <item name="menuItemSecondaryActionBarStyle">@style/Widget.MenuItemSecondaryActionBar</item>
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -671,16 +671,20 @@
     </style>
 
     <style name="GeckoActionBar" parent="ThemeOverlay.AppCompat.ActionBar">
         <item name="android:colorBackground">@color/toolbar_grey</item>
         <item name="colorAccent">@color/fennec_ui_orange</item>
         <item name="colorControlNormal">@color/toolbar_icon_grey</item>
     </style>
 
+    <style name="PreferencesActionBar" parent="Widget.AppCompat.ActionBar.Solid">
+        <item name="displayOptions">showHome|homeAsUp|showTitle</item>
+    </style>
+
     <style name="GeckoActionBar.Title">
         <item name="android:gravity">center_vertical</item>
         <item name="android:minWidth">0dp</item>
         <item name="android:background">@android:color/transparent</item>
         <item name="android:textAppearance">@style/TextAppearance.Medium</item>
         <item name="android:drawableLeft">@drawable/ab_done</item>
         <item name="android:paddingLeft">15dp</item>
         <item name="android:paddingRight">15dp</item>
--- a/mobile/android/base/resources/values/themes.xml
+++ b/mobile/android/base/resources/values/themes.xml
@@ -17,20 +17,20 @@
     <style name="GeckoDialogBase" parent="@android:style/Theme.Dialog">
         <item name="android:windowNoTitle">true</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
 
     <style name="GeckoTitleDialogBase" parent="@android:style/Theme.Dialog" />
 
     <style name="Gecko.Preferences">
-        <item name="android:windowContentOverlay">@null</item>
         <item name="windowActionBar">true</item>
         <item name="windowNoTitle">false</item>
-        <item name="actionBarStyle">@style/ActionBar.GeckoPreferences</item>
+        <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
+        <item name="actionBarStyle">@style/PreferencesActionBar</item>
     </style>
 
     <!--
         Application Theme. All customizations that are not specific
         to a particular API level can go here.
     -->
     <style name="Gecko" parent="GeckoBase">
         <!-- Default colors -->