mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-02 08:55:45 +00:00
ANDROID: Fix runtime failure on earlier versions of Android.
getAxisValue() is only present from Android 3.1 onwards and usage causes a runtime failure on earlier versions of Android. This bug was introduced by a50ede20 with addition of OUYA support. This solution is as recommended on the Android developer portal.
This commit is contained in:
parent
cda0598047
commit
0def54a60d
@ -1,5 +1,6 @@
|
||||
package org.scummvm.scummvm;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.content.Context;
|
||||
@ -69,13 +70,16 @@ public class ScummVMEvents implements
|
||||
}
|
||||
|
||||
public boolean onGenericMotionEvent(final MotionEvent e) {
|
||||
if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
|
||||
_scummvm.pushEvent(JE_JOYSTICK, e.getAction(),
|
||||
(int)(e.getAxisValue(MotionEvent.AXIS_X)*100),
|
||||
(int)(e.getAxisValue(MotionEvent.AXIS_Y)*100),
|
||||
0, 0);
|
||||
return true;
|
||||
}
|
||||
// Make sure we're running on Android 3.1 or higher to use getAxisValue()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
|
||||
if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
|
||||
_scummvm.pushEvent(JE_JOYSTICK, e.getAction(),
|
||||
(int)(e.getAxisValue(MotionEvent.AXIS_X)*100),
|
||||
(int)(e.getAxisValue(MotionEvent.AXIS_Y)*100),
|
||||
0, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user