Merge "Isolate & fix animation logic for BP icon/overlay" into tm-qpr-dev am: cbb432e32c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20976959 Change-Id: I2efa5c6a960532e29044cd1fed806b6c2180cac7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -35,13 +35,13 @@ class AuthBiometricFingerprintAndFaceIconController(
|
||||
|
||||
override val actsAsConfirmButton: Boolean = true
|
||||
|
||||
override fun shouldAnimateForTransition(
|
||||
override fun shouldAnimateIconViewForTransition(
|
||||
@BiometricState oldState: Int,
|
||||
@BiometricState newState: Int
|
||||
): Boolean = when (newState) {
|
||||
STATE_PENDING_CONFIRMATION -> true
|
||||
STATE_AUTHENTICATED -> false
|
||||
else -> super.shouldAnimateForTransition(oldState, newState)
|
||||
else -> super.shouldAnimateIconViewForTransition(oldState, newState)
|
||||
}
|
||||
|
||||
@RawRes
|
||||
|
||||
@@ -104,12 +104,14 @@ open class AuthBiometricFingerprintIconController(
|
||||
|
||||
iconView.frame = 0
|
||||
iconViewOverlay.frame = 0
|
||||
if (shouldAnimateForTransition(lastState, newState)) {
|
||||
iconView.playAnimation()
|
||||
iconViewOverlay.playAnimation()
|
||||
} else if (lastState == STATE_IDLE && newState == STATE_AUTHENTICATING_ANIMATING_IN) {
|
||||
if (shouldAnimateIconViewForTransition(lastState, newState)) {
|
||||
iconView.playAnimation()
|
||||
}
|
||||
|
||||
if (shouldAnimateIconViewOverlayForTransition(lastState, newState)) {
|
||||
iconViewOverlay.playAnimation()
|
||||
}
|
||||
|
||||
LottieColorUtils.applyDynamicColors(context, iconView)
|
||||
LottieColorUtils.applyDynamicColors(context, iconViewOverlay)
|
||||
}
|
||||
@@ -127,7 +129,7 @@ open class AuthBiometricFingerprintIconController(
|
||||
}
|
||||
|
||||
iconView.frame = 0
|
||||
if (shouldAnimateForTransition(lastState, newState)) {
|
||||
if (shouldAnimateIconViewForTransition(lastState, newState)) {
|
||||
iconView.playAnimation()
|
||||
}
|
||||
LottieColorUtils.applyDynamicColors(context, iconView)
|
||||
@@ -160,7 +162,20 @@ open class AuthBiometricFingerprintIconController(
|
||||
return if (id != null) context.getString(id) else null
|
||||
}
|
||||
|
||||
protected open fun shouldAnimateForTransition(
|
||||
protected open fun shouldAnimateIconViewForTransition(
|
||||
@BiometricState oldState: Int,
|
||||
@BiometricState newState: Int
|
||||
) = when (newState) {
|
||||
STATE_HELP,
|
||||
STATE_ERROR -> true
|
||||
STATE_AUTHENTICATING_ANIMATING_IN,
|
||||
STATE_AUTHENTICATING ->
|
||||
oldState == STATE_ERROR || oldState == STATE_HELP || oldState == STATE_IDLE
|
||||
STATE_AUTHENTICATED -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
protected open fun shouldAnimateIconViewOverlayForTransition(
|
||||
@BiometricState oldState: Int,
|
||||
@BiometricState newState: Int
|
||||
) = when (newState) {
|
||||
|
||||
Reference in New Issue
Block a user