Skip to content

Commit be3e961

Browse files
committed
add animated splash screen
1 parent 8028704 commit be3e961

File tree

7 files changed

+58
-26
lines changed

7 files changed

+58
-26
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ dependencies {
7474

7575
implementation(libs.androidx.navigation.compose)
7676

77+
implementation(libs.androidx.core.splashscreen)
78+
7779
debugImplementation(libs.androidx.ui.tooling)
7880
debugImplementation(libs.androidx.ui.test.manifest)
7981
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
android:label="Chooser"
77
android:icon="@mipmap/ic_launcher"
88
android:roundIcon="@mipmap/ic_launcher"
9-
android:theme="@style/Chooser"
9+
android:theme="@style/Theme.Chooser"
1010
android:enableOnBackInvokedCallback="true"
1111
tools:targetApi="35">
1212
<activity
13-
android:name="com.uravgcode.chooser.MainActivity"
13+
android:name=".MainActivity"
1414
android:exported="true">
1515
<intent-filter>
1616
<action android:name="android.intent.action.MAIN" />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android">
3+
<objectAnimator
4+
android:duration="1200"
5+
android:interpolator="@android:anim/linear_interpolator"
6+
android:propertyName="rotation"
7+
android:repeatCount="infinite"
8+
android:valueFrom="0"
9+
android:valueTo="360"
10+
android:valueType="floatType" />
11+
</set>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:drawable="@drawable/ic_launcher_foreground">
3+
<target
4+
android:name="circle"
5+
android:animation="@animator/infinite_rotation" />
6+
</animated-vector>

app/src/main/res/drawable/ic_launcher_foreground.xml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,32 @@
33
android:height="108dp"
44
android:viewportWidth="108"
55
android:viewportHeight="108">
6-
<path
7-
android:fillColor="#939"
8-
android:pathData="M54,54m-17,0a17,17 0,1 1,34 0a17,17 0,1 1,-34 0" />
9-
<path
10-
android:pathData="M30.3,54a23.7,23.7 0,1 0,47.4 0a23.7,23.7 0,1 0,-47.4 0z"
11-
android:strokeWidth="4.6"
12-
android:strokeColor="#939"
13-
android:strokeLineCap="round"
14-
android:strokeLineJoin="round" />
15-
<path
16-
android:pathData="m64.39,64.39a14.7,14.7 0,0 1,-20.79 0,14.7 14.7,0 0,1 0,-20.79"
17-
android:strokeWidth="4.6"
18-
android:strokeAlpha="0.3"
19-
android:strokeColor="#fff"
20-
android:strokeLineCap="round"
21-
android:strokeLineJoin="round" />
22-
<path
23-
android:pathData="m37.24,37.24a23.7,23.7 0,0 1,22.89 -6.13,23.7 23.7,0 0,1 16.76,16.76 23.7,23.7 0,0 1,-6.13 22.89"
24-
android:strokeWidth="4.6"
25-
android:strokeAlpha="0.3"
26-
android:strokeColor="#fff"
27-
android:strokeLineCap="round"
28-
android:strokeLineJoin="round" />
6+
<group
7+
android:name="circle"
8+
android:pivotX="54"
9+
android:pivotY="54">
10+
<path
11+
android:fillColor="#939"
12+
android:pathData="M54,54m-17,0a17,17 0,1 1,34 0a17,17 0,1 1,-34 0" />
13+
<path
14+
android:pathData="M30.3,54a23.7,23.7 0,1 0,47.4 0a23.7,23.7 0,1 0,-47.4 0z"
15+
android:strokeWidth="4.6"
16+
android:strokeColor="#939"
17+
android:strokeLineCap="round"
18+
android:strokeLineJoin="round" />
19+
<path
20+
android:pathData="m64.39,64.39a14.7,14.7 0,0 1,-20.79 0,14.7 14.7,0 0,1 0,-20.79"
21+
android:strokeWidth="4.6"
22+
android:strokeAlpha="0.3"
23+
android:strokeColor="#fff"
24+
android:strokeLineCap="round"
25+
android:strokeLineJoin="round" />
26+
<path
27+
android:pathData="m37.24,37.24a23.7,23.7 0,0 1,22.89 -6.13,23.7 23.7,0 0,1 16.76,16.76 23.7,23.7 0,0 1,-6.13 22.89"
28+
android:strokeWidth="4.6"
29+
android:strokeAlpha="0.3"
30+
android:strokeColor="#fff"
31+
android:strokeLineCap="round"
32+
android:strokeLineJoin="round" />
33+
</group>
2934
</vector>

app/src/main/res/values/themes.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<style name="Chooser">
3+
<style name="Theme.Chooser" parent="Theme.SplashScreen">
44
<item name="android:windowBackground">@color/black</item>
55
<item name="android:windowActionBar">false</item>
66
<item name="android:windowNoTitle">true</item>
77
<item name="android:windowFullscreen">true</item>
8+
9+
<item name="windowSplashScreenBackground">@color/black</item>
10+
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_animated</item>
11+
<item name="windowSplashScreenAnimationDuration">1000</item>
812
</style>
913
</resources>

gradle/libs.versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ activityCompose = "1.10.1"
1111
composeBom = "2025.03.01"
1212
navigationCompose = "2.8.9"
1313

14+
splashscreen = "1.0.1"
15+
1416

1517
[libraries]
1618
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -35,6 +37,8 @@ androidx-animation-graphics = { module = "androidx.compose.animation:animation-g
3537

3638
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
3739

40+
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "splashscreen" }
41+
3842

3943
[plugins]
4044
android-application = { id = "com.android.application", version.ref = "agp" }

0 commit comments

Comments
 (0)