diff options
Diffstat (limited to 'platform/android/java/lib')
3 files changed, 20 insertions, 3 deletions
diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle index 663ba73d40..fbed4ed078 100644 --- a/platform/android/java/lib/build.gradle +++ b/platform/android/java/lib/build.gradle @@ -2,9 +2,8 @@ apply plugin: 'com.android.library'  apply plugin: 'kotlin-android'  dependencies { -    implementation libraries.supportCoreUtils      implementation libraries.kotlinStdLib -    implementation libraries.v4Support +    implementation libraries.androidxFragment  }  def pathToRootDir = "../../../../" diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 896b169953..70bc73b9ad 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -295,7 +295,11 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC  		for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) {  			View pluginView = plugin.onMainCreate(activity);  			if (pluginView != null) { -				containerLayout.addView(pluginView); +				if (plugin.shouldBeOnTop()) { +					containerLayout.addView(pluginView); +				} else { +					containerLayout.addView(pluginView, 0); +				}  			}  		}  	} diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java index 2dc8359615..4536c21ed3 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java @@ -191,6 +191,9 @@ public abstract class GodotPlugin {  	 * The plugin can return a non-null {@link View} layout in order to add it to the Godot view  	 * hierarchy.  	 * +	 * Use shouldBeOnTop() to set whether the plugin's {@link View} should be added on top or behind +	 * the main Godot view. +	 *  	 * @see Activity#onCreate(Bundle)  	 * @return the plugin's view to be included; null if no views should be included.  	 */ @@ -311,6 +314,17 @@ public abstract class GodotPlugin {  	}  	/** +	 * Returns whether the plugin's {@link View} returned in onMainCreate() should be placed on +	 * top of the main Godot view. +	 * +	 * Returning false causes the plugin's {@link View} to be placed behind, which can be useful +	 * when used with transparency in order to let the Godot view handle inputs. +	 */ +	public boolean shouldBeOnTop() { +		return true; +	} + +	/**  	 * Runs the specified action on the UI thread. If the current thread is the UI  	 * thread, then the action is executed immediately. If the current thread is  	 * not the UI thread, the action is posted to the event queue of the UI thread.  |