[Scummvm-cvs-logs] scummvm master -> cbf085287c74e0994fb18fb0830ccdb340b5b0ac

digitall dgturner at iee.org
Thu Feb 27 11:49:06 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cbf085287c ANDROID: Fix Android pre3.1 compatibility.


Commit: cbf085287c74e0994fb18fb0830ccdb340b5b0ac
    https://github.com/scummvm/scummvm/commit/cbf085287c74e0994fb18fb0830ccdb340b5b0ac
Author: D G Turner (digitall at scummvm.org)
Date: 2014-02-27T02:44:55-08:00

Commit Message:
ANDROID: Fix Android pre3.1 compatibility.

This was broken by a50ede203b0424d800d2a1d4460121f9f1de8e7a.

Changed paths:
  A backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java
    backends/platform/android/android.mk
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
    backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java



diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index 915bf8a..7c4fe01 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -7,6 +7,7 @@ ANDROID_PLUGIN_VERSIONCODE = 6
 JAVA_FILES = \
 	ScummVM.java \
 	ScummVMEvents.java \
+	ScummVMEventsHoneycomb.java \
 	ScummVMApplication.java \
 	ScummVMActivity.java \
 	EditableSurfaceView.java \
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 5d041da..5964d5b 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -4,6 +4,7 @@ import android.app.Activity;
 import android.app.AlertDialog;
 import android.content.DialogInterface;
 import android.media.AudioManager;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Environment;
 import android.util.DisplayMetrics;
@@ -169,7 +170,14 @@ public class ScummVMActivity extends Activity {
 			_mouseHelper.attach(main_surface);
 		}
 
-		_events = new ScummVMEvents(this, _scummvm, _mouseHelper);
+		if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1)
+		{
+			_events = new ScummVMEvents(this, _scummvm, _mouseHelper);
+		}
+		else
+		{
+			_events = new ScummVMEventsHoneycomb(this, _scummvm, _mouseHelper);
+		}
 
 		main_surface.setOnKeyListener(_events);
 		main_surface.setOnTouchListener(_events);
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
index a96bc56..32c65d3 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
@@ -1,6 +1,5 @@
 package org.scummvm.scummvm;
 
-import android.os.Build;
 import android.os.Handler;
 import android.os.Message;
 import android.content.Context;
@@ -69,18 +68,7 @@ public class ScummVMEvents implements
 		return true;
 	}
 
-	public boolean onGenericMotionEvent(final MotionEvent e) {
-		// 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;
-			}
-		}
-
+	public boolean onGenericMotionEvent(MotionEvent e) {
 		return false;
 	}
 
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java
new file mode 100644
index 0000000..ab85429
--- /dev/null
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java
@@ -0,0 +1,25 @@
+package org.scummvm.scummvm;
+
+import android.content.Context;
+import android.view.MotionEvent;
+import android.view.InputDevice;
+
+public class ScummVMEventsHoneycomb extends ScummVMEvents {
+
+	public ScummVMEventsHoneycomb(Context context, ScummVM scummvm, MouseHelper mouseHelper) {
+		super(context, scummvm, mouseHelper);
+	}
+
+	@Override
+	public boolean onGenericMotionEvent(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;
+		}
+
+		return false;
+	}
+}






More information about the Scummvm-git-logs mailing list