android/ui: add compose-style splash screen (#283)

Updates tailscale/corp#18202

Updates the splash screen to the modern themed jetpack compose variant.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
pull/284/head
Jonathan Nobels 1 month ago committed by GitHub
parent 9fcc1ddfe1
commit d188da3a24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -91,6 +91,7 @@ dependencies {
implementation 'androidx.activity:activity-compose:1.8.2'
implementation "com.google.accompanist:accompanist-permissions:$accompanist_version"
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
implementation "androidx.core:core-splashscreen:1.1.0-alpha02"
// Navigation dependencies.
def nav_version = "2.7.7"

@ -31,7 +31,7 @@
android:icon="@mipmap/ic_launcher"
android:label="Tailscale"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/Theme.AppCompat">
android:theme="@style/Theme.App.SplashScreen">
<activity
android:name="MainActivity"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboardHidden"

@ -24,6 +24,7 @@ import androidx.compose.animation.core.tween
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.core.net.toUri
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
@ -88,6 +89,8 @@ class MainActivity : ComponentActivity() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
installSplashScreen()
setContent {
AppTheme {
val navController = rememberNavController()

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/ic_launcher_background</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="postSplashScreenTheme">@style/Theme.AppCompat</item>
</style>
</resources>
Loading…
Cancel
Save