am 2c4ea24c: am cb154e52: am 1b8262b8: Disable MotionEvent splitting for DrawerLayout
* commit '2c4ea24c49d222582c7e439e461935f18099886c':
Disable MotionEvent splitting for DrawerLayout
diff --git a/v4/honeycomb/android/support/v4/view/ViewGroupCompatHC.java b/v4/honeycomb/android/support/v4/view/ViewGroupCompatHC.java
new file mode 100644
index 0000000..96349ed
--- /dev/null
+++ b/v4/honeycomb/android/support/v4/view/ViewGroupCompatHC.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package android.support.v4.view;
+
+import android.view.ViewGroup;
+
+class ViewGroupCompatHC {
+ private ViewGroupCompatHC() {
+ }
+
+ public static void setMotionEventSplittingEnabled(ViewGroup group, boolean split) {
+ group.setMotionEventSplittingEnabled(split);
+ }
+}
diff --git a/v4/java/android/support/v4/view/ViewGroupCompat.java b/v4/java/android/support/v4/view/ViewGroupCompat.java
index 1be7fb5..86c48d4 100644
--- a/v4/java/android/support/v4/view/ViewGroupCompat.java
+++ b/v4/java/android/support/v4/view/ViewGroupCompat.java
@@ -30,6 +30,8 @@
interface ViewGroupCompatImpl {
public boolean onRequestSendAccessibilityEvent(ViewGroup group, View child,
AccessibilityEvent event);
+
+ public void setMotionEventSplittingEnabled(ViewGroup group, boolean split);
}
static class ViewGroupCompatStubImpl implements ViewGroupCompatImpl {
@@ -37,9 +39,20 @@
ViewGroup group, View child, AccessibilityEvent event) {
return true;
}
+
+ public void setMotionEventSplittingEnabled(ViewGroup group, boolean split) {
+ // no-op, didn't exist.
+ }
}
- static class ViewGroupCompatIcsImpl extends ViewGroupCompatStubImpl {
+ static class ViewGroupCompatHCImpl extends ViewGroupCompatStubImpl {
+ @Override
+ public void setMotionEventSplittingEnabled(ViewGroup group, boolean split) {
+ ViewGroupCompatHC.setMotionEventSplittingEnabled(group, split);
+ }
+ }
+
+ static class ViewGroupCompatIcsImpl extends ViewGroupCompatHCImpl {
@Override
public boolean onRequestSendAccessibilityEvent(
ViewGroup group, View child, AccessibilityEvent event) {
@@ -49,8 +62,11 @@
static final ViewGroupCompatImpl IMPL;
static {
- if (Build.VERSION.SDK_INT >= 14) {
+ final int version = Build.VERSION.SDK_INT;
+ if (version >= 14) {
IMPL = new ViewGroupCompatIcsImpl();
+ } else if (version >= 11) {
+ IMPL = new ViewGroupCompatHCImpl();
} else {
IMPL = new ViewGroupCompatStubImpl();
}
@@ -82,4 +98,24 @@
AccessibilityEvent event) {
return IMPL.onRequestSendAccessibilityEvent(group, child, event);
}
+
+ /**
+ * Enable or disable the splitting of MotionEvents to multiple children during touch event
+ * dispatch. This behavior is enabled by default for applications that target an
+ * SDK version of 11 (Honeycomb) or newer. On earlier platform versions this feature
+ * was not supported and this method is a no-op.
+ *
+ * <p>When this option is enabled MotionEvents may be split and dispatched to different child
+ * views depending on where each pointer initially went down. This allows for user interactions
+ * such as scrolling two panes of content independently, chording of buttons, and performing
+ * independent gestures on different pieces of content.
+ *
+ * @param group ViewGroup to modify
+ * @param split <code>true</code> to allow MotionEvents to be split and dispatched to multiple
+ * child views. <code>false</code> to only allow one child view to be the target of
+ * any MotionEvent received by this ViewGroup.
+ */
+ public static void setMotionEventSplittingEnabled(ViewGroup group, boolean split) {
+ IMPL.setMotionEventSplittingEnabled(group, split);
+ }
}
diff --git a/v4/java/android/support/v4/widget/DrawerLayout.java b/v4/java/android/support/v4/widget/DrawerLayout.java
index 05fc183..cc55b82 100644
--- a/v4/java/android/support/v4/widget/DrawerLayout.java
+++ b/v4/java/android/support/v4/widget/DrawerLayout.java
@@ -32,6 +32,7 @@
import android.support.v4.view.KeyEventCompat;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
+import android.support.v4.view.ViewGroupCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.util.AttributeSet;
import android.view.Gravity;
@@ -240,6 +241,7 @@
setFocusableInTouchMode(true);
ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
+ ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
/**