Godot Engine – Multi-platform 2D and 3D game engine
[Android] Fix orientation detection on startup
Fredia Huya-Kouadioc2d813844db5
diff --git a/platform/android/java/lib/src/main/java/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/main/java/org/godotengine/godot/Godot.ktindex 61b200b6ae7..5362d21a205 100644--- a/platform/android/java/lib/src/main/java/org/godotengine/godot/Godot.kt+++ b/platform/android/java/lib/src/main/java/org/godotengine/godot/Godot.kt@@ -784,18 +784,19 @@ class Godot private constructor(val context: Context) {/*** Configuration change callback*/- fun onConfigurationChanged(newConfig: Configuration) {+ @JvmOverloads+ fun onConfigurationChanged(newConfig: Configuration, force: Boolean = false) {godotInputHandler.onConfigurationChanged(newConfig)val newDarkMode = newConfig.uiMode.and(Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES- if (darkMode != newDarkMode) {+ if (force || darkMode != newDarkMode) {darkMode = newDarkModerunOnRenderThread {GodotLib.onNightModeChanged()}}- if (orientation != newConfig.orientation) {+ if (force || orientation != newConfig.orientation) {orientation = newConfig.orientationrunOnRenderThread {GodotLib.onOrientationChange(orientation)@@ -900,6 +901,7 @@ class Godot private constructor(val context: Context) {getActivity()?.reportFullyDrawn()registerSensorsIfNeeded()+ onConfigurationChanged(context.resources.configuration, true)}for (plugin in pluginRegistry.allPlugins) {