Bug 848707: Add focused states for buttons. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Wed, 13 Mar 2013 12:28:01 -0700
changeset 124753 67d0bd22fe140e12e534b22e2c1c1edae4da6b9e
parent 124752 b0a6d63bdec6d310d635ceff409544b2706cfedb
child 124754 f345667b192dd1dcf2c3c2a965f1c6dd48a3d383
push id24579
push usersramasubramanian@mozilla.com
push dateWed, 13 Mar 2013 20:54:52 +0000
treeherdermozilla-inbound@f345667b192d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs848707
milestone22.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 848707: Add focused states for buttons. [r=mfinkle]
mobile/android/base/BackButton.java
mobile/android/base/ForwardButton.java
mobile/android/base/MenuButton.java
mobile/android/base/TabsButton.java
mobile/android/base/resources/drawable-large-land-v11/tabs_button.xml
mobile/android/base/resources/drawable/action_bar_button.xml
mobile/android/base/resources/drawable/action_bar_button_inverse.xml
mobile/android/base/resources/drawable/menu_button.xml
mobile/android/base/resources/drawable/tabs_button.xml
mobile/android/base/resources/drawable/tabs_panel_indicator.xml
mobile/android/base/resources/values/colors.xml
--- a/mobile/android/base/BackButton.java
+++ b/mobile/android/base/BackButton.java
@@ -78,16 +78,17 @@ public class BackButton extends ShapedBu
         Drawable drawable = mActivity.getLightweightTheme().getDrawable(this);
         if (drawable == null)
             return;
 
         Resources resources = getContext().getResources();
         StateListDrawable stateList = new StateListDrawable();
 
         stateList.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight)));
+        stateList.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_focused)));
         stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(resources.getColor(R.color.background_private)));
         stateList.addState(new int[] {}, drawable);
 
         setBackgroundDrawable(stateList);
     }
 
     @Override
     public void onLightweightThemeReset() {
--- a/mobile/android/base/ForwardButton.java
+++ b/mobile/android/base/ForwardButton.java
@@ -72,16 +72,17 @@ public class ForwardButton extends Shape
         Drawable drawable = mActivity.getLightweightTheme().getDrawable(this);
         if (drawable == null)
             return;
 
         Resources resources = getContext().getResources();
         StateListDrawable stateList = new StateListDrawable();
 
         stateList.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight)));
+        stateList.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_focused)));
         stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(resources.getColor(R.color.background_private)));
         stateList.addState(new int[] {}, drawable);
 
         setBackgroundDrawable(stateList);
     }
 
     @Override
     public void onLightweightThemeReset() {
--- a/mobile/android/base/MenuButton.java
+++ b/mobile/android/base/MenuButton.java
@@ -59,16 +59,17 @@ public class MenuButton extends ShapedBu
         if (drawable == null)
             return;
 
         drawable.setAlpha(34, 34);
 
         Resources resources = getContext().getResources();
         StateListDrawable stateList = new StateListDrawable();
         stateList.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight_dark)));
+        stateList.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_dark_focused)));
         stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(Color.BLACK));
         stateList.addState(new int[] {}, drawable);
 
         LevelListDrawable levelList = new LevelListDrawable();
         levelList.addLevel(0, 1, stateList);
         levelList.addLevel(2, 2, new ColorDrawable(Color.TRANSPARENT));
 
         setBackgroundDrawable(levelList);
--- a/mobile/android/base/TabsButton.java
+++ b/mobile/android/base/TabsButton.java
@@ -166,21 +166,23 @@ public class TabsButton extends ShapedBu
             return;
 
         lightWeight1.setAlpha(34, 34);
         lightWeight2.setAlpha(34, 34);
 
         Resources resources = this.getContext().getResources();
         StateListDrawable stateList1 = new StateListDrawable();
         stateList1.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight_dark)));
+        stateList1.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_dark_focused)));
         stateList1.addState(new int[] { R.attr.state_private }, new ColorDrawable(resources.getColor(R.color.background_tabs_light)));
         stateList1.addState(new int[] {}, lightWeight1);
 
         StateListDrawable stateList2 = new StateListDrawable();
         stateList2.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight_dark)));
+        stateList2.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_dark_focused)));
         stateList2.addState(new int[] { R.attr.state_private }, new ColorDrawable(resources.getColor(R.color.background_tabs_dark)));
         stateList2.addState(new int[] {}, lightWeight2);
 
         LevelListDrawable levelList = new LevelListDrawable();
         levelList.addLevel(0, 1, stateList1);
 
         // If there is a side bar, the expanded state will have a filled button.
         if (mSideBar)
--- a/mobile/android/base/resources/drawable-large-land-v11/tabs_button.xml
+++ b/mobile/android/base/resources/drawable-large-land-v11/tabs_button.xml
@@ -7,28 +7,36 @@
 
     <item android:maxLevel="1">
 
         <selector>
 
             <item android:state_pressed="true"
                   android:drawable="@color/highlight_dark"/>
 
+            <item android:state_focused="true"
+                  android:state_pressed="false"
+                  android:drawable="@color/highlight_dark_focused"/>
+
             <item android:drawable="@color/background_tabs_light"/>
 
         </selector>
 
     </item>
 
     <item android:maxLevel="2">
 
         <selector>
 
             <item android:state_pressed="true"
                   android:drawable="@color/highlight_dark"/>
 
+            <item android:state_focused="true"
+                  android:state_pressed="false"
+                  android:drawable="@color/highlight_dark_focused"/>
+
             <item android:drawable="@color/background_tabs_dark"/>
 
         </selector>
 
     </item>
 
 </level-list>
