Compare commits
2 Commits
main
...
5f8e13f06f
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f8e13f06f | |||
| 9a00cc08f5 |
@@ -501,13 +501,17 @@ private fun taskWhenLines(task: Task): Pair<String, String?>? {
|
||||
val due = task.due
|
||||
return when {
|
||||
start != null && due != null -> {
|
||||
val sameDay = start.formatDate() == due.formatDate()
|
||||
val primary = if (sameDay) due.formatDate() else "${start.formatDate()} – ${due.formatDate()}"
|
||||
val secondary = if (task.isAllDay) null else "${start.formatTime()} – ${due.formatTime()}"
|
||||
val allDay = task.isAllDay
|
||||
val sameDay = start.formatDate(allDay) == due.formatDate(allDay)
|
||||
val primary =
|
||||
if (sameDay) due.formatDate(allDay)
|
||||
else "${start.formatDate(allDay)} – ${due.formatDate(allDay)}"
|
||||
val secondary = if (allDay) null else "${start.formatTime()} – ${due.formatTime()}"
|
||||
primary to secondary
|
||||
}
|
||||
due != null -> due.formatDate() to if (task.isAllDay) null else due.formatTime()
|
||||
start != null -> start.formatDate() to if (task.isAllDay) null else start.formatTime()
|
||||
due != null -> due.formatDate(task.isAllDay) to if (task.isAllDay) null else due.formatTime()
|
||||
start != null ->
|
||||
start.formatDate(task.isAllDay) to if (task.isAllDay) null else start.formatTime()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ private fun ScheduleRow(
|
||||
)
|
||||
} else {
|
||||
Text(
|
||||
text = value.formatDate(),
|
||||
text = value.formatDate(allDay),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = valueColor,
|
||||
modifier = Modifier.clickable(onClick = onPick).padding(vertical = 8.dp, horizontal = 6.dp),
|
||||
@@ -865,7 +865,7 @@ private fun ParentPickerSheet(
|
||||
GroupedRow(
|
||||
title = task.title.ifBlank { stringResource(R.string.task_untitled) },
|
||||
position = positionOf(index, section.tasks.size),
|
||||
summary = task.due?.formatDate(),
|
||||
summary = task.due?.formatDate(task.isAllDay),
|
||||
selected = task.taskId == selectedId,
|
||||
minHeight = 56.dp,
|
||||
onClick = { choose(task.taskId) },
|
||||
|
||||
@@ -98,6 +98,9 @@ import de.jeanlucmakiola.agendula.domain.TaskSection
|
||||
import de.jeanlucmakiola.agendula.domain.TaskSections
|
||||
import de.jeanlucmakiola.agendula.ui.common.priorityAccent
|
||||
import de.jeanlucmakiola.floret.components.Position
|
||||
import de.jeanlucmakiola.floret.components.SnackChip
|
||||
import de.jeanlucmakiola.floret.components.SnackChipHeight
|
||||
import de.jeanlucmakiola.floret.components.SnackChipMargin
|
||||
import de.jeanlucmakiola.floret.time.formatDateTimeCompact
|
||||
import de.jeanlucmakiola.floret.components.pastelize
|
||||
import de.jeanlucmakiola.floret.components.positionOf
|
||||
@@ -189,13 +192,18 @@ fun TaskListScreen(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomStart)
|
||||
.padding(start = 16.dp, bottom = inner.calculateBottomPadding() + 16.dp)
|
||||
.height(56.dp),
|
||||
.padding(
|
||||
start = SnackChipMargin,
|
||||
bottom = inner.calculateBottomPadding() + SnackChipMargin,
|
||||
)
|
||||
.height(SnackChipHeight),
|
||||
contentAlignment = Alignment.CenterStart,
|
||||
) {
|
||||
UndoChip(
|
||||
SnackChip(
|
||||
visible = undoTarget != null,
|
||||
onUndo = {
|
||||
message = stringResource(R.string.task_deleted),
|
||||
actionLabel = stringResource(R.string.undo),
|
||||
onAction = {
|
||||
undoTarget?.let { viewModel.undoDelete(it.taskId) }
|
||||
undoTarget = null
|
||||
},
|
||||
@@ -205,47 +213,6 @@ fun TaskListScreen(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A compact floating "snackchip" for an undoable delete — a rounded pill (not a
|
||||
* full-width snackbar) sized to its content, sliding up from the bottom centre.
|
||||
*/
|
||||
@Composable
|
||||
private fun UndoChip(visible: Boolean, onUndo: () -> Unit, modifier: Modifier = Modifier) {
|
||||
AnimatedVisibility(
|
||||
visible = visible,
|
||||
enter = slideInVertically { it } + fadeIn(),
|
||||
exit = slideOutVertically { it } + fadeOut(),
|
||||
modifier = modifier,
|
||||
) {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.surfaceContainerHighest,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
shape = RoundedCornerShape(50),
|
||||
shadowElevation = 6.dp,
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.padding(start = 20.dp, end = 8.dp, top = 6.dp, bottom = 6.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.task_deleted),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
TextButton(
|
||||
onClick = onUndo,
|
||||
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 6.dp),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.undo),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun TaskListBody(
|
||||
|
||||
Submodule floret-kit updated: 5a576c4d28...b08fb69843
Reference in New Issue
Block a user