summaryrefslogtreecommitdiff
path: root/platform/android/java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/app/AndroidManifest.xml2
-rw-r--r--platform/android/java/lib/AndroidManifest.xml2
-rw-r--r--platform/android/java/lib/res/drawable-nodpi/icon.pngbin7569 -> 0 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml5
-rw-r--r--platform/android/java/lib/res/mipmap-hdpi/icon.pngbin0 -> 3762 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-hdpi/icon_background.pngbin0 -> 375 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-hdpi/icon_foreground.pngbin0 -> 2998 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-mdpi/icon.pngbin0 -> 2672 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-mdpi/icon_background.pngbin0 -> 240 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-mdpi/icon_foreground.pngbin0 -> 1909 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xhdpi/icon.pngbin0 -> 5186 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xhdpi/icon_background.pngbin0 -> 517 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.pngbin0 -> 4490 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxhdpi/icon.pngbin0 -> 8154 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxhdpi/icon_background.pngbin0 -> 905 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.pngbin0 -> 7415 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxxhdpi/icon.pngbin0 -> 11749 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.pngbin0 -> 1360 bytes
-rw-r--r--platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.pngbin0 -> 11325 bytes
-rw-r--r--platform/android/java/lib/res/mipmap/icon.pngbin0 -> 11749 bytes
-rw-r--r--platform/android/java/lib/res/mipmap/icon_background.pngbin0 -> 240 bytes
-rw-r--r--platform/android/java/lib/res/mipmap/icon_foreground.pngbin0 -> 1909 bytes
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotLib.java10
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotView.java5
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java106
25 files changed, 128 insertions, 2 deletions
diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml
index ba01ec313b..7e9ce70d80 100644
--- a/platform/android/java/app/AndroidManifest.xml
+++ b/platform/android/java/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- Any tag in this line after android:icon will be erased when doing custom builds. -->
<!-- If you want to add tags manually, do before it. -->
<!-- WARNING: This should stay on a single line until the parsing code is improved. See GH-32414. -->
- <application android:label="@string/godot_project_name_string" android:allowBackup="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@drawable/icon" >
+ <application android:label="@string/godot_project_name_string" android:allowBackup="false" tools:ignore="GoogleAppIndexingWarning" android:icon="@mipmap/icon" >
<!-- The following metadata values are replaced when Godot exports, modifying them here has no effect. -->
<!-- Do these changes in the export preset. Adding new ones is fine. -->
diff --git a/platform/android/java/lib/AndroidManifest.xml b/platform/android/java/lib/AndroidManifest.xml
index 517fc403b2..b133585f99 100644
--- a/platform/android/java/lib/AndroidManifest.xml
+++ b/platform/android/java/lib/AndroidManifest.xml
@@ -11,7 +11,7 @@
</application>
<instrumentation
- android:icon="@drawable/icon"
+ android:icon="@mipmap/icon"
android:label="@string/godot_project_name_string"
android:name=".GodotInstrumentation"
android:targetPackage="org.godotengine.godot" />
diff --git a/platform/android/java/lib/res/drawable-nodpi/icon.png b/platform/android/java/lib/res/drawable-nodpi/icon.png
deleted file mode 100644
index 6ad9b43117..0000000000
--- a/platform/android/java/lib/res/drawable-nodpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml b/platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml
new file mode 100644
index 0000000000..1ed4037035
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-anydpi-v26/icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@mipmap/icon_background"/>
+ <foreground android:drawable="@mipmap/icon_foreground"/>
+</adaptive-icon> \ No newline at end of file
diff --git a/platform/android/java/lib/res/mipmap-hdpi/icon.png b/platform/android/java/lib/res/mipmap-hdpi/icon.png
new file mode 100644
index 0000000000..cc6e113e89
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-hdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-hdpi/icon_background.png b/platform/android/java/lib/res/mipmap-hdpi/icon_background.png
new file mode 100644
index 0000000000..78445c0181
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-hdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-hdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-hdpi/icon_foreground.png
new file mode 100644
index 0000000000..75e409ff74
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-hdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-mdpi/icon.png b/platform/android/java/lib/res/mipmap-mdpi/icon.png
new file mode 100644
index 0000000000..e1968fe142
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-mdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-mdpi/icon_background.png b/platform/android/java/lib/res/mipmap-mdpi/icon_background.png
new file mode 100644
index 0000000000..5813f751ed
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-mdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-mdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-mdpi/icon_foreground.png
new file mode 100644
index 0000000000..982b69be1e
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-mdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xhdpi/icon.png b/platform/android/java/lib/res/mipmap-xhdpi/icon.png
new file mode 100644
index 0000000000..9281d8da48
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xhdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xhdpi/icon_background.png b/platform/android/java/lib/res/mipmap-xhdpi/icon_background.png
new file mode 100644
index 0000000000..4269c822a7
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xhdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.png
new file mode 100644
index 0000000000..726b267ad6
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xhdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxhdpi/icon.png b/platform/android/java/lib/res/mipmap-xxhdpi/icon.png
new file mode 100644
index 0000000000..7a6b67d273
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxhdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxhdpi/icon_background.png b/platform/android/java/lib/res/mipmap-xxhdpi/icon_background.png
new file mode 100644
index 0000000000..5e8b518d17
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxhdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.png
new file mode 100644
index 0000000000..b0c727f74c
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxhdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxxhdpi/icon.png b/platform/android/java/lib/res/mipmap-xxxhdpi/icon.png
new file mode 100644
index 0000000000..0881245802
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxxhdpi/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.png b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.png
new file mode 100644
index 0000000000..004b6fd508
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.png b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.png
new file mode 100644
index 0000000000..72e6f92b6e
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap-xxxhdpi/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap/icon.png b/platform/android/java/lib/res/mipmap/icon.png
new file mode 100644
index 0000000000..0881245802
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap/icon.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap/icon_background.png b/platform/android/java/lib/res/mipmap/icon_background.png
new file mode 100644
index 0000000000..5813f751ed
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap/icon_background.png
Binary files differ
diff --git a/platform/android/java/lib/res/mipmap/icon_foreground.png b/platform/android/java/lib/res/mipmap/icon_foreground.png
new file mode 100644
index 0000000000..982b69be1e
--- /dev/null
+++ b/platform/android/java/lib/res/mipmap/icon_foreground.png
Binary files differ
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
index 8447af10e4..e0b46673ba 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
@@ -100,6 +100,16 @@ public class GodotLib {
public static native void hover(int type, int x, int y);
/**
+ * Forward double_tap events from the main thread to the GL thread.
+ */
+ public static native void doubletap(int x, int y);
+
+ /**
+ * Forward scroll events from the main thread to the GL thread.
+ */
+ public static native void scroll(int x, int y);
+
+ /**
* Forward accelerometer sensor events from the main thread to the GL thread.
* @see android.hardware.SensorEventListener#onSensorChanged(SensorEvent)
*/
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotView.java
index 78f3763d84..f938583082 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotView.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotView.java
@@ -32,8 +32,10 @@ package org.godotengine.godot;
import android.annotation.SuppressLint;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
+import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
+import org.godotengine.godot.input.GodotGestureHandler;
import org.godotengine.godot.input.GodotInputHandler;
import org.godotengine.godot.utils.GLUtils;
import org.godotengine.godot.xr.XRMode;
@@ -68,6 +70,7 @@ public class GodotView extends GLSurfaceView {
private final Godot activity;
private final GodotInputHandler inputHandler;
+ private final GestureDetector detector;
private final GodotRenderer godotRenderer;
public GodotView(Godot activity, XRMode xrMode, boolean p_use_gl3, boolean p_use_32_bits, boolean p_use_debug_opengl) {
@@ -78,6 +81,7 @@ public class GodotView extends GLSurfaceView {
this.activity = activity;
this.inputHandler = new GodotInputHandler(this);
+ this.detector = new GestureDetector(activity, new GodotGestureHandler(this));
this.godotRenderer = new GodotRenderer();
init(xrMode, false, 16, 0);
}
@@ -90,6 +94,7 @@ public class GodotView extends GLSurfaceView {
@Override
public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
+ this.detector.onTouchEvent(event);
return activity.gotTouchEvent(event);
}
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
new file mode 100644
index 0000000000..1a38a9c3d2
--- /dev/null
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java
@@ -0,0 +1,106 @@
+/*************************************************************************/
+/* GodotGestureHandler.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+package org.godotengine.godot.input;
+
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import org.godotengine.godot.GodotLib;
+import org.godotengine.godot.GodotView;
+
+/**
+ * Handles gesture input related events for the {@link GodotView} view.
+ * https://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener
+ */
+public class GodotGestureHandler extends GestureDetector.SimpleOnGestureListener {
+
+ private final GodotView godotView;
+
+ public GodotGestureHandler(GodotView godotView) {
+ this.godotView = godotView;
+ }
+
+ private void queueEvent(Runnable task) {
+ godotView.queueEvent(task);
+ }
+
+ @Override
+ public boolean onDown(MotionEvent event) {
+ super.onDown(event);
+ //Log.i("GodotGesture", "onDown");
+ return true;
+ }
+
+ @Override
+ public boolean onSingleTapConfirmed(MotionEvent event) {
+ super.onSingleTapConfirmed(event);
+ return true;
+ }
+
+ @Override
+ public void onLongPress(MotionEvent event) {
+ //Log.i("GodotGesture", "onLongPress");
+ }
+
+ @Override
+ public boolean onDoubleTap(MotionEvent event) {
+ //Log.i("GodotGesture", "onDoubleTap");
+ final int x = Math.round(event.getX());
+ final int y = Math.round(event.getY());
+ queueEvent(new Runnable() {
+ @Override
+ public void run() {
+ GodotLib.doubletap(x, y);
+ }
+ });
+ return true;
+ }
+
+ @Override
+ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+ //Log.i("GodotGesture", "onScroll");
+ final int x = Math.round(distanceX);
+ final int y = Math.round(distanceY);
+ queueEvent(new Runnable() {
+ @Override
+ public void run() {
+ GodotLib.scroll(x, y);
+ }
+ });
+ return true;
+ }
+
+ @Override
+ public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) {
+ //Log.i("GodotGesture", "onFling");
+ return true;
+ }
+}