summaryrefslogtreecommitdiffstats
path: root/platform/android/java/lib/src
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/java/lib/src')
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt6
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java25
2 files changed, 17 insertions, 14 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt b/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt
index 7b8fad8952..4c5e857b7a 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt
@@ -36,6 +36,7 @@ import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import androidx.annotation.CallSuper
+import androidx.annotation.LayoutRes
import androidx.fragment.app.FragmentActivity
import org.godotengine.godot.utils.PermissionsUtil
import org.godotengine.godot.utils.ProcessPhoenix
@@ -65,7 +66,7 @@ abstract class GodotActivity : FragmentActivity(), GodotHost {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.godot_app_layout)
+ setContentView(getGodotAppLayout())
handleStartIntent(intent, true)
@@ -80,6 +81,9 @@ abstract class GodotActivity : FragmentActivity(), GodotHost {
}
}
+ @LayoutRes
+ protected open fun getGodotAppLayout() = R.layout.godot_app_layout
+
override fun onDestroy() {
Log.v(TAG, "Destroying Godot app...")
super.onDestroy()
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
index 43ae71f8e1..83e76e49c9 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
@@ -228,16 +228,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
public boolean onGenericMotionEvent(MotionEvent event) {
lastSeenToolType = getEventToolType(event);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && gestureDetector.onGenericMotionEvent(event)) {
- // The gesture detector has handled the event.
- return true;
- }
-
- if (godotGestureHandler.onMotionEvent(event)) {
- // The gesture handler has handled the event.
- return true;
- }
-
if (event.isFromSource(InputDevice.SOURCE_JOYSTICK) && event.getActionMasked() == MotionEvent.ACTION_MOVE) {
// Check if the device exists
final int deviceId = event.getDeviceId();
@@ -273,11 +263,20 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
}
return true;
}
- } else {
- return handleMouseEvent(event);
+ return false;
}
- return false;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && gestureDetector.onGenericMotionEvent(event)) {
+ // The gesture detector has handled the event.
+ return true;
+ }
+
+ if (godotGestureHandler.onMotionEvent(event)) {
+ // The gesture handler has handled the event.
+ return true;
+ }
+
+ return handleMouseEvent(event);
}
public void initInputDevices() {