Android: Add export options to customize splash screen

This commit is contained in:
Anish Kumar
2026-01-07 14:05:27 +05:30
parent 755fa449c4
commit ee82a8f69d
8 changed files with 138 additions and 12 deletions
@@ -11,7 +11,8 @@
To add custom attributes, use the "gradle_build/custom_theme_attributes" Android export option. -->
<style name="GodotAppSplashTheme" parent="Theme.SplashScreen">
<item name="android:windowSplashScreenBackground">@mipmap/icon_background</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/icon_foreground</item>
<item name="android:windowSplashScreenBrandingImage">@drawable/splash_branding_image</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
<item name="postSplashScreenTheme">@style/GodotAppMainTheme</item>
<item name="android:windowIsTranslucent">false</item>
</style>
@@ -67,9 +67,14 @@ public class GodotApp extends GodotActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
SplashScreen.installSplashScreen(this);
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
EdgeToEdge.enable(this);
super.onCreate(savedInstanceState);
Godot godot = getGodot();
if (godot != null && godot.getDisableGodotSplash()) {
splashScreen.setKeepOnScreenCondition(() -> godot.getRunStatus() != Godot.RunStatus.STARTED);
}
}
@Override
@@ -204,6 +204,8 @@ class Godot private constructor(val context: Context) {
internal var darkMode = false
private var backgroundColor: Int = Color.BLACK
private var orientation = Configuration.ORIENTATION_UNDEFINED
var disableGodotSplash = false
private set
internal var containerLayout: FrameLayout? = null
var renderView: GodotRenderView? = null
@@ -276,6 +278,8 @@ class Godot private constructor(val context: Context) {
newArgs.add(commandLine[i])
} else if (commandLine[i] == "--background_color") {
setWindowColor(commandLine[i + 1])
} else if (commandLine[i] == "--disable_godot_splash") {
disableGodotSplash = true
} else if (commandLine[i] == "--use_apk_expansion") {
useApkExpansion = true
} else if (hasExtra && commandLine[i] == "--apk_expansion_md5") {
Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB