Update help animation per new spec
Bug: 288155127
Bug: 305834550
Test: manually
Change-Id: I0731d65bbcbefa30c25b53e625d07b4e5771c78d
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index 063d55d..3257e36 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -53,7 +53,6 @@
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
-import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.ProgressBar;
@@ -190,7 +189,7 @@
private boolean mHaveShownSfpsRightEdgeLottie;
private boolean mShouldShowLottie;
- private ObjectAnimator mHelpAnimation;
+ private Animator mHelpAnimation;
private OrientationEventListener mOrientationEventListener;
private int mPreviousRotation = 0;
@@ -332,16 +331,10 @@
}
private void setHelpAnimation() {
- final float translationX = 40;
- final int duration = 550;
final RelativeLayout progressLottieLayout = findViewById(R.id.progress_lottie);
- mHelpAnimation = ObjectAnimator.ofFloat(progressLottieLayout,
- "translationX" /* propertyName */,
- 0, translationX, -1 * translationX, translationX, 0f);
- mHelpAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
- mHelpAnimation.setDuration(duration);
- mHelpAnimation.setAutoCancel(false);
+ mHelpAnimation = mSfpsEnrollmentFeature.getHelpAnimator(progressLottieLayout);
}
+
@Override
protected BiometricEnrollSidecar getSidecar() {
final FingerprintEnrollSidecar sidecar = new FingerprintEnrollSidecar(this,
@@ -689,6 +682,9 @@
view.setComposition(composition);
view.setVisibility(View.VISIBLE);
view.playAnimation();
+ if (mCanAssumeSfps) {
+ mSfpsEnrollmentFeature.handleOnEnrollmentLottieComposition(view);
+ }
}
@EnrollStage
@@ -1212,5 +1208,10 @@
public float getEnrollStageThreshold(@NonNull Context context, int index) {
throw new IllegalStateException(exceptionStr);
}
+
+ @Override
+ public Animator getHelpAnimator(@NonNull View target) {
+ throw new IllegalStateException(exceptionStr);
+ }
}
}
diff --git a/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeature.java b/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeature.java
index a1a18e5..f99d394 100644
--- a/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeature.java
+++ b/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeature.java
@@ -16,12 +16,16 @@
package com.android.settings.biometrics.fingerprint.feature;
+import android.animation.Animator;
import android.content.Context;
+import android.view.View;
import androidx.annotation.NonNull;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling;
+import com.airbnb.lottie.LottieAnimationView;
+
import java.util.function.Function;
import java.util.function.Supplier;
@@ -76,4 +80,17 @@
* @return threshold
*/
float getEnrollStageThreshold(@NonNull Context context, int index);
+
+ /**
+ * Gets the help animator used when get help message.
+ * @param target the target view to animate
+ * @return animator
+ */
+ Animator getHelpAnimator(@NonNull View target);
+
+ /**
+ * Handles extra stuffs on lottie composition.
+ * @param lottieView the view related to the lottie
+ */
+ default void handleOnEnrollmentLottieComposition(LottieAnimationView lottieView) {}
}
diff --git a/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeatureImpl.java b/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeatureImpl.java
index 5a97537..abc31c9 100644
--- a/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeatureImpl.java
+++ b/src/com/android/settings/biometrics/fingerprint/feature/SfpsEnrollmentFeatureImpl.java
@@ -23,8 +23,12 @@
import static com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling.SFPS_STAGE_RIGHT_EDGE;
import static com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling.STAGE_UNKNOWN;
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
+import android.view.View;
+import android.view.animation.AccelerateInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -88,4 +92,17 @@
}
return mFingerprintManager.getEnrollStageThreshold(index);
}
+
+ @Override
+ public Animator getHelpAnimator(@NonNull View target) {
+ final float translationX = 40;
+ final int duration = 550;
+ final ObjectAnimator help = ObjectAnimator.ofFloat(target,
+ "translationX" /* propertyName */,
+ 0, translationX, -1 * translationX, translationX, 0f);
+ help.setInterpolator(new AccelerateInterpolator());
+ help.setDuration(duration);
+ help.setAutoCancel(false);
+ return help;
+ }
}