From 667347b37abe26fd3a6e86ca14b1c417f4a97e8e Mon Sep 17 00:00:00 2001 From: Yasin Kilicdere Date: Fri, 4 Mar 2022 18:23:26 +0000 Subject: [PATCH] Update UI to show feedback while creating Guest from Settings. Make UserCreationDialog able to show "Creating new guest" message for guest users. And add relevant string resources. Bug: 219741250 Test: Manual Change-Id: I8a7797f1ee19a271169f66331c5ed18cf0a3377b --- packages/SettingsLib/res/values/strings.xml | 4 ++++ .../settingslib/users/UserCreatingDialog.java | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml index da0381b682789..e524405a39d59 100644 --- a/packages/SettingsLib/res/values/strings.xml +++ b/packages/SettingsLib/res/values/strings.xml @@ -1426,8 +1426,12 @@ Switch to %s Creating new user… + + Creating new guest… Failed to create a new user + + Failed to create a new guest Nickname diff --git a/packages/SettingsLib/src/com/android/settingslib/users/UserCreatingDialog.java b/packages/SettingsLib/src/com/android/settingslib/users/UserCreatingDialog.java index 075635c87b1b1..dd86bec9126cc 100644 --- a/packages/SettingsLib/src/com/android/settingslib/users/UserCreatingDialog.java +++ b/packages/SettingsLib/src/com/android/settingslib/users/UserCreatingDialog.java @@ -31,11 +31,15 @@ import com.android.settingslib.R; public class UserCreatingDialog extends AlertDialog { public UserCreatingDialog(Context context) { + this(context, false); + } + + public UserCreatingDialog(Context context, boolean isGuest) { // hardcoding theme to be consistent with UserSwitchingDialog's theme // todo replace both to adapt to the device's theme super(context, com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog_Alert); - inflateContent(); + inflateContent(isGuest); getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR); WindowManager.LayoutParams attrs = getWindow().getAttributes(); @@ -44,12 +48,14 @@ public class UserCreatingDialog extends AlertDialog { getWindow().setAttributes(attrs); } - private void inflateContent() { + private void inflateContent(boolean isGuest) { // using the same design as UserSwitchingDialog setCancelable(false); View view = LayoutInflater.from(getContext()) .inflate(R.layout.user_creation_progress_dialog, null); - String message = getContext().getString(R.string.creating_new_user_dialog_message); + String message = getContext().getString(isGuest + ? R.string.creating_new_guest_dialog_message + : R.string.creating_new_user_dialog_message); view.setAccessibilityPaneTitle(message); ((TextView) view.findViewById(R.id.message)).setText(message); setView(view);