Compare commits
5 Commits
ec4ee64d68
...
7f613a2106
Author | SHA1 | Date | |
---|---|---|---|
7f613a2106 | |||
99effd1e52 | |||
764eedc837 | |||
90d1f69f0d | |||
7bfcb3d3c9 |
@ -147,7 +147,7 @@ fun ScheduleDay(modifier: Modifier = Modifier, date: LocalDate) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ScheduleItem(modifier: Modifier = Modifier, unit: ScheduleUnit, expanded: Boolean = false) {
|
fun ScheduleItem(modifier: Modifier = Modifier, unit: ScheduleUnit, expanded: Boolean = false) {
|
||||||
fun getRel(): Float {
|
fun getRatio(): Float {
|
||||||
val begin = LocalDateTime.of(unit.date, unit.begin).atZone(ZoneId.of("Europe/Moscow")).toEpochSecond()
|
val begin = LocalDateTime.of(unit.date, unit.begin).atZone(ZoneId.of("Europe/Moscow")).toEpochSecond()
|
||||||
val end = LocalDateTime.of(unit.date, unit.end).atZone(ZoneId.of("Europe/Moscow")).toEpochSecond()
|
val end = LocalDateTime.of(unit.date, unit.end).atZone(ZoneId.of("Europe/Moscow")).toEpochSecond()
|
||||||
val now = LocalDateTime.now().atZone(ZoneId.of("Europe/Moscow")).toEpochSecond()
|
val now = LocalDateTime.now().atZone(ZoneId.of("Europe/Moscow")).toEpochSecond()
|
||||||
@ -160,7 +160,7 @@ fun ScheduleItem(modifier: Modifier = Modifier, unit: ScheduleUnit, expanded: Bo
|
|||||||
|
|
||||||
val begin = unit.begin.format(DateTimeFormatter.ofPattern("HH:mm"))
|
val begin = unit.begin.format(DateTimeFormatter.ofPattern("HH:mm"))
|
||||||
val end = unit.end.format(DateTimeFormatter.ofPattern("HH:mm"))
|
val end = unit.end.format(DateTimeFormatter.ofPattern("HH:mm"))
|
||||||
var rel by remember { mutableFloatStateOf(getRel()) }
|
var ratio by remember { mutableFloatStateOf(getRatio()) }
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -170,7 +170,7 @@ fun ScheduleItem(modifier: Modifier = Modifier, unit: ScheduleUnit, expanded: Bo
|
|||||||
val millisUntilNextMinute = (60 - seconds) * 1000L - calendar.get(Calendar.MILLISECOND)
|
val millisUntilNextMinute = (60 - seconds) * 1000L - calendar.get(Calendar.MILLISECOND)
|
||||||
|
|
||||||
delay(millisUntilNextMinute)
|
delay(millisUntilNextMinute)
|
||||||
rel = getRel()
|
ratio = getRatio()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ fun ScheduleItem(modifier: Modifier = Modifier, unit: ScheduleUnit, expanded: Bo
|
|||||||
verticalAlignment = Alignment.CenterVertically) {
|
verticalAlignment = Alignment.CenterVertically) {
|
||||||
Text(begin.toString(), fontWeight = FontWeight.Bold)
|
Text(begin.toString(), fontWeight = FontWeight.Bold)
|
||||||
AnimatedVisibility (
|
AnimatedVisibility (
|
||||||
(0f < rel) and (rel < 1f),
|
(0f <= rel) and (rel < 1f),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.padding(horizontal = 2.dp)
|
.padding(horizontal = 2.dp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user