kopia lustrzana https://github.com/rt-bishop/Look4Sat
Updated dependencies, added EntriesDialog tweaks
rodzic
3ab1bd6621
commit
018eb07cdc
|
@ -16,6 +16,7 @@ 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
|
||||
import androidx.compose.material3.ElevatedButton
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
|
@ -23,6 +24,8 @@ import androidx.compose.material3.Icon
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
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.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
|
||||
@Preview(showBackground = true)
|
||||
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
|
||||
fun CardLoadingIndicator() {
|
||||
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.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
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.lazy.grid.GridCells
|
||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||
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.ModalBottomSheet
|
||||
import androidx.compose.material3.RadioButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
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
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import com.rtbishop.look4sat.presentation.MainTheme
|
||||
|
||||
@Preview(showBackground = true)
|
||||
|
@ -34,56 +33,48 @@ private fun TypeDialogPreview() {
|
|||
MainTheme { TypesDialog(types, "All", {}) {} }
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun TypesDialog(items: List<String>, selected: String, dismiss: () -> Unit, select: (String) -> Unit) {
|
||||
val height = LocalConfiguration.current.screenHeightDp
|
||||
Dialog(onDismissRequest = { dismiss() }) {
|
||||
ElevatedCard {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.heightIn(max = height.times(0.80).dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Select satellites type",
|
||||
fontSize = 18.sp,
|
||||
textAlign = TextAlign.Center,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.padding(top = 8.dp, bottom = 4.dp)
|
||||
)
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Adaptive(240.dp),
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background),
|
||||
horizontalArrangement = Arrangement.spacedBy(1.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp)
|
||||
) {
|
||||
itemsIndexed(items) { index, item ->
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.clickable { select(item) }) {
|
||||
Text(
|
||||
text = "$index - ",
|
||||
modifier = Modifier.padding(start = 12.dp),
|
||||
fontWeight = FontWeight.Normal,
|
||||
color = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
Text(
|
||||
text = item,
|
||||
modifier = Modifier.weight(1f),
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
||||
ModalBottomSheet(
|
||||
onDismissRequest = { dismiss() },
|
||||
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
|
||||
dragHandle = { BottomSheetDefaults.DragHandle() },
|
||||
modifier = Modifier.fillMaxHeight(0.80f)
|
||||
) {
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Adaptive(240.dp),
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background),
|
||||
horizontalArrangement = Arrangement.spacedBy(1.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp)
|
||||
) {
|
||||
item { HorizontalDivider(thickness = 0.dp, color = MaterialTheme.colorScheme.surface) }
|
||||
itemsIndexed(items) { index, item ->
|
||||
Row(verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.clickable { select(item) }) {
|
||||
Text(
|
||||
text = "$index - ",
|
||||
modifier = Modifier.padding(start = 12.dp),
|
||||
fontWeight = FontWeight.Normal,
|
||||
color = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
Text(
|
||||
text = item,
|
||||
modifier = Modifier.weight(1f),
|
||||
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.PullRefreshState
|
||||
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.rememberPullRefreshState
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
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)) {
|
||||
TimerBarNew(aosTime = uiState.nextTime, losTime = uiState.nextTime)
|
||||
TimerBar(
|
||||
id = uiState.nextId,
|
||||
name = uiState.nextName,
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -1,7 +1,7 @@
|
|||
[versions]
|
||||
android-gradle-plugin = "8.2.0"
|
||||
google-ksp = "1.9.21-1.0.15"
|
||||
kotlin = "1.9.21"
|
||||
android-gradle-plugin = "8.3.0"
|
||||
google-ksp = "1.9.22-1.0.17"
|
||||
kotlin = "1.9.22"
|
||||
|
||||
jvmToolchain = "17"
|
||||
|
||||
|
@ -15,12 +15,12 @@ androidx-core-ktx = "1.12.0"
|
|||
androidx-core-splashscreen = "1.0.1"
|
||||
androidx-room = "2.6.1"
|
||||
|
||||
compose = "1.5.4"
|
||||
compose = "1.6.2"
|
||||
compose-activity = "1.8.2"
|
||||
compose-compiler = "1.5.6"
|
||||
compose-lifecycle = "2.6.2"
|
||||
compose-material3 = "1.1.2"
|
||||
compose-navigation = "2.7.6"
|
||||
compose-compiler = "1.5.10"
|
||||
compose-lifecycle = "2.7.0"
|
||||
compose-material3 = "1.2.0"
|
||||
compose-navigation = "2.7.7"
|
||||
|
||||
other-coroutines = "1.7.3"
|
||||
other-json = "20231013"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#Fri Sep 01 22:09:30 BST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
Ładowanie…
Reference in New Issue