mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Integrated fixes from release v3.1.4 (leap year bug)
This commit is contained in:
1 parent
ad0b611bcb
commit
630fa2877f
16 files changed
+127
-84
No files matched your search
@@ -5,18 +5,18 @@ plugins {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(libs.versions.jvmToolchain.get().toInt())
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.rtbishop.look4sat"
|
||||
compileSdk = libs.versions.compileSdk.get().toInt()
|
||||
compileSdk = 34
|
||||
defaultConfig {
|
||||
applicationId = "com.rtbishop.look4sat"
|
||||
minSdk = libs.versions.minSdk.get().toInt()
|
||||
targetSdk = libs.versions.targetSdk.get().toInt()
|
||||
versionCode = libs.versions.versionCode.get().toInt()
|
||||
versionName = libs.versions.versionName.get()
|
||||
minSdk = 26
|
||||
targetSdk = 34
|
||||
versionCode = 314
|
||||
versionName = "3.1.4"
|
||||
resourceConfigurations.addAll(listOf("en", "ru", "si", "zh-rCN", "anydpi"))
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
@@ -44,9 +43,10 @@ import com.rtbishop.look4sat.domain.predict.OrbitalData
|
||||
import com.rtbishop.look4sat.domain.predict.OrbitalPass
|
||||
import com.rtbishop.look4sat.presentation.MainTheme
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
private val sdf = SimpleDateFormat("HH:mm:ss", Locale.ENGLISH)
|
||||
private val sdfTime = SimpleDateFormat("HH:mm:ss", Locale.ENGLISH)
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
@@ -105,11 +105,10 @@ fun NextPassRow(pass: OrbitalPass) {
|
||||
.background(color = MaterialTheme.colorScheme.surface)
|
||||
.padding(start = 6.dp, top = 1.dp, end = 6.dp, bottom = 0.dp)
|
||||
) {
|
||||
val passSatId = stringResource(id = R.string.pass_satId, pass.catNum)
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = "Id:${pass.catNum} - ",
|
||||
modifier = Modifier.width(82.dp),
|
||||
textAlign = TextAlign.End,
|
||||
text = "$passSatId - ",
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
Text(
|
||||
@@ -139,23 +138,33 @@ fun NextPassRow(pass: OrbitalPass) {
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.pass_aosAz, pass.aosAzimuth),
|
||||
text = sdfTime.format(Date(pass.aosTime)),
|
||||
textAlign = TextAlign.Start,
|
||||
fontSize = 15.sp,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.pass_altitude, pass.altitude),
|
||||
text = stringResource(id = R.string.pass_aosLos, pass.aosAzimuth.toInt(), pass.losAzimuth.toInt()),
|
||||
textAlign = TextAlign.Center,
|
||||
fontSize = 15.sp,
|
||||
modifier = Modifier.weight(2f)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.pass_losAz, pass.losAzimuth),
|
||||
textAlign = TextAlign.End,
|
||||
fontSize = 15.sp,
|
||||
modifier = Modifier.weight(1f)
|
||||
modifier = Modifier.weight(1.5f)
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.End,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_altitude),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(16.dp)
|
||||
)
|
||||
Text(
|
||||
text = " ${pass.altitude} km",
|
||||
textAlign = TextAlign.Start,
|
||||
fontSize = 15.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ fun TypesDialog(items: List<String>, selected: String, dismiss: () -> Unit, sele
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.clickable { select(item) }) {
|
||||
Text(
|
||||
text = "$index - ",
|
||||
modifier = Modifier.padding(start = 12.dp),
|
||||
text = "$index).",
|
||||
modifier = Modifier.padding(start = 12.dp, end = 6.dp),
|
||||
fontWeight = FontWeight.Normal,
|
||||
color = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
|
||||
@@ -33,7 +33,6 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -188,6 +187,7 @@ private fun EntryPreview() {
|
||||
|
||||
@Composable
|
||||
private fun Entry(item: SatItem, onSelected: (Int, Boolean) -> Unit, modifier: Modifier) {
|
||||
val passSatId = stringResource(id = R.string.pass_satId, item.catnum)
|
||||
Surface(color = MaterialTheme.colorScheme.background,
|
||||
modifier = modifier.clickable { onSelected(item.catnum, item.isSelected) }) {
|
||||
Surface(modifier = Modifier.padding(bottom = 1.dp)) {
|
||||
@@ -195,12 +195,10 @@ private fun Entry(item: SatItem, onSelected: (Int, Boolean) -> Unit, modifier: M
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.padding(start = 0.dp, top = 8.dp, end = 12.dp, bottom = 8.dp)
|
||||
.padding(start = 14.dp, top = 8.dp, end = 12.dp, bottom = 8.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Id:${item.catnum} - ",
|
||||
modifier = Modifier.width(104.dp),
|
||||
textAlign = TextAlign.End,
|
||||
text = "$passSatId - ",
|
||||
color = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
Text(
|
||||
|
||||
@@ -144,7 +144,7 @@ fun PassesDialog(hours: Int, elev: Double, dismiss: () -> Unit, save: (Int, Doub
|
||||
Slider(
|
||||
value = hoursValue.intValue.toFloat(),
|
||||
onValueChange = { hoursValue.intValue = it.toInt() },
|
||||
valueRange = 1f..96f,
|
||||
valueRange = 1f..240f,
|
||||
colors = SliderDefaults.colors(inactiveTrackColor = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
@@ -49,7 +48,8 @@ import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
private val sdf = SimpleDateFormat("HH:mm:ss", Locale.ENGLISH)
|
||||
private val sdfDate = SimpleDateFormat("EEE, dd MMM", Locale.ENGLISH)
|
||||
private val sdfTime = SimpleDateFormat("HH:mm:ss", Locale.ENGLISH)
|
||||
|
||||
@Composable
|
||||
fun PassesScreen(uiState: PassesState, navToRadar: (Int, Long) -> Unit) {
|
||||
@@ -107,7 +107,7 @@ private fun DeepSpacePassPreview() {
|
||||
"Satellite", 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 45000, 0.0
|
||||
)
|
||||
val satellite = DeepSpaceObject(data)
|
||||
val pass = OrbitalPass(1L, 0.0, 10L, 180.0, 850, 45.0, satellite, 0.5f)
|
||||
val pass = OrbitalPass(1L, 180.0, 10L, 360.0, 36650, 45.0, satellite, 0.5f)
|
||||
MainTheme { PassItem(pass = pass, { _, _ -> }) }
|
||||
}
|
||||
|
||||
@@ -118,27 +118,26 @@ private fun NearEarthPassPreview() {
|
||||
"Satellite", 0.0, 15.0, 0.0, 0.0, 0.0, 0.0, 0.0, 45000, 0.0
|
||||
)
|
||||
val satellite = NearEarthObject(data)
|
||||
val pass = OrbitalPass(1L, 0.0, 10L, 180.0, 850, 45.0, satellite, 0.5f)
|
||||
val pass = OrbitalPass(1L, 180.0, 10L, 360.0, 36650, 45.0, satellite, 0.5f)
|
||||
MainTheme { PassItem(pass = pass, { _, _ -> }) }
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PassItem(pass: OrbitalPass, navToRadar: (Int, Long) -> Unit, modifier: Modifier = Modifier) {
|
||||
val passSatId = stringResource(id = R.string.pass_satId, pass.catNum)
|
||||
Surface(color = MaterialTheme.colorScheme.background, modifier = modifier) {
|
||||
Surface(modifier = Modifier
|
||||
.padding(bottom = 2.dp)
|
||||
.clickable { navToRadar(pass.catNum, pass.aosTime) }) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(2.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp),
|
||||
modifier = Modifier
|
||||
.background(color = MaterialTheme.colorScheme.surface)
|
||||
.padding(horizontal = 6.dp, vertical = 4.dp)
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = "Id:${pass.catNum} - ",
|
||||
modifier = Modifier.width(82.dp),
|
||||
textAlign = TextAlign.End,
|
||||
text = "$passSatId - ",
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
Text(
|
||||
@@ -168,23 +167,37 @@ private fun PassItem(pass: OrbitalPass, navToRadar: (Int, Long) -> Unit, modifie
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.pass_aosAz, pass.aosAzimuth),
|
||||
text = sdfDate.format(Date(pass.aosTime)),
|
||||
textAlign = TextAlign.Start,
|
||||
fontSize = 15.sp,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.pass_altitude, pass.altitude),
|
||||
text = stringResource(
|
||||
id = R.string.pass_aosLos,
|
||||
pass.aosAzimuth.toInt(),
|
||||
pass.losAzimuth.toInt()
|
||||
),
|
||||
textAlign = TextAlign.Center,
|
||||
fontSize = 15.sp,
|
||||
modifier = Modifier.weight(2f)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.pass_losAz, pass.losAzimuth),
|
||||
textAlign = TextAlign.End,
|
||||
fontSize = 15.sp,
|
||||
modifier = Modifier.weight(1f)
|
||||
modifier = Modifier.weight(1.5f)
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.End,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_altitude),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(16.dp)
|
||||
)
|
||||
Text(
|
||||
text = " ${pass.altitude} km",
|
||||
textAlign = TextAlign.Start,
|
||||
fontSize = 15.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
@@ -192,7 +205,10 @@ private fun PassItem(pass: OrbitalPass, navToRadar: (Int, Long) -> Unit, modifie
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
val defaultTime = " - - : - - "
|
||||
Text(text = if (pass.isDeepSpace) defaultTime else sdf.format(Date(pass.aosTime)), fontSize = 15.sp)
|
||||
Text(
|
||||
text = if (pass.isDeepSpace) defaultTime else sdfTime.format(Date(pass.aosTime)),
|
||||
fontSize = 15.sp
|
||||
)
|
||||
LinearProgressIndicator(
|
||||
progress = { if (pass.isDeepSpace) 100f else pass.progress },
|
||||
modifier = modifier
|
||||
@@ -200,7 +216,10 @@ private fun PassItem(pass: OrbitalPass, navToRadar: (Int, Long) -> Unit, modifie
|
||||
.padding(top = 2.dp),
|
||||
trackColor = MaterialTheme.colorScheme.inverseSurface
|
||||
)
|
||||
Text(text = if (pass.isDeepSpace) defaultTime else sdf.format(Date(pass.losTime)), fontSize = 15.sp)
|
||||
Text(
|
||||
text = if (pass.isDeepSpace) defaultTime else sdfTime.format(Date(pass.losTime)),
|
||||
fontSize = 15.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@ class RadarViewModel(
|
||||
if (settingsRepo.getRotatorState()) {
|
||||
val server = settingsRepo.getRotatorAddress()
|
||||
val port = settingsRepo.getRotatorPort().toInt()
|
||||
val azimuth = orbitalPos.azimuth.toDegrees().round(1)
|
||||
val elevation = orbitalPos.elevation.toDegrees().round(1)
|
||||
val azimuth = orbitalPos.azimuth.toDegrees().round(2)
|
||||
val elevation = orbitalPos.elevation.toDegrees().round(2)
|
||||
networkReporter.reportRotation(server, port, azimuth, elevation)
|
||||
}
|
||||
radarData.value = RadarData(orbitalPass, orbitalPos, track)
|
||||
|
||||
@@ -133,14 +133,15 @@ private fun CardAbout(version: String, modifier: Modifier = Modifier) {
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
) {
|
||||
Row(horizontalArrangement = Arrangement.Center) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_sputnik),
|
||||
tint = MaterialTheme.colorScheme.secondary,
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.size(96.dp)
|
||||
.padding(top = 8.dp, end = 8.dp)
|
||||
modifier = Modifier.size(72.dp)
|
||||
)
|
||||
Column {
|
||||
Text(
|
||||
@@ -436,8 +437,8 @@ private fun UpdateIndicator(isUpdating: Boolean, modifier: Modifier = Modifier)
|
||||
)
|
||||
} else {
|
||||
LinearProgressIndicator(
|
||||
progress = 0f,
|
||||
progress = { 0f },
|
||||
modifier = modifier.padding(start = 6.dp),
|
||||
trackColor = MaterialTheme.colorScheme.inverseSurface
|
||||
trackColor = MaterialTheme.colorScheme.inverseSurface,
|
||||
)
|
||||
}
|
||||
@@ -75,8 +75,9 @@
|
||||
<string name="passes_empty_db">No data to show. Please update the database via Settings menu.</string>
|
||||
|
||||
<string name="pass_satName">%s</string>
|
||||
<string name="pass_satId">Id:%d</string>
|
||||
<string name="pass_satId">Id:%05d</string>
|
||||
<string name="pass_aosAz">AOS - %.1f°</string>
|
||||
<string name="pass_aosLos" translatable="false">Az: %03d° -> Az: %03d°</string>
|
||||
<string name="pass_elevation">Elevation: %.1f°</string>
|
||||
<string name="pass_losAz">%.1f° - LOS</string>
|
||||
<string name="pass_altitude">Altitude: %d km</string>
|
||||
|
||||
Reference in new issue
Block a user