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

Commit 44639252 authored by Jason Chang's avatar Jason Chang
Browse files

Update the fingerprint enrollment color when

device dark/light theme color changes

To change the fingerprint enrollment page color accordingly when
device dark/light theme color changes

Bug: 250037527

Test: manual
Test: atest SystemUITests

Change-Id: I4e85bfca6cc7e0679571f0afe006fb52c145e26e
(cherry picked from commit 1478326b)
parent ebca044d
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -78,9 +78,6 @@
    <color name="biometric_dialog_accent">@color/material_dynamic_primary70</color>
    <color name="biometric_dialog_error">#fff28b82</color> <!-- red 300 -->

    <!-- UDFPS colors -->
    <color name="udfps_enroll_icon">#7DA7F1</color>

    <color name="GM2_green_500">#FF41Af6A</color>
    <color name="GM2_blue_500">#5195EA</color>
    <color name="GM2_red_500">#E25142</color>
@@ -103,4 +100,13 @@
    <color name="accessibility_floating_menu_message_text">@*android:color/primary_text_default_material_dark</color>

    <color name="people_tile_background">@color/material_dynamic_secondary20</color>

    <!-- UDFPS colors -->
    <color name="udfps_enroll_icon">#7DA7F1</color>
    <color name="udfps_moving_target_fill">#475670</color>
    <!-- 50% of udfps_moving_target_fill-->
    <color name="udfps_moving_target_fill_error">#80475670</color>
    <color name="udfps_enroll_progress">#7DA7F1</color>
    <color name="udfps_enroll_progress_help">#607DA7F1</color>
    <color name="udfps_enroll_progress_help_with_talkback">#FFEE675C</color>
</resources>
+10 −0
Original line number Diff line number Diff line
@@ -209,5 +209,15 @@
        <attr name="permissionGrantButtonTopStyle" format="reference"/>
        <attr name="permissionGrantButtonBottomStyle" format="reference"/>
    </declare-styleable>

    <declare-styleable name="BiometricsEnrollView">
        <attr name="biometricsEnrollStyle" format="reference" />
        <attr name="biometricsEnrollIcon" format="reference|color" />
        <attr name="biometricsMovingTargetFill" format="reference|color" />
        <attr name="biometricsMovingTargetFillError" format="reference|color" />
        <attr name="biometricsEnrollProgress" format="reference|color" />
        <attr name="biometricsEnrollProgressHelp" format="reference|color" />
        <attr name="biometricsEnrollProgressHelpWithTalkback" format="reference|color" />
    </declare-styleable>
</resources>
+5 −5
Original line number Diff line number Diff line
@@ -134,12 +134,12 @@
    <color name="biometric_dialog_error">#ffd93025</color>                  <!-- red 600 -->

    <!-- UDFPS colors -->
    <color name="udfps_enroll_icon">#7DA7F1</color>
    <color name="udfps_moving_target_fill">#475670</color>
    <color name="udfps_enroll_icon">#699FF3</color>
    <color name="udfps_moving_target_fill">#C2D7F7</color>
    <!-- 50% of udfps_moving_target_fill-->
    <color name="udfps_moving_target_fill_error">#80475670</color>
    <color name="udfps_enroll_progress">#7DA7F1</color>
    <color name="udfps_enroll_progress_help">#607DA7F1</color>
    <color name="udfps_moving_target_fill_error">#80C2D7F7</color>
    <color name="udfps_enroll_progress">#699FF3</color>
    <color name="udfps_enroll_progress_help">#70699FF3</color>
    <color name="udfps_enroll_progress_help_with_talkback">#FFEE675C</color>

    <!-- Floating overlay actions -->
+13 −1
Original line number Diff line number Diff line
@@ -314,6 +314,10 @@

        <!-- Needed for MediaRoute chooser dialog -->
        <item name="*android:isLightTheme">false</item>

        <!-- Biometrics enroll color style -->
        <item name="biometricsEnrollStyle">@style/BiometricsEnrollStyle</item>

    </style>

    <style name="Theme.SystemUI.LightWallpaper">
