Added a few minor tweaks to resources and screens
This commit is contained in:
1 parent
6c3aeab041
commit
82f41940c7
8 files changed
+68
-39
No files matched your search
@@ -33,6 +33,7 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
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
|
||||
@@ -216,10 +217,24 @@ fun CardLoadingIndicator() {
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun EmptyListCard(message: String) {
|
||||
Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||
modifier = Modifier.padding(32.dp)
|
||||
) {
|
||||
Text(text = stringResource(R.string.empty_list_title), fontSize = 21.sp)
|
||||
Text(text = message, fontSize = 18.sp, textAlign = TextAlign.Center)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getDefaultPass(): OrbitalPass {
|
||||
val orbitalData = OrbitalData("No Future Passes", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0)
|
||||
val orbitalData = OrbitalData("||=<☉>=||", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0)
|
||||
val satellite = NearEarthObject(orbitalData)
|
||||
return OrbitalPass(0L, 0.0, 0L, 0.0, 0, 0.0, satellite, 0f)
|
||||
return OrbitalPass(0L, 0.0, Long.MAX_VALUE, 0.0, 0, 0.0, satellite, 0f)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.rtbishop.look4sat.domain.predict.OrbitalData
|
||||
import com.rtbishop.look4sat.domain.predict.OrbitalPass
|
||||
import com.rtbishop.look4sat.presentation.MainTheme
|
||||
import com.rtbishop.look4sat.presentation.Screen
|
||||
import com.rtbishop.look4sat.presentation.common.EmptyListCard
|
||||
import com.rtbishop.look4sat.presentation.common.IconCard
|
||||
import com.rtbishop.look4sat.presentation.common.InfoDialog
|
||||
import com.rtbishop.look4sat.presentation.common.NextPassRow
|
||||
@@ -139,17 +140,21 @@ private fun PassesList(
|
||||
)
|
||||
}
|
||||
) {
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Adaptive(320.dp),
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
items(items = passes, key = { item -> item.catNum + item.aosTime }) { pass ->
|
||||
NearEarthPass(
|
||||
pass = pass,
|
||||
navigateToRadar = navigateToRadar,
|
||||
modifier = Modifier.animateItem(),
|
||||
isVerticalLayout = isVerticalLayout
|
||||
)
|
||||
if (passes.isEmpty()) {
|
||||
EmptyListCard(message = stringResource(R.string.passes_empty_list_message))
|
||||
} else {
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Adaptive(320.dp),
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
items(items = passes, key = { item -> item.catNum + item.aosTime }) { pass ->
|
||||
NearEarthPass(
|
||||
pass = pass,
|
||||
navigateToRadar = navigateToRadar,
|
||||
modifier = Modifier.animateItem(),
|
||||
isVerticalLayout = isVerticalLayout
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ class PassesViewModel(
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
delay(1000)
|
||||
satelliteRepo.passes.collectLatest { passes ->
|
||||
processing?.cancelAndJoin()
|
||||
processing = viewModelScope.launch {
|
||||
@@ -117,7 +118,7 @@ class PassesViewModel(
|
||||
val nextPass = passes.first { it.aosTime.minus(timeNow) > 0 }
|
||||
val time = nextPass.aosTime.minus(timeNow).toTimerString()
|
||||
_uiState.update { it.copy(nextPass = nextPass, nextTime = time, isNextTimeAos = true) }
|
||||
} catch (exception: NoSuchElementException) {
|
||||
} catch (_: NoSuchElementException) {
|
||||
val lastPass = passes.last()
|
||||
val time = lastPass.losTime.minus(timeNow).toTimerString()
|
||||
_uiState.update { it.copy(nextPass = lastPass, nextTime = time, isNextTimeAos = false) }
|
||||
|
||||
@@ -100,6 +100,9 @@ private fun RadarScreen(uiState: RadarState, navigateUp: () -> Unit) {
|
||||
if(isVerticalLayout()) {
|
||||
ElevatedCard(modifier = Modifier.weight(1f)) {
|
||||
Box(contentAlignment = Alignment.Center) {
|
||||
if (uiState.orbitalPos == null) {
|
||||
ElevatedCard(modifier = Modifier.fillMaxSize()) {}
|
||||
}
|
||||
uiState.orbitalPos?.let { position ->
|
||||
RadarViewCompose(
|
||||
item = position,
|
||||
@@ -182,6 +185,9 @@ private fun RadarScreen(uiState: RadarState, navigateUp: () -> Unit) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
ElevatedCard(modifier = Modifier.weight(1f)) {
|
||||
Box(contentAlignment = Alignment.Center) {
|
||||
if (uiState.orbitalPos == null) {
|
||||
ElevatedCard(modifier = Modifier.fillMaxSize()) {}
|
||||
}
|
||||
uiState.orbitalPos?.let { position ->
|
||||
RadarViewCompose(
|
||||
item = position,
|
||||
@@ -355,7 +361,7 @@ private fun TransmitterItem(radio: SatRadio) {
|
||||
// BluetoothCIV.updateOnce(radio)
|
||||
// }
|
||||
// })
|
||||
) {
|
||||
) {
|
||||
Surface(modifier = Modifier.padding(bottom = 2.dp)) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
@@ -436,7 +442,7 @@ private fun FrequencyText(frequency: Long?) {
|
||||
Text(
|
||||
text = freqText,
|
||||
textAlign = TextAlign.Center,
|
||||
fontSize = 21.sp,
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.rtbishop.look4sat.domain.model.SatItem
|
||||
import com.rtbishop.look4sat.presentation.MainTheme
|
||||
import com.rtbishop.look4sat.presentation.Screen
|
||||
import com.rtbishop.look4sat.presentation.common.CardLoadingIndicator
|
||||
import com.rtbishop.look4sat.presentation.common.EmptyListCard
|
||||
import com.rtbishop.look4sat.presentation.common.IconCard
|
||||
import com.rtbishop.look4sat.presentation.common.InfoDialog
|
||||
import com.rtbishop.look4sat.presentation.common.TopBar
|
||||
@@ -104,10 +105,11 @@ private fun SatellitesScreen(uiState: SatellitesState, navigateUp: () -> Unit) {
|
||||
}
|
||||
}
|
||||
ElevatedCard(modifier = Modifier.fillMaxSize()) {
|
||||
if (uiState.isLoading) {
|
||||
CardLoadingIndicator()
|
||||
} else {
|
||||
SatellitesCard(uiState.itemsList) { id, isTicked ->
|
||||
val emptyMessage = stringResource(R.string.satellites_empty_list_message)
|
||||
when {
|
||||
uiState.isLoading -> CardLoadingIndicator()
|
||||
uiState.itemsList.isEmpty() -> EmptyListCard(message = emptyMessage)
|
||||
else -> SatellitesCard(uiState.itemsList) { id, isTicked ->
|
||||
uiState.takeAction(SatellitesAction.SelectSingle(id, isTicked))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<string name="menu_about">About</string>
|
||||
|
||||
<!--Buttons-->
|
||||
|
||||
<string name="btn_add">Add</string>
|
||||
<string name="btn_accept">Accept</string>
|
||||
<string name="btn_understand" translatable="false">I Understand</string>
|
||||
@@ -42,14 +41,20 @@
|
||||
<string name="btn_license">GPLv3 Licence</string>
|
||||
<string name="btn_privacy">Privacy Policy</string>
|
||||
|
||||
<!--Dialogs-->
|
||||
<!--Commmon-->
|
||||
<string name="empty_list_title" translatable="false">No items to display</string>
|
||||
|
||||
<!--Dialogs-->
|
||||
<string name="satellites_empty_list_message" translatable="false">
|
||||
Make sure your search query is correct and the DB is updated</string>
|
||||
<string name="satellites_warning_title" translatable="false">Warning\!</string>
|
||||
<string name="satellites_warning_message" translatable="false">
|
||||
There are over 9000 satellites listed in this app.
|
||||
It makes no sense to track them all at the same time.
|
||||
\n\nAlways try to narrow down the list to only the ones
|
||||
you\'re interested in via search and types selector.</string>
|
||||
<string name="passes_empty_list_message" translatable="false">
|
||||
Make sure your filters are correct and you have selected satellites</string>
|
||||
<string name="passes_welcome_title" translatable="false">Welcome to Look4Sat\!</string>
|
||||
<string name="passes_welcome_message" translatable="false">
|
||||
Make sure to set your position via GPS, Lat/Lon or QTH in Settings.
|
||||
@@ -80,7 +85,6 @@
|
||||
<string name="types_message">Selected type: %s</string>
|
||||
|
||||
<!--Fragments-->
|
||||
|
||||
<string name="entries_search_hint">Name / Id</string>
|
||||
|
||||
<string name="passes_error">There are no upcoming satellite passes to display</string>
|
||||
@@ -142,7 +146,6 @@
|
||||
<string name="map_copyright">Wikimedia maps | Map data © OpenStreetMap contributors</string>
|
||||
|
||||
<!--Cards-->
|
||||
|
||||
<string name="location_title">Station position</string>
|
||||
<string name="location_lat">Latitude: %.4f°</string>
|
||||
<string name="location_lon">Longitude: %.4f°</string>
|
||||
|
||||
@@ -35,17 +35,14 @@ fun qthToPosition(locator: String): GeoPos? {
|
||||
|
||||
fun positionToQth(latitude: Double, longitude: Double): String? {
|
||||
if (!isValidPosition(latitude, longitude)) return null
|
||||
val tempLon = if (longitude > 180.0) longitude - 180 else longitude
|
||||
val upper = "ABCDEFGHIJKLMNOPQRSTUVWX"
|
||||
val lower = "abcdefghijklmnopqrstuvwx"
|
||||
val newLongitude = tempLon + 180
|
||||
val newLongitude = if (longitude > 180.0) longitude else longitude + 180
|
||||
val newLatitude = latitude + 90
|
||||
val lonFirst = upper[(newLongitude / 20).toInt()]
|
||||
val latFirst = upper[(newLatitude / 10).toInt()]
|
||||
val lonSecond = ((newLongitude / 2) % 10).toInt().toString()
|
||||
val latSecond = (newLatitude % 10).toInt().toString()
|
||||
val lonThird = lower[((newLongitude % 2) * 12).toInt()]
|
||||
val latThird = lower[((newLatitude % 1) * 24).toInt()]
|
||||
val lonFirst = (65 + (newLongitude / 20)).toInt().toChar()
|
||||
val latFirst = (65 + (newLatitude / 10)).toInt().toChar()
|
||||
val lonSecond = ((newLongitude / 2) % 10).toInt()
|
||||
val latSecond = (newLatitude % 10).toInt()
|
||||
val lonThird = (65 + (newLongitude % 2) * 12).toInt().toChar().lowercaseChar()
|
||||
val latThird = (65 + (newLatitude % 1) * 24).toInt().toChar().lowercaseChar()
|
||||
return "$lonFirst$latFirst$lonSecond$latSecond$lonThird$latThird"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[versions]
|
||||
android-gradle-plugin = "8.12.0"
|
||||
google-ksp = "2.2.0-2.0.2"
|
||||
kotlin = "2.2.0"
|
||||
android-gradle-plugin = "8.12.1"
|
||||
google-ksp = "2.2.10-2.0.2"
|
||||
kotlin = "2.2.10"
|
||||
|
||||
androidx-core-ktx = "1.16.0"
|
||||
androidx-core-ktx = "1.17.0"
|
||||
androidx-core-splashscreen = "1.0.1"
|
||||
androidx-room = "2.7.2"
|
||||
|
||||
compose-bom = "2025.07.00"
|
||||
compose-bom = "2025.08.00"
|
||||
compose-activity = "1.10.1"
|
||||
compose-lifecycle = "2.9.2"
|
||||
compose-navigation = "2.9.3"
|
||||
|
||||
Reference in new issue
Block a user