From 1487466dc2ce14cccf0ff2bd2f824238aaa0044e Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Thu, 18 Jul 2013 19:42:41 -0700 Subject: 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 --- core/java/android/view/ViewGroup.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/java/android/view/ViewGroup.java') 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 -- cgit v1.2.3