|
@@ -84,7 +84,7 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
}
|
|
|
|
|
|
private val pluginRegistry: GodotPluginRegistry by lazy {
|
|
|
- GodotPluginRegistry.initializePluginRegistry(this)
|
|
|
+ GodotPluginRegistry.getPluginRegistry()
|
|
|
}
|
|
|
private val mSensorManager: SensorManager by lazy {
|
|
|
requireActivity().getSystemService(Context.SENSOR_SERVICE) as SensorManager
|
|
@@ -190,7 +190,7 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
val activity = requireActivity()
|
|
|
val window = activity.window
|
|
|
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
|
|
|
- GodotPluginRegistry.initializePluginRegistry(this)
|
|
|
+ GodotPluginRegistry.initializePluginRegistry(this, primaryHost.getHostPlugins(this))
|
|
|
if (io == null) {
|
|
|
io = GodotIO(activity)
|
|
|
}
|
|
@@ -250,11 +250,7 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
}
|
|
|
i++
|
|
|
}
|
|
|
- if (newArgs.isEmpty()) {
|
|
|
- commandLine = mutableListOf()
|
|
|
- } else {
|
|
|
- commandLine = newArgs
|
|
|
- }
|
|
|
+ commandLine = if (newArgs.isEmpty()) { mutableListOf() } else { newArgs }
|
|
|
if (useApkExpansion && mainPackMd5 != null && mainPackKey != null) {
|
|
|
// Build the full path to the app's expansion files
|
|
|
try {
|
|
@@ -392,6 +388,10 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
// Fallback to openGl
|
|
|
GodotGLRenderView(host, this, xrMode, useDebugOpengl)
|
|
|
}
|
|
|
+
|
|
|
+ renderView?.inputHandler?.enableLongPress(java.lang.Boolean.parseBoolean(GodotLib.getGlobal("input_devices/pointing/android/enable_long_press_as_right_click")))
|
|
|
+ renderView?.inputHandler?.enablePanningAndScalingGestures(java.lang.Boolean.parseBoolean(GodotLib.getGlobal("input_devices/pointing/android/enable_pan_and_scale_gestures")))
|
|
|
+
|
|
|
if (host == primaryHost) {
|
|
|
renderView!!.startRenderer()
|
|
|
}
|
|
@@ -616,7 +616,7 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
|
|
|
private fun alert(message: String, title: String, okCallback: Runnable?) {
|
|
|
val activity: Activity = getActivity() ?: return
|
|
|
- runOnUiThread(Runnable {
|
|
|
+ runOnUiThread {
|
|
|
val builder = AlertDialog.Builder(activity)
|
|
|
builder.setMessage(message).setTitle(title)
|
|
|
builder.setPositiveButton(
|
|
@@ -627,7 +627,7 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
}
|
|
|
val dialog = builder.create()
|
|
|
dialog.show()
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -685,9 +685,9 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
- private fun setKeepScreenOn(p_enabled: Boolean) {
|
|
|
+ private fun setKeepScreenOn(enabled: Boolean) {
|
|
|
runOnUiThread {
|
|
|
- if (p_enabled) {
|
|
|
+ if (enabled) {
|
|
|
getActivity()?.window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
|
|
} else {
|
|
|
getActivity()?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
|
@@ -835,9 +835,7 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
|
|
|
- // Do something here if sensor accuracy changes.
|
|
|
- }
|
|
|
+ override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {}
|
|
|
|
|
|
/**
|
|
|
* Used by the native code (java_godot_wrapper.h) to vibrate the device.
|
|
@@ -865,7 +863,7 @@ class Godot(private val context: Context) : SensorEventListener {
|
|
|
private fun getCommandLine(): MutableList<String> {
|
|
|
val original: MutableList<String> = parseCommandLine()
|
|
|
val hostCommandLine = primaryHost?.commandLine
|
|
|
- if (hostCommandLine != null && hostCommandLine.isNotEmpty()) {
|
|
|
+ if (!hostCommandLine.isNullOrEmpty()) {
|
|
|
original.addAll(hostCommandLine)
|
|
|
}
|
|
|
return original
|