Bug 1105541 - Part 3: Change add tab button to a dark color on light themes on new tablet. r=mhaigh, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 12 Dec 2014 14:03:28 -0800
changeset 242454 64c6aa56aa22915bdb257e87c00c1d289f47c5d6
parent 242453 cd9788ebebcca115ca17e2d6cf1ff996d9b8b8c6
child 242455 f74eb7dc50d532ada21854487997ffa0cb89b2ec
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh, sledru
bugs1105541
milestone36.0a2
Bug 1105541 - Part 3: Change add tab button to a dark color on light themes on new tablet. r=mhaigh, a=sledru
mobile/android/base/newtablet/res/drawable-large-hdpi-v11/new_tablet_tab_new_dark.png
mobile/android/base/newtablet/res/drawable-large-mdpi-v11/new_tablet_tab_new_dark.png
mobile/android/base/newtablet/res/drawable-large-v11/new_tablet_tab_strip_add_tab.xml
mobile/android/base/newtablet/res/drawable-large-xhdpi-v11/new_tablet_tab_new_dark.png
mobile/android/base/newtablet/res/layout-large-v11/tab_strip.xml
mobile/android/base/tabs/TabStrip.java
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b29e972af98f4521bc3532215541f085c51579b0
GIT binary patch
literal 122
zc%17D@N?(olHy`uVBq!ia0vp^Dj>|k3?#4J%UA`Z*aCb)T;r27fJo?BraVxDu_VYZ
zn8D%MjWi%f$<xI#q=GTofxX9}LC<Z?qCnThT@sxPC1EaS6(mAUR&g+#_{1m})~!_v
PRL$V&>gTe~DWM4f&Qc&Z
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e674cd8553b3b9b3f15bf606a04a2f1f62939d83
GIT binary patch
literal 112
zc%17D@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbMaAu?6^qxW*@E0FltMOnIOPV@Z%-
zFoVOh8)+c5o-U3d6^zLWOa?|qeHxr@ZyHKE1!X!ICRZ>ty)oH)7N~~7)78&qol`;+
E0F3<|BLDyZ
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/newtablet/res/drawable-large-v11/new_tablet_tab_strip_add_tab.xml
@@ -0,0 +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"
+          xmlns:gecko="http://schemas.android.com/apk/res-auto">
+
+    <item gecko:state_private="true"
+          android:drawable="@drawable/tab_new_pb"/>
+
+    <item gecko:state_light="true"
+          android:drawable="@drawable/new_tablet_tab_new_dark"/>
+
+    <item android:drawable="@drawable/tab_new"/>
+
+</selector>
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a7aa51e48758ab09dc758f82627824283084fab5
GIT binary patch
literal 127
zc%17D@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sYymzYuJOqkKqT}mQywV7SQ6wH
z%;50sMjDW#?&;zfQo)#ffJ@>a!|E#rmkm}Wh8$kO<|cHo<BGwd%a>NP1@bPIV%QbV
VB<ugEffJ~O!PC{xWt~$(69BSGB$)sJ
--- a/mobile/android/base/newtablet/res/layout-large-v11/tab_strip.xml
+++ b/mobile/android/base/newtablet/res/layout-large-v11/tab_strip.xml
@@ -9,18 +9,18 @@
         android:id="@+id/tab_strip"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_weight="1"
         android:paddingTop="8dp"/>
 
     <!-- The right margin creates a "dead area" on the right side of the button
          which we compensate for with a touch delegate. See TabStrip -->
-    <ImageButton
+    <org.mozilla.gecko.widget.ThemedImageButton
         android:id="@+id/add_tab"
         style="@style/UrlBar.ImageButton"
         android:layout_width="@dimen/new_tablet_tab_strip_height"
-        android:src="@drawable/tab_new_level"
+        android:src="@drawable/new_tablet_tab_strip_add_tab"
         android:contentDescription="@string/new_tab"
         android:layout_marginRight="9dp"
         android:background="@drawable/new_tablet_tab_strip_button"/>
 
 </merge>
--- a/mobile/android/base/tabs/TabStrip.java
+++ b/mobile/android/base/tabs/TabStrip.java
@@ -9,46 +9,43 @@ import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.StateListDrawable;
 import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.TouchDelegate;
 import android.view.View;
 import android.view.ViewTreeObserver;
-import android.widget.ImageButton;
 
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
+import org.mozilla.gecko.widget.ThemedImageButton;
 import org.mozilla.gecko.widget.ThemedLinearLayout;
 
 public class TabStrip extends ThemedLinearLayout {
     private static final String LOGTAG = "GeckoTabStrip";
 
-    private static final int IMAGE_LEVEL_NORMAL = 0;
-    private static final int IMAGE_LEVEL_PRIVATE = 1;
-
     private final TabStripView tabStripView;
-    private final ImageButton addTabButton;
+    private final ThemedImageButton addTabButton;
 
     private final TabsListener tabsListener;
 
     public TabStrip(Context context) {
         this(context, null);
     }
 
     public TabStrip(Context context, AttributeSet attrs) {
         super(context, attrs);
         setOrientation(HORIZONTAL);
 
         LayoutInflater.from(context).inflate(R.layout.tab_strip, this);
         tabStripView = (TabStripView) findViewById(R.id.tab_strip);
 
-        addTabButton = (ImageButton) findViewById(R.id.add_tab);
+        addTabButton = (ThemedImageButton) findViewById(R.id.add_tab);
         addTabButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 final Tabs tabs = Tabs.getInstance();
                 if (isPrivateMode()) {
                     tabs.addPrivateTab();
                 } else {
                     tabs.addTab();
@@ -92,17 +89,17 @@ public class TabStrip extends ThemedLine
 
         Tabs.unregisterOnTabsChangedListener(tabsListener);
         tabStripView.clearTabs();
     }
 
     @Override
     public void setPrivateMode(boolean isPrivate) {
         super.setPrivateMode(isPrivate);
-        addTabButton.setImageLevel(isPrivate ? IMAGE_LEVEL_PRIVATE : IMAGE_LEVEL_NORMAL);
+        addTabButton.setPrivateMode(isPrivate);
     }
 
     private class TabsListener implements Tabs.OnTabsChangedListener {
         @Override
         public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
             switch (msg) {
                 case RESTORED:
                     tabStripView.restoreTabs();