Migrate to Android 12 splash screen implementation

This commit is contained in:
CappielloAntonio 2021-08-04 08:33:53 +02:00
parent a531502a1b
commit 43c78c6e9b
8 changed files with 37 additions and 1 deletions

View file

@ -52,6 +52,9 @@ dependencies {
// Android Material
implementation 'com.google.android.material:material:1.4.0'
// Splashscreen
implementation 'androidx.core:core-splashscreen:1.0.0-alpha01'
// VolleyRequest
implementation 'com.android.volley:volley:1.2.0'

View file

@ -13,7 +13,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:theme="@style/Theme.App.Starting"
android:usesCleartextTraffic="true">
<activity
android:name=".ui.activity.MainActivity"

View file

@ -6,6 +6,7 @@ import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.splashscreen.SplashScreen;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.NavController;
@ -44,6 +45,8 @@ public class MainActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SplashScreen.installSplashScreen(this);
bind = ActivityMainBinding.inflate(getLayoutInflater());
View view = bind.getRoot();
setContentView(view);

View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/colorPrimary</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>

View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/colorPrimary</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>