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)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
index 23724c2..ee10d34 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
@@ -155,7 +155,7 @@
* 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 @@
.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 @@
}
}
+ @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