Bug 1019595 - Use light cancel edit button with dark lightweight themes. r=bnicholson, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 05 Jun 2014 11:58:17 -0700
changeset 200497 d9edba5338ffcbdc114fddf2f5be479e03960315
parent 200496 95deb57e283b74c6b7c68d9b2d5bc29765e39f0c
child 200498 2415441c3620198a198775997e312e4f2f53c79f
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, sledru
bugs1019595
milestone31.0a2
Bug 1019595 - Use light cancel edit button with dark lightweight themes. r=bnicholson, a=sledru
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/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/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:layout_marginLeft="2dp"
-               android:layout_marginRight="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 left margin of the cancel button is larger than the right because
          the url bar drawable contains some whitespace, so we compensate by adding
          a negative right margin (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:layout_marginLeft="4dp"
--- a/mobile/android/base/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/toolbar/BrowserToolbar.java
@@ -135,17 +135,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 boolean shouldShrinkURLBar = false;
 
     private OnActivateListener activateListener;
     private OnFocusChangeListener focusChangeListener;
     private OnStartEditingListener startEditingListener;
     private OnStopEditingListener stopEditingListener;
 
@@ -217,17 +217,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));
@@ -1430,15 +1430,22 @@ 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);
+
+        if (editCancel != null) {
+            editCancel.onLightweightThemeChanged();
+        }
     }
 
     @Override
     public void onLightweightThemeReset() {
         setBackgroundResource(R.drawable.url_bar_bg);
+        if (editCancel != null) {
+            editCancel.onLightweightThemeReset();
+        }
     }
 }