Make Android port compatible with older API versions again.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 03 Aug 2012 23:59:05 -0400
changeset 6386 0aa624a37ad4
parent 6385 f909e1dab4e2
child 6387 58f0fb54bf88
Make Android port compatible with older API versions again. Fixes Bugzilla #1563. Thanks to Philipp Wiesemann for the patch!
android-project/src/org/libsdl/app/SDLActivity.java
--- a/android-project/src/org/libsdl/app/SDLActivity.java	Wed Aug 01 21:41:54 2012 -0400
+++ b/android-project/src/org/libsdl/app/SDLActivity.java	Fri Aug 03 23:59:05 2012 -0400
@@ -539,9 +539,9 @@
              final int touchDevId = event.getDeviceId();
              final int pointerCount = event.getPointerCount();
              // touchId, pointerId, action, x, y, pressure
-             int actionPointerIndex = event.getActionIndex();
+             int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent. ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */
              int pointerFingerId = event.getPointerId(actionPointerIndex);
-             int action = event.getActionMasked();
+             int action = (event.getAction() & MotionEvent.ACTION_MASK); /* API 8: event.getActionMasked(); */
 
              float x = event.getX(actionPointerIndex);
              float y = event.getY(actionPointerIndex);