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

1
.idea/.name generated Normal file
View file

@ -0,0 +1 @@
Play

17
.idea/deploymentTargetDropDown.xml generated Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_3a_API_30_x86.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-08-04T06:28:38.102773Z" />
</component>
</project>

2
.idea/misc.xml generated
View file

@ -3,8 +3,10 @@
<component name="DesignSurface"> <component name="DesignSurface">
<option name="filePathToZoomLevelMap"> <option name="filePathToZoomLevelMap">
<map> <map>
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2814814814814815" />
<entry key="app/src/main/res/drawable/ic_downloading.xml" value="0.2722222222222222" /> <entry key="app/src/main/res/drawable/ic_downloading.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_file_download.xml" value="0.2722222222222222" /> <entry key="app/src/main/res/drawable/ic_file_download.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.2814814814814815" />
<entry key="app/src/main/res/drawable/ic_refresh.xml" value="0.18958333333333333" /> <entry key="app/src/main/res/drawable/ic_refresh.xml" value="0.18958333333333333" />
<entry key="app/src/main/res/drawable/ic_shuffle.xml" value="0.2722222222222222" /> <entry key="app/src/main/res/drawable/ic_shuffle.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_star.xml" value="0.2722222222222222" /> <entry key="app/src/main/res/drawable/ic_star.xml" value="0.2722222222222222" />

View file

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

View file

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

View file

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

View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <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"> <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>

View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <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"> <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>