diff options
author | 2022-07-11 16:42:55 +0000 | |
---|---|---|
committer | 2022-07-11 16:42:55 +0000 | |
commit | fbd5a8a7a831f52ba9ed1b39695487420a646ce8 (patch) | |
tree | 82bee70fde97c8050c3e1e6736eb9e6a5a2690aa | |
parent | efcc893050cf07544dfd3f25e49c1ee7c4d48caf (diff) | |
parent | f6ad27e961ed0ce98bf623752fd4ac7f2686a1a2 (diff) |
Merge "Read isInFlight for action buttons" into tm-mainline-prod
-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; } |