@@ -1281,7 +1285,6 @@
        <item name="android:textSize">@dimen/broadcast_dialog_btn_text_size</item>
    </style>


    <!-- The style for log access consent dialog -->
    <style name="LogAccessDialogTheme" parent="@style/Theme.SystemUI.Dialog.Alert">
        <item name="permissionGrantButtonTopStyle">@style/PermissionGrantButtonTop</item>
@@ -1321,4 +1324,13 @@
        <item name="android:layout_marginBottom">2dp</item>
        <item name="android:background">@drawable/grant_permissions_buttons_bottom</item>
    </style>

    <style name="BiometricsEnrollStyle">
        <item name="biometricsEnrollIcon">@color/udfps_enroll_icon</item>
        <item name="biometricsMovingTargetFill">@color/udfps_moving_target_fill</item>
        <item name="biometricsMovingTargetFillError">@color/udfps_moving_target_fill_error</item>
        <item name="biometricsEnrollProgress">@color/udfps_enroll_progress</item>
        <item name="biometricsEnrollProgressHelp">@color/udfps_enroll_progress_help</item>
        <item name="biometricsEnrollProgressHelpWithTalkback">@color/udfps_enroll_progress_help_with_talkback</item>
    </style>
</resources>
+21 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
@@ -28,6 +29,7 @@ import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.animation.AccelerateDecelerateInterpolator;

import androidx.annotation.NonNull;
@@ -68,25 +70,29 @@ public class UdfpsEnrollDrawable extends UdfpsDrawable {
    private boolean mShouldShowTipHint = false;
    private boolean mShouldShowEdgeHint = false;

    UdfpsEnrollDrawable(@NonNull Context context) {
    private int mEnrollIcon;
    private int mMovingTargetFill;

    UdfpsEnrollDrawable(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context);

        loadResources(context, attrs);
        mSensorOutlinePaint = new Paint(0 /* flags */);
        mSensorOutlinePaint.setAntiAlias(true);
        mSensorOutlinePaint.setColor(context.getColor(R.color.udfps_moving_target_fill));
        mSensorOutlinePaint.setColor(mMovingTargetFill);
        mSensorOutlinePaint.setStyle(Paint.Style.FILL);

        mBlueFill = new Paint(0 /* flags */);
        mBlueFill.setAntiAlias(true);
        mBlueFill.setColor(context.getColor(R.color.udfps_moving_target_fill));
        mBlueFill.setColor(mMovingTargetFill);
        mBlueFill.setStyle(Paint.Style.FILL);

        mMovingTargetFpIcon = context.getResources()
                .getDrawable(R.drawable.ic_kg_fingerprint, null);
        mMovingTargetFpIcon.setTint(context.getColor(R.color.udfps_enroll_icon));
        mMovingTargetFpIcon.setTint(mEnrollIcon);
        mMovingTargetFpIcon.mutate();

        getFingerprintDrawable().setTint(context.getColor(R.color.udfps_enroll_icon));
        getFingerprintDrawable().setTint(mEnrollIcon);

        mTargetAnimListener = new Animator.AnimatorListener() {
            @Override
@@ -105,6 +111,16 @@ public class UdfpsEnrollDrawable extends UdfpsDrawable {
        };
    }

    void loadResources(Context context, @Nullable AttributeSet attrs) {
        final TypedArray ta = context.obtainStyledAttributes(attrs,
                R.styleable.BiometricsEnrollView, R.attr.biometricsEnrollStyle,
                R.style.BiometricsEnrollStyle);
        mEnrollIcon = ta.getColor(R.styleable.BiometricsEnrollView_biometricsEnrollIcon, 0);
        mMovingTargetFill = ta.getColor(
                R.styleable.BiometricsEnrollView_biometricsMovingTargetFill, 0);
        ta.recycle();
    }

    void setEnrollHelper(@NonNull UdfpsEnrollHelper helper) {
        mEnrollHelper = helper;
    }
Loading