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

Commit 2fe6673d authored by Pasty Chang's avatar Pasty Chang Committed by Android (Google) Code Review
Browse files

Merge "Migrating to new footer button for lockscreen pages."

parents 847c0660 5dfdb4ff
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -20,8 +20,7 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:icon="@drawable/ic_lock"
    app:sucFooter="@layout/encryption_interstitial_footer">
    android:icon="@drawable/ic_lock">

    <LinearLayout
        style="@style/SuwContentFrame"
+0 −43
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2017 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.
-->

<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/SuwGlifButtonBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <Button
        android:id="@+id/encrypt_dont_require_password"
        style="@style/SuwGlifButton.Secondary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/encryption_interstitial_no" />

    <Space
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" />

    <Button
        android:id="@+id/encrypt_require_password"
        style="@style/SuwGlifButton.Primary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/encryption_interstitial_yes" />

</LinearLayout>
+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:icon="@drawable/ic_suggested_notifications"
    settings:sucFooter="@layout/redaction_interstitial_footer"
    settings:suwHeaderText="@string/lock_screen_notifications_interstitial_title">

    <LinearLayout
+0 −32
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2017 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
-->

<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/SuwGlifButtonBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <Button
        android:id="@+id/redaction_done_button"
        style="@style/SuwGlifButton.Primary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:text="@string/app_notifications_dialog_done" />

</FrameLayout>
+36 −24
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ import com.android.settings.core.InstrumentedFragment;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.password.ChooseLockSettingsHelper;

import com.google.android.setupcompat.item.FooterButton;
import com.google.android.setupcompat.template.ButtonFooterMixin;
import com.google.android.setupdesign.GlifLayout;

import java.util.List;
@@ -86,11 +88,8 @@ public class EncryptionInterstitial extends SettingsActivity {
        layout.setFitsSystemWindows(false);
    }

    public static class EncryptionInterstitialFragment extends InstrumentedFragment
            implements View.OnClickListener {
    public static class EncryptionInterstitialFragment extends InstrumentedFragment {

        private View mRequirePasswordToDecrypt;
        private View mDontRequirePasswordToDecrypt;
        private boolean mPasswordRequired;
        private Intent mUnlockMethodIntent;
        private int mRequestedPasswordQuality;
@@ -110,8 +109,6 @@ public class EncryptionInterstitial extends SettingsActivity {
        public void onViewCreated(View view, Bundle savedInstanceState) {
            super.onViewCreated(view, savedInstanceState);

            mRequirePasswordToDecrypt = view.findViewById(R.id.encrypt_require_password);
            mDontRequirePasswordToDecrypt = view.findViewById(R.id.encrypt_dont_require_password);
            final boolean forFingerprint = getActivity().getIntent().getBooleanExtra(
                    ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
            final boolean forFace = getActivity().getIntent()
@@ -147,14 +144,30 @@ public class EncryptionInterstitial extends SettingsActivity {
            TextView message = (TextView) getActivity().findViewById(R.id.encryption_message);
            message.setText(msgId);

            mRequirePasswordToDecrypt.setOnClickListener(this);
            mDontRequirePasswordToDecrypt.setOnClickListener(this);

            setRequirePasswordState(getActivity().getIntent().getBooleanExtra(
                    EXTRA_REQUIRE_PASSWORD, true));

            GlifLayout layout = (GlifLayout) view;
            layout.setHeaderText(getActivity().getTitle());

            final ButtonFooterMixin buttonFooterMixin = layout.getMixin(ButtonFooterMixin.class);
            buttonFooterMixin.setSecondaryButton(
                    new FooterButton(
                            getContext(),
                            R.string.encryption_interstitial_no,
                            this::onNoButtonClicked,
                            FooterButton.ButtonType.SKIP,
                            R.style.SuwGlifButton_Secondary)
            );

            buttonFooterMixin.setPrimaryButton(
                    new FooterButton(
                            getContext(),
                            R.string.encryption_interstitial_yes,
                            this::onYesButtonClicked,
                            FooterButton.ButtonType.NEXT,
                            R.style.SuwGlifButton_Primary)
            );
        }

        protected void startLockIntent() {
@@ -176,9 +189,7 @@ public class EncryptionInterstitial extends SettingsActivity {
            }
        }

        @Override
        public void onClick(View view) {
            if (view == mRequirePasswordToDecrypt) {
        private void onYesButtonClicked(View view) {
            final boolean accEn = AccessibilityManager.getInstance(getActivity()).isEnabled();
            if (accEn && !mPasswordRequired) {
                setRequirePasswordState(false); // clear the UI state
@@ -190,11 +201,12 @@ public class EncryptionInterstitial extends SettingsActivity {
                setRequirePasswordState(true);
                startLockIntent();
            }
            } else {
        }

        private void onNoButtonClicked(View view) {
            setRequirePasswordState(false);
            startLockIntent();
        }
        }

        private void setRequirePasswordState(boolean required) {
            mPasswordRequired = required;
Loading