Switched to SplashScreen API

This commit is contained in:
Arty Bishop committed 2021-10-27 21:47:02 +01:00
1 parent 8c7e2c9bb0
commit 09f35579dc
7 files changed
+10 -13

No files matched your search

+1
View File
@@ -45,6 +45,7 @@ android {
dependencies { dependencies {
implementation project(':core') implementation project(':core')
implementation "com.google.android.material:material:$material_version" implementation "com.google.android.material:material:$material_version"
implementation "androidx.core:core-splashscreen:$splash_screen_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version" implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
+1 -1
View File
@@ -14,7 +14,7 @@
<activity <activity
android:name=".presentation.Look4SatActivity" android:name=".presentation.Look4SatActivity"
android:exported="true" android:exported="true"
android:theme="@style/AppTheme.Splash"> android:theme="@style/Theme.Look4Sat.SplashScreen">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
@@ -21,6 +21,7 @@ import android.annotation.SuppressLint
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.fragment.NavHostFragment import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController import androidx.navigation.ui.setupWithNavController
import com.rtbishop.look4sat.R import com.rtbishop.look4sat.R
@@ -33,8 +34,8 @@ class Look4SatActivity : AppCompatActivity() {
@SuppressLint("SourceLockedOrientationActivity") @SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
installSplashScreen()
val binding = ActivityMainBinding.inflate(layoutInflater) val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
val navHost = supportFragmentManager.findFragmentById(R.id.main_nav_host) as NavHostFragment val navHost = supportFragmentManager.findFragmentById(R.id.main_nav_host) as NavHostFragment
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@drawable/ic_launcher_background" />
<item
android:drawable="@drawable/splash_foreground"
android:gravity="center" />
</layer-list>
+5 -3
View File
@@ -1,10 +1,12 @@
<resources> <resources>
<style name="AppTheme.Splash" parent="AppTheme"> <style name="Theme.Look4Sat.SplashScreen" parent="Theme.SplashScreen">
<item name="android:windowBackground">@drawable/splash_drawable</item> <item name="windowSplashScreenBackground">@color/greyDark</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash_drawable</item>
<item name="postSplashScreenTheme">@style/Theme.Look4Sat.Main</item>
</style> </style>
<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar"> <style name="Theme.Look4Sat.Main" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">@color/themeLight</item> <item name="colorPrimary">@color/themeLight</item>
<item name="colorSecondary">@color/themeLight</item> <item name="colorSecondary">@color/themeLight</item>
<item name="colorPrimaryVariant">@color/themeDark</item> <item name="colorPrimaryVariant">@color/themeDark</item>
+1
View File
@@ -4,6 +4,7 @@ buildscript {
kotlin_version = '1.5.30' kotlin_version = '1.5.30'
coroutines_version = '1.5.2-native-mt' coroutines_version = '1.5.2-native-mt'
material_version = '1.4.0' material_version = '1.4.0'
splash_screen_version = '1.0.0-alpha01'
constraint_layout_version = '2.1.0' constraint_layout_version = '2.1.0'
lifecycle_version = '2.3.1' lifecycle_version = '2.3.1'
navigation_version = '2.3.5' navigation_version = '2.3.5'