Back from settings page navigates to weather page first
This commit is contained in:
parent
c61eec68eb
commit
e95e0c03f6
@ -40,7 +40,7 @@ import io.hammerhead.karooext.KarooSystemService
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MainScreen(onFinish: () -> Unit) {
|
fun MainScreen(close: () -> Unit) {
|
||||||
var karooConnected by remember { mutableStateOf(false) }
|
var karooConnected by remember { mutableStateOf(false) }
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
@ -51,6 +51,14 @@ fun MainScreen(onFinish: () -> Unit) {
|
|||||||
|
|
||||||
val tabs = listOf("Weather", "Settings")
|
val tabs = listOf("Weather", "Settings")
|
||||||
|
|
||||||
|
fun onFinish() {
|
||||||
|
if (tabIndex > 0){
|
||||||
|
tabIndex--
|
||||||
|
} else {
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DisposableEffect(Unit) {
|
DisposableEffect(Unit) {
|
||||||
onDispose {
|
onDispose {
|
||||||
karooSystem.disconnect()
|
karooSystem.disconnect()
|
||||||
@ -84,8 +92,8 @@ fun MainScreen(onFinish: () -> Unit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (tabIndex) {
|
when (tabIndex) {
|
||||||
0 -> WeatherScreen(onFinish)
|
0 -> WeatherScreen(::onFinish)
|
||||||
1 -> SettingsScreen(onFinish)
|
1 -> SettingsScreen(::onFinish)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +128,9 @@ fun MainScreen(onFinish: () -> Unit) {
|
|||||||
.align(Alignment.BottomStart)
|
.align(Alignment.BottomStart)
|
||||||
.padding(bottom = 10.dp)
|
.padding(bottom = 10.dp)
|
||||||
.size(54.dp)
|
.size(54.dp)
|
||||||
.clickable { onFinish() }
|
.clickable {
|
||||||
|
onFinish()
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user