Bug 1084545 - Update nav button stroke colors. r=lucasr
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 20 Oct 2014 08:08:48 -0700
changeset 211254 2123184ca578c28d9c1266fb69b64c933373d13c
parent 211253 421c674933b49ddc732077a7b257150f739d57ec
child 211255 3416fed83bb4a9e12ebc0827b8e29f2800e8b107
push id9457
push usermichael.l.comella@gmail.com
push dateMon, 20 Oct 2014 15:07:33 +0000
treeherderfx-team@2123184ca578 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs1084545
milestone36.0a1
Bug 1084545 - Update nav button stroke colors. r=lucasr
mobile/android/base/resources/values/colors.xml
mobile/android/base/toolbar/BackButton.java
mobile/android/base/toolbar/ForwardButton.java
mobile/android/base/toolbar/NavButton.java
--- a/mobile/android/base/resources/values/colors.xml
+++ b/mobile/android/base/resources/values/colors.xml
@@ -105,16 +105,19 @@
   <color name="textbox_stroke_disabled">#666</color>
 
   <color name="url_bar_urltext">#A6A6A6</color>
   <color name="url_bar_domaintext">#000</color>
   <color name="url_bar_domaintext_private">#FFF</color>
   <color name="url_bar_blockedtext">#b14646</color>
   <color name="url_bar_shadow">#12000000</color>
 
+  <color name="nav_button_border_color">#BFBFBF</color>
+  <color name="nav_button_border_color_private">#5F6368</color>
+
   <color name="home_button_bar_bg">#FFF5F7F9</color>
 
   <!-- Colour used for share overlay button labels -->
   <color name="home_text_color">@color/text_color_primary</color>
   <color name="home_text_color_disabled">#AFB1B3</color>
 
   <color name="panel_image_item_background">#D1D9E1</color>
 
--- a/mobile/android/base/toolbar/BackButton.java
+++ b/mobile/android/base/toolbar/BackButton.java
@@ -8,23 +8,16 @@ import android.content.Context;
 import android.graphics.Path;
 import android.util.AttributeSet;
 
 public class BackButton extends NavButton {
     public BackButton(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
 
-    // TODO: The only reason we can't inherit this method is because there's a color inconsistency.
-    @Override
-    public void setPrivateMode(boolean isPrivate) {
-        super.setPrivateMode(isPrivate);
-        mBorderPaint.setColor(isPrivate ? 0xFF363B40 : 0xFFB5B5B5);
-    }
-
     @Override
     protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
         super.onSizeChanged(width, height, oldWidth, oldHeight);
 
         mPath.reset();
         mPath.addCircle(width/2, height/2, width/2, Path.Direction.CW);
 
         mBorderPath.reset();
--- a/mobile/android/base/toolbar/ForwardButton.java
+++ b/mobile/android/base/toolbar/ForwardButton.java
@@ -7,23 +7,16 @@ package org.mozilla.gecko.toolbar;
 import android.content.Context;
 import android.util.AttributeSet;
 
 public class ForwardButton extends NavButton {
     public ForwardButton(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
 
-    // TODO: The only reason we can't inherit this method is because there's a color inconsistency.
-    @Override
-    public void setPrivateMode(boolean isPrivate) {
-        super.setPrivateMode(isPrivate);
-        mBorderPaint.setColor(isPrivate ? 0xFF363B40 : 0xFFBFBFBF);
-    }
-
     @Override
     protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
         super.onSizeChanged(width, height, oldWidth, oldHeight);
 
         mBorderPath.reset();
         mBorderPath.moveTo(width - mBorderWidth, 0);
         mBorderPath.lineTo(width - mBorderWidth, height);
     }
--- a/mobile/android/base/toolbar/NavButton.java
+++ b/mobile/android/base/toolbar/NavButton.java
@@ -15,35 +15,46 @@ import android.graphics.drawable.Drawabl
 import android.graphics.drawable.StateListDrawable;
 import android.util.AttributeSet;
 
 abstract class NavButton extends ShapedButton {
     protected final Path mBorderPath;
     protected final Paint mBorderPaint;
     protected final float mBorderWidth;
 
+    protected final int mBorderColor;
+    protected final int mBorderColorPrivate;
+
     public NavButton(Context context, AttributeSet attrs) {
         super(context, attrs);
 
         final Resources res = getResources();
+        mBorderColor = res.getColor(R.color.nav_button_border_color);
+        mBorderColorPrivate = res.getColor(R.color.nav_button_border_color_private);
         mBorderWidth = res.getDimension(R.dimen.nav_button_border_width);
 
         // Paint to draw the border.
         mBorderPaint = new Paint();
         mBorderPaint.setAntiAlias(true);
         mBorderPaint.setStrokeWidth(mBorderWidth);
         mBorderPaint.setStyle(Paint.Style.STROKE);
 
         // Path is masked.
         mBorderPath = new Path();
 
         setPrivateMode(false);
     }
 
     @Override
+    public void setPrivateMode(boolean isPrivate) {
+        super.setPrivateMode(isPrivate);
+        mBorderPaint.setColor(isPrivate ? mBorderColorPrivate : mBorderColor);
+    }
+
+    @Override
     public void draw(Canvas canvas) {
         super.draw(canvas);
 
         // Draw the border on top.
         canvas.drawPath(mBorderPath, mBorderPaint);
     }
 
     // The drawable is constructed as per @drawable/url_bar_nav_button.