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