From deff195d1f6d26f7cb13c01f339034c5747ee450 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Sat, 25 Jun 2022 13:42:38 -0500 Subject: [PATCH] Add splash screen animation --- .idea/gradle.xml | 1 - .idea/misc.xml | 1 + app/build.gradle.kts | 3 ++- app/src/main/AndroidManifest.xml | 2 +- .../com/wbrawner/pihelper/MainActivity.kt | 22 +++++++++++++++++++ app/src/main/res/values/styles.xml | 7 ++++++ gradle/libs.versions.toml | 2 ++ 7 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 37e6888..e900b00 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -15,7 +15,6 @@ - diff --git a/.idea/misc.xml b/.idea/misc.xml index 4c155bf..aad08f6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -36,6 +36,7 @@ + diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2f6b1ee..2ae59a9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,6 @@ -import java.util.Properties import java.io.FileInputStream import java.io.FileNotFoundException +import java.util.* plugins { id("com.android.application") @@ -75,6 +75,7 @@ dependencies { kapt(libs.hilt.android.kapt) implementation(libs.androidx.core) implementation(libs.androidx.appcompat) + implementation(libs.androidx.splash) implementation(libs.material) implementation("androidx.constraintlayout:constraintlayout:2.0.4") implementation("androidx.legacy:legacy-support-v4:1.0.0") diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 89e5426..af71810 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:usesCleartextTraffic="true" android:supportsRtl="true" - android:theme="@style/AppTheme"> + android:theme="@style/Theme.App.Starting"> + listOf(View.SCALE_X, View.SCALE_Y).forEach { axis -> + ObjectAnimator.ofFloat( + splashScreenView, + axis, + 1f, + 0.45f + ).apply { + interpolator = AnticipateInterpolator() + duration = 200L + doOnEnd { + splashScreenView.remove() + } + start() + } + } + } } override fun onBackPressed() { diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 47db077..427363a 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -10,4 +10,11 @@ + + + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b01f2b3..e7600bd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,7 @@ [versions] androidx-core = "1.3.2" androidx-appcompat = "1.2.0" +androidx-splash = "1.0.0-beta02" compose = "1.1.1" coroutines = "1.4.3" espresso = "3.3.0" @@ -24,6 +25,7 @@ versionName = "1.0" android-gradle = { module = "com.android.tools.build:gradle", version = "7.1.2"} androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } +androidx-splash = { module = "androidx.core:core-splashscreen", version.ref = "androidx-splash" } compose-activity = { module = "androidx.activity:activity-compose", version = "1.4.0" } compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } compose-test = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" }