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

Commit b75b6039 authored by Grace Cheng's avatar Grace Cheng Committed by Automerger Merge Worker
Browse files

Merge "Isolate & fix animation logic for BP icon/overlay" into tm-qpr-dev am:...

Merge "Isolate & fix animation logic for BP icon/overlay" into tm-qpr-dev am: cbb432e3 am: 8b7ecdc8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20976959



Change-Id: If893b786444337ae1858b146ea4d9307b33afd8f
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0148a41e 8b7ecdc8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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
+20 −5
Original line number Diff line number Diff line
@@ -104,12 +104,14 @@ open class AuthBiometricFingerprintIconController(

        iconView.frame = 0
        iconViewOverlay.frame = 0
        if (shouldAnimateForTransition(lastState, newState)) {
        if (shouldAnimateIconViewForTransition(lastState, newState)) {
            iconView.playAnimation()
        }

        if (shouldAnimateIconViewOverlayForTransition(lastState, newState)) {
            iconViewOverlay.playAnimation()
        } else if (lastState == STATE_IDLE && newState == STATE_AUTHENTICATING_ANIMATING_IN) {
            iconView.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) {