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

Commit 147fa2f1 authored by Curtis Belmonte's avatar Curtis Belmonte Committed by Android (Google) Code Review
Browse files

Merge "Fix face education UX for both grid and traffic light" into sc-dev

parents 7a6ff694 d3a07c29
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -30,15 +30,18 @@

    <!-- Title -->
    <com.google.android.setupdesign.view.RichTextView
        style="@style/SudDescription.Glif"
        android:id="@+id/title"
        android:paddingHorizontal="8dp"
        android:paddingTop="8dp"
        android:paddingBottom="4dp"
        android:gravity="start"
        android:layout_alignParentStart="true"
        android:layout_toStartOf="@+id/toggle"
        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 -->
    <TextView
@@ -50,7 +53,8 @@
        android:layout_below="@+id/title"
        android:layout_width="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 -->
    <View
+4 −3
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@
    style="?attr/face_layout_theme"
    android:id="@+id/setup_wizard_layout"
    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
        style="@style/SudContentFrame"
@@ -38,7 +39,7 @@
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="-32dp">
            android:layout_marginTop="-24dp">

            <com.google.android.setupdesign.view.IllustrationVideoView
                android:id="@+id/illustration_default"
@@ -97,7 +98,7 @@
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="gone"
                    app:messageText="@string/security_settings_face_enroll_introduction_accessibility_diversity"/>
                    app:messageText="@string/security_settings_face_enroll_introduction_accessibility"/>

            </FrameLayout>

+7 −37
Original line number Diff line number Diff line
@@ -16,20 +16,17 @@

package com.android.settings.biometrics.face;

import android.annotation.StringRes;
import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.content.Intent;
import android.hardware.face.FaceManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.text.TextUtils;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.TextView;

import com.android.settings.R;
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.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.GlifLayout;
import com.google.android.setupdesign.view.IllustrationVideoView;

public class FaceEnrollEducation extends BiometricEnrollBase {

    private static final String TAG = "FaceEducation";
    private static final int ON = 1;
    private static final int OFF = 0;

    private FaceManager mFaceManager;
    private FaceEnrollAccessibilityToggle mSwitchDiversity;
@@ -57,28 +50,18 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
    private IllustrationVideoView mIllustrationDefault;
    private LottieAnimationView mIllustrationLottie;
    private View mIllustrationAccessibility;
    private Handler mHandler;
    private Intent mResultIntent;
    private TextView mDescriptionText;
    private boolean mNextClicked;
    private boolean mAccessibilityEnabled;

    private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
    private final CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
            new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    final int headerRes;
                    final int descriptionRes;
                    if (isChecked) {
                        headerRes = R.string
                                .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);
                    final int descriptionRes = isChecked
                            ? R.string.security_settings_face_enroll_education_message_accessibility
                            : R.string.security_settings_face_enroll_education_message;
                    setDescriptionText(descriptionRes);

                    if (isChecked) {
                        hideDefaultIllustration();
@@ -95,18 +78,14 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.face_enroll_education);

        final int headerRes = R.string.security_settings_face_enroll_education_title;
        final int descriptionRes = R.string.security_settings_face_enroll_education_message;
        updateHeaders(headerRes, descriptionRes);

        mHandler = new Handler();
        setTitle(R.string.security_settings_face_enroll_education_title);
        setDescriptionText(R.string.security_settings_face_enroll_education_message);

        mFaceManager = Utils.getFaceManagerOrNull(this);

        mIllustrationDefault = findViewById(R.id.illustration_default);
        mIllustrationLottie = findViewById(R.id.illustration_lottie);
        mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
        mDescriptionText = findViewById(R.id.sud_layout_description);

        mIsUsingLottie = getResources().getBoolean(R.bool.config_face_education_use_lottie);
        if (mIsUsingLottie) {
@@ -259,15 +238,6 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
        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() {
        if (mIsUsingLottie) {
            mIllustrationLottie.cancelAnimation();