diff options
author | D G Turner | 2014-02-21 16:29:23 +0000 |
---|---|---|
committer | D G Turner | 2014-02-21 16:29:23 +0000 |
commit | 0def54a60d8a5c6e63bb5db238bbadf388dede97 (patch) | |
tree | deb2a8900edd0466942ba4a538e5a872754e7f40 | |
parent | cda0598047724433e511182ffd3b17b08233f084 (diff) | |
download | scummvm-rg350-0def54a60d8a5c6e63bb5db238bbadf388dede97.tar.gz scummvm-rg350-0def54a60d8a5c6e63bb5db238bbadf388dede97.tar.bz2 scummvm-rg350-0def54a60d8a5c6e63bb5db238bbadf388dede97.zip |
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.
-rw-r--r-- | backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java index 702215341b..eef5d1911b 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java @@ -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; } |