mirror of
https://github.com/wismna/DoNext.git
synced 2025-12-06 08:12:37 -05:00
Light cleanup and refactoring
This commit is contained in:
@@ -227,10 +227,7 @@ fun AppContent(
|
||||
}
|
||||
|
||||
composable(AppDestination.ManageLists.route) {
|
||||
ManageListsScreen(
|
||||
modifier = Modifier,
|
||||
showAddListSheet = {viewModel.showAddListSheet = true}
|
||||
)
|
||||
ManageListsScreen(modifier = Modifier)
|
||||
}
|
||||
composable(AppDestination.DueTodayList.route) {
|
||||
DueTodayTasksScreen (modifier = Modifier)
|
||||
|
||||
@@ -60,8 +60,7 @@ import sh.calvin.reorderable.rememberReorderableLazyListState
|
||||
@Composable
|
||||
fun ManageListsScreen(
|
||||
modifier: Modifier,
|
||||
viewModel: ManageListsViewModel = hiltViewModel(),
|
||||
showAddListSheet: () -> Unit
|
||||
viewModel: ManageListsViewModel = hiltViewModel()
|
||||
) {
|
||||
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 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 onDescriptionChanged(value: String) { description = 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
|
||||
taskListId = null
|
||||
title = ""
|
||||
|
||||
Reference in New Issue
Block a user