--- a/mobile/android/base/resources/drawable/action_bar_button.xml
+++ b/mobile/android/base/resources/drawable/action_bar_button.xml
@@ -1,11 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - 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/. -->
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:state_pressed="true" android:drawable="@color/highlight"/>
+    <item android:state_pressed="true"
+          android:drawable="@color/highlight"/>
+
+    <item android:state_focused="true"
+          android:state_pressed="false"
+          android:drawable="@color/highlight_focused"/>
+
     <item android:drawable="@android:color/transparent"/>
 
 </selector>
--- a/mobile/android/base/resources/drawable/action_bar_button_inverse.xml
+++ b/mobile/android/base/resources/drawable/action_bar_button_inverse.xml
@@ -1,11 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - 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/. -->
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:state_pressed="true" android:drawable="@color/highlight_dark"/>
+    <item android:state_pressed="true"
+          android:drawable="@color/highlight_dark"/>
+
+    <item android:state_focused="true"
+          android:state_pressed="false"
+          android:drawable="@color/highlight_dark_focused"/>
+
     <item android:drawable="@android:color/transparent"/>
 
 </selector>
--- a/mobile/android/base/resources/drawable/menu_button.xml
+++ b/mobile/android/base/resources/drawable/menu_button.xml
@@ -1,17 +1,27 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - 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/. -->
 
 <level-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item android:maxLevel="1">
+
         <selector>
-            <item android:state_pressed="true" android:drawable="@color/highlight_dark"/>
+
+            <item android:state_pressed="true"
+                  android:drawable="@color/highlight_dark"/>
+
+            <item android:state_focused="true"
+                  android:state_pressed="false"
+                  android:drawable="@color/highlight_dark_focused"/>
+
             <item android:drawable="@android:color/black"/>
+
         </selector>
+
     </item>
 
     <item android:maxLevel="2" android:drawable="@android:color/transparent"/>
 
 </level-list>
--- a/mobile/android/base/resources/drawable/tabs_button.xml
+++ b/mobile/android/base/resources/drawable/tabs_button.xml
@@ -7,16 +7,20 @@
 
     <item android:maxLevel="1">
 
         <selector>
 
             <item android:state_pressed="true"
                   android:drawable="@color/highlight_dark"/>
 
+            <item android:state_focused="true"
+                  android:state_pressed="false"
+                  android:drawable="@color/highlight_dark_focused"/>
+
             <item android:drawable="@color/background_tabs_light"/>
 
         </selector>
 
     </item>
 
     <item android:maxLevel="2" android:drawable="@android:color/transparent"/>
 
--- a/mobile/android/base/resources/drawable/tabs_panel_indicator.xml
+++ b/mobile/android/base/resources/drawable/tabs_panel_indicator.xml
@@ -3,27 +3,27 @@
    - 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/. -->
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item android:state_focused="false"
           android:state_selected="false"
           android:state_pressed="false"
-          android:drawable="@color/tab_indicator_unselected"/>
+          android:drawable="@android:color/transparent"/>
 
     <item android:state_focused="false"
           android:state_selected="true"
           android:state_pressed="false"
           android:drawable="@drawable/tab_indicator_selected"/>
 
     <item android:state_focused="true"
           android:state_selected="false"
           android:state_pressed="false"
-          android:drawable="@color/tab_indicator_unselected_focused"/>
+          android:drawable="@color/highlight_dark_focused"/>
 
     <item android:state_focused="true"
           android:state_selected="true"
           android:state_pressed="false"
           android:drawable="@drawable/tab_indicator_selected_focused"/>
 
     <item android:state_focused="false"
           android:state_selected="false"
--- a/mobile/android/base/resources/values/colors.xml
+++ b/mobile/android/base/resources/values/colors.xml
@@ -4,32 +4,32 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <resources>
   <color name="background_normal">#FFCED7DE</color>
   <color name="background_private">#FF292C29</color>
   <color name="background_tabs_dark">#FF363B40</color>
   <color name="background_tabs_light">#FF43484E</color>
   <color name="highlight">#33000000</color>
+  <color name="highlight_focused">#1A000000</color>
   <color name="highlight_dark">#33FFFFFF</color>
+  <color name="highlight_dark_focused">#1AFFFFFF</color>
   <color name="autocomplete_listitem_text">#000000</color>
   <color name="splash_background">#000000</color>
   <color name="splash_msgfont">#ffffff</color>
   <color name="splash_urlfont">#000000</color>
   <color name="splash_content">#ffffff</color>
   <color name="doorhanger_text">#FF222222</color>
   <color name="doorhanger_link">#ACC4D5</color>
   <color name="validation_message_text">#ffffff</color>
   <color name="identity_verified">#FF3298FF</color>
   <color name="identity_identified">#FF89C450</color>
   <color name="url_bar_text_highlight">#FFFF9500</color>
   <color name="url_bar_text_highlight_pb">#FFD06BFF</color>
   <color name="suggestion_primary">#dddddd</color>
   <color name="suggestion_pressed">#bbbbbb</color>
   <color name="abouthome_thumbnail_bg">#5FFF</color>
   <color name="abouthome_topsite_shadow">#1000</color>
-  <color name="tab_indicator_unselected">@android:color/transparent</color>
-  <color name="tab_indicator_unselected_focused">#34FF9500</color>
   <color name="tab_row_pressed">#4D000000</color>
   <color name="abouthome_topsite_pin">#55000000</color>
   <color name="dialogtitle_textcolor">#ffffff</color>
 </resources>