Added more tweaks to the Transceiver card component

This commit is contained in:
Arty Bishop committed 2025-12-27 15:02:15 +00:00
1 parent c370d9febd
commit 1a69822d3f
5 files changed
+66 -87

No files matched your search

@@ -148,20 +148,20 @@ private fun MapDataCard(data: MapData) {
Card(colors = cardColors) {
Column(modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)) {
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
Text(text = stringResource(R.string.map_azimuth, data.azimuth))
Text(text = stringResource(R.string.map_elevation, data.elevation))
Text(text = stringResource(R.string.map_azimuth, data.azimuth), color = textColor)
Text(text = stringResource(R.string.map_elevation, data.elevation), color = textColor)
}
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
Text(text = stringResource(R.string.map_altitude, data.altitude), color = textColor)
Text(text = stringResource(R.string.map_distance, data.range), color = textColor)
Text(text = stringResource(R.string.map_altitude, data.altitude))
Text(text = stringResource(R.string.map_distance, data.range))
}
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
Text(text = stringResource(R.string.map_latitude, data.osmPos.latitude))
Text(text = stringResource(R.string.map_longitude, data.osmPos.longitude))
Text(text = stringResource(R.string.map_latitude, data.osmPos.latitude), color = textColor)
Text(text = stringResource(R.string.map_longitude, data.osmPos.longitude), color = textColor)
}
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
Text(text = stringResource(R.string.map_qth, data.qthLoc), color = textColor)
Text(text = stringResource(R.string.map_phase, data.phase), color = textColor)
Text(text = stringResource(R.string.map_qth, data.qthLoc))
Text(text = stringResource(R.string.map_phase, data.phase))
}
}
}
@@ -177,27 +177,27 @@ private fun MapDataCards(data: MapData) {
Box(modifier = Modifier.fillMaxSize()) {
Card(colors = cardColors, modifier = Modifier.align(Alignment.TopStart)) {
Column(horizontalAlignment = Alignment.Start, modifier = paddingMod) {
Text(text = stringResource(R.string.map_azimuth, data.azimuth))
Text(text = stringResource(R.string.map_elevation, data.elevation), color = textColor)
Text(text = stringResource(R.string.map_azimuth, data.azimuth), color = textColor)
Text(text = stringResource(R.string.map_elevation, data.elevation))
}
}
Card(colors = cardColors, modifier = Modifier.align(Alignment.TopEnd)) {
Column(horizontalAlignment = Alignment.End, modifier = paddingMod) {
Text(text = stringResource(R.string.map_altitude, data.altitude))
Text(text = stringResource(R.string.map_distance, data.range), color = textColor)
Text(text = stringResource(R.string.map_altitude, data.altitude), color = textColor)
Text(text = stringResource(R.string.map_distance, data.range))
}
}
Card(colors = cardColors, modifier = Modifier.align(Alignment.BottomStart)) {
Column(horizontalAlignment = Alignment.Start, modifier = paddingMod) {
Text(text = stringResource(R.string.map_phase, data.phase))
Text(text = stringResource(R.string.map_qth, data.qthLoc), color = textColor)
Text(text = stringResource(R.string.map_phase, data.phase), color = textColor)
Text(text = stringResource(R.string.map_qth, data.qthLoc))
}
}
Text(text = osmText, fontSize = 14.sp, modifier = Modifier.align(Alignment.BottomCenter))
Card(colors = cardColors, modifier = Modifier.align(Alignment.BottomEnd)) {
Column(horizontalAlignment = Alignment.End, modifier = paddingMod) {
Text(text = stringResource(R.string.map_latitude, data.osmPos.latitude))
Text(text = stringResource(R.string.map_longitude, data.osmPos.longitude), color = textColor)
Text(text = stringResource(R.string.map_latitude, data.osmPos.latitude), color = textColor)
Text(text = stringResource(R.string.map_longitude, data.osmPos.longitude))
}
}
}
@@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
@@ -31,7 +30,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
@@ -351,7 +349,8 @@ private fun TransmitterItem(radio: SatRadio) {
// LaunchedEffect(radio) {
// BluetoothCIV.updateOnce(radio)
// }
val title = if (radio.isInverted) "INVERTED: ${radio.info}" else radio.info
val fullTitle = "$title - (${radio.downlinkMode ?: "--"}/${radio.uplinkMode ?: "--"})"
Surface(color = MaterialTheme.colorScheme.background,
// modifier = Modifier.clickable(onClick = {
// Log.d("BluetoothCivManager", radio.toString())
@@ -364,86 +363,66 @@ private fun TransmitterItem(radio: SatRadio) {
) {
Surface(modifier = Modifier.padding(bottom = 2.dp)) {
Column(
verticalArrangement = Arrangement.spacedBy(4.dp),
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier
.background(MaterialTheme.colorScheme.surface)
.padding(horizontal = 6.dp, vertical = 8.dp)
.padding(horizontal = 8.dp, vertical = 6.dp)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth()
) {
Icon(
painter = painterResource(id = R.drawable.ic_arrow),
tint = Color.Green,
contentDescription = null, modifier = Modifier
.rotate(90f)
.weight(0.15f)
)
Text(
text = if (radio.isInverted) "INVERTED: ${radio.info} " else "${radio.info} ",
text = fullTitle,
textAlign = TextAlign.Center,
modifier = Modifier
.fillMaxWidth()
.infiniteMarquee()
.weight(0.7f)
)
Icon(
painter = painterResource(id = R.drawable.ic_arrow),
tint = Color.Red,
contentDescription = null, modifier = Modifier
.rotate(-90f)
.weight(0.15f)
)
}
FrequencyRow(satRadio = radio)
FrequencyRow(radio = radio, isDownlink = true)
FrequencyRow(radio = radio, isDownlink = false)
}
}
}
}
@Composable
private fun FrequencyRow(satRadio: SatRadio) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
ModeText(satRadio.downlinkMode)
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.weight(0.35f)
) {
FrequencyText(satRadio.downlinkHigh)
FrequencyText(satRadio.downlinkLow)
}
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.weight(0.35f)
) {
FrequencyText(satRadio.uplinkHigh)
FrequencyText(satRadio.uplinkLow)
}
ModeText(satRadio.uplinkMode)
}
}
@Composable
private fun RowScope.ModeText(mode: String?) {
private fun FrequencyRow(radio: SatRadio, isDownlink: Boolean, modifier: Modifier = Modifier) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = modifier.fillMaxWidth()) {
val rotateMod = Modifier.rotate(if (isDownlink) 90f else -90f)
val weightMod = Modifier.weight(1f)
Text(
text = mode ?: "- - : - -",
textAlign = TextAlign.Center,
modifier = Modifier.weight(0.15f)
)
}
@Composable
private fun FrequencyText(frequency: Long?) {
val noLinkText = stringResource(R.string.radio_no_link)
val freqValue = frequency?.let { it / 1000000f }
val freqText = freqValue?.let { stringResource(id = R.string.radio_link_low, it) } ?: noLinkText
Text(
text = freqText,
text = if (isDownlink) "D:" else "U:",
textAlign = TextAlign.Center,
fontSize = 18.sp,
color = MaterialTheme.colorScheme.onSurface,
modifier = modifier.size(width = 24.dp, height = 24.dp)
)
FrequencyText(if (isDownlink) radio.downlinkLow else radio.uplinkLow, weightMod)
Text(
text = "-",
textAlign = TextAlign.Center,
fontSize = 21.sp,
fontWeight = FontWeight.Bold,
color = MaterialTheme.colorScheme.primary
color = MaterialTheme.colorScheme.primary,
modifier = modifier
)
FrequencyText(if (isDownlink) radio.downlinkHigh else radio.uplinkHigh, weightMod)
Icon(
painter = painterResource(id = R.drawable.ic_arrow),
tint = MaterialTheme.colorScheme.onSurface,
contentDescription = if (isDownlink) "Downlink" else "Uplink",
modifier = rotateMod.size(width = 24.dp, height = 24.dp)
)
}
}
@Composable
private fun FrequencyText(frequency: Long?, modifier: Modifier = Modifier) {
val noLinkText = stringResource(R.string.radio_no_link)
val freqValue = frequency?.let { it / 1000000f }
Text(
text = freqValue?.let { stringResource(id = R.string.radio_link_low, it) } ?: noLinkText,
textAlign = TextAlign.Center,
fontSize = 21.sp,
fontWeight = FontWeight.Bold,
color = MaterialTheme.colorScheme.primary,
modifier = modifier
)
}
+1 -1
View File
@@ -1,4 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/accent" />
<solid android:color="@color/background" />
</shape>
+2 -2
View File
@@ -10,10 +10,10 @@
android:translateX="70.26573"
android:translateY="70.26573">
<path
android:fillColor="@color/background"
android:fillColor="@color/accent"
android:pathData="m96.64,31.5c7.91,8 17.14,13.58 25.36,15.58l1.75,-4C123.78,43.05 123.79,43.01 123.8,42.97 125.83,38.99 127,34.49 127,29.72 127,13.88 114.38,1 98.87,1c-5.13,0 -9.92,1.43 -14.06,3.88l-3.4,1.6c0.08,0.31 0.13,0.6 0.22,0.91 2.32,8.1 7.65,16.67 15.02,24.11z" />
<path
android:fillColor="@color/background"
android:fillColor="@color/accent"
android:pathData="M93.88,34.3C86.05,26.39 80.37,17.23 77.87,8.49 77.84,8.39 77.82,8.28 77.79,8.18L2.63,43.51c-1.4,0.66 -2.02,2.36 -1.37,3.79 0.47,1.05 1.49,1.66 2.55,1.66 0.39,0 0.79,-0.08 1.17,-0.26L74.04,16.24c-1.87,3.58 -3,7.61 -3.23,11.89L35.57,51.73c-1.29,0.87 -1.65,2.64 -0.81,3.96 0.54,0.84 1.43,1.29 2.34,1.29 0.53,0 1.06,-0.15 1.53,-0.47L71.19,34.71c1.4,8.11 6.14,15.04 12.72,19.28l-54.94,68.34c-0.98,1.22 -0.81,3.02 0.39,4.02 0.52,0.44 1.15,0.65 1.77,0.65 0.81,0 1.61,-0.36 2.17,-1.04L89.06,56.6c3.06,1.17 6.36,1.84 9.81,1.84 4.93,0 9.57,-1.31 13.6,-3.6L84.6,118.32c-0.63,1.44 0,3.13 1.41,3.78 0.37,0.17 0.76,0.25 1.14,0.25 1.07,0 2.09,-0.63 2.56,-1.69L120.4,50.74C111.64,48.42 102.04,42.56 93.88,34.3Z" />
</group>
</group>
+2 -2
View File
@@ -10,10 +10,10 @@
android:translateX="70.26573"
android:translateY="70.26573">
<path
android:fillColor="@color/background"
android:fillColor="@color/accent"
android:pathData="m96.64,31.5c7.91,8 17.14,13.58 25.36,15.58l1.75,-4C123.78,43.05 123.79,43.01 123.8,42.97 125.83,38.99 127,34.49 127,29.72 127,13.88 114.38,1 98.87,1c-5.13,0 -9.92,1.43 -14.06,3.88l-3.4,1.6c0.08,0.31 0.13,0.6 0.22,0.91 2.32,8.1 7.65,16.67 15.02,24.11z" />
<path
android:fillColor="@color/background"
android:fillColor="@color/accent"
android:pathData="M93.88,34.3C86.05,26.39 80.37,17.23 77.87,8.49 77.84,8.39 77.82,8.28 77.79,8.18L2.63,43.51c-1.4,0.66 -2.02,2.36 -1.37,3.79 0.47,1.05 1.49,1.66 2.55,1.66 0.39,0 0.79,-0.08 1.17,-0.26L74.04,16.24c-1.87,3.58 -3,7.61 -3.23,11.89L35.57,51.73c-1.29,0.87 -1.65,2.64 -0.81,3.96 0.54,0.84 1.43,1.29 2.34,1.29 0.53,0 1.06,-0.15 1.53,-0.47L71.19,34.71c1.4,8.11 6.14,15.04 12.72,19.28l-54.94,68.34c-0.98,1.22 -0.81,3.02 0.39,4.02 0.52,0.44 1.15,0.65 1.77,0.65 0.81,0 1.61,-0.36 2.17,-1.04L89.06,56.6c3.06,1.17 6.36,1.84 9.81,1.84 4.93,0 9.57,-1.31 13.6,-3.6L84.6,118.32c-0.63,1.44 0,3.13 1.41,3.78 0.37,0.17 0.76,0.25 1.14,0.25 1.07,0 2.09,-0.63 2.56,-1.69L120.4,50.74C111.64,48.42 102.04,42.56 93.88,34.3Z" />
</group>
</group>