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

Commit 4e2e02b0 authored by Bill Lin's avatar Bill Lin Committed by Android (Google) Code Review
Browse files

Merge "Adapt Expressive style theme for SetupSkipDialog" into main

parents 47f114e7 b482b963
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -96,4 +96,22 @@
    <style name="Theme.Settings.Home.Expressive" parent="Theme.Settings.Expressive.NoActionBar">
        <item name="android:colorBackground">@color/settingslib_materialColorSurfaceContainerLow</item>
    </style>

    <style name="Theme.LockSettings.Expressive" parent="Theme.SubSettings.Expressive">
        <item name="android:alertDialogTheme">@style/Theme.Expressive.Dialog.Alert.DayNight</item>
    </style>

    <style name="Theme.Expressive.Dialog.Alert.DayNight" parent="@style/SudGlifExpressiveDialogTheme">
        <item name="android:colorAccent">@color/settingslib_materialColorPrimary</item>
        <item name="android:colorBackground">@color/settingslib_materialColorSurfaceContainerHigh</item>
        <item name="android:background">@color/sud_color_surface_container_high</item>
        <item name="android:fontFamily">@string/sudGlifExpressiveDialogFontFamily</item>
        <item name="android:windowTitleStyle">@style/SudGlifExpressiveWindowTitleTextAppearance</item>
        <item name="android:textColorPrimary">@color/sud_on_surface_variant</item>
        <item name="android:dialogPreferredPadding">@dimen/settingslib_expressive_space_small4</item>
        <item name="android:buttonBarStyle">@style/SudAppCompatButtonButtonBarAlertDialog</item>
        <item name="android:buttonBarPositiveButtonStyle">@style/Widget.SettingsLib.DialogButton</item>
        <item name="android:buttonBarNegativeButtonStyle">@style/Widget.SettingsLib.DialogButton</item>
        <item name="android:buttonBarNeutralButtonStyle">@style/Widget.SettingsLib.DialogButton</item>
    </style>
</resources>
+3 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.admin.DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY;

import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_USE_EXPRESSIVE_STYLE;

import android.app.RemoteServiceException.MissingRequestPasswordComplexityPermissionException;
import android.content.Context;
@@ -197,7 +198,8 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
                        /* forFingerprint= */ false,
                        /* forFace= */ false,
                        /* forBiometrics= */ false,
                        WizardManagerHelper.isAnySetupWizard(intent)
                        WizardManagerHelper.isAnySetupWizard(intent),
                        intent.getBooleanExtra(EXTRA_KEY_USE_EXPRESSIVE_STYLE, false)
                );
                dialog.show(getFragmentManager());
                return true;
+5 −1
Original line number Diff line number Diff line
@@ -134,13 +134,17 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
                        .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
                final boolean forBiometrics = intent
                        .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
                final boolean isExpressiveStyle = intent
                        .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_USE_EXPRESSIVE_STYLE,
                                false);
                final SetupSkipDialog dialog = SetupSkipDialog.newInstance(
                        mIsAlphaMode ? CREDENTIAL_TYPE_PASSWORD : CREDENTIAL_TYPE_PIN,
                        frpSupported,
                        forFingerprint,
                        forFace,
                        forBiometrics,
                        WizardManagerHelper.isAnySetupWizard(intent));
                        WizardManagerHelper.isAnySetupWizard(intent),
                        isExpressiveStyle);

                ConfirmDeviceCredentialUtils.hideImeImmediately(
                        getActivity().getWindow().getDecorView());
+5 −1
Original line number Diff line number Diff line
@@ -120,13 +120,17 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
                        .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
                final boolean forBiometrics = intent
                        .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
                final boolean isExpressiveStyle = intent
                        .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_USE_EXPRESSIVE_STYLE,
                                false);
                final SetupSkipDialog dialog = SetupSkipDialog.newInstance(
                        CREDENTIAL_TYPE_PATTERN,
                        frpSupported,
                        forFingerprint,
                        forFace,
                        forBiometrics,
                        WizardManagerHelper.isAnySetupWizard(intent));
                        WizardManagerHelper.isAnySetupWizard(intent),
                        isExpressiveStyle);
                dialog.show(getFragmentManager());
                return;
            }
+15 −5
Original line number Diff line number Diff line
@@ -23,13 +23,16 @@ import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_F
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_IS_SUW;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_USE_EXPRESSIVE_STYLE;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

@@ -57,7 +60,7 @@ public class SetupSkipDialog extends InstrumentedDialogFragment

    public static SetupSkipDialog newInstance(@LockPatternUtils.CredentialType int credentialType,
            boolean isFrpSupported, boolean forFingerprint, boolean forFace,
            boolean forBiometrics, boolean isSuw) {
            boolean forBiometrics, boolean isSuw, boolean isExpressiveStyle) {
        SetupSkipDialog dialog = new SetupSkipDialog();
        Bundle args = new Bundle();
        args.putInt(ARG_LOCK_CREDENTIAL_TYPE, credentialType);
@@ -66,6 +69,7 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
        args.putBoolean(EXTRA_KEY_FOR_FACE, forFace);
        args.putBoolean(EXTRA_KEY_FOR_BIOMETRICS, forBiometrics);
        args.putBoolean(EXTRA_KEY_IS_SUW, isSuw);
        args.putBoolean(EXTRA_KEY_USE_EXPRESSIVE_STYLE, isExpressiveStyle);
        dialog.setArguments(args);
        return dialog;
    }
@@ -82,7 +86,7 @@ public class SetupSkipDialog extends InstrumentedDialogFragment

    private AlertDialog.Builder getBiometricsBuilder(
            @LockPatternUtils.CredentialType int credentialType, boolean isSuw, boolean hasFace,
            boolean hasFingerprint) {
            boolean hasFingerprint, boolean isExpressiveStyle) {
        final boolean isFaceSupported = hasFace && (!isSuw || BiometricUtils.isFaceSupportedInSuw(
                getContext()));
        final int msgResId;
@@ -102,7 +106,7 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
                msgResId = getPinSkipMessageRes(hasFace && isFaceSupported, hasFingerprint);
                break;
        }
        return new AlertDialog.Builder(getContext())
        return new AlertDialog.Builder(isExpressiveStyle ? getExpressiveContext() : getContext())
                .setPositiveButton(R.string.skip_lock_screen_dialog_button_label, this)
                .setNegativeButton(R.string.cancel_lock_screen_dialog_button_label, this)
                .setTitle(getSkipSetupTitle(screenLockResId, hasFingerprint,
@@ -110,10 +114,15 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
                .setMessage(msgResId);
    }

    private Context getExpressiveContext() {
        return new ContextThemeWrapper(getContext(), R.style.Theme_LockSettings_Expressive);
    }

    @NonNull
    public AlertDialog.Builder onCreateDialogBuilder() {
        Bundle args = getArguments();
        final boolean isSuw = args.getBoolean(EXTRA_KEY_IS_SUW);
        final boolean isExpressiveStyle = args.getBoolean(EXTRA_KEY_USE_EXPRESSIVE_STYLE);
        final boolean forBiometrics = args.getBoolean(EXTRA_KEY_FOR_BIOMETRICS);
        final boolean forFace = args.getBoolean(EXTRA_KEY_FOR_FACE);
        final boolean forFingerprint = args.getBoolean(EXTRA_KEY_FOR_FINGERPRINT);
@@ -123,10 +132,11 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
        if (forFace || forFingerprint || forBiometrics) {
            final boolean hasFace = Utils.hasFaceHardware(getContext());
            final boolean hasFingerprint = Utils.hasFingerprintHardware(getContext());
            return getBiometricsBuilder(credentialType, isSuw, hasFace, hasFingerprint);
            return getBiometricsBuilder(credentialType, isSuw, hasFace, hasFingerprint,
                    isExpressiveStyle);
        }

        return new AlertDialog.Builder(getContext())
        return new AlertDialog.Builder(isExpressiveStyle ? getExpressiveContext() : getContext())
                .setPositiveButton(R.string.skip_anyway_button_label, this)
                .setNegativeButton(R.string.go_back_button_label, this)
                .setTitle(R.string.lock_screen_intro_skip_title)
Loading