From 09923d5eca02486324b55c9f28562d17418fc577 Mon Sep 17 00:00:00 2001 From: Beverly Date: Wed, 14 Jul 2021 16:01:50 -0400 Subject: [PATCH] Animate in a background for kg unlock icon - to indicate it is tappable - update background drawable on color change to update color Test: manual Fixes: 192403524 Change-Id: I34255e3f7cc7b1dfc246c4e2441822129abdf819 --- .../SystemUI/res/drawable/fingerprint_bg.xml | 3 +- .../res/layout/status_bar_expanded.xml | 20 +++- .../com/android/keyguard/LockIconView.java | 96 ++++++++++++++++++- .../keyguard/LockIconViewController.java | 12 +-- .../biometrics/UdfpsKeyguardView.java | 5 + 5 files changed, 124 insertions(+), 12 deletions(-) diff --git a/packages/SystemUI/res/drawable/fingerprint_bg.xml b/packages/SystemUI/res/drawable/fingerprint_bg.xml index 2b0ab6f9a8d24..558ec08b2ceb9 100644 --- a/packages/SystemUI/res/drawable/fingerprint_bg.xml +++ b/packages/SystemUI/res/drawable/fingerprint_bg.xml @@ -14,10 +14,11 @@ --> + android:color="?androidprv:attr/colorSurface"/> + android:layout_gravity="center"> + + + + + mLockIcon.setImageTintList( + ColorStateList.valueOf((int) animation.getAnimatedValue()))); + lockIconColorAnimator.setDuration(150); + + if (mBgAnimator != null) { + if (mBgAnimator.isRunning()) { + return; + } + mBgAnimator.cancel(); + } + mBgAnimator = new AnimatorSet(); + mBgAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + mBgAnimator = null; + } + }); + mBgAnimator.playTogether( + bgAlphaAnimator, + scaleYAnimator, + scaleXAnimator, + lockIconColorAnimator); + mBgAnimator.setStartDelay(167); + mUnlockBgView.setAlpha(0f); + mUnlockBgView.setScaleX(0); + mUnlockBgView.setScaleY(0); + mUnlockBgView.setVisibility(View.VISIBLE); + + mBgAnimator.start(); + } + void setCenterLocation(@NonNull PointF center, int radius) { mLockIconCenter = center; mRadius = radius; @@ -70,7 +163,6 @@ public class LockIconView extends ImageView implements Dumpable { return mLockIconCenter.y - mRadius; } - @Override public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) { pw.println("Center in px (x, y)= (" + mLockIconCenter.x + ", " + mLockIconCenter.y + ")"); diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index afea27222fbbd..a7bd4c8e3d273 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -40,7 +40,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; -import com.android.settingslib.Utils; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.biometrics.AuthController; @@ -145,6 +144,7 @@ public class LockIconViewController extends ViewController impleme mUnlockedLabel = context.getResources().getString(R.string.accessibility_unlock_button); mLockedLabel = context.getResources().getString(R.string.accessibility_lock_icon); dumpManager.registerDumpable("LockIconViewController", this); + } @Override @@ -224,6 +224,7 @@ public class LockIconViewController extends ViewController impleme mView.setImageDrawable(mLockIcon); mView.setVisibility(View.VISIBLE); mView.setContentDescription(mLockedLabel); + mView.hideBg(); } else if (mShowUnlockIcon) { if (wasShowingFpIcon) { mView.setImageDrawable(mFpToUnlockIcon); @@ -234,9 +235,11 @@ public class LockIconViewController extends ViewController impleme mLockToUnlockIcon.forceAnimationOnUI(); mLockToUnlockIcon.start(); } + mView.animateBg(); mView.setVisibility(View.VISIBLE); mView.setContentDescription(mUnlockedLabel); } else { + mView.hideBg(); mView.setVisibility(View.INVISIBLE); mView.setContentDescription(null); } @@ -281,11 +284,7 @@ public class LockIconViewController extends ViewController impleme } private void updateColors() { - final int color = Utils.getColorAttrDefaultColor(mView.getContext(), - R.attr.wallpaperTextColorAccent); - mFpToUnlockIcon.setTint(color); - mLockToUnlockIcon.setTint(color); - mLockIcon.setTint(color); + mView.updateColor(); } private void updateConfiguration() { @@ -445,6 +444,7 @@ public class LockIconViewController extends ViewController impleme @Override public void onConfigChanged(Configuration newConfig) { updateConfiguration(); + updateColors(); } }; diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java index 131618442c22c..eb02aa0d9cdfe 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java @@ -162,7 +162,12 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { } void updateColor() { + mWallpaperTextColor = Utils.getColorAttrDefaultColor(mContext, + R.attr.wallpaperTextColorAccent); + mTextColorPrimary = Utils.getColorAttrDefaultColor(mContext, + android.R.attr.textColorPrimary); mLockScreenFp.invalidate(); + mBgProtection.setBackground(getContext().getDrawable(R.drawable.fingerprint_bg)); } private boolean showingUdfpsBouncer() {