Recreate fingerprint setup if degree 0 to 180

Recreate animation on fingerprint setup page when screen orientation is
changed from 0 to 180, or 180 to 0.

Bug: 232187001
Test: Manually rotate screen for 4 orientation, and make sure animation
      orientation is correct
Change-Id: I75687bc8500cf5a48be6da6ef4245b12b63e774e
This commit is contained in:
Milton Wu
2022-05-11 16:10:20 +08:00
parent d375456251
commit 23b95b4147

View File

@@ -111,6 +111,11 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
lottieAnimationView.setVisibility(View.GONE);
lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
break;
case Surface.ROTATION_180:
lottieAnimationView.setVisibility(View.VISIBLE);
lottieAnimationView.setRotation(180);
lottieAnimationViewPortrait.setVisibility(View.GONE);
break;
case Surface.ROTATION_270:
lottieAnimationView.setVisibility(View.GONE);
lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
@@ -342,10 +347,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
@Override
public void onOrientationChanged(int orientation) {
final int currentRotation = getDisplay().getRotation();
if ((mPreviousRotation == Surface.ROTATION_90
&& currentRotation == Surface.ROTATION_270) || (
mPreviousRotation == Surface.ROTATION_270
&& currentRotation == Surface.ROTATION_90)) {
if ((currentRotation + 2) % 4 == mPreviousRotation) {
mPreviousRotation = currentRotation;
recreate();
}