summaryrefslogtreecommitdiffstats
path: root/platform/android/java
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuyakou@gmail.com>2024-06-09 17:02:03 -0700
committerFredia Huya-Kouadio <fhuyakou@gmail.com>2024-06-10 00:59:36 -0700
commitf20e21a6d6b91fee2106be2fea5f794cfed7578f (patch)
treeea80e056ea686ce71f9521a368a6c726df12e22f /platform/android/java
parentdd966f5680eac1b068d9492d6dbba572cff54936 (diff)
downloadredot-engine-f20e21a6d6b91fee2106be2fea5f794cfed7578f.tar.gz
Update the splash screen logic for the Godot app template
Due to limitations to the splash screen introduced in Android 12, the splash screen logic is updated to the same logic as used on other platforms, i.e: the splash screen is rendered by the Godot engine instead of the Android runtime.
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/app/build.gradle1
-rw-r--r--platform/android/java/app/res/drawable-nodpi/splash.pngbin14766 -> 0 bytes
-rw-r--r--platform/android/java/app/res/drawable-nodpi/splash_bg_color.pngbin1360 -> 0 bytes
-rw-r--r--platform/android/java/app/res/drawable/splash_drawable.xml12
-rw-r--r--platform/android/java/app/res/values/themes.xml15
-rw-r--r--platform/android/java/app/src/com/godot/game/GodotApp.java4
6 files changed, 16 insertions, 16 deletions
diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle
index bde6a93c86..01d5d9ef92 100644
--- a/platform/android/java/app/build.gradle
+++ b/platform/android/java/app/build.gradle
@@ -32,6 +32,7 @@ configurations {
dependencies {
implementation "androidx.fragment:fragment:$versions.fragmentVersion"
+ implementation "androidx.core:core-splashscreen:$versions.splashscreenVersion"
if (rootProject.findProject(":lib")) {
implementation project(":lib")
diff --git a/platform/android/java/app/res/drawable-nodpi/splash.png b/platform/android/java/app/res/drawable-nodpi/splash.png
deleted file mode 100644
index 7bddd4325a..0000000000
--- a/platform/android/java/app/res/drawable-nodpi/splash.png
+++ /dev/null
Binary files differ
diff --git a/platform/android/java/app/res/drawable-nodpi/splash_bg_color.png b/platform/android/java/app/res/drawable-nodpi/splash_bg_color.png
deleted file mode 100644
index 004b6fd508..0000000000
--- a/platform/android/java/app/res/drawable-nodpi/splash_bg_color.png
+++ /dev/null
Binary files differ
diff --git a/platform/android/java/app/res/drawable/splash_drawable.xml b/platform/android/java/app/res/drawable/splash_drawable.xml
deleted file mode 100644
index 30627b998c..0000000000
--- a/platform/android/java/app/res/drawable/splash_drawable.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:drawable="@drawable/splash_bg_color" />
-
- <item>
- <bitmap
- android:gravity="center"
- android:filter="false"
- android:src="@drawable/splash" />
- </item>
-</layer-list>
diff --git a/platform/android/java/app/res/values/themes.xml b/platform/android/java/app/res/values/themes.xml
index d64b50ca45..3ab8401928 100644
--- a/platform/android/java/app/res/values/themes.xml
+++ b/platform/android/java/app/res/values/themes.xml
@@ -3,8 +3,17 @@
<style name="GodotAppMainTheme" parent="@android:style/Theme.Black.NoTitleBar"/>
- <style name="GodotAppSplashTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">
- <item name="android:windowBackground">@drawable/splash_drawable</item>
- <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
+ <style name="GodotAppSplashTheme" parent="Theme.SplashScreen">
+ <!-- Set the splash screen background, animated icon, and animation
+ duration. -->
+ <item name="android:windowSplashScreenBackground">@mipmap/icon_background</item>
+
+ <!-- Use windowSplashScreenAnimatedIcon to add a drawable or an animated
+ drawable. One of these is required. -->
+ <item name="windowSplashScreenAnimatedIcon">@mipmap/icon_foreground</item>
+
+ <!-- Set the theme of the Activity that directly follows your splash
+ screen. This is required. -->
+ <item name="postSplashScreenTheme">@style/GodotAppMainTheme</item>
</style>
</resources>
diff --git a/platform/android/java/app/src/com/godot/game/GodotApp.java b/platform/android/java/app/src/com/godot/game/GodotApp.java
index 9142d767b4..22e617f6e7 100644
--- a/platform/android/java/app/src/com/godot/game/GodotApp.java
+++ b/platform/android/java/app/src/com/godot/game/GodotApp.java
@@ -34,6 +34,8 @@ import org.godotengine.godot.GodotActivity;
import android.os.Bundle;
+import androidx.core.splashscreen.SplashScreen;
+
/**
* Template activity for Godot Android builds.
* Feel free to extend and modify this class for your custom logic.
@@ -41,7 +43,7 @@ import android.os.Bundle;
public class GodotApp extends GodotActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
- setTheme(R.style.GodotAppMainTheme);
+ SplashScreen.installSplashScreen(this);
super.onCreate(savedInstanceState);
}
}