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

Commit f27e9e65 authored by josephpv's avatar josephpv
Browse files

Add skip button in PS account login error screen

Recording link : b/320460786#comment5

Bug: 320460786
Test: Verified skip button in shown in error screen.
Change-Id: I0b3b9258ad55069c9920d7fc9fb7f17d422297f1
parent d9e66ea9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@
        <action
            android:id="@+id/action_advance_login_error"
            app:destination="@id/ps_account_error_fragment"/>
        <action
            android:id="@+id/action_success_fragment"
            app:destination="@id/ps_profile_success_fragment"/>
    </fragment>
    <fragment android:id="@+id/ps_profile_lock_fragment"
              android:name="com.android.settings.privatespace.PrivateSpaceSetLockFragment"
+7 −3
Original line number Diff line number Diff line
@@ -1341,10 +1341,14 @@
    <string name="private_space_done_label">Done</string>
    <!-- Toast to show on private space setup completion informing user to scroll down All apps to access private space. [CHAR LIMIT=60] -->
    <string name="private_space_scrolldown_to_access">Scroll down to find private space</string>
    <!-- Title for private space account login error screen. [CHAR LIMIT=60] -->
    <string name="private_space_retry_signin_title">Sign in to set up a private space</string>
    <!-- Title for private space account login error screen. [CHAR LIMIT=30] -->
    <string name="private_space_retry_signin_title">Sign in</string>
    <!-- Summary for the private space account login error screen. [CHAR LIMIT=NONE] -->
    <string name="private_space_retry_summary">You need to sign in to an account to set up a private space</string>
    <string name="private_space_retry_summary">Sign in to an account to use with your private space</string>
    <!-- Label for button to skip private space account sign in. [CHAR LIMIT=30] -->
    <string name="private_space_skip_login_label">Not now</string>
    <!-- Label for button to coninue with private space account sign in. [CHAR LIMIT=30] -->
    <string name="private_space_continue_login_label">Continue</string>
    <!-- private space lock setup screen title. This title is asking the user to choose a type of screen lock (such as a pattern, PIN, or password) that they need to enter to unlock private space. [CHAR LIMIT=60] -->
    <string name="private_space_lock_setup_title">Choose a lock for your private space</string>
    <!-- private space lock setup screen description [CHAR LIMIT=NONE] -->
+24 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.view.ViewGroup;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.Nullable;
import androidx.navigation.fragment.NavHostFragment;

import com.android.settings.R;
import com.android.settings.core.InstrumentedFragment;
@@ -55,11 +56,20 @@ public class PrivateSpaceAccountLoginError extends InstrumentedFragment {
        final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class);
        mixin.setPrimaryButton(
                new FooterButton.Builder(getContext())
                        .setText(R.string.private_space_tryagain_label)
                        .setText(R.string.private_space_continue_login_label)
                        .setListener(nextScreen())
                        .setButtonType(FooterButton.ButtonType.NEXT)
                        .setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
                        .build());
        mixin.setSecondaryButton(
                new FooterButton.Builder(getContext())
                        .setText(R.string.private_space_skip_login_label)
                        .setListener(onSkip())
                        .setButtonType(FooterButton.ButtonType.CANCEL)
                        .setTheme(
                                androidx.appcompat.R.style
                                        .Base_TextAppearance_AppCompat_Widget_Button)
                        .build());
        OnBackPressedCallback callback =
                new OnBackPressedCallback(true /* enabled by default */) {
                    @Override
@@ -96,4 +106,17 @@ public class PrivateSpaceAccountLoginError extends InstrumentedFragment {
            }
        };
    }

    private View.OnClickListener onSkip() {
        return v -> {
            mMetricsFeatureProvider.action(
                    getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_SKIP_ACCOUNT_LOGIN);
            mMetricsFeatureProvider.action(
                    getContext(),
                    SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_SUCCESS,
                    false);
            NavHostFragment.findNavController(PrivateSpaceAccountLoginError.this)
                    .navigate(R.id.action_success_fragment);
        };
    }
}