Godot Engine – Multi-platform 2D and 3D game engine
Android editor: Enable screen orientation change on large screens
Anish Kumar986d5ebfd545
diff --git a/platform/android/java/editor/src/main/AndroidManifest.xml b/platform/android/java/editor/src/main/AndroidManifest.xmlindex e6bbada469b..8c5aada6eed 100644--- a/platform/android/java/editor/src/main/AndroidManifest.xml+++ b/platform/android/java/editor/src/main/AndroidManifest.xml@@ -61,7 +61,7 @@android:exported="false"android:icon="@mipmap/themed_icon"android:launchMode="singleInstancePerTask"- android:screenOrientation="userLandscape">+ android:screenOrientation="user"><layoutandroid:defaultWidth="@dimen/editor_default_window_width"android:defaultHeight="@dimen/editor_default_window_height" />diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.ktindex b7e198bcf8b..bd9ce87890e 100644--- a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt+++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt@@ -277,6 +277,13 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe// Add the game menu bar.setupGameMenuBar()++ if (!isLargeScreen) {+ // Lock the editor screen orientation to landscape on small screens.+ changingOrientationAllowed = true+ requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE+ changingOrientationAllowed = false+ }}override fun onConfigurationChanged(newConfig: Configuration) {@@ -720,7 +727,7 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe/*** The Godot Android Editor sets its own orientation via its AndroidManifest*/- protected open fun overrideOrientationRequest() = !changingOrientationAllowed+ protected open fun overrideOrientationRequest() = isLargeScreen || godot?.isProjectManagerHint() == true || !changingOrientationAllowedprotected open fun overrideVolumeButtons() = false@@ -939,12 +946,16 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe}}- toggleScriptEditorOrientation()+ if (!isLargeScreen) {+ toggleScriptEditorOrientation()+ }}override fun onDistractionFreeModeChanged(enabled: Boolean) {distractionFreeModeEnabled = enabled- toggleScriptEditorOrientation()+ if (!isLargeScreen) {+ toggleScriptEditorOrientation()+ }}private fun toggleScriptEditorOrientation() {