Commit fda8d9344036a18cc9c330eed536350953d0340a

Philipp Wiesemann 2013-11-10T14:58:48

Moved two function calls so they are only called if needed. If the MotionEvent is not from joystick the return values are not needed.

diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java
index 773ec43..426dd97 100644
--- a/android-project/src/org/libsdl/app/SDLActivity.java
+++ b/android-project/src/org/libsdl/app/SDLActivity.java
@@ -890,10 +890,9 @@ class SDLGenericMotionHandler_API12 extends Activity implements View.OnGenericMo
     // We only have joysticks yet
     @Override
     public boolean onGenericMotion(View v, MotionEvent event) {
-        int actionPointerIndex = event.getActionIndex();
-        int action = event.getActionMasked();
-        
         if ( (event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) {
+            int actionPointerIndex = event.getActionIndex();
+            int action = event.getActionMasked();
             switch(action) {
                 case MotionEvent.ACTION_MOVE:
                     int id = SDLActivity.getJoyId( event.getDeviceId() );
@@ -906,4 +905,4 @@ class SDLGenericMotionHandler_API12 extends Activity implements View.OnGenericMo
         }
         return true;
     }
-}
\ No newline at end of file
+}