diff options
8 files changed, 95 insertions, 23 deletions
diff --git a/packages/SystemUI/res/drawable/udfps_enroll_checkmark.xml b/packages/SystemUI/res/drawable/udfps_enroll_checkmark.xml index f8169d377f12..a3ed3d1f6b79 100644 --- a/packages/SystemUI/res/drawable/udfps_enroll_checkmark.xml +++ b/packages/SystemUI/res/drawable/udfps_enroll_checkmark.xml @@ -26,10 +26,10 @@ android:fillType="evenOdd"/> <path android:pathData="M27,0C12.088,0 0,12.088 0,27C0,41.912 12.088,54 27,54C41.912,54 54,41.912 54,27C54,12.088 41.912,0 27,0ZM27,3.962C39.703,3.962 50.037,14.297 50.037,27C50.037,39.703 39.703,50.038 27,50.038C14.297,50.038 3.963,39.703 3.963,27C3.963,14.297 14.297,3.962 27,3.962Z" - android:fillColor="@color/udfps_enroll_progress" + android:fillColor="?attr/biometricsEnrollProgress" android:fillType="evenOdd"/> <path android:pathData="M23.0899,38.8534L10.4199,26.1824L13.2479,23.3544L23.0899,33.1974L41.2389,15.0474L44.0679,17.8754L23.0899,38.8534Z" - android:fillColor="@color/udfps_enroll_progress" + android:fillColor="?attr/biometricsEnrollProgress" android:fillType="evenOdd"/> </vector> diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml index dc2bee56373c..e44155f472ea 100644 --- a/packages/SystemUI/res/values-night/colors.xml +++ b/packages/SystemUI/res/values-night/colors.xml @@ -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> @@ -101,4 +98,13 @@ <color name="accessibility_floating_menu_background">#B3000000</color> <!-- 70% --> <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> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index df0659d67afe..f46266b339d1 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -204,5 +204,15 @@ <attr name="passwordTextAppearance" format="reference" /> <attr name="errorTextAppearance" 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> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 75baeeff6025..4ce0852901ff 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -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 --> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index e76887babc50..ff29039a962f 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -308,6 +308,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"> @@ -1274,4 +1278,13 @@ <item name="android:textColor">?androidprv:attr/textColorOnAccent</item> <item name="android:textSize">@dimen/broadcast_dialog_btn_text_size</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> diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollDrawable.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollDrawable.java index 1e359584ceec..3e1c4e543779 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollDrawable.java @@ -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; } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollProgressBarDrawable.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollProgressBarDrawable.java index 49e378e4a76f..97d202c5c738 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollProgressBarDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollProgressBarDrawable.java @@ -18,6 +18,7 @@ package com.android.systemui.biometrics; import android.animation.ValueAnimator; import android.content.Context; +import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; @@ -26,6 +27,7 @@ import android.os.Process; import android.os.VibrationAttributes; import android.os.VibrationEffect; import android.os.Vibrator; +import android.util.AttributeSet; import android.view.accessibility.AccessibilityManager; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; @@ -93,17 +95,25 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { @Nullable private ValueAnimator mCheckmarkAnimator; @NonNull private final ValueAnimator.AnimatorUpdateListener mCheckmarkUpdateListener; - public UdfpsEnrollProgressBarDrawable(@NonNull Context context) { + private int mMovingTargetFill; + private int mMovingTargetFillError; + private int mEnrollProgress; + private int mEnrollProgressHelp; + private int mEnrollProgressHelpWithTalkback; + + public UdfpsEnrollProgressBarDrawable(@NonNull Context context, @Nullable AttributeSet attrs) { mContext = context; + + loadResources(context, attrs); mStrokeWidthPx = Utils.dpToPixels(context, STROKE_WIDTH_DP); - mProgressColor = context.getColor(R.color.udfps_enroll_progress); + mProgressColor = mEnrollProgress; final AccessibilityManager am = context.getSystemService(AccessibilityManager.class); mIsAccessibilityEnabled = am.isTouchExplorationEnabled(); if (!mIsAccessibilityEnabled) { - mHelpColor = context.getColor(R.color.udfps_enroll_progress_help); - mOnFirstBucketFailedColor = context.getColor(R.color.udfps_moving_target_fill_error); + mHelpColor = mEnrollProgressHelp; + mOnFirstBucketFailedColor = mMovingTargetFillError; } else { - mHelpColor = context.getColor(R.color.udfps_enroll_progress_help_with_talkback); + mHelpColor = mEnrollProgressHelpWithTalkback; mOnFirstBucketFailedColor = mHelpColor; } mCheckmarkDrawable = context.getDrawable(R.drawable.udfps_enroll_checkmark); @@ -112,7 +122,7 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { mBackgroundPaint = new Paint(); mBackgroundPaint.setStrokeWidth(mStrokeWidthPx); - mBackgroundPaint.setColor(context.getColor(R.color.udfps_moving_target_fill)); + mBackgroundPaint.setColor(mMovingTargetFill); mBackgroundPaint.setAntiAlias(true); mBackgroundPaint.setStyle(Paint.Style.STROKE); mBackgroundPaint.setStrokeCap(Paint.Cap.ROUND); @@ -148,6 +158,23 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { }; } + void loadResources(Context context, @Nullable AttributeSet attrs) { + final TypedArray ta = context.obtainStyledAttributes(attrs, + R.styleable.BiometricsEnrollView, R.attr.biometricsEnrollStyle, + R.style.BiometricsEnrollStyle); + mMovingTargetFill = ta.getColor( + R.styleable.BiometricsEnrollView_biometricsMovingTargetFill, 0); + mMovingTargetFillError = ta.getColor( + R.styleable.BiometricsEnrollView_biometricsMovingTargetFillError, 0); + mEnrollProgress = ta.getColor( + R.styleable.BiometricsEnrollView_biometricsEnrollProgress, 0); + mEnrollProgressHelp = ta.getColor( + R.styleable.BiometricsEnrollView_biometricsEnrollProgressHelp, 0); + mEnrollProgressHelpWithTalkback = ta.getColor( + R.styleable.BiometricsEnrollView_biometricsEnrollProgressHelpWithTalkback, 0); + ta.recycle(); + } + void onEnrollmentProgress(int remaining, int totalSteps) { mAfterFirstTouch = true; updateState(remaining, totalSteps, false /* showingHelp */); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollView.java index 69c37b2b9a62..e5c485547382 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollView.java @@ -43,8 +43,8 @@ public class UdfpsEnrollView extends UdfpsAnimationView { public UdfpsEnrollView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); - mFingerprintDrawable = new UdfpsEnrollDrawable(mContext); - mFingerprintProgressDrawable = new UdfpsEnrollProgressBarDrawable(context); + mFingerprintDrawable = new UdfpsEnrollDrawable(mContext, attrs); + mFingerprintProgressDrawable = new UdfpsEnrollProgressBarDrawable(context, attrs); mHandler = new Handler(Looper.getMainLooper()); } |