Bug 1275880 - Give preferences action bar the correct config & delete unused. r=liuche
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 26 May 2016 10:28:33 -0700
changeset 338654 cb494ac32123f3498ef62b5e312dc4970f15cbc1
parent 338653 13b13d02ddad18766fa565196c11d5fe6ff3f7b3
child 338655 7f6135916882e9dff30c5549e278f49f2fca2c17
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1275880
milestone49.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 1275880 - Give preferences action bar the correct config & delete unused. r=liuche MozReview-Commit-ID: DavXaecwtux
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/java/org/mozilla/gecko/util/UnusedResourcesUtil.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
@@ -351,18 +351,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");
@@ -401,37 +399,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/java/org/mozilla/gecko/util/UnusedResourcesUtil.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/UnusedResourcesUtil.java
@@ -97,17 +97,16 @@ final class UnusedResourcesUtil {
     // more unused resources but we are not ready to remove them yet. Some of the resources are going
     // to be reused soon. This is a temporary solution so that the gradle migration is not blocked.
     // See bug 1263390 / bug 1268414.
     public static final int[] TEMPORARY_UNUSED_WHILE_MIGRATING_GRADLE = {
             R.color.remote_tabs_setup_button_background_hit,
 
             R.drawable.remote_tabs_setup_button_background,
 
-            R.style.ActionBarThemeGeckoPreferences,
             R.style.TabsPanelSectionBase,
             R.style.TabsPanelSection,
             R.style.TabsPanelItemBase,
             R.style.TabsPanelItem,
             R.style.TabsPanelItem_TextAppearance,
             R.style.TabsPanelItem_TextAppearance_Header,
             R.style.TabsPanelItem_TextAppearance_Linkified,
             R.style.TabWidget,
--- 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
@@ -663,16 +663,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 -->