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

Commit bcb41d37 authored by Chandru S's avatar Chandru S
Browse files

Update pin hinting dot and pin shape (blobby) color

Bug: 394136959
Flag: com.android.systemui.bouncer_ui_revamp_2
Test: verified manually
Change-Id: Ie30b3fe34fd34de2d7826638ae0ca90cc850426d
parent 6c118a5b
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import android.widget.LinearLayout;

import androidx.core.graphics.drawable.DrawableCompat;

import com.android.systemui.Flags;
import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color;
import com.android.systemui.res.R;

/**
@@ -38,6 +40,7 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput {

    private int mPinLength;
    private int mDotDiameter;
    @Deprecated
    private int mColor = getContext().getColor(PIN_SHAPES);
    private int mPosition = 0;
    private static final int DEFAULT_PIN_LENGTH = 6;
@@ -56,7 +59,7 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput {
            pinDot.setImageResource(R.drawable.pin_dot_avd);
            if (pinDot.getDrawable() != null) {
                Drawable drawable = DrawableCompat.wrap(pinDot.getDrawable());
                DrawableCompat.setTint(drawable, mColor);
                DrawableCompat.setTint(drawable, getPinHintDotColor());
            }
            addView(pinDot);
        }
@@ -67,7 +70,8 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput {
        if (mPosition == DEFAULT_PIN_LENGTH) {
            return;
        }
        setAnimatedDrawable(mPosition, mPinShapeAdapter.getShape(mPosition));
        setAnimatedDrawable((ImageView) getChildAt(mPosition), mPinShapeAdapter.getShape(mPosition),
                getPinShapeColor());
        mPosition++;
    }

@@ -77,7 +81,8 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput {
            return;
        }
        mPosition--;
        setAnimatedDrawable(mPosition, R.drawable.pin_dot_delete_avd);
        setAnimatedDrawable((ImageView) getChildAt(mPosition), R.drawable.pin_dot_delete_avd,
                getPinHintDotColor());
    }

    @Override
@@ -99,15 +104,32 @@ public class PinShapeHintingView extends LinearLayout implements PinShapeInput {
        return this;
    }

    private void setAnimatedDrawable(int position, int drawableResId) {
        ImageView pinDot = (ImageView) getChildAt(position);
    private static void setAnimatedDrawable(ImageView pinDot, int drawableResId,
            int drawableColor) {
        pinDot.setImageResource(drawableResId);
        if (pinDot.getDrawable() != null) {
            Drawable drawable = DrawableCompat.wrap(pinDot.getDrawable());
            DrawableCompat.setTint(drawable, mColor);
            DrawableCompat.setTint(drawable, drawableColor);
        }
        if (pinDot.getDrawable() instanceof AnimatedVectorDrawable) {
            ((AnimatedVectorDrawable) pinDot.getDrawable()).start();
        }
    }

    private int getPinHintDotColor() {
        if (Flags.bouncerUiRevamp2()) {
            return mContext.getColor(Color.hintDot);
        } else {
            return mColor;
        }
    }

    private int getPinShapeColor() {
        if (Flags.bouncerUiRevamp2()) {
            return mContext.getColor(Color.shape);
        } else {
            return mColor;
        }
    }

}
+12 −1
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import android.widget.LinearLayout;
import androidx.core.graphics.drawable.DrawableCompat;

import com.android.app.animation.Interpolators;
import com.android.systemui.Flags;
import com.android.systemui.bouncer.shared.constants.PinBouncerConstants.Color;
import com.android.systemui.res.R;

/**
@@ -48,6 +50,7 @@ import com.android.systemui.res.R;
public class PinShapeNonHintingView extends LinearLayout implements PinShapeInput {
    private static final int RESET_STAGGER_DELAY = 40;
    private static final int RESET_MAX_DELAY = 200;
    @Deprecated
    private int mColor = getContext().getColor(PIN_SHAPES);
    private int mPosition = 0;
    private boolean mIsAnimatingReset = false;
@@ -88,7 +91,7 @@ public class PinShapeNonHintingView extends LinearLayout implements PinShapeInpu
        pinDot.setImageResource(mPinShapeAdapter.getShape(mPosition));
        if (pinDot.getDrawable() != null) {
            Drawable wrappedDrawable = DrawableCompat.wrap(pinDot.getDrawable());
            DrawableCompat.setTint(wrappedDrawable, mColor);
            DrawableCompat.setTint(wrappedDrawable, getPinShapeColor());
        }
        if (pinDot.getDrawable() instanceof AnimatedVectorDrawable) {
            ((AnimatedVectorDrawable) pinDot.getDrawable()).start();
@@ -216,4 +219,12 @@ public class PinShapeNonHintingView extends LinearLayout implements PinShapeInpu
            return animator;
        }
    }

    private int getPinShapeColor() {
        if (Flags.bouncerUiRevamp2()) {
            return mContext.getColor(Color.shape);
        } else {
            return mColor;
        }
    }
}
+27 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.bouncer.shared.constants

import com.android.internal.R.color as colors

object KeyguardBouncerConstants {
    /**
     * Values for the bouncer expansion represented as the panel expansion. Panel expansion 1f =
@@ -33,15 +35,40 @@ object KeyguardBouncerConstants {
    const val DEFAULT_PIN_LENGTH = 6

    object ColorId {
        private const val DEPRECATION_MSG =
            "Colors will not be used after bouncerUiRevamp2 flag is launched"

        @Deprecated(DEPRECATION_MSG)
        const val TITLE = com.android.internal.R.color.materialColorOnSurface

        @Deprecated(DEPRECATION_MSG)
        const val PIN_SHAPES = com.android.internal.R.color.materialColorOnSurfaceVariant

        @Deprecated(DEPRECATION_MSG)
        const val NUM_PAD_BACKGROUND =
            com.android.internal.R.color.materialColorSurfaceContainerHigh

        @Deprecated(DEPRECATION_MSG)
        const val NUM_PAD_BACKGROUND_PRESSED =
            com.android.internal.R.color.materialColorPrimaryFixed

        @Deprecated(DEPRECATION_MSG)
        const val NUM_PAD_PRESSED = com.android.internal.R.color.materialColorOnPrimaryFixed

        @Deprecated(DEPRECATION_MSG)
        const val NUM_PAD_KEY = com.android.internal.R.color.materialColorOnSurface

        @Deprecated(DEPRECATION_MSG)
        const val NUM_PAD_BUTTON = com.android.internal.R.color.materialColorOnSecondaryFixed

        @Deprecated(DEPRECATION_MSG)
        const val EMERGENCY_BUTTON = com.android.internal.R.color.materialColorTertiaryFixed
    }
}

object PinBouncerConstants {
    object Color {
        @JvmField val hintDot = colors.materialColorOnSurfaceVariant
        @JvmField val shape = colors.materialColorPrimary
    }
}