mirror of
https://github.com/wismna/DoNext.git
synced 2025-12-06 00:02:40 -05:00
Light cleanup and refactoring
This commit is contained in:
@@ -227,10 +227,7 @@ fun AppContent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
composable(AppDestination.ManageLists.route) {
|
composable(AppDestination.ManageLists.route) {
|
||||||
ManageListsScreen(
|
ManageListsScreen(modifier = Modifier)
|
||||||
modifier = Modifier,
|
|
||||||
showAddListSheet = {viewModel.showAddListSheet = true}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
composable(AppDestination.DueTodayList.route) {
|
composable(AppDestination.DueTodayList.route) {
|
||||||
DueTodayTasksScreen (modifier = Modifier)
|
DueTodayTasksScreen (modifier = Modifier)
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ import sh.calvin.reorderable.rememberReorderableLazyListState
|
|||||||
@Composable
|
@Composable
|
||||||
fun ManageListsScreen(
|
fun ManageListsScreen(
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
viewModel: ManageListsViewModel = hiltViewModel(),
|
viewModel: ManageListsViewModel = hiltViewModel()
|
||||||
showAddListSheet: () -> Unit
|
|
||||||
) {
|
) {
|
||||||
var lists = viewModel.taskLists.toMutableList()
|
var lists = viewModel.taskLists.toMutableList()
|
||||||
|
|
||||||
|
|||||||
@@ -56,28 +56,6 @@ class TaskViewModel @Inject constructor(
|
|||||||
|
|
||||||
fun screenTitle(): String = if (isDeleted) "Task details" else if (isEditing()) "Edit Task" else "New Task"
|
fun screenTitle(): String = if (isDeleted) "Task details" else if (isEditing()) "Edit Task" else "New Task"
|
||||||
fun isEditing(): Boolean = editingTaskId != null
|
fun isEditing(): Boolean = editingTaskId != null
|
||||||
|
|
||||||
private fun startNewTask(selectedListId: Long) {
|
|
||||||
editingTaskId = null
|
|
||||||
taskListId = selectedListId
|
|
||||||
title = ""
|
|
||||||
description = ""
|
|
||||||
priority = Priority.NORMAL
|
|
||||||
dueDate = null
|
|
||||||
isDeleted = false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startEditTask(task: Task) {
|
|
||||||
editingTaskId = task.id
|
|
||||||
taskListId = task.taskListId
|
|
||||||
title = task.name
|
|
||||||
description = task.description ?: ""
|
|
||||||
priority = task.priority
|
|
||||||
dueDate = task.dueDate
|
|
||||||
isDone = task.isDone
|
|
||||||
isDeleted = task.isDeleted
|
|
||||||
}
|
|
||||||
|
|
||||||
fun onTitleChanged(value: String) { title = value }
|
fun onTitleChanged(value: String) { title = value }
|
||||||
fun onDescriptionChanged(value: String) { description = value }
|
fun onDescriptionChanged(value: String) { description = value }
|
||||||
fun onPriorityChanged(value: Priority) { priority = value }
|
fun onPriorityChanged(value: Priority) { priority = value }
|
||||||
@@ -104,7 +82,28 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reset() {
|
private fun startNewTask(selectedListId: Long) {
|
||||||
|
editingTaskId = null
|
||||||
|
taskListId = selectedListId
|
||||||
|
title = ""
|
||||||
|
description = ""
|
||||||
|
priority = Priority.NORMAL
|
||||||
|
dueDate = null
|
||||||
|
isDeleted = false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startEditTask(task: Task) {
|
||||||
|
editingTaskId = task.id
|
||||||
|
taskListId = task.taskListId
|
||||||
|
title = task.name
|
||||||
|
description = task.description ?: ""
|
||||||
|
priority = task.priority
|
||||||
|
dueDate = task.dueDate
|
||||||
|
isDone = task.isDone
|
||||||
|
isDeleted = task.isDeleted
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun reset() {
|
||||||
editingTaskId = null
|
editingTaskId = null
|
||||||
taskListId = null
|
taskListId = null
|
||||||
title = ""
|
title = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user