mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Fix some toasts
Change some icons Fix warnings
This commit is contained in:
@@ -11,8 +11,8 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.ArrowBack
|
|
||||||
import androidx.compose.material.icons.filled.Menu
|
import androidx.compose.material.icons.filled.Menu
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.DrawerState
|
import androidx.compose.material3.DrawerState
|
||||||
@@ -123,7 +123,7 @@ fun AppContent(
|
|||||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onPrimaryContainer) {
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onPrimaryContainer) {
|
||||||
if (viewModel.currentDestination.showBackButton) {
|
if (viewModel.currentDestination.showBackButton) {
|
||||||
IconButton(onClick = { navController.popBackStack() }) {
|
IconButton(onClick = { navController.popBackStack() }) {
|
||||||
Icon(Icons.Default.ArrowBack, contentDescription = "Back")
|
Icon(Icons.AutoMirrored.Default.ArrowBack, contentDescription = "Back")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IconButton(onClick = { scope.launch { drawerState.open() } }) {
|
IconButton(onClick = { scope.launch { drawerState.open() } }) {
|
||||||
|
@@ -183,7 +183,7 @@ fun ManageListsScreen(
|
|||||||
IconButton(onClick = { isInEditMode = true }) {
|
IconButton(onClick = { isInEditMode = true }) {
|
||||||
Icon(Icons.Default.Edit, contentDescription = "Edit")
|
Icon(Icons.Default.Edit, contentDescription = "Edit")
|
||||||
}
|
}
|
||||||
IconButton(onClick = { viewModel.deleteTaskList(list.id!!) }) {
|
IconButton(onClick = { viewModel.deleteTaskList(list.id) }) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Delete,
|
Icons.Default.Delete,
|
||||||
contentDescription = "Delete"
|
contentDescription = "Delete"
|
||||||
|
@@ -7,10 +7,10 @@ import androidx.compose.foundation.layout.fillMaxHeight
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.automirrored.filled.List
|
||||||
import androidx.compose.material.icons.filled.DateRange
|
import androidx.compose.material.icons.filled.DateRange
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material.icons.filled.Edit
|
import androidx.compose.material.icons.filled.Edit
|
||||||
import androidx.compose.material.icons.filled.List
|
|
||||||
import androidx.compose.material3.Badge
|
import androidx.compose.material3.Badge
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -71,7 +71,7 @@ fun MenuScreen(
|
|||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
icon = { Icon(Icons.Default.List, contentDescription = list.name) },
|
icon = { Icon(Icons.AutoMirrored.Default.List, contentDescription = list.name) },
|
||||||
selected = currentDestination is AppDestination.TaskList &&
|
selected = currentDestination is AppDestination.TaskList &&
|
||||||
currentDestination.taskListId == list.id,
|
currentDestination.taskListId == list.id,
|
||||||
onClick = { onNavigate("taskList/${list.id}") },
|
onClick = { onNavigate("taskList/${list.id}") },
|
||||||
|
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Clear
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material.icons.filled.Done
|
import androidx.compose.material.icons.filled.Done
|
||||||
@@ -72,7 +73,7 @@ fun TaskItemScreen(
|
|||||||
SwipeToDismissBox(
|
SwipeToDismissBox(
|
||||||
state = dismissState,
|
state = dismissState,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
backgroundContent = { DismissBackground(dismissState, viewModel.isDone) },
|
backgroundContent = { DismissBackground(dismissState, viewModel.isDone, viewModel.isDeleted) },
|
||||||
content = {
|
content = {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
@@ -148,7 +149,7 @@ fun TaskItemScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DismissBackground(dismissState: SwipeToDismissBoxState, isDone: Boolean) {
|
fun DismissBackground(dismissState: SwipeToDismissBoxState, isDone: Boolean, isDeleted: Boolean) {
|
||||||
val color = when (dismissState.dismissDirection) {
|
val color = when (dismissState.dismissDirection) {
|
||||||
SwipeToDismissBoxValue.StartToEnd -> MaterialTheme.colorScheme.error
|
SwipeToDismissBoxValue.StartToEnd -> MaterialTheme.colorScheme.error
|
||||||
SwipeToDismissBoxValue.EndToStart -> Color(0xFF18590D)
|
SwipeToDismissBoxValue.EndToStart -> Color(0xFF18590D)
|
||||||
@@ -164,7 +165,7 @@ fun DismissBackground(dismissState: SwipeToDismissBoxState, isDone: Boolean) {
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Delete,
|
if (isDeleted) Icons.Default.Clear else Icons.Default.Delete,
|
||||||
tint = Color.LightGray,
|
tint = Color.LightGray,
|
||||||
contentDescription = "Delete"
|
contentDescription = "Delete"
|
||||||
)
|
)
|
||||||
|
@@ -101,7 +101,7 @@ fun TaskListScreen(
|
|||||||
viewModel = TaskItemViewModel(task),
|
viewModel = TaskItemViewModel(task),
|
||||||
onSwipeLeft = {
|
onSwipeLeft = {
|
||||||
viewModel.updateTaskDone(task.id!!, false)
|
viewModel.updateTaskDone(task.id!!, false)
|
||||||
Toast.makeText(context, "Task done", Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, "Task in progress", Toast.LENGTH_SHORT).show()
|
||||||
},
|
},
|
||||||
onSwipeRight = {
|
onSwipeRight = {
|
||||||
viewModel.deleteTask(task.id!!)
|
viewModel.deleteTask(task.id!!)
|
||||||
|
@@ -15,6 +15,7 @@ class TaskItemViewModel(task: Task) {
|
|||||||
val name: String = task.name
|
val name: String = task.name
|
||||||
val description: String? = task.description
|
val description: String? = task.description
|
||||||
val isDone: Boolean = task.isDone
|
val isDone: Boolean = task.isDone
|
||||||
|
val isDeleted: Boolean = task.isDeleted
|
||||||
val priority: Priority = task.priority
|
val priority: Priority = task.priority
|
||||||
|
|
||||||
val today: LocalDate = LocalDate.now(ZoneOffset.UTC)
|
val today: LocalDate = LocalDate.now(ZoneOffset.UTC)
|
||||||
|
Reference in New Issue
Block a user