Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2df5cc80 authored by Jagrut Desai's avatar Jagrut Desai
Browse files

Inroducing ability to enable/disable hover scale for icon's dislay

Test: Manual, Presubmit
Bug: 284081291
Flag: EXEMPT bugfix
Change-Id: Iddea955e77c420982a97df3b5c6e9e4618ce970a
parent c40e2aa0
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {

    private Drawable mBadge;

    private boolean mHoverScaleEnabledForDisplay = true;

    public FastBitmapDrawable(Bitmap b) {
        this(b, Color.TRANSPARENT);
    }
@@ -254,7 +256,9 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
            if (s == android.R.attr.state_pressed) {
                isPressed = true;
                break;
            } else if (sFlagHoverEnabled && s == android.R.attr.state_hovered) {
            } else if (sFlagHoverEnabled
                    && s == android.R.attr.state_hovered
                    && mHoverScaleEnabledForDisplay) {
                isHovered = true;
                // Do not break on hovered state, as pressed state should take precedence.
            }
@@ -414,6 +418,10 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
        sFlagHoverEnabled = isFlagHoverEnabled;
    }

    public void setHoverScaleEnabledForDisplay(boolean hoverScaleEnabledForDisplay) {
        mHoverScaleEnabledForDisplay = hoverScaleEnabledForDisplay;
    }

    public static class FastBitmapConstantState extends ConstantState {
        protected final Bitmap mBitmap;
        protected final int mIconColor;