diff options
| author | Adam Powell <adamp@google.com> | 2013-07-18 19:42:41 -0700 |
|---|---|---|
| committer | Adam Powell <adamp@google.com> | 2013-09-05 00:55:20 +0000 |
| commit | 1487466dc2ce14cccf0ff2bd2f824238aaa0044e (patch) | |
| tree | 4bf31a9b198846b45f9a15b3ebc53532bb748e6b /core/java/android/view/ViewGroup.java | |
| parent | 7f71206d009e737e91c4c767183befe6006497c6 (diff) | |
Add View#cancelPendingInputEvents API
This API allows an application to cancel deferred high-level input
events already in flight. It forms one tool of several to help apps
debounce input events and prevent things like multiple startActivity
calls, FragmentTransactions, etc. from executing when only one was
desired since it's otherwise not desirable for things like click
events to fire synchronously.
Change-Id: I60b12cd5350898065f0019d616e24d779eb8cff9
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 2d75b063ca74..faeee3fa5ce7 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3182,6 +3182,17 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } + @Override + void dispatchCancelPendingInputEvents() { + super.dispatchCancelPendingInputEvents(); + + final View[] children = mChildren; + final int count = mChildrenCount; + for (int i = 0; i < count; i++) { + children[i].dispatchCancelPendingInputEvents(); + } + } + /** * When this property is set to true, this ViewGroup supports static transformations on * children; this causes |
