Merge "Revert "Revert "Update animation for fingerprint edu page""" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c0cca5c474
56
res/layout/sfps_enroll_find_sensor_layout.xml
Normal file
56
res/layout/sfps_enroll_find_sensor_layout.xml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2021 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.google.android.setupdesign.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/setup_wizard_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
style="?attr/fingerprint_layout_theme">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
style="@style/SudContentFrame"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:clipChildren="false">
|
||||||
|
|
||||||
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
android:id="@+id/illustration_lottie"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
app:lottie_imageAssetsFolder="images"
|
||||||
|
app:lottie_autoPlay="true"
|
||||||
|
app:lottie_loop="true"
|
||||||
|
app:lottie_rawRes="@raw/fingerprint_edu_lottie"/>
|
||||||
|
|
||||||
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
android:id="@+id/illustration_lottie_portrait"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:lottie_imageAssetsFolder="images"
|
||||||
|
app:lottie_autoPlay="true"
|
||||||
|
app:lottie_loop="true"
|
||||||
|
app:lottie_rawRes="@raw/fingerprint_edu_lottie_portrait"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</com.google.android.setupdesign.GlifLayout>
|
0
res/raw/fingerprint_edu_lottie.json
Normal file
0
res/raw/fingerprint_edu_lottie.json
Normal file
0
res/raw/fingerprint_edu_lottie_portrait.json
Normal file
0
res/raw/fingerprint_edu_lottie_portrait.json
Normal file
@@ -21,13 +21,14 @@ import android.content.Intent;
|
|||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.OrientationEventListener;
|
||||||
|
import android.view.Surface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.airbnb.lottie.LottieAnimationView;
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||||
@@ -35,6 +36,7 @@ import com.android.settings.biometrics.BiometricEnrollSidecar;
|
|||||||
import com.android.settings.biometrics.BiometricUtils;
|
import com.android.settings.biometrics.BiometricUtils;
|
||||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||||
|
|
||||||
|
import com.airbnb.lottie.LottieAnimationView;
|
||||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
import com.google.android.setupcompat.template.FooterButton;
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
|
|
||||||
@@ -52,6 +54,10 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
private FingerprintEnrollSidecar mSidecar;
|
private FingerprintEnrollSidecar mSidecar;
|
||||||
private boolean mNextClicked;
|
private boolean mNextClicked;
|
||||||
private boolean mCanAssumeUdfps;
|
private boolean mCanAssumeUdfps;
|
||||||
|
private boolean mCanAssumeSidefps;
|
||||||
|
|
||||||
|
private OrientationEventListener mOrientationEventListener;
|
||||||
|
private int mPreviousRotation = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -61,6 +67,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
final List<FingerprintSensorPropertiesInternal> props =
|
final List<FingerprintSensorPropertiesInternal> props =
|
||||||
fingerprintManager.getSensorPropertiesInternal();
|
fingerprintManager.getSensorPropertiesInternal();
|
||||||
mCanAssumeUdfps = props != null && props.size() == 1 && props.get(0).isAnyUdfpsType();
|
mCanAssumeUdfps = props != null && props.size() == 1 && props.get(0).isAnyUdfpsType();
|
||||||
|
mCanAssumeSidefps = props != null && props.size() == 1 && props.get(0).isAnySidefpsType();
|
||||||
setContentView(getContentView());
|
setContentView(getContentView());
|
||||||
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
|
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
|
||||||
mFooterBarMixin.setSecondaryButton(
|
mFooterBarMixin.setSecondaryButton(
|
||||||
@@ -72,6 +79,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
listenOrientationEvent();
|
||||||
|
|
||||||
if (mCanAssumeUdfps) {
|
if (mCanAssumeUdfps) {
|
||||||
setHeaderText(R.string.security_settings_udfps_enroll_find_sensor_title);
|
setHeaderText(R.string.security_settings_udfps_enroll_find_sensor_title);
|
||||||
setDescriptionText(R.string.security_settings_udfps_enroll_find_sensor_message);
|
setDescriptionText(R.string.security_settings_udfps_enroll_find_sensor_message);
|
||||||
@@ -90,6 +99,28 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
lottieAnimationView.setAnimation(R.raw.udfps_edu_a11y_lottie);
|
lottieAnimationView.setAnimation(R.raw.udfps_edu_a11y_lottie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (mCanAssumeSidefps) {
|
||||||
|
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
||||||
|
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
|
||||||
|
final LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie);
|
||||||
|
final LottieAnimationView lottieAnimationViewPortrait =
|
||||||
|
findViewById(R.id.illustration_lottie_portrait);
|
||||||
|
final int rotation = getApplicationContext().getDisplay().getRotation();
|
||||||
|
switch(rotation) {
|
||||||
|
case Surface.ROTATION_90:
|
||||||
|
lottieAnimationView.setVisibility(View.GONE);
|
||||||
|
lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
|
||||||
|
break;
|
||||||
|
case Surface.ROTATION_270:
|
||||||
|
lottieAnimationView.setVisibility(View.GONE);
|
||||||
|
lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
|
||||||
|
lottieAnimationViewPortrait.setRotation(180);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
lottieAnimationView.setVisibility(View.VISIBLE);
|
||||||
|
lottieAnimationViewPortrait.setVisibility(View.GONE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
||||||
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
|
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
|
||||||
@@ -145,6 +176,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
protected int getContentView() {
|
protected int getContentView() {
|
||||||
if (mCanAssumeUdfps) {
|
if (mCanAssumeUdfps) {
|
||||||
return R.layout.udfps_enroll_find_sensor_layout;
|
return R.layout.udfps_enroll_find_sensor_layout;
|
||||||
|
} else if (mCanAssumeSidefps) {
|
||||||
|
return R.layout.sfps_enroll_find_sensor_layout;
|
||||||
}
|
}
|
||||||
return R.layout.fingerprint_enroll_find_sensor;
|
return R.layout.fingerprint_enroll_find_sensor;
|
||||||
}
|
}
|
||||||
@@ -220,6 +253,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
stopListenOrientationEvent();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
if (mAnimation != null) {
|
if (mAnimation != null) {
|
||||||
mAnimation.stopAnimation();
|
mAnimation.stopAnimation();
|
||||||
@@ -297,4 +331,37 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.FINGERPRINT_FIND_SENSOR;
|
return SettingsEnums.FINGERPRINT_FIND_SENSOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void listenOrientationEvent() {
|
||||||
|
if (!mCanAssumeSidefps) {
|
||||||
|
// Do nothing if the device doesn't support SideFPS.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mOrientationEventListener = new OrientationEventListener(this) {
|
||||||
|
@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)) {
|
||||||
|
mPreviousRotation = currentRotation;
|
||||||
|
recreate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mOrientationEventListener.enable();
|
||||||
|
mPreviousRotation = getDisplay().getRotation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopListenOrientationEvent() {
|
||||||
|
if (!mCanAssumeSidefps) {
|
||||||
|
// Do nothing if the device doesn't support SideFPS.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mOrientationEventListener != null) {
|
||||||
|
mOrientationEventListener.disable();
|
||||||
|
}
|
||||||
|
mOrientationEventListener = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user