summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Quang Anh Luong <qal@google.com> 2023-07-27 21:01:32 +0900
committer Quang Luong <qal@google.com> 2023-07-27 12:08:11 +0000
commit8fca6a3bcca85b84d79fa1dbdc070a7cf8191996 (patch)
tree0980bee89bccb87197205105ce8acd200228300b
parentcb8576290c9239b1eb45354b06fbe754cd885f08 (diff)
Fix P2P PIN accept button greyed out incorrectly on config change
The P2P PIN accept button in the P2P invitation dialog should be greyed out if the PIN is not 4 or 8 digits in length. However, if the correct number of digits is inputted and then a configuration change reloads the dialog (e.g. light -> dark mode), then the accept button is still greyed out upon reload. Add an extra check when reloading the dialog to enable the button if the pre-existing input is the correct length. Bug: 292441663 Test: manually verify using adb shell cmd wifi launch-dialog-p2p-invitation-received Device -p -c 0, input 4 digits to PIN entry, change device from light->dark mode, verify Accept button is not greyed out upon reloading the dialog. Change-Id: Ia90f7dd23316cc0d04a5326dbd27e771ef77af1d
-rw-r--r--WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
index 43d7d92e1e..d7226f15ab 100644
--- a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
+++ b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
@@ -664,7 +664,8 @@ public class WifiDialogActivity extends Activity {
pinEditText.requestFocus();
pinEditText.setSelection(pinEditText.getText().length());
}
- dialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(false);
+ dialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(
+ pinEditText.length() == 4 || pinEditText.length() == 8);
});
pinEditText.addTextChangedListener(new TextWatcher() {
@Override
@@ -685,11 +686,8 @@ public class WifiDialogActivity extends Activity {
// configuration change.
intent.putExtra(EXTRA_DIALOG_P2P_PIN_INPUT, s);
}
- if (s.length() == 4 || s.length() == 8) {
- dialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(true);
- } else {
- dialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(false);
- }
+ dialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(
+ s.length() == 4 || s.length() == 8);
}
});
} else {