Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 6e42b71

Browse files
keianhzobluemarvin
authored andcommitted
Avoid tinting the profile icon for FxA honeycomb (#2334)
1 parent 1846765 commit 6e42b71

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/views/HoneycombButton.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import android.util.AttributeSet;
99
import android.util.Log;
1010
import android.view.MotionEvent;
11-
import android.view.View;
1211
import android.widget.ImageView;
1312
import android.widget.LinearLayout;
1413
import android.widget.TextView;
@@ -33,6 +32,7 @@ public class HoneycombButton extends LinearLayout {
3332
private float mButtonTextSize;
3433
private String mSecondaryButtonText;
3534
private Drawable mButtonIcon;
35+
private boolean mButtonIconHover;
3636

3737
public HoneycombButton(Context context, @Nullable AttributeSet attrs) {
3838
this(context, attrs, R.style.honeycombButtonTheme);
@@ -44,6 +44,7 @@ public HoneycombButton(Context context, @Nullable AttributeSet attrs, int defSty
4444
mButtonText = attributes.getString(R.styleable.HoneycombButton_honeycombButtonText);
4545
mButtonTextSize = attributes.getDimension(R.styleable.HoneycombButton_honeycombButtonTextSize, 0.0f);
4646
mButtonIcon = attributes.getDrawable(R.styleable.HoneycombButton_honeycombButtonIcon);
47+
mButtonIconHover = attributes.getBoolean(R.styleable.HoneycombButton_honeycombButtonIconHover, true);
4748

4849
String iconIdStr = attributes.getString(R.styleable.HoneycombButton_honeycombButtonIcon);
4950
int deviceTypeId = DeviceType.getType();
@@ -123,14 +124,18 @@ public void setOnHoverListener(final OnHoverListener l) {
123124
switch (motionEvent.getAction()) {
124125
case MotionEvent.ACTION_HOVER_ENTER:
125126
if (mIcon != null && mText != null) {
126-
mIcon.setColorFilter(new PorterDuffColorFilter(getResources().getColor(R.color.asphalt, getContext().getTheme()), PorterDuff.Mode.MULTIPLY));
127+
if (mButtonIconHover) {
128+
mIcon.setColorFilter(new PorterDuffColorFilter(getResources().getColor(R.color.asphalt, getContext().getTheme()), PorterDuff.Mode.MULTIPLY));
129+
}
127130
mText.setTextColor(getContext().getColor(R.color.asphalt));
128131
mSecondaryText.setTextColor(getContext().getColor(R.color.asphalt));
129132
}
130133
break;
131134
case MotionEvent.ACTION_HOVER_EXIT:
132135
if (mIcon != null && mText != null) {
133-
mIcon.setColorFilter(new PorterDuffColorFilter(getResources().getColor(R.color.fog, getContext().getTheme()), PorterDuff.Mode.MULTIPLY));
136+
if (mButtonIconHover) {
137+
mIcon.setColorFilter(new PorterDuffColorFilter(getResources().getColor(R.color.fog, getContext().getTheme()), PorterDuff.Mode.MULTIPLY));
138+
}
134139
mText.setTextColor(getContext().getColor(R.color.fog));
135140
mSecondaryText.setTextColor(getContext().getColor(R.color.fog));
136141
}

app/src/main/res/layout/settings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@
152152
style="?attr/honeycombButtonStyle"
153153
app:honeycombButtonIcon="@drawable/ic_icon_settings_account"
154154
app:honeycombButtonText="@string/settings_fxa_account_sign_in"
155-
app:honeycombButtonTextSize="@dimen/settings_main_button_text_width" />
155+
app:honeycombButtonTextSize="@dimen/settings_main_button_text_width"
156+
app:honeycombButtonIconHover="false"/>
156157

157158
</LinearLayout>
158159

app/src/main/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<attr name="honeycombButtonText" format="string" />
88
<attr name="honeycombButtonTextSize" format="dimension" />
99
<attr name="honeycombSecondaryText" format="string" />
10+
<attr name="honeycombButtonIconHover" format="boolean" />
1011
</declare-styleable>
1112

1213
<declare-styleable name="HoneycombSwitch">

0 commit comments

Comments
 (0)