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

Commit 61dd88e8 authored by Yasin Kilicdere's avatar Yasin Kilicdere Committed by Android (Google) Code Review
Browse files

Merge "Update UI to show feedback while creating Guest from Settings." into tm-dev

parents dcff8df6 667347b3
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1426,8 +1426,12 @@
    <string name="user_switch_to_user">Switch to <xliff:g id="user_name" example="John Doe">%s</xliff:g></string>
    <string name="user_switch_to_user">Switch to <xliff:g id="user_name" example="John Doe">%s</xliff:g></string>
    <!-- Dialog message when creating a new user [CHAR LIMIT=NONE] -->
    <!-- Dialog message when creating a new user [CHAR LIMIT=NONE] -->
    <string name="creating_new_user_dialog_message">Creating new user…</string>
    <string name="creating_new_user_dialog_message">Creating new user…</string>
    <!-- Dialog message when creating a new guest [CHAR LIMIT=NONE] -->
    <string name="creating_new_guest_dialog_message">Creating new guest…</string>
    <!-- Text shown to notify that the creation of new user has failed. [CHAR LIMIT=40] -->
    <!-- Text shown to notify that the creation of new user has failed. [CHAR LIMIT=40] -->
    <string name="add_user_failed">Failed to create a new user</string>
    <string name="add_user_failed">Failed to create a new user</string>
    <!-- Text shown to notify that the creation of new guest has failed. [CHAR LIMIT=40] -->
    <string name="add_guest_failed">Failed to create a new guest</string>


    <!-- Title for the preference to enter the nickname of the user to display in the user switcher [CHAR LIMIT=25]-->
    <!-- Title for the preference to enter the nickname of the user to display in the user switcher [CHAR LIMIT=25]-->
    <string name="user_nickname">Nickname</string>
    <string name="user_nickname">Nickname</string>
+9 −3
Original line number Original line Diff line number Diff line
@@ -31,11 +31,15 @@ import com.android.settingslib.R;
public class UserCreatingDialog extends AlertDialog {
public class UserCreatingDialog extends AlertDialog {


    public UserCreatingDialog(Context context) {
    public UserCreatingDialog(Context context) {
        this(context, false);
    }

    public UserCreatingDialog(Context context, boolean isGuest) {
        // hardcoding theme to be consistent with UserSwitchingDialog's theme
        // hardcoding theme to be consistent with UserSwitchingDialog's theme
        // todo replace both to adapt to the device's theme
        // todo replace both to adapt to the device's theme
        super(context, com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
        super(context, com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog_Alert);


        inflateContent();
        inflateContent(isGuest);
        getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
        getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);


        WindowManager.LayoutParams attrs = getWindow().getAttributes();
        WindowManager.LayoutParams attrs = getWindow().getAttributes();
@@ -44,12 +48,14 @@ public class UserCreatingDialog extends AlertDialog {
        getWindow().setAttributes(attrs);
        getWindow().setAttributes(attrs);
    }
    }


    private void inflateContent() {
    private void inflateContent(boolean isGuest) {
        // using the same design as UserSwitchingDialog
        // using the same design as UserSwitchingDialog
        setCancelable(false);
        setCancelable(false);
        View view = LayoutInflater.from(getContext())
        View view = LayoutInflater.from(getContext())
                .inflate(R.layout.user_creation_progress_dialog, null);
                .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);
        view.setAccessibilityPaneTitle(message);
        ((TextView) view.findViewById(R.id.message)).setText(message);
        ((TextView) view.findViewById(R.id.message)).setText(message);
        setView(view);
        setView(view);