mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Consolidated app dialogs and tweaked bottom sheets
This commit is contained in:
1 parent
3f5b48f270
commit
24eebdef74
9 files changed
+110
-84
No files matched your search
+7
-7
@@ -49,7 +49,7 @@ import com.rtbishop.look4sat.core.presentation.CardButton
|
||||
import com.rtbishop.look4sat.core.presentation.LocalSpacing
|
||||
import com.rtbishop.look4sat.core.presentation.MainTheme
|
||||
import com.rtbishop.look4sat.core.presentation.R
|
||||
import com.rtbishop.look4sat.core.presentation.SharedDialog
|
||||
import com.rtbishop.look4sat.core.presentation.ConfirmDialog
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
@@ -63,7 +63,7 @@ fun PositionDialog(lat: Double, lon: Double, dismiss: () -> Unit, save: (Double,
|
||||
val lonValue = rememberSaveable { mutableStateOf(lon.toString()) }
|
||||
val titleText = stringResource(id = R.string.prefs_station_title)
|
||||
val onAccept = { saveValues(latValue.value, lonValue.value, save).also { dismiss() } }
|
||||
SharedDialog(title = titleText, onCancel = dismiss, onAccept = onAccept) {
|
||||
ConfirmDialog(title = titleText, onCancel = dismiss, onAccept = onAccept) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier
|
||||
@@ -107,7 +107,7 @@ private fun LocatorDialogPreview() {
|
||||
fun LocatorDialog(qthLocator: String, dismiss: () -> Unit, save: (String) -> Unit) {
|
||||
val locator = rememberSaveable { mutableStateOf(qthLocator) }
|
||||
val onAccept = { save(locator.value).also { dismiss() } }
|
||||
SharedDialog(
|
||||
ConfirmDialog(
|
||||
title = stringResource(R.string.prefs_locator_title),
|
||||
onCancel = dismiss,
|
||||
onAccept = onAccept
|
||||
@@ -169,7 +169,7 @@ fun DataSourcesDialog(
|
||||
onDismiss()
|
||||
}
|
||||
val onCancel = { onDismiss() }
|
||||
SharedDialog(
|
||||
ConfirmDialog(
|
||||
title = stringResource(id = R.string.prefs_data_sources_title),
|
||||
onCancel = onCancel,
|
||||
onAccept = onAccept,
|
||||
@@ -313,7 +313,7 @@ fun NetworkOutputDialog(
|
||||
)
|
||||
onDismiss()
|
||||
}
|
||||
SharedDialog(
|
||||
ConfirmDialog(
|
||||
title = stringResource(R.string.prefs_net_title),
|
||||
onCancel = onDismiss,
|
||||
onAccept = onAccept
|
||||
@@ -411,7 +411,7 @@ fun BluetoothOutputDialog(
|
||||
)
|
||||
onDismiss()
|
||||
}
|
||||
SharedDialog(
|
||||
ConfirmDialog(
|
||||
title = stringResource(R.string.prefs_bt_title),
|
||||
onCancel = onDismiss,
|
||||
onAccept = onAccept
|
||||
@@ -538,7 +538,7 @@ fun RadioControlDialog(
|
||||
onDismiss()
|
||||
}
|
||||
|
||||
SharedDialog(
|
||||
ConfirmDialog(
|
||||
title = stringResource(R.string.rc_settings_title),
|
||||
onCancel = onDismiss,
|
||||
onAccept = onAccept
|
||||
|
||||
+9
-4
@@ -74,6 +74,7 @@ import com.rtbishop.look4sat.core.presentation.PrimaryIconCard
|
||||
import com.rtbishop.look4sat.core.presentation.R
|
||||
import com.rtbishop.look4sat.core.presentation.ScreenColumn
|
||||
import com.rtbishop.look4sat.core.presentation.TopBar
|
||||
import com.rtbishop.look4sat.core.presentation.WhatsNewDialog
|
||||
import com.rtbishop.look4sat.core.presentation.infiniteMarquee
|
||||
import com.rtbishop.look4sat.core.presentation.isVerticalLayout
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -198,6 +199,9 @@ private fun SettingsScreen(uiState: SettingsState, onAction: (SettingsAction) ->
|
||||
onSave = { onAction(SettingsAction.UpdateRadioControl(it)) }
|
||||
)
|
||||
}
|
||||
if (dialogs.whatsNew) {
|
||||
WhatsNewDialog(onDismiss = { dialogs.whatsNew = false })
|
||||
}
|
||||
|
||||
// URLs for top bar
|
||||
val uriHandler = LocalUriHandler.current
|
||||
@@ -218,7 +222,7 @@ private fun SettingsScreen(uiState: SettingsState, onAction: (SettingsAction) ->
|
||||
if (isVerticalLayout) {
|
||||
TopBar {
|
||||
TopCard(
|
||||
onClick = { safeOpenUri(appUrl) },
|
||||
onClick = { dialogs.whatsNew = true },
|
||||
version = uiState.appVersionName,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
@@ -246,7 +250,7 @@ private fun SettingsScreen(uiState: SettingsState, onAction: (SettingsAction) ->
|
||||
TopBar {
|
||||
PrimaryIconCard(onClick = { safeOpenUri(donateUrl) }, resId = R.drawable.ic_like)
|
||||
TopCard(
|
||||
onClick = { safeOpenUri(appUrl) },
|
||||
onClick = { dialogs.whatsNew = true },
|
||||
version = uiState.appVersionName,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
@@ -718,6 +722,7 @@ private class DialogVisibility {
|
||||
var network by mutableStateOf(false)
|
||||
var bluetooth by mutableStateOf(false)
|
||||
var radioControl by mutableStateOf(false)
|
||||
var whatsNew by mutableStateOf(false)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -725,12 +730,12 @@ private fun rememberDialogVisibility(): DialogVisibility {
|
||||
return rememberSaveable(saver = run {
|
||||
androidx.compose.runtime.saveable.Saver(
|
||||
save = {
|
||||
listOf(it.position, it.locator, it.dataSources, it.network, it.bluetooth, it.radioControl)
|
||||
listOf(it.position, it.locator, it.dataSources, it.network, it.bluetooth, it.radioControl, it.whatsNew)
|
||||
},
|
||||
restore = {
|
||||
DialogVisibility().apply {
|
||||
position = it[0]; locator = it[1]; dataSources = it[2]
|
||||
network = it[3]; bluetooth = it[4]; radioControl = it[5]
|
||||
network = it[3]; bluetooth = it[4]; radioControl = it[5]; whatsNew = it[6]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user