From e89a4e7d2808b44b2da6827d13d6da6ce0998896 Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Mon, 13 Aug 2012 17:31:22 +0800 Subject: Make a copy of MotionEvent in MotionEventHelper.transform. RotateLayout transforms the event in dispatchTouchEvent. If the event is not handled, the parent of RotateLayout may send the transformed event to other views and the coordinates will be wrong. Make a copy of MotionEvent in transform. This also makes the behavior consistent in different API levels. bug:6974916 Change-Id: Id835767cc9be3f244e5abe2b855e5188045adedc --- src/com/android/gallery3d/util/MotionEventHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/com/android/gallery3d/util/MotionEventHelper.java b/src/com/android/gallery3d/util/MotionEventHelper.java index 1c9d06244..715f7fa69 100644 --- a/src/com/android/gallery3d/util/MotionEventHelper.java +++ b/src/com/android/gallery3d/util/MotionEventHelper.java @@ -38,8 +38,9 @@ public final class MotionEventHelper { @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB) private static MotionEvent transformEventNew(MotionEvent e, Matrix m) { - e.transform(m); - return e; + MotionEvent newEvent = MotionEvent.obtain(e); + newEvent.transform(m); + return newEvent; } // This is copied from Input.cpp in the android framework. -- cgit v1.2.3