diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c51d473..ed118fc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,8 @@ +/* + * Created by sweetbread + * Copyright (c) 2025. All rights reserved. + */ + plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) @@ -63,4 +68,6 @@ dependencies { implementation(libs.ktor.client.okhttp) implementation(libs.ktor.client.logging) implementation(libs.logback.classic) + + implementation(libs.splitties.base) } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 65c94bf..b5b7bc1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,12 @@ + + + - Box(Modifier.padding(innerPadding)) { + Box( + Modifier + .padding(innerPadding) + .fillMaxSize()) { + var loading by remember { mutableStateOf(true) } + if (loading) { + CircularProgressIndicator(Modifier.align(Alignment.Center)) + LaunchedEffect(true) { + launch { + if (!health(SettingsPreferences.url)) { + Settings() + } + } + } + } } } } @@ -30,18 +57,28 @@ class MainActivity : ComponentActivity() { } } -@Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier - ) +sealed class Screen { + object Main : Screen() + object Settings : Screen() } -@Preview(showBackground = true) @Composable -fun GreetingPreview() { - GeoTrackerTheme { - Greeting("Android") +fun Settings(modifier: Modifier = Modifier) { + var username by remember { mutableStateOf("") } + var url by remember { mutableStateOf("") } + + + Box (modifier = modifier) { + OutlinedTextField( + value = username, + onValueChange = { username = it }, + label = { Text("Username") } + ) + + OutlinedTextField( + value = url, + onValueChange = { url = it }, + label = { Text("Server URL") } + ) } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a44a75c..87d0963 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,6 +11,7 @@ lifecycleRuntimeKtx = "2.8.7" activityCompose = "1.10.1" composeBom = "2024.04.01" logbackClassic = "1.2.11" +splittiesFunPackAndroidBase = "3.0.0" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } @@ -33,6 +34,7 @@ ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" } ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logbackClassic" } +splitties-base = { module = "com.louiscad.splitties:splitties-fun-pack-android-base", version.ref = "splittiesFunPackAndroidBase" } [plugins] android-application = { id = "com.android.application", version.ref = "agp" }