diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..7b3006b --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..6d0ee1c --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 6c97f0a..2cdc89a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,494 +1,5 @@ - - - + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..931b96c --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ru/risdeveau/geotracker/MainActivity.kt b/app/src/main/java/ru/risdeveau/geotracker/MainActivity.kt index 67cf120..7357579 100644 --- a/app/src/main/java/ru/risdeveau/geotracker/MainActivity.kt +++ b/app/src/main/java/ru/risdeveau/geotracker/MainActivity.kt @@ -10,6 +10,7 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.CircularProgressIndicator @@ -38,14 +39,27 @@ class MainActivity : ComponentActivity() { Modifier .padding(innerPadding) .fillMaxSize()) { - var loading by remember { mutableStateOf(true) } + var screen by remember { mutableStateOf(Screen.Loading) } - if (loading) { - CircularProgressIndicator(Modifier.align(Alignment.Center)) - LaunchedEffect(true) { - launch { - if (!health(SettingsPreferences.url)) { - Settings() + when (screen) { + Screen.Main -> TODO() + + Screen.Settings -> { + Settings(Modifier.align(Alignment.Center)) + } + + Screen.Loading -> { + var loading by remember { mutableStateOf(true) } + + if (loading) { + CircularProgressIndicator(Modifier.align(Alignment.Center)) + LaunchedEffect(true) { + launch { + screen = if (health(SettingsPreferences.url)) + Screen.Main + else + Screen.Settings + } } } } @@ -60,6 +74,7 @@ class MainActivity : ComponentActivity() { sealed class Screen { object Main : Screen() object Settings : Screen() + object Loading : Screen() } @Composable @@ -68,7 +83,7 @@ fun Settings(modifier: Modifier = Modifier) { var url by remember { mutableStateOf("") } - Box (modifier = modifier) { + Column (modifier = modifier) { OutlinedTextField( value = username, onValueChange = { username = it },