Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: mobile/android/base/toolbar/ShapedButton.java

Issue 29348083: Issue 3769 - UI colours gone bad (Closed)
Patch Set: Created July 21, 2016, 2:09 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* This Source Code Form is subject to the terms of the Mozilla Public 1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 4
5 package org.mozilla.gecko.toolbar; 5 package org.mozilla.gecko.toolbar;
6 6
7 import org.mozilla.gecko.R; 7 import org.mozilla.gecko.R;
8 import org.mozilla.gecko.lwt.LightweightThemeDrawable; 8 import org.mozilla.gecko.lwt.LightweightThemeDrawable;
9 import org.mozilla.gecko.util.ColorUtils; 9 import org.mozilla.gecko.util.ColorUtils;
10 import org.mozilla.gecko.widget.themed.ThemedImageButton; 10 import org.mozilla.gecko.widget.themed.ThemedImageButton;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 @Override 54 @Override
55 public void defaultDraw(Canvas canvas) { 55 public void defaultDraw(Canvas canvas) {
56 super.draw(canvas); 56 super.draw(canvas);
57 } 57 }
58 58
59 // The drawable is constructed as per @drawable/shaped_button. 59 // The drawable is constructed as per @drawable/shaped_button.
60 @Override 60 @Override
61 public void onLightweightThemeChanged() { 61 public void onLightweightThemeChanged() {
62 final int background = ColorUtils.getColor(getContext(), R.color.text_an d_tabs_tray_grey); 62 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37 69
63 final int background = ColorUtils.getColor(getContext(), R.color.abb_bac kground_light_grey);
63 final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable (this, background); 64 final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable (this, background);
64 65
65 if (lightWeight == null) 66 if (lightWeight == null)
66 return; 67 return;
67 68
68 lightWeight.setAlpha(34, 34); 69 lightWeight.setAlpha(34, 34);
69 70
70 final StateListDrawable stateList = new StateListDrawable(); 71 final StateListDrawable stateList = new StateListDrawable();
71 stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.h ighlight_shaped)); 72 stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.h ighlight_shaped));
72 stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.highlight _shaped_focused)); 73 stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.highlight _shaped_focused));
73 stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.text_and_ tabs_tray_grey)); 74 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37 69
75 stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.abb_backg round_light_grey));
74 stateList.addState(EMPTY_STATE_SET, lightWeight); 76 stateList.addState(EMPTY_STATE_SET, lightWeight);
75 77
76 setBackgroundDrawable(stateList); 78 setBackgroundDrawable(stateList);
77 } 79 }
78 80
79 @Override 81 @Override
80 public void onLightweightThemeReset() { 82 public void onLightweightThemeReset() {
81 setBackgroundResource(R.drawable.shaped_button); 83 setBackgroundResource(R.drawable.shaped_button);
82 } 84 }
83 85
(...skipping 13 matching lines...) Expand all
97 super.setBackgroundDrawable(drawable); 99 super.setBackgroundDrawable(drawable);
98 100
99 setPadding(padding[0], padding[1], padding[2], padding[3]); 101 setPadding(padding[0], padding[1], padding[2], padding[3]);
100 } 102 }
101 103
102 @Override 104 @Override
103 public void setBackgroundResource(int resId) { 105 public void setBackgroundResource(int resId) {
104 setBackgroundDrawable(getResources().getDrawable(resId)); 106 setBackgroundDrawable(getResources().getDrawable(resId));
105 } 107 }
106 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld