Add splash screen
This commit is contained in:
parent
7954ea4a4f
commit
028a43474b
6 changed files with 23 additions and 1 deletions
|
|
@ -69,6 +69,7 @@ dependencies {
|
||||||
// Android X
|
// Android X
|
||||||
implementation(libs.androidx.core)
|
implementation(libs.androidx.core)
|
||||||
implementation(libs.androidx.core.ktx)
|
implementation(libs.androidx.core.ktx)
|
||||||
|
implementation(libs.androidx.core.core.splashscreen)
|
||||||
implementation(libs.androidx.appcompat)
|
implementation(libs.androidx.appcompat)
|
||||||
implementation(libs.androidx.activity)
|
implementation(libs.androidx.activity)
|
||||||
implementation(libs.androidx.activity.ktx)
|
implementation(libs.androidx.activity.ktx)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.ToDo"
|
android:theme="@style/Theme.ToDo.Starting"
|
||||||
tools:targetApi="35">
|
tools:targetApi="35">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import android.app.ComponentCaller
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.commit
|
import androidx.fragment.app.commit
|
||||||
import cn.super12138.todo.R
|
import cn.super12138.todo.R
|
||||||
|
|
@ -15,6 +16,7 @@ import cn.super12138.todo.views.fragments.welcome.WelcomeFragment
|
||||||
|
|
||||||
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
installSplashScreen()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (!GlobalValues.welcomePage) {
|
if (!GlobalValues.welcomePage) {
|
||||||
|
|
|
||||||
7
app/src/main/res/drawable/splash_screen.xml
Normal file
7
app/src/main/res/drawable/splash_screen.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:width="70dp"
|
||||||
|
android:height="70dp"
|
||||||
|
android:drawable="@drawable/ic_launcher"
|
||||||
|
android:gravity="center" />
|
||||||
|
</layer-list>
|
||||||
|
|
@ -61,6 +61,16 @@
|
||||||
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
|
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<style name="Theme.ToDo.Starting" parent="Theme.SplashScreen">
|
||||||
|
<!-- Splash Screen 背景颜色 -->
|
||||||
|
<item name="windowSplashScreenBackground">#0061A4</item>
|
||||||
|
<!-- Splash Screen 图标 -->
|
||||||
|
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_screen</item>
|
||||||
|
<!-- 应用默认主题 -->
|
||||||
|
<item name="postSplashScreenTheme">@style/Theme.ToDo</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="AppPreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay">
|
<style name="AppPreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay">
|
||||||
<item name="switchPreferenceCompatStyle">@style/AppSwitchPreference</item>
|
<item name="switchPreferenceCompatStyle">@style/AppSwitchPreference</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ recyclerview = "1.3.2"
|
||||||
fragment = "1.8.3"
|
fragment = "1.8.3"
|
||||||
fragmentKtx = "1.8.3"
|
fragmentKtx = "1.8.3"
|
||||||
roomRuntime = "2.6.1"
|
roomRuntime = "2.6.1"
|
||||||
|
splashScreen = "1.2.0-alpha02"
|
||||||
# Material
|
# Material
|
||||||
material = "1.13.0-alpha05"
|
material = "1.13.0-alpha05"
|
||||||
# Fast Scroll
|
# Fast Scroll
|
||||||
|
|
@ -33,6 +34,7 @@ ksp = "2.0.20-1.0.25"
|
||||||
# Android X
|
# Android X
|
||||||
androidx-core = { group = "androidx.core", name = "core", version.ref = "core" }
|
androidx-core = { group = "androidx.core", name = "core", version.ref = "core" }
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
androidx-core-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "splashScreen" }
|
||||||
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||||
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activityKtx" }
|
androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activityKtx" }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue