|
@@ -37,10 +37,12 @@ import android.os.Build
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
import android.os.Debug
|
|
import android.os.Debug
|
|
import android.os.Environment
|
|
import android.os.Environment
|
|
|
|
+import android.util.Log
|
|
import android.widget.Toast
|
|
import android.widget.Toast
|
|
import androidx.window.layout.WindowMetricsCalculator
|
|
import androidx.window.layout.WindowMetricsCalculator
|
|
import org.godotengine.godot.FullScreenGodotApp
|
|
import org.godotengine.godot.FullScreenGodotApp
|
|
import org.godotengine.godot.utils.PermissionsUtil
|
|
import org.godotengine.godot.utils.PermissionsUtil
|
|
|
|
+import org.godotengine.godot.utils.ProcessPhoenix
|
|
import java.util.*
|
|
import java.util.*
|
|
import kotlin.math.min
|
|
import kotlin.math.min
|
|
|
|
|
|
@@ -56,12 +58,17 @@ import kotlin.math.min
|
|
open class GodotEditor : FullScreenGodotApp() {
|
|
open class GodotEditor : FullScreenGodotApp() {
|
|
|
|
|
|
companion object {
|
|
companion object {
|
|
|
|
+ private val TAG = GodotEditor::class.java.simpleName
|
|
|
|
+
|
|
private const val WAIT_FOR_DEBUGGER = false
|
|
private const val WAIT_FOR_DEBUGGER = false
|
|
|
|
|
|
private const val COMMAND_LINE_PARAMS = "command_line_params"
|
|
private const val COMMAND_LINE_PARAMS = "command_line_params"
|
|
|
|
|
|
private const val EDITOR_ARG = "--editor"
|
|
private const val EDITOR_ARG = "--editor"
|
|
|
|
+ private const val EDITOR_ARG_SHORT = "-e"
|
|
|
|
+
|
|
private const val PROJECT_MANAGER_ARG = "--project-manager"
|
|
private const val PROJECT_MANAGER_ARG = "--project-manager"
|
|
|
|
+ private const val PROJECT_MANAGER_ARG_SHORT = "-p"
|
|
}
|
|
}
|
|
|
|
|
|
private val commandLineParams = ArrayList<String>()
|
|
private val commandLineParams = ArrayList<String>()
|
|
@@ -105,13 +112,13 @@ open class GodotEditor : FullScreenGodotApp() {
|
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && (isInMultiWindowMode || isLargeScreen)
|
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && (isInMultiWindowMode || isLargeScreen)
|
|
|
|
|
|
for (arg in args) {
|
|
for (arg in args) {
|
|
- if (EDITOR_ARG == arg) {
|
|
|
|
|
|
+ if (EDITOR_ARG == arg || EDITOR_ARG_SHORT == arg) {
|
|
targetClass = GodotEditor::class.java
|
|
targetClass = GodotEditor::class.java
|
|
launchAdjacent = false
|
|
launchAdjacent = false
|
|
break
|
|
break
|
|
}
|
|
}
|
|
|
|
|
|
- if (PROJECT_MANAGER_ARG == arg) {
|
|
|
|
|
|
+ if (PROJECT_MANAGER_ARG == arg || PROJECT_MANAGER_ARG_SHORT == arg) {
|
|
targetClass = GodotProjectManager::class.java
|
|
targetClass = GodotProjectManager::class.java
|
|
launchAdjacent = false
|
|
launchAdjacent = false
|
|
break
|
|
break
|
|
@@ -125,7 +132,13 @@ open class GodotEditor : FullScreenGodotApp() {
|
|
if (launchAdjacent) {
|
|
if (launchAdjacent) {
|
|
newInstance.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT)
|
|
newInstance.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT)
|
|
}
|
|
}
|
|
- startActivity(newInstance)
|
|
|
|
|
|
+ if (targetClass == javaClass) {
|
|
|
|
+ Log.d(TAG, "Restarting $targetClass")
|
|
|
|
+ ProcessPhoenix.triggerRebirth(this, newInstance)
|
|
|
|
+ } else {
|
|
|
|
+ Log.d(TAG, "Starting $targetClass")
|
|
|
|
+ startActivity(newInstance)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// Get the screen's density scale
|
|
// Get the screen's density scale
|