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