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

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

Issue 29986555: Issue 7200 - Adjust UI colors (Closed)
Patch Set: Created Jan. 21, 2019, 6:56 p.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 android.support.v4.content.ContextCompat; 7 import android.support.v4.content.ContextCompat;
8 import org.mozilla.gecko.R; 8 import org.mozilla.gecko.R;
9 import org.mozilla.gecko.lwt.LightweightThemeDrawable; 9 import org.mozilla.gecko.lwt.LightweightThemeDrawable;
10 import org.mozilla.gecko.widget.themed.ThemedImageButton; 10 import org.mozilla.gecko.widget.themed.ThemedImageButton;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 @Override 62 @Override
63 public void defaultDraw(Canvas canvas) { 63 public void defaultDraw(Canvas canvas) {
64 super.draw(canvas); 64 super.draw(canvas);
65 } 65 }
66 66
67 // The drawable is constructed as per @drawable/shaped_button. 67 // The drawable is constructed as per @drawable/shaped_button.
68 @Override 68 @Override
69 public void onLightweightThemeChanged() { 69 public void onLightweightThemeChanged() {
70 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37 69 70 final int background = ContextCompat.getColor(getContext(), R.color.text _and_tabs_tray_grey);
71 final int background = ContextCompat.getColor(getContext(), R.color.abb_ background_light_grey);
72 final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable (this, background); 71 final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable (this, background);
73 72
74 if (lightWeight == null) 73 if (lightWeight == null)
75 return; 74 return;
76 75
77 lightWeight.setAlpha(34, 34); 76 lightWeight.setAlpha(34, 34);
78 77
79 final StateListDrawable stateList = new StateListDrawable(); 78 final StateListDrawable stateList = new StateListDrawable();
80 stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.h ighlight_shaped)); 79 stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.h ighlight_shaped));
81 stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.highlight _shaped_focused)); 80 stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.highlight _shaped_focused));
82 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37 69 81 stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.text_and_ tabs_tray_grey));
83 stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.abb_backg round_light_grey));
84 stateList.addState(EMPTY_STATE_SET, lightWeight); 82 stateList.addState(EMPTY_STATE_SET, lightWeight);
85 83
86 setBackgroundDrawable(stateList); 84 setBackgroundDrawable(stateList);
87 } 85 }
88 86
89 @Override 87 @Override
90 public void onLightweightThemeReset() { 88 public void onLightweightThemeReset() {
91 setBackgroundResource(R.drawable.shaped_button); 89 setBackgroundResource(R.drawable.shaped_button);
92 } 90 }
93 91
(...skipping 13 matching lines...) Expand all
107 super.setBackgroundDrawable(drawable); 105 super.setBackgroundDrawable(drawable);
108 106
109 ViewCompat.setPaddingRelative(this, padding[0], padding[1], padding[2], padding[3]); 107 ViewCompat.setPaddingRelative(this, padding[0], padding[1], padding[2], padding[3]);
110 } 108 }
111 109
112 @Override 110 @Override
113 public void setBackgroundResource(int resId) { 111 public void setBackgroundResource(int resId) {
114 setBackgroundDrawable(getResources().getDrawable(resId)); 112 setBackgroundDrawable(getResources().getDrawable(resId));
115 } 113 }
116 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld