Satellite tracker and pass predictor for Android, inspired by Gpredict
Kotlin amsatcelestrakgpsham-radiohamlibhamradiokotlinnasaradiosatellitesatellite-datasatellite-positionsatellite-predictionsatellitessatnogssdrspacespacexstarlink
Tweaked output dialogs ui, fixed manual import category
Arty Bishop3f981c09d510
diff --git a/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/DatabaseRepo.kt b/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/DatabaseRepo.ktindex fe897a9c..3fbabeea 100644--- a/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/DatabaseRepo.kt+++ b/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/DatabaseRepo.kt@@ -46,8 +46,10 @@ class DatabaseRepo(}override suspend fun updateTLEFromFile(uri: String) = withContext(dispatcher) {- remoteSource.getFileStream(uri)?.let {- localSource.insertEntries(dataParser.parseTLEStream(it))+ remoteSource.getFileStream(uri)?.let { stream ->+ val entries = dataParser.parseTLEStream(stream)+ localSource.insertEntries(entries)+ settingsRepo.setSatelliteTypeIds("Other", entries.map { it.catnum })}setUpdateSuccessful(System.currentTimeMillis())}diff --git a/core/presentation/src/main/res/values-es/strings.xml b/core/presentation/src/main/res/values-es/strings.xmlindex a68859e2..75d6c764 100644--- a/core/presentation/src/main/res/values-es/strings.xml+++ b/core/presentation/src/main/res/values-es/strings.xml@@ -118,12 +118,10 @@<string name="prefs_net_title">Salida de datos de red</string><string name="prefs_net_rotator_switch">Enable rotation output</string>- <string name="prefs_net_rotator_ip_hint">Dirección IP</string>- <string name="prefs_net_rotator_port_hint">Puerto</string>+ <string name="prefs_net_rotator_address_hint">IP:Puerto</string><string name="prefs_net_rotator_format_hint">Formato de datos</string><string name="prefs_net_frequency_switch">Enable frequency output</string>- <string name="prefs_net_frequency_ip_hint">Dirección IP</string>- <string name="prefs_net_frequency_port_hint">Puerto</string>+ <string name="prefs_net_frequency_address_hint">IP:Puerto</string><string name="prefs_net_frequency_format_hint">Formato de datos</string><string name="prefs_bt_title">Salida por Bluetooth</string>diff --git a/core/presentation/src/main/res/values-ru/strings.xml b/core/presentation/src/main/res/values-ru/strings.xmlindex 83e5d918..358fd036 100644--- a/core/presentation/src/main/res/values-ru/strings.xml+++ b/core/presentation/src/main/res/values-ru/strings.xml@@ -117,12 +117,10 @@<string name="prefs_net_title">Вывод сетевых данных</string><string name="prefs_net_rotator_switch">Включить вывод ротатора</string>- <string name="prefs_net_rotator_ip_hint">IP адрес</string>- <string name="prefs_net_rotator_port_hint">Порт</string>+ <string name="prefs_net_rotator_address_hint">IP:Порт</string><string name="prefs_net_rotator_format_hint">Формат</string><string name="prefs_net_frequency_switch">Включить вывод частоты</string>- <string name="prefs_net_frequency_ip_hint">IP адрес</string>- <string name="prefs_net_frequency_port_hint">Порт</string>+ <string name="prefs_net_frequency_address_hint">IP:Порт</string><string name="prefs_net_frequency_format_hint">Формат</string><string name="prefs_bt_title">Вывод данных Bluetooth</string>diff --git a/core/presentation/src/main/res/values-si/strings.xml b/core/presentation/src/main/res/values-si/strings.xmlindex b8a1c495..6777d1b5 100644--- a/core/presentation/src/main/res/values-si/strings.xml+++ b/core/presentation/src/main/res/values-si/strings.xml@@ -118,12 +118,10 @@<string name="prefs_net_title">ජාල ප්රතිදානය</string><string name="prefs_net_rotator_switch">Enable rotation output</string>- <string name="prefs_net_rotator_ip_hint">IP ලිපිනය</string>- <string name="prefs_net_rotator_port_hint">Port</string>+ <string name="prefs_net_rotator_address_hint">IP:Port</string><string name="prefs_net_rotator_format_hint">දත්ත අකාරය</string><string name="prefs_net_frequency_switch">Enable frequency output</string>- <string name="prefs_net_frequency_ip_hint">IP ලිපිනය</string>- <string name="prefs_net_frequency_port_hint">Port</string>+ <string name="prefs_net_frequency_address_hint">IP:Port</string><string name="prefs_net_frequency_format_hint">දත්ත අකාරය</string><string name="prefs_bt_title">Bluetooth දත්ත ප්රතිදානය</string>diff --git a/core/presentation/src/main/res/values-uk/strings.xml b/core/presentation/src/main/res/values-uk/strings.xmlindex 19c0d6d7..85d94a03 100644--- a/core/presentation/src/main/res/values-uk/strings.xml+++ b/core/presentation/src/main/res/values-uk/strings.xml@@ -118,12 +118,10 @@<string name="prefs_net_title">Вивід мережевих даних</string><string name="prefs_net_rotator_switch">Enable rotation output</string>- <string name="prefs_net_rotator_ip_hint">IP адреса</string>- <string name="prefs_net_rotator_port_hint">Порт</string>+ <string name="prefs_net_rotator_address_hint">IP:Порт</string><string name="prefs_net_rotator_format_hint">Формат даних</string><string name="prefs_net_frequency_switch">Enable frequency output</string>- <string name="prefs_net_frequency_ip_hint">IP адреса</string>- <string name="prefs_net_frequency_port_hint">Порт</string>+ <string name="prefs_net_frequency_address_hint">IP:Порт</string><string name="prefs_net_frequency_format_hint">Формат даних</string><string name="prefs_bt_title">Вивід даних Bluetooth</string>diff --git a/core/presentation/src/main/res/values-zh/strings.xml b/core/presentation/src/main/res/values-zh/strings.xmlindex bd55a20c..40b7c0e8 100644--- a/core/presentation/src/main/res/values-zh/strings.xml+++ b/core/presentation/src/main/res/values-zh/strings.xml@@ -110,12 +110,10 @@<string name="prefs_net_title">网络数据输出</string><string name="prefs_net_rotator_switch">启用方位俯仰角输出</string>- <string name="prefs_net_rotator_ip_hint">IP地址</string>- <string name="prefs_net_rotator_port_hint">端口</string>+ <string name="prefs_net_rotator_address_hint">IP:端口</string><string name="prefs_net_rotator_format_hint">数据格式</string><string name="prefs_net_frequency_switch">启用多普勒频率输出</string>- <string name="prefs_net_frequency_ip_hint">IP地址</string>- <string name="prefs_net_frequency_port_hint">端口</string>+ <string name="prefs_net_frequency_address_hint">IP:端口</string><string name="prefs_net_frequency_format_hint">数据格式</string><string name="prefs_bt_title">蓝牙数据输出</string>diff --git a/core/presentation/src/main/res/values/strings.xml b/core/presentation/src/main/res/values/strings.xmlindex 9705d024..7bcc1c68 100644--- a/core/presentation/src/main/res/values/strings.xml+++ b/core/presentation/src/main/res/values/strings.xml@@ -147,12 +147,10 @@<string name="prefs_net_title">Network data output</string><string name="prefs_net_rotator_switch">Enable rotation output</string>- <string name="prefs_net_rotator_ip_hint">IP address</string>- <string name="prefs_net_rotator_port_hint">Port</string>+ <string name="prefs_net_rotator_address_hint">IP:Port</string><string name="prefs_net_rotator_format_hint">Format</string><string name="prefs_net_frequency_switch">Enable frequency output</string>- <string name="prefs_net_frequency_ip_hint">IP address</string>- <string name="prefs_net_frequency_port_hint">Port</string>+ <string name="prefs_net_frequency_address_hint">IP:Port</string><string name="prefs_net_frequency_format_hint">Format</string><string name="prefs_bt_title">Bluetooth data output</string>diff --git a/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsDialog.kt b/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsDialog.ktindex 07aa8d27..8e3c6d13 100644--- a/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsDialog.kt+++ b/feature/settings/src/main/java/com/rtbishop/look4sat/feature/settings/SettingsDialog.kt@@ -240,22 +240,26 @@ fun NetworkOutputDialog() {val padding = LocalSpacing.current.largeval rotatorState = rememberSaveable { mutableStateOf(initialSettings.rotatorState) }- val rotatorAddress = rememberSaveable { mutableStateOf(initialSettings.rotatorAddress) }- val rotatorPort = rememberSaveable { mutableStateOf(initialSettings.rotatorPort) }+ val rotatorAddress = rememberSaveable {+ mutableStateOf("${initialSettings.rotatorAddress}:${initialSettings.rotatorPort}")+ }val rotatorFormat = rememberSaveable { mutableStateOf(initialSettings.rotatorFormat) }val frequencyState = rememberSaveable { mutableStateOf(initialSettings.frequencyState) }- val frequencyAddress = rememberSaveable { mutableStateOf(initialSettings.frequencyAddress) }- val frequencyPort = rememberSaveable { mutableStateOf(initialSettings.frequencyPort) }+ val frequencyAddress = rememberSaveable {+ mutableStateOf("${initialSettings.frequencyAddress}:${initialSettings.frequencyPort}")+ }val frequencyFormat = rememberSaveable { mutableStateOf(initialSettings.frequencyFormat) }val onAccept = {+ val (rotIp, rotPort) = splitAddress(rotatorAddress.value)+ val (freqIp, freqPort) = splitAddress(frequencyAddress.value)onSave(rotatorState.value,- rotatorAddress.value,- rotatorPort.value,+ rotIp,+ rotPort,rotatorFormat.value,frequencyState.value,- frequencyAddress.value,- frequencyPort.value,+ freqIp,+ freqPort,frequencyFormat.value)onDismiss()@@ -285,29 +289,20 @@ fun NetworkOutputDialog(value = rotatorAddress.value,onValueChange = { rotatorAddress.value = it },singleLine = true,- label = { Text(stringResource(R.string.prefs_net_rotator_ip_hint)) },- modifier = Modifier.weight(1.5f),+ label = { Text(stringResource(R.string.prefs_net_rotator_address_hint)) },+ modifier = Modifier.weight(0.6f),enabled = rotatorState.value)OutlinedTextField(- value = rotatorPort.value,- onValueChange = { rotatorPort.value = it },+ value = rotatorFormat.value,+ onValueChange = { rotatorFormat.value = it },singleLine = true,- label = { Text(stringResource(R.string.prefs_net_rotator_port_hint)) },- modifier = Modifier.weight(1f),+ label = { Text(stringResource(R.string.prefs_net_rotator_format_hint)) },+ modifier = Modifier.weight(0.4f),enabled = rotatorState.value)}Spacer(modifier = Modifier.height(6.dp))- OutlinedTextField(- value = rotatorFormat.value,- onValueChange = { rotatorFormat.value = it },- singleLine = true,- label = { Text(stringResource(R.string.prefs_net_rotator_format_hint)) },- modifier = Modifier.fillMaxWidth(),- enabled = rotatorState.value- )- Spacer(modifier = Modifier.height(6.dp))Row(horizontalArrangement = Arrangement.SpaceBetween,verticalAlignment = Alignment.CenterVertically,@@ -327,32 +322,32 @@ fun NetworkOutputDialog(value = frequencyAddress.value,onValueChange = { frequencyAddress.value = it },singleLine = true,- label = { Text(stringResource(R.string.prefs_net_frequency_ip_hint)) },- modifier = Modifier.weight(1.5f),+ label = { Text(stringResource(R.string.prefs_net_frequency_address_hint)) },+ modifier = Modifier.weight(0.6f),enabled = frequencyState.value)OutlinedTextField(- value = frequencyPort.value,- onValueChange = { frequencyPort.value = it },+ value = frequencyFormat.value,+ onValueChange = { frequencyFormat.value = it },singleLine = true,- label = { Text(stringResource(R.string.prefs_net_frequency_port_hint)) },- modifier = Modifier.weight(1f),+ label = { Text(stringResource(R.string.prefs_net_frequency_format_hint)) },+ modifier = Modifier.weight(0.4f),enabled = frequencyState.value)}- Spacer(modifier = Modifier.height(6.dp))- OutlinedTextField(- value = frequencyFormat.value,- onValueChange = { frequencyFormat.value = it },- maxLines = 2,- label = { Text(stringResource(R.string.prefs_net_frequency_format_hint)) },- modifier = Modifier.fillMaxWidth(),- enabled = frequencyState.value- )}}}+private fun splitAddress(address: String): Pair<String, String> {+ val lastColon = address.lastIndexOf(':')+ return if (lastColon >= 0) {+ address.substring(0, lastColon) to address.substring(lastColon + 1)+ } else {+ address to ""+ }+}+@Preview(showBackground = true)@Composablefun PreviewBluetoothOutputDialog() {@@ -434,7 +429,7 @@ fun BluetoothOutputDialog(onValueChange = { rotatorAddress.value = it },singleLine = true,label = { Text(stringResource(R.string.prefs_bt_rotator_device_hint)) },- modifier = Modifier.weight(1.5f),+ modifier = Modifier.weight(0.6f),enabled = rotatorState.value)OutlinedTextField(@@ -442,7 +437,7 @@ fun BluetoothOutputDialog(onValueChange = { rotatorFormat.value = it },singleLine = true,label = { Text(stringResource(R.string.prefs_bt_rotator_output_hint)) },- modifier = Modifier.weight(1f),+ modifier = Modifier.weight(0.4f),enabled = rotatorState.value)}@@ -467,7 +462,7 @@ fun BluetoothOutputDialog(onValueChange = { frequencyAddress.value = it },singleLine = true,label = { Text(stringResource(R.string.prefs_bt_frequency_device_hint)) },- modifier = Modifier.weight(1.5f),+ modifier = Modifier.weight(0.6f),enabled = frequencyState.value)OutlinedTextField(@@ -475,7 +470,7 @@ fun BluetoothOutputDialog(onValueChange = { frequencyFormat.value = it },singleLine = true,label = { Text(stringResource(R.string.prefs_bt_frequency_output_hint)) },- modifier = Modifier.weight(1f),+ modifier = Modifier.weight(0.4f),enabled = frequencyState.value)}