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

Commit 8fd6862d authored by Jagrut Desai's avatar Jagrut Desai Committed by Android (Google) Code Review
Browse files

Merge "Inroducing ability to enable/disable hover scale for icon's dislay" into main

parents 66f97f4a 2df5cc80
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;