Configure the splash screen for the Android editor
This commit is contained in:
parent
5833f59786
commit
dd966f5680
|
@ -11,7 +11,8 @@ ext.versions = [
|
||||||
nexusPublishVersion: '1.3.0',
|
nexusPublishVersion: '1.3.0',
|
||||||
javaVersion : JavaVersion.VERSION_17,
|
javaVersion : JavaVersion.VERSION_17,
|
||||||
// Also update 'platform/android/detect.py#get_ndk_version()' when this is updated.
|
// Also update 'platform/android/detect.py#get_ndk_version()' when this is updated.
|
||||||
ndkVersion : '23.2.8568313'
|
ndkVersion : '23.2.8568313',
|
||||||
|
splashscreenVersion: '1.0.1'
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ dependencies {
|
||||||
implementation project(":lib")
|
implementation project(":lib")
|
||||||
|
|
||||||
implementation "androidx.window:window:1.2.0"
|
implementation "androidx.window:window:1.2.0"
|
||||||
|
implementation "androidx.core:core-splashscreen:$versions.splashscreenVersion"
|
||||||
|
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
|
@ -92,6 +94,10 @@ android {
|
||||||
targetSdkVersion versions.targetSdk
|
targetSdkVersion versions.targetSdk
|
||||||
|
|
||||||
missingDimensionStrategy 'products', 'editor'
|
missingDimensionStrategy 'products', 'editor'
|
||||||
|
manifestPlaceholders += [
|
||||||
|
editorAppName: "Godot Editor 4",
|
||||||
|
editorBuildSuffix: ""
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
base {
|
base {
|
||||||
|
@ -124,11 +130,13 @@ android {
|
||||||
dev {
|
dev {
|
||||||
initWith debug
|
initWith debug
|
||||||
applicationIdSuffix ".dev"
|
applicationIdSuffix ".dev"
|
||||||
|
manifestPlaceholders += [editorBuildSuffix: " (dev)"]
|
||||||
}
|
}
|
||||||
|
|
||||||
debug {
|
debug {
|
||||||
initWith release
|
initWith release
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
|
manifestPlaceholders += [editorBuildSuffix: " (debug)"]
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="godot_editor_name_string">Godot Editor 4 (debug)</string>
|
|
||||||
</resources>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="godot_editor_name_string">Godot Editor 4 (dev)</string>
|
|
||||||
</resources>
|
|
|
@ -13,12 +13,15 @@
|
||||||
android:glEsVersion="0x00030000"
|
android:glEsVersion="0x00030000"
|
||||||
android:required="true" />
|
android:required="true" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
<uses-permission
|
||||||
|
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||||
tools:ignore="ScopedStorage" />
|
tools:ignore="ScopedStorage" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
<uses-permission
|
||||||
android:maxSdkVersion="29"/>
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
|
android:maxSdkVersion="29" />
|
||||||
android:maxSdkVersion="29"/>
|
<uses-permission
|
||||||
|
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="29" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
@ -26,39 +29,44 @@
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:icon="@mipmap/icon"
|
android:icon="@mipmap/icon"
|
||||||
android:label="@string/godot_editor_name_string"
|
android:label="${editorAppName}${editorBuildSuffix}"
|
||||||
tools:ignore="GoogleAppIndexingWarning"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:theme="@style/GodotEditorTheme"
|
android:theme="@style/GodotEditorSplashScreenTheme"
|
||||||
android:requestLegacyExternalStorage="true">
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
|
<profileable
|
||||||
|
android:shell="true"
|
||||||
|
android:enabled="true"
|
||||||
|
tools:targetApi="29" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".GodotEditor"
|
android:name=".GodotEditor"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
|
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
|
||||||
|
android:exported="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="userLandscape"
|
android:screenOrientation="userLandscape">
|
||||||
android:exported="true">
|
<layout
|
||||||
<layout android:defaultHeight="@dimen/editor_default_window_height"
|
android:defaultWidth="@dimen/editor_default_window_width"
|
||||||
android:defaultWidth="@dimen/editor_default_window_width" />
|
android:defaultHeight="@dimen/editor_default_window_height" />
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".GodotGame"
|
android:name=".GodotGame"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
|
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
|
||||||
android:label="@string/godot_project_name_string"
|
|
||||||
android:process=":GodotGame"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
android:label="@string/godot_project_name_string"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:process=":GodotGame"
|
||||||
android:screenOrientation="userLandscape">
|
android:screenOrientation="userLandscape">
|
||||||
<layout android:defaultHeight="@dimen/editor_default_window_height"
|
<layout
|
||||||
android:defaultWidth="@dimen/editor_default_window_width" />
|
android:defaultWidth="@dimen/editor_default_window_width"
|
||||||
|
android:defaultHeight="@dimen/editor_default_window_height" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -38,8 +38,10 @@ import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.*
|
import android.os.*
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import androidx.window.layout.WindowMetricsCalculator
|
import androidx.window.layout.WindowMetricsCalculator
|
||||||
import org.godotengine.godot.GodotActivity
|
import org.godotengine.godot.GodotActivity
|
||||||
import org.godotengine.godot.GodotLib
|
import org.godotengine.godot.GodotLib
|
||||||
|
@ -88,8 +90,13 @@ open class GodotEditor : GodotActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private val commandLineParams = ArrayList<String>()
|
private val commandLineParams = ArrayList<String>()
|
||||||
|
private val editorLoadingIndicator: View? by lazy { findViewById(R.id.editor_loading_indicator) }
|
||||||
|
|
||||||
|
override fun getGodotAppLayout() = R.layout.godot_editor_layout
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
installSplashScreen()
|
||||||
|
|
||||||
// We exclude certain permissions from the set we request at startup, as they'll be
|
// We exclude certain permissions from the set we request at startup, as they'll be
|
||||||
// requested on demand based on use-cases.
|
// requested on demand based on use-cases.
|
||||||
PermissionsUtil.requestManifestPermissions(this, setOf(Manifest.permission.RECORD_AUDIO))
|
PermissionsUtil.requestManifestPermissions(this, setOf(Manifest.permission.RECORD_AUDIO))
|
||||||
|
@ -121,6 +128,14 @@ open class GodotEditor : GodotActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onGodotMainLoopStarted() {
|
||||||
|
super.onGodotMainLoopStarted()
|
||||||
|
runOnUiThread {
|
||||||
|
// Hide the loading indicator
|
||||||
|
editorLoadingIndicator?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for project permissions to enable
|
* Check for project permissions to enable
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,6 +34,9 @@ package org.godotengine.editor
|
||||||
* Drives the 'run project' window of the Godot Editor.
|
* Drives the 'run project' window of the Godot Editor.
|
||||||
*/
|
*/
|
||||||
class GodotGame : GodotEditor() {
|
class GodotGame : GodotEditor() {
|
||||||
|
|
||||||
|
override fun getGodotAppLayout() = org.godotengine.godot.R.layout.godot_app_layout
|
||||||
|
|
||||||
override fun overrideOrientationRequest() = false
|
override fun overrideOrientationRequest() = false
|
||||||
|
|
||||||
override fun enableLongPressGestures() = false
|
override fun enableLongPressGestures() = false
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/godot_fragment_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
style="@android:style/Widget.Holo.ProgressBar.Large"
|
||||||
|
android:id="@+id/editor_loading_indicator"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:indeterminate="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.80"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,6 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="godot_editor_name_string">Godot Editor 4</string>
|
|
||||||
|
|
||||||
<string name="denied_storage_permission_error_msg">Missing storage access permission!</string>
|
<string name="denied_storage_permission_error_msg">Missing storage access permission!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2,4 +2,10 @@
|
||||||
<resources>
|
<resources>
|
||||||
<style name="GodotEditorTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">
|
<style name="GodotEditorTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="GodotEditorSplashScreenTheme" parent="Theme.SplashScreen.IconBackground">
|
||||||
|
<!-- Set the theme of the Activity that directly follows your splash
|
||||||
|
screen. This is required. -->
|
||||||
|
<item name="postSplashScreenTheme">@style/GodotEditorTheme</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -36,6 +36,7 @@ import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
|
import androidx.annotation.LayoutRes
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import org.godotengine.godot.utils.PermissionsUtil
|
import org.godotengine.godot.utils.PermissionsUtil
|
||||||
import org.godotengine.godot.utils.ProcessPhoenix
|
import org.godotengine.godot.utils.ProcessPhoenix
|
||||||
|
@ -65,7 +66,7 @@ abstract class GodotActivity : FragmentActivity(), GodotHost {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.godot_app_layout)
|
setContentView(getGodotAppLayout())
|
||||||
|
|
||||||
handleStartIntent(intent, true)
|
handleStartIntent(intent, true)
|
||||||
|
|
||||||
|
@ -80,6 +81,9 @@ abstract class GodotActivity : FragmentActivity(), GodotHost {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@LayoutRes
|
||||||
|
protected open fun getGodotAppLayout() = R.layout.godot_app_layout
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
Log.v(TAG, "Destroying Godot app...")
|
Log.v(TAG, "Destroying Godot app...")
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
|
Loading…
Reference in New Issue