Skip to content

Commit

Permalink
added splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
yamin8000 committed Feb 21, 2024
1 parent 66c4269 commit 0412ef7
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {
applicationId = appId
minSdk = 21
targetSdk = 34
versionCode = 38
versionName = "1.6.1"
versionCode = 39
versionName = "1.6.2"
vectorDrawables.useSupportLibrary = true
ksp.arg("room.schemaLocation", "$projectDir/schemas")
archivesName = "$applicationId-v$versionCode($versionName)"
Expand Down Expand Up @@ -96,6 +96,7 @@ dependencies {
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7")
implementation("androidx.core:core-splashscreen:1.0.1")
//compose
val material3Version = "1.2.0"
val composeLibsVersion = "1.6.1"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="false"
android:theme="@style/Theme.Owl">
android:theme="@style/Theme.Owl.Splash">
<activity
android:name="io.github.yamin8000.owl.ui.content.MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard|locale|screenLayout|screenSize"
android:exported="true"
android:theme="@style/Theme.Owl">
android:theme="@style/Theme.Owl.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.lifecycle.viewmodel.initializer
import androidx.navigation.compose.NavHost
Expand Down Expand Up @@ -80,6 +81,8 @@ internal class MainActivity : ComponentActivity() {
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@ExperimentalMaterial3Api
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()

super.onCreate(savedInstanceState)

Constants.db = createDb()
Expand Down
36 changes: 36 additions & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ freeDictionaryApp/freeDictionaryApp.app.main
~ themes.xml Copyrighted by Yamin Siahmargooei at 2023/8/26
~ themes.xml Last modified at 2023/8/26
~ This file is part of freeDictionaryApp/freeDictionaryApp.app.main.
~ Copyright (C) 2023 Yamin Siahmargooei
~
~ freeDictionaryApp/freeDictionaryApp.app.main is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ freeDictionaryApp/freeDictionaryApp.app.main is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with freeDictionaryApp. If not, see <https://www.gnu.org/licenses/>.
-->

<resources xmlns:tools="http://schemas.android.com/tools">

<style name="Theme.Owl" parent="android:Theme.Material.Light.NoActionBar" />

<style name="Theme.Owl.Splash" parent="Theme.SplashScreen">
<item name="android:windowSplashScreenBackground" tools:targetApi="s">#201A1B</item>
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">
@drawable/ic_launcher_foreground
</item>
<item name="android:windowSplashScreenIconBackgroundColor" tools:targetApi="s">#BB0055
</item>
<item name="android:windowSplashScreenAnimationDuration" tools:targetApi="s">500</item>
<item name="postSplashScreenTheme">@style/Theme.Owl</item>
</style>
</resources>
13 changes: 11 additions & 2 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@
~ along with freeDictionaryApp. If not, see <https://www.gnu.org/licenses/>.
-->

<resources>
<resources xmlns:tools="http://schemas.android.com/tools">

<style name="Theme.Owl" parent="android:Theme.Material.Light.NoActionBar">
<style name="Theme.Owl" parent="android:Theme.Material.Light.NoActionBar" />

<style name="Theme.Owl.Splash" parent="Theme.SplashScreen">
<item name="android:windowSplashScreenBackground" tools:targetApi="s">#FBE9E7</item>
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">
@drawable/ic_launcher_foreground
</item>
<item name="android:windowSplashScreenIconBackgroundColor" tools:targetApi="s">#BB0055</item>
<item name="android:windowSplashScreenAnimationDuration" tools:targetApi="s">500</item>
<item name="postSplashScreenTheme">@style/Theme.Owl</item>
</style>
</resources>

0 comments on commit 0412ef7

Please sign in to comment.