Merge "Fix face education UX for both grid and traffic light" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
147fa2f159
@@ -30,15 +30,18 @@
|
|||||||
|
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
<com.google.android.setupdesign.view.RichTextView
|
<com.google.android.setupdesign.view.RichTextView
|
||||||
style="@style/SudDescription.Glif"
|
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:paddingHorizontal="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_toStartOf="@+id/toggle"
|
android:layout_toStartOf="@+id/toggle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="@dimen/sud_description_text_size"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Subtitle -->
|
<!-- Subtitle -->
|
||||||
<TextView
|
<TextView
|
||||||
@@ -50,7 +53,8 @@
|
|||||||
android:layout_below="@+id/title"
|
android:layout_below="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"/>
|
android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"/>
|
||||||
|
|
||||||
<!-- Vertical divider -->
|
<!-- Vertical divider -->
|
||||||
<View
|
<View
|
||||||
|
@@ -21,7 +21,8 @@
|
|||||||
style="?attr/face_layout_theme"
|
style="?attr/face_layout_theme"
|
||||||
android:id="@+id/setup_wizard_layout"
|
android:id="@+id/setup_wizard_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:sucHeaderText="@string/security_settings_face_enroll_education_title">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
style="@style/SudContentFrame"
|
style="@style/SudContentFrame"
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="-32dp">
|
android:layout_marginTop="-24dp">
|
||||||
|
|
||||||
<com.google.android.setupdesign.view.IllustrationVideoView
|
<com.google.android.setupdesign.view.IllustrationVideoView
|
||||||
android:id="@+id/illustration_default"
|
android:id="@+id/illustration_default"
|
||||||
@@ -97,7 +98,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:messageText="@string/security_settings_face_enroll_introduction_accessibility_diversity"/>
|
app:messageText="@string/security_settings_face_enroll_introduction_accessibility"/>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
@@ -16,20 +16,17 @@
|
|||||||
|
|
||||||
package com.android.settings.biometrics.face;
|
package com.android.settings.biometrics.face;
|
||||||
|
|
||||||
import android.annotation.StringRes;
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
@@ -41,14 +38,10 @@ 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;
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
import com.google.android.setupdesign.GlifLayout;
|
|
||||||
import com.google.android.setupdesign.view.IllustrationVideoView;
|
import com.google.android.setupdesign.view.IllustrationVideoView;
|
||||||
|
|
||||||
public class FaceEnrollEducation extends BiometricEnrollBase {
|
public class FaceEnrollEducation extends BiometricEnrollBase {
|
||||||
|
|
||||||
private static final String TAG = "FaceEducation";
|
private static final String TAG = "FaceEducation";
|
||||||
private static final int ON = 1;
|
|
||||||
private static final int OFF = 0;
|
|
||||||
|
|
||||||
private FaceManager mFaceManager;
|
private FaceManager mFaceManager;
|
||||||
private FaceEnrollAccessibilityToggle mSwitchDiversity;
|
private FaceEnrollAccessibilityToggle mSwitchDiversity;
|
||||||
@@ -57,28 +50,18 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
private IllustrationVideoView mIllustrationDefault;
|
private IllustrationVideoView mIllustrationDefault;
|
||||||
private LottieAnimationView mIllustrationLottie;
|
private LottieAnimationView mIllustrationLottie;
|
||||||
private View mIllustrationAccessibility;
|
private View mIllustrationAccessibility;
|
||||||
private Handler mHandler;
|
|
||||||
private Intent mResultIntent;
|
private Intent mResultIntent;
|
||||||
private TextView mDescriptionText;
|
|
||||||
private boolean mNextClicked;
|
private boolean mNextClicked;
|
||||||
private boolean mAccessibilityEnabled;
|
private boolean mAccessibilityEnabled;
|
||||||
|
|
||||||
private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
|
private final CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
|
||||||
new CompoundButton.OnCheckedChangeListener() {
|
new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
final int headerRes;
|
final int descriptionRes = isChecked
|
||||||
final int descriptionRes;
|
? R.string.security_settings_face_enroll_education_message_accessibility
|
||||||
if (isChecked) {
|
: R.string.security_settings_face_enroll_education_message;
|
||||||
headerRes = R.string
|
setDescriptionText(descriptionRes);
|
||||||
.security_settings_face_enroll_education_title_accessibility;
|
|
||||||
descriptionRes = R.string
|
|
||||||
.security_settings_face_enroll_education_message_accessibility;
|
|
||||||
} else {
|
|
||||||
headerRes = R.string.security_settings_face_enroll_education_title;
|
|
||||||
descriptionRes = R.string.security_settings_face_enroll_education_message;
|
|
||||||
}
|
|
||||||
updateHeaders(headerRes, descriptionRes);
|
|
||||||
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
hideDefaultIllustration();
|
hideDefaultIllustration();
|
||||||
@@ -95,18 +78,14 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.face_enroll_education);
|
setContentView(R.layout.face_enroll_education);
|
||||||
|
|
||||||
final int headerRes = R.string.security_settings_face_enroll_education_title;
|
setTitle(R.string.security_settings_face_enroll_education_title);
|
||||||
final int descriptionRes = R.string.security_settings_face_enroll_education_message;
|
setDescriptionText(R.string.security_settings_face_enroll_education_message);
|
||||||
updateHeaders(headerRes, descriptionRes);
|
|
||||||
|
|
||||||
mHandler = new Handler();
|
|
||||||
|
|
||||||
mFaceManager = Utils.getFaceManagerOrNull(this);
|
mFaceManager = Utils.getFaceManagerOrNull(this);
|
||||||
|
|
||||||
mIllustrationDefault = findViewById(R.id.illustration_default);
|
mIllustrationDefault = findViewById(R.id.illustration_default);
|
||||||
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
||||||
mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
|
mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
|
||||||
mDescriptionText = findViewById(R.id.sud_layout_description);
|
|
||||||
|
|
||||||
mIsUsingLottie = getResources().getBoolean(R.bool.config_face_education_use_lottie);
|
mIsUsingLottie = getResources().getBoolean(R.bool.config_face_education_use_lottie);
|
||||||
if (mIsUsingLottie) {
|
if (mIsUsingLottie) {
|
||||||
@@ -259,15 +238,6 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
return SettingsEnums.FACE_ENROLL_INTRO;
|
return SettingsEnums.FACE_ENROLL_INTRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateHeaders(@StringRes int headerRes, @StringRes int descriptionRes) {
|
|
||||||
final CharSequence headerText = getText(headerRes);
|
|
||||||
setTitle(headerText);
|
|
||||||
|
|
||||||
final GlifLayout layout = getLayout();
|
|
||||||
layout.setHeaderText(headerText);
|
|
||||||
layout.setDescriptionText(descriptionRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideDefaultIllustration() {
|
private void hideDefaultIllustration() {
|
||||||
if (mIsUsingLottie) {
|
if (mIsUsingLottie) {
|
||||||
mIllustrationLottie.cancelAnimation();
|
mIllustrationLottie.cancelAnimation();
|
||||||
|
Reference in New Issue
Block a user