diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/common/Components.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/common/Components.kt
index 6c18ef7a..40697bec 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/common/Components.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/common/Components.kt
@@ -212,8 +212,8 @@ fun CardButton(onClick: () -> Unit, text: String, modifier: Modifier = Modifier)
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
), shape = MaterialTheme.shapes.small, modifier = modifier,
- contentPadding = PaddingValues(horizontal = 12.dp)
- ) { Text(text = text, fontSize = 16.sp) }
+ contentPadding = PaddingValues(horizontal = 8.dp, vertical = 8.dp)
+ ) { Text(text = text, fontSize = 16.sp, textAlign = TextAlign.Center) }
}
@Composable
@@ -280,7 +280,7 @@ fun SharedDialog(
) {
Text(
text = title,
- fontSize = 18.sp,
+ fontSize = 16.sp,
fontWeight = FontWeight.Medium,
color = MaterialTheme.colorScheme.primary,
modifier = Modifier.padding(start = padding, top = padding, end = padding)
@@ -330,40 +330,6 @@ fun InfoDialog(title: String, text: String, onDismiss: () -> Unit) {
}
}
-@Composable
-fun InfoDialog(
- title: String,
- onDismiss: () -> Unit,
- content: @Composable () -> Unit
-) {
- val padding = LocalSpacing.current.large
-
- Dialog(onDismissRequest = onDismiss) {
- ElevatedCard {
- Column(
- horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangement = Arrangement.spacedBy(padding)
- ) {
- Text(
- text = title,
- fontSize = 18.sp,
- fontWeight = FontWeight.Medium,
- color = MaterialTheme.colorScheme.primary,
- modifier = Modifier.padding(start = padding, top = padding, end = padding)
- )
- content()
- Row(modifier = Modifier.padding(start = padding, bottom = padding, end = padding)) {
- Spacer(modifier = Modifier.weight(1f))
- CardButton(
- onClick = onDismiss,
- text = stringResource(id = R.string.btn_cancel)
- )
- }
- }
- }
- }
-}
-
@Composable
fun hasEnoughHeight(): Boolean {
return currentWindowAdaptiveInfo().windowSizeClass.isHeightAtLeastBreakpoint(480)
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsDialog.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsDialog.kt
index f13958cf..b589252d 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsDialog.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsDialog.kt
@@ -27,12 +27,13 @@ import androidx.compose.ui.tooling.preview.Preview
import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.presentation.MainTheme
import com.rtbishop.look4sat.presentation.common.SharedDialog
-import com.rtbishop.look4sat.presentation.common.InfoDialog
import com.rtbishop.look4sat.presentation.common.CardButton
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Switch
import androidx.compose.ui.unit.dp
@@ -53,10 +54,16 @@ fun PositionDialog(lat: Double, lon: Double, dismiss: () -> Unit, save: (Double,
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) {
- Text(text = stringResource(id = R.string.prefs_station_lat_text))
- OutlinedTextField(value = latValue.value, onValueChange = { latValue.value = it })
- Text(text = stringResource(id = R.string.prefs_station_lon_text))
- OutlinedTextField(value = lonValue.value, onValueChange = { lonValue.value = it })
+ OutlinedTextField(
+ value = latValue.value,
+ onValueChange = { latValue.value = it },
+ label = { Text(text = stringResource(id = R.string.prefs_station_lat_text)) }
+ )
+ OutlinedTextField(
+ value = lonValue.value,
+ onValueChange = { lonValue.value = it },
+ label = { Text(text = stringResource(id = R.string.prefs_station_lon_text)) }
+ )
}
}
@@ -79,55 +86,11 @@ fun LocatorDialog(qthLocator: String, dismiss: () -> Unit, save: (String) -> Uni
val locator = rememberSaveable { mutableStateOf(qthLocator) }
val onAccept = { save(locator.value).also { dismiss() } }
SharedDialog(title = stringResource(R.string.prefs_locator_title), onCancel = dismiss, onAccept = onAccept) {
- Text(text = stringResource(id = R.string.prefs_locator_text))
- OutlinedTextField(value = locator.value, onValueChange = { locator.value = it })
- }
-}
-
-@Preview(showBackground = true)
-@Composable
-private fun ImportDialogPreview() = MainTheme {
- ImportDialog(
- onImportTle = {},
- onImportTransceivers = {},
- onDismiss = {}
- )
-}
-
-@Composable
-fun ImportDialog(
- onImportTle: () -> Unit,
- onImportTransceivers: () -> Unit,
- onDismiss: () -> Unit
-) {
- val padding = LocalSpacing.current.large
- InfoDialog(
- title = stringResource(R.string.prefs_data_import),
- onDismiss = onDismiss
- ) {
- Row(
- horizontalArrangement = Arrangement.spacedBy(12.dp),
- modifier = Modifier
- .padding(horizontal = padding)
- .fillMaxWidth()
- ) {
- CardButton(
- onClick = {
- onImportTle()
- onDismiss()
- },
- text = "TLE",
- modifier = Modifier.weight(0.7f)
- )
- CardButton(
- onClick = {
- onImportTransceivers()
- onDismiss()
- },
- text = "Transceivers",
- modifier = Modifier.weight(1.3f)
- )
- }
+ OutlinedTextField(
+ value = locator.value,
+ onValueChange = { locator.value = it },
+ label = { Text(text = stringResource(id = R.string.prefs_locator_text)) }
+ )
}
}
@@ -140,7 +103,9 @@ private fun TransceiversDialogPreview() {
useCustomTransceivers = true,
tleUrl = "https://example.com/tle.txt",
transceiversUrl = "https://example.com/tx.json",
- dismiss = {},
+ onImportTle = {},
+ onImportTransceivers = {},
+ onDismiss = {},
onSave = { _, _, _, _ -> }
)
}
@@ -152,7 +117,9 @@ fun DataSourcesDialog(
useCustomTransceivers: Boolean,
tleUrl: String,
transceiversUrl: String,
- dismiss: () -> Unit,
+ onImportTle: () -> Unit,
+ onImportTransceivers: () -> Unit,
+ onDismiss: () -> Unit,
onSave: (Boolean, Boolean, String, String) -> Unit
) {
val padding = LocalSpacing.current.large
@@ -162,15 +129,34 @@ fun DataSourcesDialog(
val urlTransceivers = rememberSaveable { mutableStateOf(transceiversUrl) }
val onAccept = {
onSave(isEnabledCustomTle.value, isEnabledCustomTransceivers.value, urlTle.value, urlTransceivers.value)
- dismiss()
+ onDismiss()
}
- val onCancel = { dismiss() }
+ val onCancel = { onDismiss() }
SharedDialog(
title = stringResource(id = R.string.prefs_data_sources_title),
onCancel = onCancel,
onAccept = onAccept,
) {
Column(modifier = Modifier.padding(horizontal = padding)) {
+ Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
+ CardButton(
+ onClick = {
+ onImportTle()
+ onDismiss()
+ },
+ text = "TLE (3LE)\nR4UAB (.txt)",
+ modifier = Modifier.weight(1f)
+ )
+ CardButton(
+ onClick = {
+ onImportTransceivers()
+ onDismiss()
+ },
+ text = "Transceivers\nSatNOGS (.json)",
+ modifier = Modifier.weight(1f)
+ )
+ }
+ Spacer(modifier = Modifier.height(6.dp))
Row(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
@@ -190,6 +176,7 @@ fun DataSourcesDialog(
modifier = Modifier.fillMaxWidth(),
enabled = isEnabledCustomTle.value,
)
+ Spacer(modifier = Modifier.height(6.dp))
Row(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt
index ddc0093d..be610312 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt
@@ -150,7 +150,9 @@ private fun SettingsScreen(uiState: SettingsState) {
useCustomTransceivers = uiState.dataSourcesSettings.useCustomTransceivers,
tleUrl = uiState.dataSourcesSettings.tleUrl,
transceiversUrl = uiState.dataSourcesSettings.transceiversUrl,
- dismiss = dismissDataSourcesDialog,
+ onImportTle = { contentRequestForTle.launch("*/*") },
+ onImportTransceivers = { contentRequestForTransceivers.launch("*/*") },
+ onDismiss = dismissDataSourcesDialog,
onSave = {
useCustomTle, useCustomTransceivers, tleUrl, transceiversUrl ->
if (!useCustomTle || tleUrl.isNotBlank()) {
@@ -165,18 +167,6 @@ private fun SettingsScreen(uiState: SettingsState) {
)
}
- // Import dialog
- val importDialogState = rememberSaveable { mutableStateOf(false) }
- val showImportDialog = { importDialogState.value = true }
- val dismissImportDialog = { importDialogState.value = false }
- if (importDialogState.value) {
- ImportDialog(
- onImportTle = { contentRequestForTle.launch("*/*") },
- onImportTransceivers = { contentRequestForTransceivers.launch("*/*") },
- onDismiss = dismissImportDialog
- )
- }
-
// Data settings
val dataSettings = uiState.dataSettings
val updateFromWeb: () -> Unit = { uiState.sendAction(SettingsAction.UpdateFromWeb) }
@@ -248,7 +238,7 @@ private fun SettingsScreen(uiState: SettingsState) {
item {
LocationCard(posSettings, setGpsPos, showPosDialog, showLocDialog, dismissPos, uiState.sendSystemAction)
}
- item { DataCard(dataSettings, updateFromWeb, clearAllData, showImportDialog, showDataSourcesDialog) }
+ item { DataCard(dataSettings, updateFromWeb, clearAllData, showDataSourcesDialog) }
item { NetworkOutputCard(rcSettings, setRotatorState, setRotatorAddress, setRotatorPort) }
item { BluetoothOutputCard(rcSettings, setBluetoothState, setBluetoothAddress, setBluetoothFormat) }
item { OtherCard(otherSettings, toggleUtc, toggleUpdate, toggleSweep, toggleSensor) }
@@ -329,7 +319,7 @@ private fun LocationCard(
@Composable
private fun DataCardPreview() = MainTheme {
val settings = DataSettings(true, 5000, 2500, 0L)
- DataCard(settings = settings, {}, {},{}) {}
+ DataCard(settings = settings, {}, {}, {})
}
@Composable
@@ -337,7 +327,6 @@ private fun DataCard(
settings: DataSettings,
updateFromWeb: () -> Unit,
clearAllData: () -> Unit,
- showImportDialog: () -> Unit,
showDataSourcesDialog: () -> Unit
) {
ElevatedCard(modifier = Modifier.fillMaxWidth()) {
@@ -360,17 +349,14 @@ private fun DataCard(
Text(text = stringResource(R.string.prefs_data_radios, settings.radiosTotal))
}
Spacer(modifier = Modifier.height(1.dp))
- Row(
- horizontalArrangement = Arrangement.spacedBy(6.dp),
- modifier = Modifier.fillMaxWidth()
- ) {
+ Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
CardButton(
onClick = updateFromWeb,
text = stringResource(id = R.string.prefs_data_update),
modifier = Modifier.weight(1f)
)
CardButton(
- onClick = showImportDialog,
+ onClick = showDataSourcesDialog,
text = stringResource(id = R.string.prefs_data_import),
modifier = Modifier.weight(1f)
)
@@ -380,17 +366,6 @@ private fun DataCard(
modifier = Modifier.weight(1f)
)
}
- Spacer(modifier = Modifier.height(6.dp))
- Row(
- horizontalArrangement = Arrangement.spacedBy(6.dp),
- modifier = Modifier.fillMaxWidth()
- ) {
- CardButton(
- onClick = showDataSourcesDialog,
- text = stringResource(id = R.string.prefs_data_sources),
- modifier = Modifier.weight(1f)
- )
- }
}
}
}
@@ -685,4 +660,3 @@ private fun BotCard(onClick: () -> Unit, resId: Int, text: String, modifier: Mod
}
}
}
-
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt
index 834c4ffc..ab2274b1 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt
@@ -52,7 +52,12 @@ class SettingsViewModel(
private val defaultPosSettings = PositionSettings(false, settingsRepo.stationPosition.value, 0)
private val defaultDataSettings = DataSettings(false, 0, 0, 0L)
- private val defaultDataSourcesSettings = DataSourcesSettings(false, false, settingsRepo.dataSourcesSettings.value.tleUrl, settingsRepo.dataSourcesSettings.value.transceiversUrl)
+ private val defaultDataSourcesSettings = DataSourcesSettings(
+ useCustomTLE = false,
+ useCustomTransceivers = false,
+ tleUrl = settingsRepo.dataSourcesSettings.value.tleUrl,
+ transceiversUrl = settingsRepo.dataSourcesSettings.value.transceiversUrl
+ )
private val _uiState = MutableStateFlow(
SettingsState(
nextTime = "00:00:00",
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 6e6a00fe..8e7d8917 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -105,14 +105,12 @@
Actualizar
Importar
Vaciar
- Custom data sources
Datos eliminados con éxito
Actualización completada con éxito
Custom data sources
Custom TLE URL
Custom transceivers URL
- URL (https)
Salida de datos de red
Habilitar salida
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index ffe3aa6f..f02c71c3 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -93,10 +93,10 @@
Неправильный локатор QTH
Позиция успешно обновлена
Настройки местоположения
- Установите широту наземной станции
- Установите долготу наземной станции
+ Введите широту наземной станции
+ Введите долготу наземной станции
Настройки локатора QTH
- Установить позицию используя локатор
+ Введите позицию через локатор
Данные спутников
Спутников: %s
@@ -104,14 +104,12 @@
Обновить
Импорт
Очистить
- Свои источники данных
Очистка прошла успешно
Обновление прошло успешно
Свои источники данных
Custom TLE URL
- Custom transceivers URL
- URL (https)
+ Custom Transceivers URL
Вывод сетевых данных
Включить вывод
diff --git a/app/src/main/res/values-si/strings.xml b/app/src/main/res/values-si/strings.xml
index 1144f44a..e687df9a 100644
--- a/app/src/main/res/values-si/strings.xml
+++ b/app/src/main/res/values-si/strings.xml
@@ -105,14 +105,12 @@
නැවුම් කරන්න
ආදානය
පිරිසිදු ක°
- Custom data sources
දත්ත ඉවත් කිරීම සාර්ථකයි
යාවත්කාලීනය සම්පූර්ණ කිරීම සාර්ථකයි
Custom data sources
Custom TLE URL
Custom transceivers URL
- URL (https)
ජාල ප්රතිදානය
ප්රතිදානය සක්රීය කරන්න
diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml
index 9fb4870d..26bddb87 100644
--- a/app/src/main/res/values-uk/strings.xml
+++ b/app/src/main/res/values-uk/strings.xml
@@ -105,14 +105,12 @@
Оновити
Імпорт
Очистити
- Custom data sources
Дані успішно очищено
Оновлення успішне
Custom data sources
Custom TLE URL
Custom transceivers URL
- URL (https)
Вивід мережевих даних
Увімкнути вихід
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index b0acfb07..fe53ceaf 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -97,14 +97,12 @@
在线更新
导入文件
清空
- Custom data sources
数据清空成功
更新成功
Custom data sources
Custom TLE URL
Custom transceivers URL
- URL (https)
网络数据输出
启用输出
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4a33e8bf..08d4939e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -20,7 +20,7 @@
Clear
Clear all
Select all
- " Make sure your search query is correct and the DB is updated"
+ "Make sure your search query is correct and the DB is updated"
Warning\!
There are over 9000 satellites listed in this app.
@@ -128,14 +128,13 @@
Update
Import
Clear
- Custom data sources
Data was cleared successfully
Update completed successfully
Custom data sources
Custom TLE URL
Custom transceivers URL
- URL (https)
+ URL (HTTPS)
Network data output
Enable output