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

Commit c6d13660 authored by Aarthi Balachander's avatar Aarthi Balachander
Browse files

Enable the add button if user cancels "add user" dialog by clicking

outside the dialog.

Bug: 112436539
Test: Tested on device
Change-Id: I4b33a659134297119a8d538d4cbe5fb00d1ee588
(cherry picked from commit 1680d8d0bc749f60c99b5dc2cd35f02f2b840b88)
parent 6e68dc71
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ public class UserGridRecyclerView extends PagedListView implements
     * Adapter to populate the grid layout with the available user profiles
     */
    public final class UserAdapter extends RecyclerView.Adapter<UserAdapter.UserAdapterViewHolder>
            implements Dialog.OnClickListener {
            implements Dialog.OnClickListener, Dialog.OnCancelListener {

        private final Context mContext;
        private List<UserRecord> mUsers;
@@ -231,6 +231,7 @@ public class UserGridRecyclerView extends PagedListView implements
                        .setMessage(message)
                        .setNegativeButton(android.R.string.cancel, this)
                        .setPositiveButton(android.R.string.ok, this)
                        .setOnCancelListener(this)
                        .create();
                    // Sets window flags for the SysUI dialog
                    SystemUIDialog.applyFlags(mDialog);
@@ -277,6 +278,14 @@ public class UserGridRecyclerView extends PagedListView implements
            }
        }

        @Override
        public void onCancel(DialogInterface dialog) {
            // Enable the add button again if user cancels dialog by clicking outside the dialog
            if (mAddUserView != null) {
                mAddUserView.setEnabled(true);
            }
        }

        private class AddNewUserTask extends AsyncTask<String, Void, UserInfo> {

            @Override