Skip to content

Commit

Permalink
#17 in progress - splash screen improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mjureczko committed May 20, 2024
1 parent 8e002cc commit eea6d14
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ TODO:
- w introduction dodać widok-instrukcję z kodem QR
- kopiowanie "assetów" podczas wyświetlania splash screen
- remove dead code
- do not show splash when switching back to app
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation "androidx.core:core-splashscreen:1.0.1"
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
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 @@ -42,7 +42,7 @@
android:icon="@mipmap/poszukiwacz_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.App.Starting">
android:theme="@style/LaunchTheme">

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
Expand Down Expand Up @@ -78,7 +78,7 @@
<activity
android:name=".activity.main.MainActivity"
android:exported="true"
android:theme="@style/Theme.App.Starting">
android:theme="@style/LaunchTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.os.Bundle
import android.util.Log
import androidx.activity.compose.setContent
import androidx.compose.runtime.Composable
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
Expand Down Expand Up @@ -62,7 +61,6 @@ class MainActivity : PermissionActivity() {

@SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/launch_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/colorPrimary" />

<item android:gravity="center" android:drawable="@drawable/chest_splash" />
</layer-list>
8 changes: 8 additions & 0 deletions app/src/main/res/values-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowSplashScreenBackground">@color/colorPrimary</item>
<item name="android:windowSplashScreenIconBackgroundColor">@color/colorPrimary</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/chest_splash</item>
</style>
</resources>
6 changes: 2 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<resources>

<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/colorPrimary</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/chest_splash</item>
<item name="postSplashScreenTheme">@style/FullscreenTheme</item>
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>

<!-- Base application theme. -->
Expand Down

0 comments on commit eea6d14

Please sign in to comment.