citra_android: Use androidx splash screen (#6355)

This commit is contained in:
Charles Lombardo 2023-03-16 02:30:47 -04:00 committed by GitHub
parent e18e30a8cc
commit 27c280534d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View file

@ -126,6 +126,7 @@ dependencies {
implementation 'androidx.fragment:fragment:1.5.3' implementation 'androidx.fragment:fragment:1.5.3'
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0" implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
implementation 'com.google.android.material:material:1.6.1' implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.core:core-splashscreen:1.0.0'
// For loading huge screenshots from the disk. // For loading huge screenshots from the disk.
implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.squareup.picasso:picasso:2.71828'

View file

@ -44,7 +44,7 @@
<activity <activity
android:name="org.citra.citra_emu.ui.main.MainActivity" android:name="org.citra.citra_emu.ui.main.MainActivity"
android:theme="@style/Theme.Citra.Main" android:theme="@style/Theme.Citra.Splash.Main"
android:resizeableActivity="false"> android:resizeableActivity="false">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. --> <!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->

View file

@ -11,6 +11,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.splashscreen.SplashScreen;
import org.citra.citra_emu.NativeLibrary; import org.citra.citra_emu.NativeLibrary;
import org.citra.citra_emu.R; import org.citra.citra_emu.R;
@ -48,6 +49,9 @@ public final class MainActivity extends AppCompatActivity implements MainView {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
splashScreen.setKeepOnScreenCondition(() -> !DirectoryInitialization.areCitraDirectoriesReady());
ThemeUtil.applyTheme(this); ThemeUtil.applyTheme(this);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Theme.Citra.Splash.Main" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/citra_surface</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_citra</item>
<item name="postSplashScreenTheme">@style/Theme.Citra.Main</item>
</style>
<style name="Theme.Citra.Main" parent="Theme.Material3.DayNight.NoActionBar"> <style name="Theme.Citra.Main" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Main theme colors --> <!-- Main theme colors -->
<item name="colorPrimary">@color/citra_primary</item> <item name="colorPrimary">@color/citra_primary</item>