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

Side by Side Diff: mobile/android/base/java/org/mozilla/gecko/toolbar/ShapedButtonFrameLayout.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.ThemedFrameLayout; 10 import org.mozilla.gecko.widget.themed.ThemedFrameLayout;
(...skipping 10 matching lines...) Expand all
21 */ 21 */
22 public class ShapedButtonFrameLayout extends ThemedFrameLayout { 22 public class ShapedButtonFrameLayout extends ThemedFrameLayout {
23 23
24 public ShapedButtonFrameLayout(Context context, AttributeSet attrs) { 24 public ShapedButtonFrameLayout(Context context, AttributeSet attrs) {
25 super(context, attrs); 25 super(context, attrs);
26 } 26 }
27 27
28 // The drawable is constructed as per @drawable/shaped_button. 28 // The drawable is constructed as per @drawable/shaped_button.
29 @Override 29 @Override
30 public void onLightweightThemeChanged() { 30 public void onLightweightThemeChanged() {
31 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37 69 31 final int background = ContextCompat.getColor(getContext(), R.color.text _and_tabs_tray_grey);
32 final int background = ContextCompat.getColor(getContext(), R.color.abb_ background_light_grey);
33 final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable (this, background); 32 final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable (this, background);
34 33
35 if (lightWeight == null) 34 if (lightWeight == null)
36 return; 35 return;
37 36
38 lightWeight.setAlpha(34, 34); 37 lightWeight.setAlpha(34, 34);
39 38
40 final StateListDrawable stateList = new StateListDrawable(); 39 final StateListDrawable stateList = new StateListDrawable();
41 stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.h ighlight_shaped)); 40 stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.h ighlight_shaped));
42 stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.highlight _shaped_focused)); 41 stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.highlight _shaped_focused));
43 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37 69 42 stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.text_and_ tabs_tray_grey));
44 stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.abb_backg round_light_grey));
45 stateList.addState(EMPTY_STATE_SET, lightWeight); 43 stateList.addState(EMPTY_STATE_SET, lightWeight);
46 44
47 setBackgroundDrawable(stateList); 45 setBackgroundDrawable(stateList);
48 } 46 }
49 47
50 @Override 48 @Override
51 public void onLightweightThemeReset() { 49 public void onLightweightThemeReset() {
52 setBackgroundResource(R.drawable.shaped_button); 50 setBackgroundResource(R.drawable.shaped_button);
53 } 51 }
54 52
(...skipping 13 matching lines...) Expand all
68 super.setBackgroundDrawable(drawable); 66 super.setBackgroundDrawable(drawable);
69 67
70 ViewCompat.setPaddingRelative(this, padding[0], padding[1], padding[2], padding[3]); 68 ViewCompat.setPaddingRelative(this, padding[0], padding[1], padding[2], padding[3]);
71 } 69 }
72 70
73 @Override 71 @Override
74 public void setBackgroundResource(int resId) { 72 public void setBackgroundResource(int resId) {
75 setBackgroundDrawable(getResources().getDrawable(resId)); 73 setBackgroundDrawable(getResources().getDrawable(resId));
76 } 74 }
77 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld