Updated dependencies, added EntriesDialog tweaks

This commit is contained in:
Arty Bishop committed 2025-12-27 15:01:46 +00:00
1 parent 1f53ffbda9
commit 08767c5589
8 files changed
+131 -63

No files matched your search

@@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ElevatedButton import androidx.compose.material3.ElevatedButton
import androidx.compose.material3.ElevatedCard import androidx.compose.material3.ElevatedCard
@@ -23,6 +24,8 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
@@ -37,6 +40,34 @@ import androidx.compose.ui.unit.sp
import com.rtbishop.look4sat.R import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.presentation.MainTheme import com.rtbishop.look4sat.presentation.MainTheme
@Composable
@Preview(showBackground = true)
private fun TimerBarNewPreview() {
MainTheme { TimerBarNew("88:88:88", "88:88:88") }
}
@Composable
fun TimerBarNew(aosTime: String, losTime: String) {
val isAosSelected = remember { mutableStateOf(true) }
val barHeightMod = Modifier.height(48.dp)
val timerText = if (isAosSelected.value) aosTime else losTime
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
CardAosLos(onClick = { isAosSelected.value = true }, iconId = R.drawable.ic_aos, isAosSelected.value)
ElevatedCard(modifier = barHeightMod.weight(1f)) {
Text(
text = "T- $timerText",
textAlign = TextAlign.Center,
fontSize = 42.sp,
fontWeight = FontWeight.Bold,
color = MaterialTheme.colorScheme.primary,
style = TextStyle(platformStyle = PlatformTextStyle(includeFontPadding = false)),
modifier = Modifier.fillMaxSize()
)
}
CardAosLos(onClick = { isAosSelected.value = false }, iconId = R.drawable.ic_los, isAosSelected.value.not())
}
}
@Composable @Composable
@Preview(showBackground = true) @Preview(showBackground = true)
private fun TimerBarPreview() { private fun TimerBarPreview() {
@@ -104,6 +135,22 @@ fun CardIcon(onClick: () -> Unit, iconId: Int, description: String? = null) {
} }
} }
@Composable
fun CardAosLos(onClick: () -> Unit, iconId: Int, isAos: Boolean = true, description: String? = null) {
val cardColors = if (isAos) {
CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primary)
} else {
CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
}
val iconTint = if (isAos) MaterialTheme.colorScheme.surface else MaterialTheme.colorScheme.onSurface
val clickableModifier = Modifier.clickable { onClick() }
ElevatedCard(modifier = Modifier.size(48.dp), colors = cardColors) {
Box(modifier = clickableModifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Icon(imageVector = ImageVector.vectorResource(iconId), tint = iconTint, contentDescription = description)
}
}
}
@Composable @Composable
fun CardLoadingIndicator() { fun CardLoadingIndicator() {
Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) { Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
@@ -3,28 +3,27 @@ package com.rtbishop.look4sat.presentation.entries
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.material3.ElevatedCard import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.RadioButton import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
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
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog
import com.rtbishop.look4sat.presentation.MainTheme import com.rtbishop.look4sat.presentation.MainTheme
@Preview(showBackground = true) @Preview(showBackground = true)
@@ -34,56 +33,48 @@ private fun TypeDialogPreview() {
MainTheme { TypesDialog(types, "All", {}) {} } MainTheme { TypesDialog(types, "All", {}) {} }
} }
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun TypesDialog(items: List<String>, selected: String, dismiss: () -> Unit, select: (String) -> Unit) { fun TypesDialog(items: List<String>, selected: String, dismiss: () -> Unit, select: (String) -> Unit) {
val height = LocalConfiguration.current.screenHeightDp ModalBottomSheet(
Dialog(onDismissRequest = { dismiss() }) { onDismissRequest = { dismiss() },
ElevatedCard { sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
Column( dragHandle = { BottomSheetDefaults.DragHandle() },
horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.fillMaxHeight(0.80f)
modifier = Modifier.heightIn(max = height.times(0.80).dp) ) {
) { LazyVerticalGrid(
Text( columns = GridCells.Adaptive(240.dp),
text = "Select satellites type", modifier = Modifier.background(MaterialTheme.colorScheme.background),
fontSize = 18.sp, horizontalArrangement = Arrangement.spacedBy(1.dp),
textAlign = TextAlign.Center, verticalArrangement = Arrangement.spacedBy(1.dp)
color = MaterialTheme.colorScheme.primary, ) {
modifier = Modifier.padding(top = 8.dp, bottom = 4.dp) item { HorizontalDivider(thickness = 0.dp, color = MaterialTheme.colorScheme.surface) }
) itemsIndexed(items) { index, item ->
LazyVerticalGrid( Row(verticalAlignment = Alignment.CenterVertically,
columns = GridCells.Adaptive(240.dp), modifier = Modifier
modifier = Modifier.background(MaterialTheme.colorScheme.background), .background(MaterialTheme.colorScheme.surface)
horizontalArrangement = Arrangement.spacedBy(1.dp), .clickable { select(item) }) {
verticalArrangement = Arrangement.spacedBy(1.dp) Text(
) { text = "$index - ",
itemsIndexed(items) { index, item -> modifier = Modifier.padding(start = 12.dp),
Row( fontWeight = FontWeight.Normal,
verticalAlignment = Alignment.CenterVertically, color = MaterialTheme.colorScheme.secondary
modifier = Modifier )
.background(MaterialTheme.colorScheme.surface) Text(
.clickable { select(item) }) { text = item,
Text( modifier = Modifier.weight(1f),
text = "$index - ", fontWeight = FontWeight.Medium,
modifier = Modifier.padding(start = 12.dp), maxLines = 1,
fontWeight = FontWeight.Normal, overflow = TextOverflow.Ellipsis
color = MaterialTheme.colorScheme.secondary )
) RadioButton(
Text( selected = item == selected,
text = item, onClick = null,
modifier = Modifier.weight(1f), modifier = Modifier.padding(start = 8.dp, top = 8.dp, end = 12.dp, bottom = 8.dp)
fontWeight = FontWeight.Medium, )
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
RadioButton(
selected = item == selected,
onClick = null,
modifier = Modifier.padding(start = 8.dp, top = 8.dp, end = 12.dp, bottom = 8.dp)
)
}
}
} }
} }
item { HorizontalDivider(thickness = 24.dp, color = MaterialTheme.colorScheme.surface) }
} }
} }
} }
@@ -40,10 +40,12 @@ import com.rtbishop.look4sat.presentation.MainTheme
import com.rtbishop.look4sat.presentation.components.PullRefreshIndicator import com.rtbishop.look4sat.presentation.components.PullRefreshIndicator
import com.rtbishop.look4sat.presentation.components.PullRefreshState import com.rtbishop.look4sat.presentation.components.PullRefreshState
import com.rtbishop.look4sat.presentation.components.TimerBar import com.rtbishop.look4sat.presentation.components.TimerBar
import com.rtbishop.look4sat.presentation.components.TimerBarNew
import com.rtbishop.look4sat.presentation.components.pullRefresh import com.rtbishop.look4sat.presentation.components.pullRefresh
import com.rtbishop.look4sat.presentation.components.rememberPullRefreshState import com.rtbishop.look4sat.presentation.components.rememberPullRefreshState
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.Date
import java.util.Locale
private val sdf = SimpleDateFormat("HH:mm:ss", Locale.ENGLISH) private val sdf = SimpleDateFormat("HH:mm:ss", Locale.ENGLISH)
@@ -59,6 +61,7 @@ fun PassesScreen(uiState: PassesState, navToRadar: (Int, Long) -> Unit) {
} }
} }
Column(modifier = Modifier.padding(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) { Column(modifier = Modifier.padding(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
TimerBarNew(aosTime = uiState.nextTime, losTime = uiState.nextTime)
TimerBar( TimerBar(
id = uiState.nextId, id = uiState.nextId,
name = uiState.nextName, name = uiState.nextName,
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M9,5v2h6.59L4,18.59L5.41,20L17,8.41V15h2V5H9z" />
</vector>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M16,18H6V8h3v4.77L15.98,6 18,8.03 11.15,15H16v3z" />
</vector>
+9
View File
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19,9h-2v6.59L5.41,4L4,5.41L15.59,17H9v2h10V9z" />
</vector>
+8 -8
View File
@@ -1,7 +1,7 @@
[versions] [versions]
android-gradle-plugin = "8.2.0" android-gradle-plugin = "8.3.0"
google-ksp = "1.9.21-1.0.15" google-ksp = "1.9.22-1.0.17"
kotlin = "1.9.21" kotlin = "1.9.22"
jvmToolchain = "17" jvmToolchain = "17"
@@ -15,12 +15,12 @@ androidx-core-ktx = "1.12.0"
androidx-core-splashscreen = "1.0.1" androidx-core-splashscreen = "1.0.1"
androidx-room = "2.6.1" androidx-room = "2.6.1"
compose = "1.5.4" compose = "1.6.2"
compose-activity = "1.8.2" compose-activity = "1.8.2"
compose-compiler = "1.5.6" compose-compiler = "1.5.10"
compose-lifecycle = "2.6.2" compose-lifecycle = "2.7.0"
compose-material3 = "1.1.2" compose-material3 = "1.2.0"
compose-navigation = "2.7.6" compose-navigation = "2.7.7"
other-coroutines = "1.7.3" other-coroutines = "1.7.3"
other-json = "20231013" other-json = "20231013"
+1 -1
View File
@@ -1,6 +1,6 @@
#Fri Sep 01 22:09:30 BST 2023 #Fri Sep 01 22:09:30 BST 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists