Bug 1110310 - "Replace LightweightTheme member variable with getTheme() calls". r=michael.l.comella
authorFrancisco Jordano <francisco@jordano.es>
Tue, 16 Dec 2014 11:01:00 +0100
changeset 220624 f9e29a6834cdfc0f4b52a8337d3be5df45be8b80
parent 220623 cac34649ce457368977c30f24ecd91f86518c549
child 220625 b38a659f3d0d0badfe46ca22afee5e5b69e3189f
push id27991
push userkwierso@gmail.com
push dateFri, 19 Dec 2014 23:43:54 +0000
treeherdermozilla-central@b052018cf239 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichael.l.comella
bugs1110310
milestone37.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 1110310 - "Replace LightweightTheme member variable with getTheme() calls". r=michael.l.comella
mobile/android/base/toolbar/BrowserToolbar.java
mobile/android/base/toolbar/NavButton.java
mobile/android/base/toolbar/ShapedButton.java
--- a/mobile/android/base/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/toolbar/BrowserToolbar.java
@@ -135,17 +135,16 @@ public abstract class BrowserToolbar ext
     protected boolean hasSoftMenuButton;
 
     protected UIMode uiMode;
     protected TabHistoryController tabHistoryController;
 
     private final Paint shadowPaint;
     private final int shadowSize;
 
-    private final LightweightTheme theme;
     private final ToolbarPrefs prefs;
 
     public abstract boolean isAnimating();
 
     protected abstract boolean isTabsButtonOffscreen();
 
     protected abstract void updateNavigationButtons(Tab tab);
 
@@ -174,17 +173,16 @@ public abstract class BrowserToolbar ext
         return toolbar;
     }
 
     protected BrowserToolbar(final Context context, final AttributeSet attrs) {
         super(context, attrs);
         setWillNotDraw(false);
 
         isNewTablet = NewTabletUI.isEnabled(context);
-        theme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
 
         // BrowserToolbar is attached to BrowserApp only.
         activity = (BrowserApp) context;
 
         // Inflate the content.
         // TODO: Remove the branch when new tablet becomes old tablet.
         if (!isNewTablet) {
             LayoutInflater.from(context).inflate(R.layout.browser_toolbar, this);
--- a/mobile/android/base/toolbar/NavButton.java
+++ b/mobile/android/base/toolbar/NavButton.java
@@ -58,17 +58,17 @@ abstract class NavButton extends ShapedB
         canvas.drawPath(mBorderPath, mBorderPaint);
     }
 
     // The drawable is constructed as per @drawable/url_bar_nav_button.
     @Override
     public void onLightweightThemeChanged() {
         final Drawable drawable;
         if (!NewTabletUI.isEnabled(getContext())) {
-            drawable = mTheme.getDrawable(this);
+            drawable = getTheme().getDrawable(this);
         } else {
             drawable = BrowserToolbar.getLightweightThemeDrawable(this, getResources(), getTheme(),
                     R.color.background_normal);
         }
 
         if (drawable == null) {
             return;
         }
--- a/mobile/android/base/toolbar/ShapedButton.java
+++ b/mobile/android/base/toolbar/ShapedButton.java
@@ -18,24 +18,22 @@ import android.graphics.Paint;
 import android.graphics.Path;
 import android.graphics.PorterDuff.Mode;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.StateListDrawable;
 import android.util.AttributeSet;
 
 public class ShapedButton extends ThemedImageButton
                           implements CanvasDelegate.DrawManager {
-    protected final LightweightTheme mTheme;
 
     protected final Path mPath;
     protected final CanvasDelegate mCanvasDelegate;
 
     public ShapedButton(Context context, AttributeSet attrs) {
         super(context, attrs);
-        mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
 
         // Path is clipped.
         mPath = new Path();
 
         final Paint paint = new Paint();
         paint.setAntiAlias(true);
         paint.setColor(getResources().getColor(R.color.canvas_delegate_paint));
         paint.setStrokeWidth(0.0f);
@@ -56,17 +54,17 @@ public class ShapedButton extends Themed
     public void defaultDraw(Canvas canvas) {
         super.draw(canvas);
     }
 
     // The drawable is constructed as per @drawable/shaped_button.
     @Override
     public void onLightweightThemeChanged() {
         final int background = getResources().getColor(R.color.background_tabs);
-        final LightweightThemeDrawable lightWeight = mTheme.getColorDrawable(this, background);
+        final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable(this, background);
 
         if (lightWeight == null)
             return;
 
         lightWeight.setAlpha(34, 34);
 
         final StateListDrawable stateList = new StateListDrawable();
         stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.highlight_shaped));