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

Commit f3b26292 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Let scanning progress loop

Bug: 111414690
Test: visual
Change-Id: Ic4e6e1198acaf8666bb944ae6244243f8f02f7c5
parent c7f498fe
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
@@ -134,6 +135,16 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange

            if (animation != null && isAnim) {
                animation.forceAnimationOnUI();
                animation.clearAnimationCallbacks();
                animation.registerAnimationCallback(new Animatable2.AnimationCallback() {
                    @Override
                    public void onAnimationEnd(Drawable drawable) {
                        if (getDrawable() == animation && state == getState()
                                && doesAnimationLoop(iconAnimRes)) {
                            animation.start();
                        }
                    }
                });
                animation.start();
            }

@@ -215,6 +226,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        return mContext.getDrawable(iconRes);
    }

    private boolean doesAnimationLoop(int resourceId) {
        return resourceId == com.android.internal.R.anim.lock_scanning;
    }

    private static int getAnimationResForTransition(int oldState, int newState,
            boolean wasPulsing, boolean pulsing,
            boolean wasDozing, boolean dozing) {