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
This commit is contained in:
josephpv
2024-01-18 14:21:22 +00:00
parent d9e66ea97b
commit f27e9e6553
3 changed files with 34 additions and 4 deletions

View File

@@ -52,6 +52,9 @@
<action <action
android:id="@+id/action_advance_login_error" android:id="@+id/action_advance_login_error"
app:destination="@id/ps_account_error_fragment"/> app:destination="@id/ps_account_error_fragment"/>
<action
android:id="@+id/action_success_fragment"
app:destination="@id/ps_profile_success_fragment"/>
</fragment> </fragment>
<fragment android:id="@+id/ps_profile_lock_fragment" <fragment android:id="@+id/ps_profile_lock_fragment"
android:name="com.android.settings.privatespace.PrivateSpaceSetLockFragment" android:name="com.android.settings.privatespace.PrivateSpaceSetLockFragment"

View File

@@ -1341,10 +1341,14 @@
<string name="private_space_done_label">Done</string> <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] --> <!-- 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> <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] --> <!-- Title for private space account login error screen. [CHAR LIMIT=30] -->
<string name="private_space_retry_signin_title">Sign in to set up a private space</string> <string name="private_space_retry_signin_title">Sign in</string>
<!-- Summary for the private space account login error screen. [CHAR LIMIT=NONE] --> <!-- 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] --> <!-- 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> <string name="private_space_lock_setup_title">Choose a lock for your private space</string>
<!-- private space lock setup screen description [CHAR LIMIT=NONE] --> <!-- private space lock setup screen description [CHAR LIMIT=NONE] -->

View File

@@ -31,6 +31,7 @@ import android.view.ViewGroup;
import androidx.activity.OnBackPressedCallback; import androidx.activity.OnBackPressedCallback;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.navigation.fragment.NavHostFragment;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.InstrumentedFragment; import com.android.settings.core.InstrumentedFragment;
@@ -55,11 +56,20 @@ public class PrivateSpaceAccountLoginError extends InstrumentedFragment {
final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class); final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class);
mixin.setPrimaryButton( mixin.setPrimaryButton(
new FooterButton.Builder(getContext()) new FooterButton.Builder(getContext())
.setText(R.string.private_space_tryagain_label) .setText(R.string.private_space_continue_login_label)
.setListener(nextScreen()) .setListener(nextScreen())
.setButtonType(FooterButton.ButtonType.NEXT) .setButtonType(FooterButton.ButtonType.NEXT)
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary) .setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
.build()); .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 = OnBackPressedCallback callback =
new OnBackPressedCallback(true /* enabled by default */) { new OnBackPressedCallback(true /* enabled by default */) {
@Override @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);
};
}
} }