Bug 1019595 - Use light cancel edit button with dark lightweight themes. r=bnicholson
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 05 Jun 2014 11:58:17 -0700
changeset 207269 82cdfd1b391408e60b25752900d850674f35c135
parent 207268 17f0049099028179eb9243851fd7d38e684443d9
child 207270 707b7bcc4fca31506a03d7dfc14888e3fd4f91bd
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs1019595
milestone32.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 1019595 - Use light cancel edit button with dark lightweight themes. r=bnicholson
mobile/android/base/resources/drawable-hdpi/close_edit_mode.png
mobile/android/base/resources/drawable-hdpi/close_edit_mode_dark.png
mobile/android/base/resources/drawable-hdpi/close_edit_mode_light.png
mobile/android/base/resources/drawable-mdpi/close_edit_mode.png
mobile/android/base/resources/drawable-mdpi/close_edit_mode_dark.png
mobile/android/base/resources/drawable-mdpi/close_edit_mode_light.png
mobile/android/base/resources/drawable-xhdpi/close_edit_mode.png
mobile/android/base/resources/drawable-xhdpi/close_edit_mode_dark.png
mobile/android/base/resources/drawable-xhdpi/close_edit_mode_light.png
mobile/android/base/resources/drawable/close_edit_mode_selector.xml
mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
mobile/android/base/resources/layout/browser_toolbar.xml
mobile/android/base/toolbar/BrowserToolbar.java
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..14765da7ef5dacd273d90cdec2b9b5a82b150fa0
GIT binary patch
literal 480
zc%17D@N?(olHy`uVBq!ia0vp^Y9P$P0wkGC6jgx~OS+@4BLl<6e(pbstU$g(vPY0F
z149*1VM7Z8!!Mvv!wUw6QUeBtR|yOZRx=nF#0%!^3bX+kk>u^}!tlSn|IB_M@3*Im
zV~EG`r_*eOS`>KPHp?{$<=SpDzHzg{p)&f#yEOuWcT1KfsnmJOJ#>E}`0W?Z1v@dH
z&-rD+ad(!6%=r-#;Uds7Z)Rg(NzhsDg~<ua+yy_MaZyT~x>!f0ghgqh<os?+Hl+;$
z8U9D3n79Qb3!-M;eYU|s?sRU@<7bj0I!lVOHkQU!ohf^NV&8$Jf115Lv6b7l_(kT-
zz3M5P`f>Ywp|D(EbGgl{Q<sYEUOsu_Dv{tDzCP0<L~pJwYrWcd=Zom<b4zAfC%$|3
zwSHzBcfu{HHs9=RbA8NrJrqnSvzR4!`<i&y%h2>H&e?YS*WSdubxU-8T)*0&HpuqK
zy@fY~tDMhSiU5N_wZt`|BqgyV)hf9t6-Y4{85o-A8kp%C7>5{|Ss9pF85-&um|Gbb
iG-to{LD7(#pOTqYiCe=bv(OJf4Gf;HelF{r5}E)X`L7ZH
rename from mobile/android/base/resources/drawable-hdpi/close_edit_mode.png
rename to mobile/android/base/resources/drawable-hdpi/close_edit_mode_light.png
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b0eea2e7704d40178a1c399a9128b2023b83e5a1
GIT binary patch
literal 437
zc%17D@N?(olHy`uVBq!ia0vp^QXtI10wkH8TU>z@OS+@4BLl<6e(pbstU$g(vPY0F
z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a><Y92N-!mPySp&_Z|^^|AIQ7l
z>Eak-ar*3JYraDU0xs+>FHe~t*r_5btM1wOL?g9tveI^ijbAi+oQ}+5x||XdvHSJM
zH$Rl$O10Z025aZM-Eq?5=XuxcCr^764izq5>X?&ZxoF|jw!;%_bUQr^mN=+fe5C7X
z;v!_5zC|*<O33hgf~V4j$uBlXX)adMeSdrJ9@CQOw@laeT8k+)I;1T8y(s9zHUonV
zB718>r5PknX}SOHpMQI`MMszN`dxQ!rGGixY`gYr<m7j|vP{a{W4~Njvh&Hwhq=$!
ztJ%JbUHR*s^>JZ|2KPz64Ng%&zp0kEMwFx^mZVxG7o`Fz1|tJQ6I}x{T?69~Lo+J_
sGb=+wT?2C~1B2%5w>~Hua`RI%(<*Um_+%FP0jPn&)78&qol`;+0DtD79smFU
rename from mobile/android/base/resources/drawable-mdpi/close_edit_mode.png
rename to mobile/android/base/resources/drawable-mdpi/close_edit_mode_light.png
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a6297a75e1a3050cdaf47de0d4c902f35525d0d1
GIT binary patch
literal 574
zc%17D@N?(olHy`uVBq!ia0vp^#vshW0wgD__^}X3v7|ftIx;Y9?C1WI$O_~uBzpw;
zGB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpafHrx4R3&|Mvbf`xzJ*
zBRyRlLn02po#ETpY{27YTg;Hr*Kmcm{1k5$hlQy61Dh4A99}J}+T7r1A|O=v#P_xA
zp=aHHoi+&myw!gD{1>MCy&0cvAC^Cx)GexfDB5EVi;|MtnkVa)JU%wHt8G%sd>&3!
zUeWNdlp?J-hwZT$A}<@nMR&#@yL2Ji`=n|dhvSZbOMD-BujwbZUH!wol;abRhfVdw
z5~WLlN!M<u2tPMlS2Fu?8lzy(y%|Sz`zm{xd;a`ul<Fy+XIN!1uRm2S^U1N!wO`|=
zz3!P4s+YF+Z7jF(t+Oig1dq=+Vr+Hd$n1%`Umevczpb>msppZwWQE1nrr(8Uut*jP
z3H!Spo#8q^v@l9-@7=0}JylA<lNC?AwUL~f6LLf2jmgsQZcjx5EH8`rWh{N)d+K`d
zQt^NnIa7X_OkEeevi+McOQ6wgHKwIM-7=$sXW9Pl(Mdah(e8+}&Q9s|U*aER%jeh6
z{lJ}Yx$#^dFvwL)Tq8<S5=&C8l8aJ-6oZk0p^2`6nXZ9xh@qL4fti(|p{{|sm4QKX
h_FEqm4Y~O#nQ4`{HGDD){Q%U!;OXk;vd$@?2>=yD;1vJ>
rename from mobile/android/base/resources/drawable-xhdpi/close_edit_mode.png
rename to mobile/android/base/resources/drawable-xhdpi/close_edit_mode_light.png
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable/close_edit_mode_selector.xml
@@ -0,0 +1,14 @@
+<?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_dark="true"
+          android:drawable="@drawable/close_edit_mode_dark"/>
+
+    <item android:drawable="@drawable/close_edit_mode_light"/>
+
+</selector>
--- a/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml
@@ -104,18 +104,19 @@
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:layout_alignParentBottom="true"
                android:background="@color/url_bar_shadow"
                android:contentDescription="@null"/>
 
     <!-- We draw after the menu items so when they are hidden, the cancel button,
          which is thus drawn on top, may be pressed. -->
-    <ImageView android:id="@+id/edit_cancel"
-               style="@style/UrlBar.ImageButton.Icon"
-               android:layout_alignParentRight="true"
-               android:src="@drawable/close_edit_mode"
-               android:paddingLeft="2dp"
-               android:paddingRight="2dp"
-               android:contentDescription="@string/edit_mode_cancel"
-               android:visibility="gone"/>
+    <org.mozilla.gecko.widget.ThemedImageView
+            android:id="@+id/edit_cancel"
+            style="@style/UrlBar.ImageButton.Icon"
+            android:layout_alignParentRight="true"
+            android:src="@drawable/close_edit_mode_selector"
+            android:paddingLeft="2dp"
+            android:paddingRight="2dp"
+            android:contentDescription="@string/edit_mode_cancel"
+            android:visibility="gone"/>
 
 </merge>
--- a/mobile/android/base/resources/layout/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout/browser_toolbar.xml
@@ -92,24 +92,25 @@
                         android:layout_height="24dip"
                         android:layout_marginLeft="40dip"
                         android:layout_marginRight="8dip"
                         android:layout_marginTop="12dip"
                         android:layout_alignRight="@id/tabs"/>
 
     <!-- Note that the edit components are invisible so that the views
          depending on their location can properly layout. -->
-    <ImageView android:id="@+id/edit_cancel"
-               style="@style/UrlBar.ImageButton.Icon"
-               android:layout_alignParentRight="true"
-               android:src="@drawable/close_edit_mode"
-               android:paddingLeft="2dp"
-               android:paddingRight="2dp"
-               android:contentDescription="@string/edit_mode_cancel"
-               android:visibility="invisible"/>
+    <org.mozilla.gecko.widget.ThemedImageView
+            android:id="@+id/edit_cancel"
+            style="@style/UrlBar.ImageButton.Icon"
+            android:layout_alignParentRight="true"
+            android:src="@drawable/close_edit_mode_selector"
+            android:paddingLeft="2dp"
+            android:paddingRight="2dp"
+            android:contentDescription="@string/edit_mode_cancel"
+            android:visibility="invisible"/>
 
     <!-- The space to the left of the cancel button would be larger than the right because
          the url bar drawable contains some whitespace, so we compensate by removing
          some padding from the right (value determined through experimentation). -->
     <org.mozilla.gecko.toolbar.ToolbarEditLayout android:id="@+id/edit_layout"
                   style="@style/UrlBar.Button"
                   android:layout_toLeftOf="@id/edit_cancel"
                   android:paddingLeft="12dp"
--- a/mobile/android/base/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/toolbar/BrowserToolbar.java
@@ -136,17 +136,17 @@ public class BrowserToolbar extends Them
     private ToolbarProgressView progressBar;
     private TabCounter tabsCounter;
     private ThemedImageButton menuButton;
     private ThemedImageView menuIcon;
     private LinearLayout actionItemBar;
     private MenuPopup menuPopup;
     private List<View> focusOrder;
 
-    private final ImageView editCancel;
+    private final ThemedImageView editCancel;
 
     private final View[] tabletDisplayModeViews;
     private boolean hidForwardButtonOnStartEditing = false;
 
     private boolean shouldShrinkURLBar = false;
 
     private OnActivateListener activateListener;
     private OnFocusChangeListener focusChangeListener;
@@ -229,17 +229,17 @@ public class BrowserToolbar extends Them
         forwardButton = (ImageButton) findViewById(R.id.forward);
         setButtonEnabled(forwardButton, false);
 
         menuButton = (ThemedImageButton) findViewById(R.id.menu);
         menuIcon = (ThemedImageView) findViewById(R.id.menu_icon);
         actionItemBar = (LinearLayout) findViewById(R.id.menu_items);
         hasSoftMenuButton = !HardwareUtils.hasMenuButton();
 
-        editCancel = (ImageView) findViewById(R.id.edit_cancel);
+        editCancel = (ThemedImageView) findViewById(R.id.edit_cancel);
 
         // We use different layouts on phones and tablets, so adjust the focus
         // order appropriately.
         focusOrder = new ArrayList<View>();
         if (HardwareUtils.isTablet()) {
             focusOrder.addAll(Arrays.asList(tabsButton, backButton, forwardButton, this));
             focusOrder.addAll(urlDisplayLayout.getFocusOrder());
             focusOrder.addAll(Arrays.asList(actionItemBar, menuButton));
@@ -1450,15 +1450,18 @@ public class BrowserToolbar extends Them
         if (drawable == null)
             return;
 
         StateListDrawable stateList = new StateListDrawable();
         stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.background_private));
         stateList.addState(EMPTY_STATE_SET, drawable);
 
         setBackgroundDrawable(stateList);
+
+        editCancel.onLightweightThemeChanged();
     }
 
     @Override
     public void onLightweightThemeReset() {
         setBackgroundResource(R.drawable.url_bar_bg);
+        editCancel.onLightweightThemeReset();
     }
 }