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

Commit a26fc785 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Enable the add button if user cancels "add user" dialog by clicking outside the dialog."

parents 07d2da8e c6d13660
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