Skip to content

Commit

Permalink
Moved two function calls so they are only called if needed.
Browse files Browse the repository at this point in the history
If the MotionEvent is not from joystick the return values are not needed.
  • Loading branch information
philippwiesemann committed Nov 10, 2013
1 parent aa33798 commit fda8d93
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions android-project/src/org/libsdl/app/SDLActivity.java
Expand Up @@ -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() );
Expand All @@ -906,4 +905,4 @@ public boolean onGenericMotion(View v, MotionEvent event) {
}
return true;
}
}
}

0 comments on commit fda8d93

Please sign in to comment.