diff options
author | 2022-07-11 16:42:55 +0000 | |
---|---|---|
committer | 2022-07-11 16:42:55 +0000 | |
commit | b564beb6c57f5e19bfa56c661bbb5ba8274be8cf (patch) | |
tree | b3cb9a1972d5de059846d546b68919c184e3ee5b | |
parent | db91ab392a11c2ced82e8051dff2b74405fed5a6 (diff) | |
parent | 9b4226fc4db73309126341dd6adfa692e17b2658 (diff) |
Merge changes from topic "presubmit-am-0fe26308103c4f31843f4f5cafa20c2e"
* changes:
[automerge] Read isInFlight for action buttons 2p: f6ad27e961
Read isInFlight for action buttons
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java index 3b728c6ec..170012c2e 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java @@ -226,8 +226,18 @@ public class IssueCardPreference extends Preference implements ComparablePrefere Button button = isFirstButton ? createFirstButton(context) : createSubsequentButton(context); button.setText(action.getLabel()); - button.setOnClickListener( - view -> mSafetyCenterViewModel.executeIssueAction(mIssue, action)); + button.setEnabled(!action.isInFlight()); + button.setOnClickListener((view) -> { + if (action.willResolve()) { + // Disable the button to prevent double-taps. + // We ideally want to do this on any button press, however out of an abundance of + // caution we only do it with actions that indicate they will resolve (and therefore + // we can rely on a model update to redraw state). We expect the model to update + // with either isInFlight() or simply removing/updating the issue. + button.setEnabled(false); + } + mSafetyCenterViewModel.executeIssueAction(mIssue, action); + }); return button; } |