mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 07:30:13 -04:00
Compare commits
11 Commits
1c28d9aacb
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7dddc62377 | ||
![]() |
8e5ac4fedc | ||
![]() |
906ad0854d | ||
![]() |
02c985ab55 | ||
![]() |
92217c99d4 | ||
![]() |
4522296cf1 | ||
![]() |
b71fa4fdb7 | ||
![]() |
cf770ddb83 | ||
![]() |
ba2e259c7c | ||
![]() |
208f8bab3a | ||
![]() |
2d4be63d81 |
37
.idea/caches/deviceStreaming.xml
generated
37
.idea/caches/deviceStreaming.xml
generated
@@ -87,6 +87,19 @@
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2160" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="Lenovo" />
|
||||
<option name="codename" value="TB330FU" />
|
||||
<option name="formFactor" value="Tablet" />
|
||||
<option name="id" value="TB330FU" />
|
||||
<option name="labId" value="google" />
|
||||
<option name="manufacturer" value="Lenovo" />
|
||||
<option name="name" value="Tab M11" />
|
||||
<option name="screenDensity" value="240" />
|
||||
<option name="screenX" value="1200" />
|
||||
<option name="screenY" value="1920" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
@@ -366,18 +379,6 @@
|
||||
<option name="screenX" value="384" />
|
||||
<option name="screenY" value="384" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="eqe" />
|
||||
<option name="id" value="eqe" />
|
||||
<option name="labId" value="google" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="edge 50 pro" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1220" />
|
||||
<option name="screenY" value="2712" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
@@ -560,6 +561,18 @@
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="kansas" />
|
||||
<option name="id" value="kansas" />
|
||||
<option name="labId" value="google" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g - 2025" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1604" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
|
19
README.md
19
README.md
@@ -2,10 +2,19 @@
|
||||
|
||||
[](https://github.com/wismna/DoNext/actions/workflows/android.yaml)
|
||||
|
||||
DoNext is an innovative task application.
|
||||
DoNext is an a task app that aims for simplicity.
|
||||
You can create and arrange task lists, create, edit and delete tasks...
|
||||
But the emphasis is not a long list, as the more you have to do, the less you actually do!
|
||||
|
||||
Instead, focus only on the first task on the list:
|
||||
Swipe it to the left: it's done!
|
||||
Swipe it to the right: "nexted!". It goes to the end of the list and you can work on the next task.
|
||||
Focus on what's important:
|
||||
- Tasks are sorted by priority
|
||||
- Easily see when each task is due, with a warning when it's overdue
|
||||
- All tasks due today are grouped in a special view
|
||||
|
||||
## Technical stack
|
||||
|
||||
DoNext is made with:
|
||||
- Kotlin
|
||||
- Jetpack Compose for UI
|
||||
- Hilt for dependency injection
|
||||
- Room for the Database
|
||||
- Clean Architecture
|
||||
|
@@ -22,7 +22,10 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
// Enables code-related app optimization.
|
||||
isMinifyEnabled = true
|
||||
// Enables resource shrinking.
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
@@ -48,25 +51,26 @@ android {
|
||||
dependencies {
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.4")
|
||||
implementation("androidx.activity:activity-compose:1.11.0")
|
||||
implementation(platform("androidx.compose:compose-bom:2025.09.00"))
|
||||
implementation(platform("androidx.compose:compose-bom:2025.09.01"))
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.ui:ui-graphics")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
implementation("androidx.compose.material3:material3")
|
||||
implementation("androidx.navigation:navigation-compose:2.9.4")
|
||||
implementation("androidx.compose.material:material-icons-extended:1.7.8")
|
||||
implementation("androidx.navigation:navigation-compose:2.9.5")
|
||||
implementation("androidx.hilt:hilt-navigation-compose:1.3.0")
|
||||
implementation("androidx.test.ext:junit-ktx:1.3.0")
|
||||
implementation("sh.calvin.reorderable:reorderable:3.0.0")
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2025.09.00"))
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2025.09.01"))
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||
|
||||
val roomVersion = "2.8.0"
|
||||
val roomVersion = "2.8.1"
|
||||
implementation("androidx.room:room-runtime:$roomVersion")
|
||||
ksp("androidx.room:room-compiler:$roomVersion")
|
||||
|
||||
val hiltVersion = "2.57.1"
|
||||
val hiltVersion = "2.57.2"
|
||||
implementation("com.google.dagger:hilt-android:$hiltVersion")
|
||||
ksp("com.google.dagger:hilt-android-compiler:$hiltVersion")
|
||||
}
|
||||
|
@@ -87,4 +87,75 @@ class TaskDaoTest {
|
||||
|
||||
TestCase.assertEquals(1, lists.first().first().overdueCount)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dueToday_correctlyCalculated() = runBlocking {
|
||||
listDao.insertTaskList(TaskListEntity(name = "Tasks", order = 0))
|
||||
val listId = listDao.getTaskLists().first().first().id
|
||||
|
||||
val todayStart = Instant.parse("2025-09-15T00:00:00Z").toEpochMilli()
|
||||
val todayEnd = Instant.parse("2025-09-15T23:59:99Z").toEpochMilli()
|
||||
|
||||
// One task due yesterday
|
||||
taskDao.insertTask(
|
||||
TaskEntity(
|
||||
name = "Yesterday",
|
||||
taskListId = listId,
|
||||
dueDate = Instant.parse("2025-09-14T12:00:00Z").toEpochMilli(),
|
||||
isDone = false,
|
||||
description = null,
|
||||
priority = Priority.NORMAL
|
||||
)
|
||||
)
|
||||
// One task due today
|
||||
taskDao.insertTask(
|
||||
TaskEntity(
|
||||
name = "Today",
|
||||
taskListId = listId,
|
||||
dueDate = Instant.parse("2025-09-15T12:00:00Z").toEpochMilli(),
|
||||
isDone = false,
|
||||
description = null,
|
||||
priority = Priority.NORMAL
|
||||
)
|
||||
)
|
||||
// One task due in the future
|
||||
taskDao.insertTask(
|
||||
TaskEntity(
|
||||
name = "Tomorrow",
|
||||
taskListId = listId,
|
||||
dueDate = Instant.parse("2025-09-16T12:00:00Z").toEpochMilli(),
|
||||
isDone = false,
|
||||
description = null,
|
||||
priority = Priority.NORMAL
|
||||
)
|
||||
)
|
||||
// One task due in the future
|
||||
taskDao.insertTask(
|
||||
TaskEntity(
|
||||
name = "TodayDone",
|
||||
taskListId = listId,
|
||||
dueDate = Instant.parse("2025-09-15T12:00:00Z").toEpochMilli(),
|
||||
isDone = true,
|
||||
description = null,
|
||||
priority = Priority.NORMAL
|
||||
)
|
||||
)
|
||||
// One task due in the future
|
||||
taskDao.insertTask(
|
||||
TaskEntity(
|
||||
name = "TodayDeleted",
|
||||
taskListId = listId,
|
||||
dueDate = Instant.parse("2025-09-15T12:00:00Z").toEpochMilli(),
|
||||
isDone = false,
|
||||
isDeleted = true,
|
||||
description = null,
|
||||
priority = Priority.NORMAL
|
||||
)
|
||||
)
|
||||
|
||||
val tasks = taskDao.getDueTodayTasks(todayStart, todayEnd)
|
||||
|
||||
TestCase.assertEquals(1, tasks.first().count())
|
||||
TestCase.assertEquals("Prepare slides", tasks.first().first().name)
|
||||
}
|
||||
}
|
@@ -2,8 +2,10 @@ package com.wismna.geoffroy.donext.data
|
||||
|
||||
import com.wismna.geoffroy.donext.data.entities.TaskEntity
|
||||
import com.wismna.geoffroy.donext.data.entities.TaskListEntity
|
||||
import com.wismna.geoffroy.donext.data.entities.TaskWithListNameEntity
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskList
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskWithListName
|
||||
|
||||
fun TaskEntity.toDomain() = Task(
|
||||
id = id,
|
||||
@@ -15,6 +17,12 @@ fun TaskEntity.toDomain() = Task(
|
||||
dueDate = dueDate,
|
||||
priority = priority,
|
||||
)
|
||||
fun TaskWithListNameEntity.toDomain(): TaskWithListName {
|
||||
return TaskWithListName(
|
||||
task = task.toDomain(),
|
||||
listName = listName
|
||||
)
|
||||
}
|
||||
|
||||
fun Task.toEntity() = TaskEntity(
|
||||
id = id ?: 0,
|
||||
|
@@ -0,0 +1,8 @@
|
||||
package com.wismna.geoffroy.donext.data.entities
|
||||
|
||||
import androidx.room.Embedded
|
||||
|
||||
data class TaskWithListNameEntity(
|
||||
@Embedded val task: TaskEntity,
|
||||
val listName: String
|
||||
)
|
@@ -125,8 +125,8 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
// insert default lists
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val dao = DB_INSTANCE?.taskListDao()
|
||||
dao?.insertTaskList(TaskListEntity(name = "Work", order = 2))
|
||||
dao?.insertTaskList(TaskListEntity(name = "Personal", order = 1))
|
||||
dao?.insertTaskList(TaskListEntity(name = "Work", order = 2))
|
||||
dao?.insertTaskList(TaskListEntity(name = "Shopping", order = 3))
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import com.wismna.geoffroy.donext.data.entities.TaskEntity
|
||||
import com.wismna.geoffroy.donext.data.entities.TaskWithListNameEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
@@ -13,6 +14,25 @@ interface TaskDao {
|
||||
@Query("SELECT * FROM tasks WHERE task_list_id = :listId AND deleted = 0 ORDER BY done ASC, priority DESC")
|
||||
fun getTasksForList(listId: Long): Flow<List<TaskEntity>>
|
||||
|
||||
@Query("""
|
||||
SELECT * FROM tasks
|
||||
WHERE due_date BETWEEN :todayStart AND :todayEnd AND deleted = 0 AND done = 0
|
||||
ORDER BY done ASC, priority DESC
|
||||
""")
|
||||
fun getDueTodayTasks(todayStart: Long, todayEnd: Long): Flow<List<TaskEntity>>
|
||||
|
||||
@Query("""
|
||||
SELECT t.*, l.name AS listName
|
||||
FROM tasks t
|
||||
INNER JOIN task_lists l ON t.task_list_id = l.id
|
||||
WHERE t.deleted = 1
|
||||
ORDER BY l.name
|
||||
""")
|
||||
fun getDeletedTasksWithListName(): Flow<List<TaskWithListNameEntity>>
|
||||
|
||||
@Query("SELECT * FROM tasks WHERE id = :taskId")
|
||||
suspend fun getTaskById(taskId: Long): TaskEntity?
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertTask(task: TaskEntity)
|
||||
|
||||
@@ -27,4 +47,10 @@ interface TaskDao {
|
||||
|
||||
@Query("UPDATE tasks SET deleted = :deleted WHERE task_list_id = :taskListId")
|
||||
suspend fun toggleAllTasksFromListDeleted(taskListId: Long, deleted: Boolean)
|
||||
|
||||
@Query("DELETE FROM tasks WHERE id = :taskId")
|
||||
suspend fun permanentDeleteTask(taskId: Long)
|
||||
|
||||
@Query("DELETE FROM tasks WHERE deleted = 1")
|
||||
suspend fun permanentDeleteAllDeletedTasks()
|
||||
}
|
@@ -35,6 +35,9 @@ interface TaskListDao {
|
||||
""")
|
||||
fun getTaskListsWithOverdue(nowMillis: Long): Flow<List<TaskListWithOverdue>>
|
||||
|
||||
@Query("SELECT * FROM task_lists WHERE id = :taskListId")
|
||||
suspend fun getTaskListById(taskListId: Long): TaskListEntity?
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertTaskList(taskList: TaskListEntity)
|
||||
|
||||
|
@@ -7,10 +7,12 @@ import com.wismna.geoffroy.donext.data.toEntity
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskList
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskListWithOverdue
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskWithListName
|
||||
import com.wismna.geoffroy.donext.domain.repository.TaskRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.map
|
||||
|
||||
class TaskRepositoryImpl @Inject constructor(
|
||||
private val taskDao: TaskDao,
|
||||
@@ -20,6 +22,18 @@ class TaskRepositoryImpl @Inject constructor(
|
||||
return taskDao.getTasksForList(listId).map {entity -> entity.map { it.toDomain() }}
|
||||
}
|
||||
|
||||
override fun getDueTodayTasks(todayStart: Long, todayEnd: Long): Flow<List<Task>> {
|
||||
return taskDao.getDueTodayTasks(todayStart, todayEnd).map {entity -> entity.map { it.toDomain() }}
|
||||
}
|
||||
|
||||
override fun getDeletedTasks(): Flow<List<TaskWithListName>> {
|
||||
return taskDao.getDeletedTasksWithListName().map {entity -> entity.map { it.toDomain() }}
|
||||
}
|
||||
|
||||
override suspend fun getTaskById(taskId: Long): Task? {
|
||||
return taskDao.getTaskById(taskId)?.toDomain()
|
||||
}
|
||||
|
||||
override suspend fun insertTask(task: Task) {
|
||||
taskDao.insertTask(task.toEntity())
|
||||
}
|
||||
@@ -28,7 +42,7 @@ class TaskRepositoryImpl @Inject constructor(
|
||||
taskDao.updateTask(task.toEntity())
|
||||
}
|
||||
|
||||
override suspend fun deleteTask(taskId: Long, isDeleted: Boolean) {
|
||||
override suspend fun toggleTaskDeleted(taskId: Long, isDeleted: Boolean) {
|
||||
taskDao.toggleTaskDeleted(taskId, isDeleted)
|
||||
}
|
||||
|
||||
@@ -36,10 +50,22 @@ class TaskRepositoryImpl @Inject constructor(
|
||||
taskDao.toggleTaskDone(taskId, isDone)
|
||||
}
|
||||
|
||||
override suspend fun permanentlyDeleteTask(taskId: Long) {
|
||||
taskDao.permanentDeleteTask(taskId)
|
||||
}
|
||||
|
||||
override suspend fun permanentlyDeleteAllDeletedTask() {
|
||||
taskDao.permanentDeleteAllDeletedTasks()
|
||||
}
|
||||
|
||||
override fun getTaskLists(): Flow<List<TaskList>> {
|
||||
return taskListDao.getTaskLists().map {entities -> entities.map { it.toDomain() }}
|
||||
}
|
||||
|
||||
override suspend fun getTaskListById(taskListId: Long): TaskList? {
|
||||
return taskListDao.getTaskListById(taskListId)?.toDomain()
|
||||
}
|
||||
|
||||
override suspend fun insertTaskList(taskList: TaskList) {
|
||||
taskListDao.insertTaskList(taskList.toEntity())
|
||||
}
|
||||
|
@@ -0,0 +1,10 @@
|
||||
package com.wismna.geoffroy.donext.domain.extension
|
||||
|
||||
import java.time.Instant
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneId
|
||||
|
||||
fun Long.toLocalDate(): LocalDate =
|
||||
Instant.ofEpochMilli(this)
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate()
|
@@ -10,9 +10,19 @@ sealed class AppDestination(
|
||||
title = name,
|
||||
)
|
||||
|
||||
object DueTodayList : AppDestination(
|
||||
route = "todayList",
|
||||
title = "Due Today",
|
||||
showBackButton = true,
|
||||
)
|
||||
object ManageLists : AppDestination(
|
||||
route = "manageLists",
|
||||
title = "Manage Lists",
|
||||
showBackButton = true,
|
||||
)
|
||||
object RecycleBin : AppDestination(
|
||||
route = "recycleBin",
|
||||
title = "Recycle Bin",
|
||||
showBackButton = true,
|
||||
)
|
||||
}
|
||||
|
@@ -0,0 +1,6 @@
|
||||
package com.wismna.geoffroy.donext.domain.model
|
||||
|
||||
data class TaskWithListName (
|
||||
val task: Task,
|
||||
val listName: String
|
||||
)
|
@@ -3,16 +3,23 @@ package com.wismna.geoffroy.donext.domain.repository
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskList
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskListWithOverdue
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskWithListName
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface TaskRepository {
|
||||
fun getTasksForList(listId: Long): Flow<List<Task>>
|
||||
fun getDueTodayTasks(todayStart: Long, todayEnd: Long): Flow<List<Task>>
|
||||
fun getDeletedTasks(): Flow<List<TaskWithListName>>
|
||||
suspend fun getTaskById(taskId: Long): Task?
|
||||
suspend fun insertTask(task: Task)
|
||||
suspend fun updateTask(task: Task)
|
||||
suspend fun deleteTask(taskId: Long, isDeleted: Boolean)
|
||||
suspend fun toggleTaskDeleted(taskId: Long, isDeleted: Boolean)
|
||||
suspend fun toggleTaskDone(taskId: Long, isDone: Boolean)
|
||||
suspend fun permanentlyDeleteTask(taskId: Long)
|
||||
suspend fun permanentlyDeleteAllDeletedTask()
|
||||
|
||||
fun getTaskLists(): Flow<List<TaskList>>
|
||||
suspend fun getTaskListById(taskListId: Long): TaskList?
|
||||
suspend fun insertTaskList(taskList: TaskList)
|
||||
suspend fun updateTaskList(taskList: TaskList)
|
||||
suspend fun deleteTaskList(taskListId: Long, isDeleted: Boolean)
|
||||
|
@@ -0,0 +1,12 @@
|
||||
package com.wismna.geoffroy.donext.domain.usecase
|
||||
|
||||
import com.wismna.geoffroy.donext.domain.repository.TaskRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class EmptyRecycleBinUseCase @Inject constructor(
|
||||
private val repository: TaskRepository
|
||||
) {
|
||||
suspend operator fun invoke() {
|
||||
repository.permanentlyDeleteAllDeletedTask()
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.wismna.geoffroy.donext.domain.usecase
|
||||
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskWithListName
|
||||
import com.wismna.geoffroy.donext.domain.repository.TaskRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import javax.inject.Inject
|
||||
|
||||
class GetDeletedTasksUseCase @Inject constructor(private val repository: TaskRepository) {
|
||||
operator fun invoke(): Flow<List<TaskWithListName>> = repository.getDeletedTasks()
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.wismna.geoffroy.donext.domain.usecase
|
||||
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.domain.repository.TaskRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneOffset
|
||||
import javax.inject.Inject
|
||||
|
||||
class GetDueTodayTasksUseCase @Inject constructor(private val repository: TaskRepository) {
|
||||
operator fun invoke(): Flow<List<Task>> {
|
||||
val todayStart = LocalDate.now()
|
||||
.atStartOfDay(ZoneOffset.UTC)
|
||||
.toInstant()
|
||||
.toEpochMilli()
|
||||
|
||||
val todayEnd = LocalDate.now()
|
||||
.plusDays(1)
|
||||
.atStartOfDay(ZoneOffset.UTC)
|
||||
.toInstant()
|
||||
.toEpochMilli() - 1
|
||||
return repository.getDueTodayTasks(
|
||||
todayStart, todayEnd
|
||||
)
|
||||
}
|
||||
}
|
@@ -7,13 +7,11 @@ import java.time.LocalDate
|
||||
import java.time.ZoneOffset
|
||||
import javax.inject.Inject
|
||||
|
||||
class GetTaskListsWithOverdueUseCase @Inject constructor(
|
||||
private val taskRepository: TaskRepository
|
||||
) {
|
||||
class GetTaskListsWithOverdueUseCase @Inject constructor(private val taskRepository: TaskRepository) {
|
||||
operator fun invoke(): Flow<List<TaskListWithOverdue>> {
|
||||
return taskRepository.getTaskListsWithOverdue(
|
||||
LocalDate.now()
|
||||
.atStartOfDay(ZoneOffset.UTC) // or system default
|
||||
.atStartOfDay(ZoneOffset.UTC)
|
||||
.toInstant()
|
||||
.toEpochMilli()
|
||||
)
|
||||
|
@@ -3,10 +3,10 @@ package com.wismna.geoffroy.donext.domain.usecase
|
||||
import com.wismna.geoffroy.donext.domain.repository.TaskRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class DeleteTaskUseCase @Inject constructor(
|
||||
class PermanentlyDeleteTaskUseCase @Inject constructor(
|
||||
private val repository: TaskRepository
|
||||
) {
|
||||
suspend operator fun invoke(taskId: Long) {
|
||||
repository.deleteTask(taskId, true)
|
||||
repository.permanentlyDeleteTask(taskId)
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.wismna.geoffroy.donext.domain.usecase
|
||||
|
||||
import com.wismna.geoffroy.donext.domain.repository.TaskRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class ToggleTaskDeletedUseCase @Inject constructor(
|
||||
private val repository: TaskRepository
|
||||
) {
|
||||
suspend operator fun invoke(taskId: Long, isDeleted: Boolean) {
|
||||
if (!isDeleted) {
|
||||
val task = repository.getTaskById(taskId)
|
||||
if (task != null) {
|
||||
// If task list was soft-deleted, restore it as well
|
||||
val taskList = repository.getTaskListById(task.taskListId)
|
||||
if (taskList != null && taskList.isDeleted) {
|
||||
repository.updateTaskList(taskList.copy(isDeleted = false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repository.toggleTaskDeleted(taskId, isDeleted)
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package com.wismna.geoffroy.donext.presentation.screen
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.presentation.viewmodel.DueTodayViewModel
|
||||
import com.wismna.geoffroy.donext.presentation.viewmodel.TaskItemViewModel
|
||||
|
||||
@Composable
|
||||
fun DueTodayTasksScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
viewModel: DueTodayViewModel = hiltViewModel(),
|
||||
onTaskClick: (task: Task) -> Unit
|
||||
) {
|
||||
val tasks = viewModel.dueTodayTasks
|
||||
|
||||
if (tasks.isEmpty()) {
|
||||
// Placeholder when recycle bin is empty
|
||||
Box(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text("Nothing due today !")
|
||||
}
|
||||
} else {
|
||||
val context = LocalContext.current
|
||||
LazyColumn(
|
||||
modifier = modifier.padding(8.dp)
|
||||
) {
|
||||
items(tasks, key = { it.id!! }) { task ->
|
||||
TaskItemScreen(
|
||||
modifier = Modifier.animateItem(),
|
||||
viewModel = TaskItemViewModel(task),
|
||||
onTaskClick = { onTaskClick(task) },
|
||||
onSwipeLeft = {
|
||||
viewModel.updateTaskDone(task.id!!)
|
||||
Toast.makeText(context, "Task done", Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
onSwipeRight = {
|
||||
viewModel.deleteTask(task.id!!)
|
||||
Toast.makeText(context, "Task moved to recycle bin", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,8 +11,8 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
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.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Menu
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DrawerState
|
||||
@@ -60,6 +60,7 @@ fun MainScreen(
|
||||
val navController = rememberNavController()
|
||||
val drawerState = rememberDrawerState(DrawerValue.Closed)
|
||||
val scope = rememberCoroutineScope()
|
||||
// TODO: find a way to get rid of this
|
||||
val taskViewModel: TaskViewModel = hiltViewModel()
|
||||
|
||||
if (viewModel.isLoading) {
|
||||
@@ -84,9 +85,11 @@ fun MainScreen(
|
||||
MenuScreen (
|
||||
currentDestination = viewModel.currentDestination,
|
||||
onNavigate = { route ->
|
||||
scope.launch { drawerState.close() }
|
||||
navController.navigate(route) {
|
||||
restoreState = true
|
||||
scope.launch {
|
||||
drawerState.close()
|
||||
navController.navigate(route) {
|
||||
restoreState = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -121,7 +124,7 @@ fun AppContent(
|
||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onPrimaryContainer) {
|
||||
if (viewModel.currentDestination.showBackButton) {
|
||||
IconButton(onClick = { navController.popBackStack() }) {
|
||||
Icon(Icons.Default.ArrowBack, contentDescription = "Back")
|
||||
Icon(Icons.AutoMirrored.Default.ArrowBack, contentDescription = "Back")
|
||||
}
|
||||
} else {
|
||||
IconButton(onClick = { scope.launch { drawerState.open() } }) {
|
||||
@@ -134,10 +137,16 @@ fun AppContent(
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
if (viewModel.currentDestination is AppDestination.ManageLists) {
|
||||
IconButton(onClick = { viewModel.showAddListSheet = true }) {
|
||||
Icon(Icons.Default.Add, contentDescription = "Add List")
|
||||
when (viewModel.currentDestination) {
|
||||
is AppDestination.ManageLists -> {
|
||||
IconButton(onClick = { viewModel.showAddListSheet = true }) {
|
||||
Icon(Icons.Default.Add, contentDescription = "Add List")
|
||||
}
|
||||
}
|
||||
is AppDestination.RecycleBin -> {
|
||||
EmptyRecycleBinAction()
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -177,23 +186,22 @@ fun AppContent(
|
||||
slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth }, animationSpec = tween(300))
|
||||
}
|
||||
) {
|
||||
//viewModel.destinations.forEach { destination ->
|
||||
composable(
|
||||
route = "taskList/{taskListId}",
|
||||
arguments = listOf(navArgument("taskListId") {
|
||||
type = NavType.LongType
|
||||
})
|
||||
) { navBackStackEntry ->
|
||||
val taskListViewModel: TaskListViewModel = hiltViewModel(navBackStackEntry)
|
||||
TaskListScreen(
|
||||
viewModel = taskListViewModel,
|
||||
onTaskClick = { task ->
|
||||
taskViewModel.startEditTask(task)
|
||||
viewModel.showTaskSheet = true
|
||||
}
|
||||
)
|
||||
}
|
||||
//}
|
||||
composable(
|
||||
route = "taskList/{taskListId}",
|
||||
arguments = listOf(navArgument("taskListId") {
|
||||
type = NavType.LongType
|
||||
})
|
||||
) { navBackStackEntry ->
|
||||
// TODO: when task list has been deleted, we should not navigate to it event if in the stack
|
||||
val taskListViewModel: TaskListViewModel = hiltViewModel(navBackStackEntry)
|
||||
TaskListScreen(
|
||||
viewModel = taskListViewModel,
|
||||
onTaskClick = { task ->
|
||||
taskViewModel.startEditTask(task)
|
||||
viewModel.showTaskSheet = true
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
composable(AppDestination.ManageLists.route) {
|
||||
ManageListsScreen(
|
||||
@@ -201,6 +209,24 @@ fun AppContent(
|
||||
showAddListSheet = {viewModel.showAddListSheet = true}
|
||||
)
|
||||
}
|
||||
composable(AppDestination.DueTodayList.route) {
|
||||
DueTodayTasksScreen (
|
||||
modifier = Modifier,
|
||||
onTaskClick = { task ->
|
||||
taskViewModel.startEditTask(task)
|
||||
viewModel.showTaskSheet = true
|
||||
}
|
||||
)
|
||||
}
|
||||
composable(AppDestination.RecycleBin.route) {
|
||||
RecycleBinScreen(
|
||||
modifier = Modifier,
|
||||
onTaskClick = { task ->
|
||||
taskViewModel.startEditTask(task)
|
||||
viewModel.showTaskSheet = true
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.DragHandle
|
||||
import androidx.compose.material.icons.filled.Edit
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Card
|
||||
@@ -70,7 +71,7 @@ fun ManageListsScreen(
|
||||
)
|
||||
|
||||
LazyColumn(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
modifier = modifier.fillMaxWidth().padding(start = 10.dp, end = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
contentPadding = PaddingValues(vertical = 8.dp),
|
||||
state = lazyListState
|
||||
@@ -133,6 +134,7 @@ fun ManageListsScreen(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(Icons.Default.DragHandle, contentDescription = "Edit")
|
||||
AnimatedContent(
|
||||
targetState = isInEditMode,
|
||||
modifier = Modifier.weight(1f),
|
||||
@@ -183,7 +185,7 @@ fun ManageListsScreen(
|
||||
IconButton(onClick = { isInEditMode = true }) {
|
||||
Icon(Icons.Default.Edit, contentDescription = "Edit")
|
||||
}
|
||||
IconButton(onClick = { viewModel.deleteTaskList(list.id!!) }) {
|
||||
IconButton(onClick = { viewModel.deleteTaskList(list.id) }) {
|
||||
Icon(
|
||||
Icons.Default.Delete,
|
||||
contentDescription = "Delete"
|
||||
@@ -218,7 +220,7 @@ fun AddListBottomSheet(
|
||||
//var description by remember { mutableStateOf("") }
|
||||
|
||||
Column(modifier = Modifier.padding(16.dp)) {
|
||||
Text("Create New List", style = MaterialTheme.typography.titleMedium)
|
||||
Text("New List", style = MaterialTheme.typography.titleMedium)
|
||||
|
||||
Spacer(Modifier.height(8.dp))
|
||||
/*TextField(
|
||||
@@ -234,8 +236,7 @@ fun AddListBottomSheet(
|
||||
label = { Text("Title") },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.focusRequester(titleFocusRequester),
|
||||
isError = name.isEmpty(),
|
||||
.focusRequester(titleFocusRequester)
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(8.dp))
|
||||
@@ -253,11 +254,14 @@ fun AddListBottomSheet(
|
||||
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) {
|
||||
//TextButton(onClick = onDismiss) { Text("Cancel") }
|
||||
//Spacer(Modifier.width(8.dp))
|
||||
Button(onClick = {
|
||||
viewModel.createTaskList(name/*, type, description*/, 1)
|
||||
onDismiss()
|
||||
}) {
|
||||
Text("Add")
|
||||
Button(
|
||||
onClick = {
|
||||
viewModel.createTaskList(name/*, type, description*/, viewModel.taskCount + 1)
|
||||
onDismiss()
|
||||
},
|
||||
enabled = name.isNotBlank()
|
||||
) {
|
||||
Text("Create")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,11 +2,15 @@ package com.wismna.geoffroy.donext.presentation.screen
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Edit
|
||||
import androidx.compose.material.icons.filled.List
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.EditNote
|
||||
import androidx.compose.material.icons.filled.LineWeight
|
||||
import androidx.compose.material.icons.filled.Today
|
||||
import androidx.compose.material3.Badge
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
@@ -45,6 +49,19 @@ fun MenuScreen(
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
NavigationDrawerItem(
|
||||
label = {
|
||||
Row (modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
|
||||
Text("Due Today")
|
||||
Text(viewModel.dueTodayTasksCount.toString())
|
||||
}
|
||||
},
|
||||
icon = { Icon(Icons.Default.Today, contentDescription = "Due Today") },
|
||||
selected = currentDestination is AppDestination.DueTodayList,
|
||||
onClick = { onNavigate(AppDestination.DueTodayList.route) },
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
)
|
||||
HorizontalDivider()
|
||||
viewModel.taskLists.forEach { list ->
|
||||
NavigationDrawerItem(
|
||||
label = {
|
||||
@@ -54,7 +71,7 @@ fun MenuScreen(
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
},
|
||||
icon = { Icon(Icons.Default.List, contentDescription = list.name) },
|
||||
icon = { Icon(Icons.Default.LineWeight, contentDescription = list.name) },
|
||||
selected = currentDestination is AppDestination.TaskList &&
|
||||
currentDestination.taskListId == list.id,
|
||||
onClick = { onNavigate("taskList/${list.id}") },
|
||||
@@ -70,9 +87,16 @@ fun MenuScreen(
|
||||
|
||||
Column {
|
||||
HorizontalDivider()
|
||||
NavigationDrawerItem(
|
||||
label = { Text("Recycle Bin") },
|
||||
icon = { Icon(Icons.Default.Delete, contentDescription = "Recycle Bin") },
|
||||
selected = currentDestination is AppDestination.RecycleBin,
|
||||
onClick = { onNavigate(AppDestination.RecycleBin.route) },
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
)
|
||||
NavigationDrawerItem(
|
||||
label = { Text("Edit Lists") },
|
||||
icon = { Icon(Icons.Default.Edit, contentDescription = "Edit Lists") },
|
||||
icon = { Icon(Icons.Default.EditNote, contentDescription = "Edit Lists") },
|
||||
selected = currentDestination is AppDestination.ManageLists,
|
||||
onClick = { onNavigate(AppDestination.ManageLists.route) },
|
||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||
|
@@ -0,0 +1,139 @@
|
||||
package com.wismna.geoffroy.donext.presentation.screen
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.DeleteSweep
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.presentation.viewmodel.RecycleBinViewModel
|
||||
import com.wismna.geoffroy.donext.presentation.viewmodel.TaskItemViewModel
|
||||
|
||||
@Composable
|
||||
fun RecycleBinScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
viewModel: RecycleBinViewModel = hiltViewModel(),
|
||||
onTaskClick: (task: Task) -> Unit
|
||||
) {
|
||||
val tasks = viewModel.deletedTasks
|
||||
|
||||
if (tasks.isEmpty()) {
|
||||
// Placeholder when recycle bin is empty
|
||||
Box(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text("Recycle Bin is empty")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
val grouped = tasks.groupBy { it.listName }
|
||||
|
||||
val context = LocalContext.current
|
||||
LazyColumn(
|
||||
modifier = modifier.padding(8.dp)
|
||||
) {
|
||||
// Deleted tasks are grouped by list name
|
||||
grouped.forEach { (listName, items) ->
|
||||
stickyHeader {
|
||||
Surface(
|
||||
tonalElevation = 2.dp,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
text = listName,
|
||||
modifier = Modifier.padding(12.dp),
|
||||
style = MaterialTheme.typography.titleMedium.copy(
|
||||
fontStyle = FontStyle.Italic
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
items(items, key = { it.task.id!! }) { item ->
|
||||
TaskItemScreen(
|
||||
modifier = Modifier.animateItem(),
|
||||
viewModel = TaskItemViewModel(item.task),
|
||||
onTaskClick = { onTaskClick(item.task) },
|
||||
onSwipeLeft = {
|
||||
viewModel.restore(item.task.id!!)
|
||||
Toast.makeText(context, "Task restored", Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
onSwipeRight = {
|
||||
viewModel.deleteForever(item.task.id!!)
|
||||
Toast.makeText(context, "Task deleted", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun EmptyRecycleBinAction(viewModel: RecycleBinViewModel = hiltViewModel()) {
|
||||
val isEmpty = viewModel.deletedTasks.isEmpty()
|
||||
var showConfirmDialog by remember { mutableStateOf(false) }
|
||||
|
||||
IconButton(
|
||||
onClick = { showConfirmDialog = true },
|
||||
enabled = !isEmpty) {
|
||||
Icon(
|
||||
Icons.Default.DeleteSweep,
|
||||
modifier = Modifier.alpha(if (isEmpty) 0.5f else 1.0f),
|
||||
contentDescription = "Empty Recycle Bin",
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
|
||||
if (showConfirmDialog) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showConfirmDialog = false },
|
||||
title = { Text("Empty Recycle Bin") },
|
||||
text = {
|
||||
Text("Are you sure you want to permanently delete all tasks in the recycle bin? This cannot be undone.")
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
viewModel.emptyRecycleBin()
|
||||
showConfirmDialog = false
|
||||
},
|
||||
colors = ButtonDefaults.textButtonColors(
|
||||
contentColor = MaterialTheme.colorScheme.error
|
||||
)
|
||||
) {
|
||||
Text("Delete")
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { showConfirmDialog = false }) {
|
||||
Text("Cancel")
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
@@ -1,9 +1,9 @@
|
||||
package com.wismna.geoffroy.donext.presentation.screen
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
@@ -12,10 +12,14 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.Done
|
||||
import androidx.compose.material.icons.filled.DeleteForever
|
||||
import androidx.compose.material.icons.filled.DeleteOutline
|
||||
import androidx.compose.material.icons.filled.RestoreFromTrash
|
||||
import androidx.compose.material.icons.outlined.CheckCircle
|
||||
import androidx.compose.material.icons.outlined.Unpublished
|
||||
import androidx.compose.material3.Badge
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.SwipeToDismissBox
|
||||
@@ -28,12 +32,11 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.wismna.geoffroy.donext.domain.model.Priority
|
||||
import com.wismna.geoffroy.donext.presentation.viewmodel.TaskItemViewModel
|
||||
|
||||
@@ -41,23 +44,16 @@ import com.wismna.geoffroy.donext.presentation.viewmodel.TaskItemViewModel
|
||||
fun TaskItemScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
viewModel: TaskItemViewModel,
|
||||
onSwipeDone: () -> Unit,
|
||||
onSwipeDelete: () -> Unit
|
||||
onTaskClick: (taskId: Long) -> Unit,
|
||||
onSwipeLeft: () -> Unit,
|
||||
onSwipeRight: () -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
// TODO: change this
|
||||
val dismissState = rememberSwipeToDismissBoxState(
|
||||
confirmValueChange = {
|
||||
when (it) {
|
||||
SwipeToDismissBoxValue.StartToEnd -> {
|
||||
onSwipeDelete()
|
||||
Toast.makeText(context, "Task deleted", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
SwipeToDismissBoxValue.EndToStart -> {
|
||||
onSwipeDone()
|
||||
Toast.makeText(context, "Task done", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
SwipeToDismissBoxValue.StartToEnd -> { onSwipeRight() }
|
||||
SwipeToDismissBoxValue.EndToStart -> { onSwipeLeft() }
|
||||
SwipeToDismissBoxValue.Settled -> return@rememberSwipeToDismissBoxState false
|
||||
}
|
||||
return@rememberSwipeToDismissBoxState true
|
||||
@@ -78,85 +74,98 @@ fun TaskItemScreen(
|
||||
},
|
||||
textDecoration = if (viewModel.isDone) TextDecoration.LineThrough else TextDecoration.None
|
||||
)
|
||||
|
||||
SwipeToDismissBox(
|
||||
state = dismissState,
|
||||
Card(
|
||||
modifier = modifier,
|
||||
backgroundContent = { DismissBackground(dismissState, viewModel.isDone) },
|
||||
content = {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surfaceContainer)
|
||||
.padding(8.dp)
|
||||
.alpha(if (viewModel.isDone || viewModel.priority == Priority.LOW) 0.5f else 1f),
|
||||
verticalAlignment = Alignment.CenterVertically // centers checkbox + content
|
||||
) {
|
||||
Box(
|
||||
onClick = { onTaskClick(viewModel.id) },
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
),
|
||||
) {
|
||||
SwipeToDismissBox(
|
||||
state = dismissState,
|
||||
backgroundContent = {
|
||||
DismissBackground(
|
||||
dismissState,
|
||||
viewModel.isDone,
|
||||
viewModel.isDeleted
|
||||
)
|
||||
},
|
||||
content = {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.padding(start = 8.dp)
|
||||
.height(IntrinsicSize.Min) // shrink to fit title/description
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surfaceContainer)
|
||||
.padding(8.dp)
|
||||
.alpha(if (viewModel.isDone || viewModel.priority == Priority.LOW) 0.5f else 1f),
|
||||
verticalAlignment = Alignment.CenterVertically // centers checkbox + content
|
||||
) {
|
||||
// Title
|
||||
Text(
|
||||
text = viewModel.name,
|
||||
style = baseStyle,
|
||||
modifier = Modifier
|
||||
.align(
|
||||
if (viewModel.description.isNullOrBlank()) Alignment.CenterStart
|
||||
else Alignment.TopStart
|
||||
),
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
)
|
||||
|
||||
// Due date badge
|
||||
viewModel.dueDateText?.let { dueMillis ->
|
||||
Badge(
|
||||
modifier = Modifier
|
||||
.align(
|
||||
if (viewModel.description.isNullOrBlank()) Alignment.CenterEnd
|
||||
else Alignment.TopEnd
|
||||
),
|
||||
containerColor = if (viewModel.isOverdue) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.primaryContainer
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(start = 1.dp, end = 1.dp),
|
||||
text = viewModel.dueDateText,
|
||||
color = if (viewModel.isOverdue) Color.White else MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Optional description
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(40.dp) // 👈 adjust to the typical description height
|
||||
.padding(top = 20.dp),
|
||||
contentAlignment = Alignment.TopStart
|
||||
.weight(1f)
|
||||
.padding(start = 8.dp)
|
||||
.height(IntrinsicSize.Min) // shrink to fit title/description
|
||||
) {
|
||||
if (!viewModel.description.isNullOrBlank()) {
|
||||
Text(
|
||||
text = viewModel.description,
|
||||
style = baseStyle.copy(
|
||||
fontSize = MaterialTheme.typography.bodyMedium.fontSize,
|
||||
fontStyle = FontStyle.Italic
|
||||
// Title
|
||||
Text(
|
||||
text = viewModel.name,
|
||||
fontSize = 18.sp,
|
||||
style = baseStyle,
|
||||
modifier = Modifier
|
||||
.align(
|
||||
if (viewModel.description.isNullOrBlank()) Alignment.CenterStart
|
||||
else Alignment.TopStart
|
||||
),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
)
|
||||
|
||||
// Due date badge
|
||||
viewModel.dueDateText?.let { dueMillis ->
|
||||
Badge(
|
||||
modifier = Modifier
|
||||
.align(
|
||||
if (viewModel.description.isNullOrBlank()) Alignment.CenterEnd
|
||||
else Alignment.TopEnd
|
||||
),
|
||||
containerColor = if (viewModel.isOverdue) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.primaryContainer
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(start = 1.dp, end = 1.dp),
|
||||
text = viewModel.dueDateText,
|
||||
color = if (viewModel.isOverdue) Color.White else MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Optional description
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(40.dp)
|
||||
.padding(top = 24.dp),
|
||||
contentAlignment = Alignment.TopStart
|
||||
) {
|
||||
if (!viewModel.description.isNullOrBlank()) {
|
||||
Text(
|
||||
text = viewModel.description,
|
||||
color = MaterialTheme.colorScheme.tertiary,
|
||||
style = baseStyle.copy(
|
||||
fontSize = MaterialTheme.typography.bodyMedium.fontSize,
|
||||
),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DismissBackground(dismissState: SwipeToDismissBoxState, isDone: Boolean) {
|
||||
fun DismissBackground(dismissState: SwipeToDismissBoxState, isDone: Boolean, isDeleted: Boolean) {
|
||||
val color = when (dismissState.dismissDirection) {
|
||||
SwipeToDismissBoxValue.StartToEnd -> MaterialTheme.colorScheme.error
|
||||
SwipeToDismissBoxValue.EndToStart -> Color(0xFF18590D)
|
||||
@@ -171,16 +180,31 @@ fun DismissBackground(dismissState: SwipeToDismissBoxState, isDone: Boolean) {
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Delete,
|
||||
tint = Color.LightGray,
|
||||
contentDescription = "Delete"
|
||||
)
|
||||
Column (horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Icon(
|
||||
if (isDeleted) Icons.Default.DeleteForever else Icons.Default.DeleteOutline,
|
||||
tint = Color.LightGray,
|
||||
contentDescription = "Delete"
|
||||
)
|
||||
Text(
|
||||
color = MaterialTheme.colorScheme.onPrimary,
|
||||
fontSize = 10.sp,
|
||||
text = if (isDeleted) "Delete" else "Recycle"
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier)
|
||||
Icon(
|
||||
if (isDone) Icons.Default.Close else Icons.Default.Done,
|
||||
tint = Color.LightGray,
|
||||
contentDescription = "Archive"
|
||||
)
|
||||
Column (horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Icon(
|
||||
if (isDeleted) Icons.Default.RestoreFromTrash else
|
||||
if (isDone) Icons.Outlined.Unpublished else Icons.Outlined.CheckCircle,
|
||||
tint = Color.LightGray,
|
||||
contentDescription = "Archive"
|
||||
)
|
||||
Text(
|
||||
color = MaterialTheme.colorScheme.onPrimary,
|
||||
fontSize = 10.sp,
|
||||
text = if (isDeleted) "Restore" else if (isDone) "Undone" else "Done"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package com.wismna.geoffroy.donext.presentation.screen
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@@ -9,16 +10,14 @@ import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.ExtendedFloatingActionButton
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
@@ -38,6 +37,7 @@ fun TaskListScreen(
|
||||
tasks.partition { !it.isDone }
|
||||
}
|
||||
|
||||
val context = LocalContext.current
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = PaddingValues(8.dp),
|
||||
@@ -48,24 +48,19 @@ fun TaskListScreen(
|
||||
items = active,
|
||||
key = { it.id!! }
|
||||
) { task ->
|
||||
Card(
|
||||
onClick = { onTaskClick(task) },
|
||||
//elevation = CardDefaults.elevatedCardElevation(defaultElevation = 2.dp),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
),
|
||||
) {
|
||||
TaskItemScreen(
|
||||
modifier = Modifier.animateItem(),
|
||||
viewModel = TaskItemViewModel(task),
|
||||
onSwipeDone = {
|
||||
viewModel.updateTaskDone(task.id!!, true)
|
||||
},
|
||||
onSwipeDelete = {
|
||||
viewModel.deleteTask(task.id!!)
|
||||
}
|
||||
)
|
||||
}
|
||||
TaskItemScreen(
|
||||
modifier = Modifier.animateItem(),
|
||||
viewModel = TaskItemViewModel(task),
|
||||
onTaskClick = { onTaskClick(task) },
|
||||
onSwipeLeft = {
|
||||
viewModel.updateTaskDone(task.id!!, true)
|
||||
Toast.makeText(context, "Task done", Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
onSwipeRight = {
|
||||
viewModel.deleteTask(task.id!!)
|
||||
Toast.makeText(context, "Task moved to recycle bin", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Divider between active and done (optional)
|
||||
@@ -84,25 +79,21 @@ fun TaskListScreen(
|
||||
items = done,
|
||||
key = { it.id!! }
|
||||
) { task ->
|
||||
Card(
|
||||
onClick = { onTaskClick(task) },
|
||||
//elevation = CardDefaults.elevatedCardElevation(defaultElevation = 2.dp),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
),
|
||||
) {
|
||||
TaskItemScreen(
|
||||
modifier = Modifier.animateItem(),
|
||||
viewModel = TaskItemViewModel(task),
|
||||
onSwipeDone = {
|
||||
viewModel.updateTaskDone(task.id!!, false)
|
||||
},
|
||||
onSwipeDelete = {
|
||||
viewModel.deleteTask(task.id!!)
|
||||
},
|
||||
)
|
||||
}
|
||||
TaskItemScreen(
|
||||
modifier = Modifier.animateItem(),
|
||||
viewModel = TaskItemViewModel(task),
|
||||
onTaskClick = { onTaskClick(task) },
|
||||
onSwipeLeft = {
|
||||
viewModel.updateTaskDone(task.id!!, false)
|
||||
Toast.makeText(context, "Task in progress", Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
onSwipeRight = {
|
||||
viewModel.deleteTask(task.id!!)
|
||||
Toast.makeText(context, "Task moved to recycle bin", Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -8,8 +8,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.CalendarMonth
|
||||
import androidx.compose.material.icons.filled.Clear
|
||||
import androidx.compose.material.icons.filled.DateRange
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.DatePicker
|
||||
@@ -27,21 +27,25 @@ import androidx.compose.material3.SingleChoiceSegmentedButtonRow
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.rememberDatePickerState
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.wismna.geoffroy.donext.domain.extension.toLocalDate
|
||||
import com.wismna.geoffroy.donext.domain.model.Priority
|
||||
import com.wismna.geoffroy.donext.presentation.viewmodel.TaskViewModel
|
||||
import java.time.Instant
|
||||
import kotlinx.coroutines.launch
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneId
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.FormatStyle
|
||||
@@ -53,15 +57,19 @@ fun TaskBottomSheet(
|
||||
onDismiss: () -> Unit
|
||||
) {
|
||||
val titleFocusRequester = remember { FocusRequester() }
|
||||
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
titleFocusRequester.requestFocus()
|
||||
}
|
||||
|
||||
ModalBottomSheet(onDismissRequest = onDismiss) {
|
||||
ModalBottomSheet(
|
||||
onDismissRequest = onDismiss,
|
||||
sheetState = sheetState) {
|
||||
Column(Modifier.padding(16.dp)) {
|
||||
Text(
|
||||
if (viewModel.isEditing()) "Edit Task" else "New Task",
|
||||
viewModel.screenTitle(),
|
||||
style = MaterialTheme.typography.titleLarge
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
@@ -70,20 +78,19 @@ fun TaskBottomSheet(
|
||||
OutlinedTextField(
|
||||
value = viewModel.title,
|
||||
singleLine = true,
|
||||
readOnly = viewModel.isDone,
|
||||
readOnly = viewModel.isDeleted,
|
||||
onValueChange = { viewModel.onTitleChanged(it) },
|
||||
label = { Text("Title") },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.focusRequester(titleFocusRequester),
|
||||
isError = viewModel.title.isEmpty(),
|
||||
.focusRequester(titleFocusRequester)
|
||||
)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
|
||||
// --- Description ---
|
||||
OutlinedTextField(
|
||||
value = viewModel.description,
|
||||
readOnly = viewModel.isDone,
|
||||
readOnly = viewModel.isDeleted,
|
||||
onValueChange = { viewModel.onDescriptionChanged(it) },
|
||||
label = { Text("Description") },
|
||||
maxLines = 3,
|
||||
@@ -99,6 +106,7 @@ fun TaskBottomSheet(
|
||||
Text("Priority", style = MaterialTheme.typography.labelLarge)
|
||||
SingleChoiceSegmentedButton(
|
||||
value = viewModel.priority,
|
||||
isEnabled = !viewModel.isDeleted,
|
||||
onValueChange = { viewModel.onPriorityChanged(it) }
|
||||
)
|
||||
}
|
||||
@@ -106,12 +114,9 @@ fun TaskBottomSheet(
|
||||
|
||||
// --- Due Date ---
|
||||
var showDatePicker by remember { mutableStateOf(false) }
|
||||
val formattedDate = viewModel.dueDate?.let {
|
||||
Instant.ofEpochMilli(it)
|
||||
.atZone(ZoneOffset.UTC)
|
||||
.toLocalDate()
|
||||
.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM))
|
||||
} ?: ""
|
||||
val formattedDate = viewModel.dueDate?.toLocalDate()?.format(
|
||||
DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM))
|
||||
?: ""
|
||||
|
||||
OutlinedTextField(
|
||||
value = formattedDate,
|
||||
@@ -123,14 +128,14 @@ fun TaskBottomSheet(
|
||||
if (viewModel.dueDate != null) {
|
||||
IconButton(
|
||||
onClick = { viewModel.onDueDateChanged(null) },
|
||||
enabled = !viewModel.isDone) {
|
||||
enabled = !viewModel.isDeleted) {
|
||||
Icon(Icons.Default.Clear, contentDescription = "Clear due date")
|
||||
}
|
||||
}
|
||||
IconButton(
|
||||
onClick = { showDatePicker = true },
|
||||
enabled = !viewModel.isDone) {
|
||||
Icon(Icons.Default.DateRange, contentDescription = "Pick due date")
|
||||
enabled = !viewModel.isDeleted) {
|
||||
Icon(Icons.Default.CalendarMonth, contentDescription = "Pick due date")
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -142,11 +147,11 @@ fun TaskBottomSheet(
|
||||
initialSelectedDateMillis = viewModel.dueDate,
|
||||
selectableDates = object: SelectableDates {
|
||||
override fun isSelectableDate(utcTimeMillis: Long): Boolean {
|
||||
val todayStartMillis = LocalDate.now(ZoneOffset.UTC)
|
||||
val todayStartUtcMillis = LocalDate.now(ZoneId.systemDefault())
|
||||
.atStartOfDay(ZoneOffset.UTC)
|
||||
.toInstant()
|
||||
.toEpochMilli()
|
||||
return utcTimeMillis >= todayStartMillis
|
||||
return utcTimeMillis >= todayStartUtcMillis
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -154,7 +159,8 @@ fun TaskBottomSheet(
|
||||
DatePickerDialog(
|
||||
onDismissRequest = { showDatePicker = false },
|
||||
confirmButton = {
|
||||
TextButton(onClick = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
datePickerState.selectedDateMillis?.let { viewModel.onDueDateChanged(it) }
|
||||
showDatePicker = false
|
||||
}) { Text("OK") }
|
||||
@@ -166,31 +172,39 @@ fun TaskBottomSheet(
|
||||
DatePicker(state = datePickerState)
|
||||
}
|
||||
}
|
||||
if (!viewModel.isDeleted) {
|
||||
Spacer(Modifier.height(16.dp))
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
|
||||
Row (
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = if (viewModel.isEditing()) Arrangement.SpaceBetween else Arrangement.End) {
|
||||
|
||||
// --- Delete Button ---
|
||||
if (viewModel.isEditing()) {
|
||||
Button(
|
||||
onClick = { viewModel.delete(); onDismiss() },
|
||||
colors = ButtonDefaults.textButtonColors(
|
||||
contentColor = MaterialTheme.colorScheme.error
|
||||
)
|
||||
) { Text("Delete") }
|
||||
}
|
||||
// --- Save Button ---
|
||||
Button(
|
||||
onClick = {
|
||||
viewModel.save()
|
||||
onDismiss()
|
||||
},
|
||||
enabled = viewModel.title.isNotBlank() && !viewModel.isDone,
|
||||
Row (
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(if (viewModel.isEditing()) "Save" else "Create")
|
||||
// --- Cancel Button ---
|
||||
Button(
|
||||
onClick = {
|
||||
scope.launch {
|
||||
sheetState.hide()
|
||||
onDismiss()
|
||||
}
|
||||
},
|
||||
colors = ButtonDefaults.textButtonColors(
|
||||
contentColor = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
) { Text("Cancel") }
|
||||
|
||||
// --- Save Button ---
|
||||
Button(
|
||||
onClick = {
|
||||
scope.launch {
|
||||
viewModel.save()
|
||||
sheetState.hide()
|
||||
onDismiss()
|
||||
}
|
||||
},
|
||||
enabled = viewModel.title.isNotBlank() && !viewModel.isDeleted,
|
||||
) {
|
||||
Text(if (viewModel.isEditing()) "Save" else "Create")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,6 +214,7 @@ fun TaskBottomSheet(
|
||||
@Composable
|
||||
fun SingleChoiceSegmentedButton(
|
||||
value: Priority,
|
||||
isEnabled: Boolean,
|
||||
onValueChange: (Priority) -> Unit) {
|
||||
val options = listOf(Priority.LOW.label, Priority.NORMAL.label, Priority.HIGH.label)
|
||||
|
||||
@@ -210,6 +225,7 @@ fun SingleChoiceSegmentedButton(
|
||||
index = index,
|
||||
count = options.size
|
||||
),
|
||||
enabled = isEnabled,
|
||||
onClick = { onValueChange(Priority.fromValue(index)) },
|
||||
selected = index == value.value,
|
||||
label = { Text(label) }
|
||||
|
@@ -3,7 +3,7 @@ package com.wismna.geoffroy.donext.presentation.ui.theme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
// Primary shades
|
||||
val Purple80 = Color(0xFFD0BCFF) // Light theme primary
|
||||
val Purple80 = Color(0xFF6A59C7) // Light theme primary
|
||||
val Purple40 = Color(0xFF6650A4) // Dark theme primary
|
||||
|
||||
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||
|
@@ -25,48 +25,48 @@ fun DoNextTheme(
|
||||
|
||||
darkTheme -> darkColorScheme(
|
||||
primary = Purple40,
|
||||
onPrimary = Color.White,
|
||||
onPrimary = LightSurfaceContainer,
|
||||
primaryContainer = Purple40Container,
|
||||
onPrimaryContainer = Color.White,
|
||||
onPrimaryContainer = LightSurfaceContainer,
|
||||
secondary = PurpleGrey40,
|
||||
onSecondary = Color.White,
|
||||
onSecondary = LightSurfaceContainer,
|
||||
secondaryContainer = PurpleGrey40Container,
|
||||
onSecondaryContainer = Color.White,
|
||||
tertiary = Pink40,
|
||||
onTertiary = Color.White,
|
||||
onSecondaryContainer = LightSurfaceContainer,
|
||||
tertiary = Pink80,
|
||||
onTertiary = DarkSurfaceContainer,
|
||||
tertiaryContainer = Pink40Container,
|
||||
onTertiaryContainer = Color.White,
|
||||
onTertiaryContainer = LightSurfaceContainer,
|
||||
background = Color(0xFF121212),
|
||||
onBackground = Color.White,
|
||||
onBackground = LightSurfaceContainer,
|
||||
surface = Color(0xFF121212),
|
||||
onSurface = Color.White,
|
||||
onSurface = LightSurfaceContainer,
|
||||
surfaceVariant = DarkSurfaceContainer,
|
||||
onSurfaceVariant = Color.White,
|
||||
onSurfaceVariant = LightSurfaceContainer,
|
||||
error = Color(0xFFCF6679),
|
||||
onError = Color.Black
|
||||
onError = DarkSurfaceContainer
|
||||
)
|
||||
|
||||
else -> lightColorScheme(
|
||||
primary = Purple80,
|
||||
onPrimary = Color.Black,
|
||||
onPrimary = LightSurfaceContainer,
|
||||
primaryContainer = Purple80Container,
|
||||
onPrimaryContainer = Color.Black,
|
||||
onPrimaryContainer = DarkSurfaceContainer,
|
||||
secondary = PurpleGrey80,
|
||||
onSecondary = Color.Black,
|
||||
onSecondary = DarkSurfaceContainer,
|
||||
secondaryContainer = PurpleGrey80Container,
|
||||
onSecondaryContainer = Color.Black,
|
||||
tertiary = Pink80,
|
||||
onTertiary = Color.Black,
|
||||
onSecondaryContainer = DarkSurfaceContainer,
|
||||
tertiary = Pink40,
|
||||
onTertiary = LightSurfaceContainer,
|
||||
tertiaryContainer = Pink80Container,
|
||||
onTertiaryContainer = Color.Black,
|
||||
onTertiaryContainer = DarkSurfaceContainer,
|
||||
background = Color(0xFFFFFBFE),
|
||||
onBackground = Color.Black,
|
||||
onBackground = DarkSurfaceContainer,
|
||||
surface = Color(0xFFFFFBFE),
|
||||
onSurface = Color.Black,
|
||||
onSurface = DarkSurfaceContainer,
|
||||
surfaceVariant = LightSurfaceContainer,
|
||||
onSurfaceVariant = Color.Black,
|
||||
onSurfaceVariant = DarkSurfaceContainer,
|
||||
error = Color(0xFFB00020),
|
||||
onError = Color.White
|
||||
onError = LightSurfaceContainer
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package com.wismna.geoffroy.donext.presentation.viewmodel
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.domain.usecase.GetDueTodayTasksUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.ToggleTaskDeletedUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.ToggleTaskDoneUseCase
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class DueTodayViewModel @Inject constructor(
|
||||
getDueTodayTasks: GetDueTodayTasksUseCase,
|
||||
private val toggleTaskDeleted: ToggleTaskDeletedUseCase,
|
||||
private val toggleTaskDone: ToggleTaskDoneUseCase
|
||||
) : ViewModel() {
|
||||
|
||||
var dueTodayTasks by mutableStateOf<List<Task>>(emptyList())
|
||||
private set
|
||||
|
||||
init {
|
||||
getDueTodayTasks()
|
||||
.onEach { tasks ->
|
||||
dueTodayTasks = tasks
|
||||
}
|
||||
.launchIn(viewModelScope)
|
||||
}
|
||||
|
||||
fun updateTaskDone(taskId: Long) {
|
||||
viewModelScope.launch {
|
||||
toggleTaskDone(taskId, true)
|
||||
}
|
||||
}
|
||||
fun deleteTask(taskId: Long) {
|
||||
viewModelScope.launch {
|
||||
toggleTaskDeleted(taskId, true)
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@ import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class MainViewModel @Inject constructor(
|
||||
getTaskLists: GetTaskListsUseCase
|
||||
getTaskListsUseCase: GetTaskListsUseCase
|
||||
) : ViewModel() {
|
||||
|
||||
var isLoading by mutableStateOf(true)
|
||||
@@ -34,11 +34,14 @@ class MainViewModel @Inject constructor(
|
||||
var showAddListSheet by mutableStateOf(false)
|
||||
|
||||
init {
|
||||
getTaskLists()
|
||||
getTaskListsUseCase()
|
||||
.onEach { lists ->
|
||||
destinations = lists.map { taskList ->
|
||||
AppDestination.TaskList(taskList.id!!, taskList.name)
|
||||
} + AppDestination.ManageLists
|
||||
} +
|
||||
AppDestination.ManageLists +
|
||||
AppDestination.RecycleBin +
|
||||
AppDestination.DueTodayList
|
||||
isLoading = false
|
||||
if (startDestination == AppDestination.ManageLists && destinations.isNotEmpty()) {
|
||||
startDestination = destinations.first()
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.wismna.geoffroy.donext.presentation.viewmodel
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.ViewModel
|
||||
@@ -26,11 +27,14 @@ class ManageListsViewModel @Inject constructor(
|
||||
|
||||
var taskLists by mutableStateOf<List<TaskList>>(emptyList())
|
||||
private set
|
||||
var taskCount by mutableIntStateOf(0)
|
||||
private set
|
||||
|
||||
init {
|
||||
getTaskListsUseCase()
|
||||
.onEach { lists ->
|
||||
taskLists = lists
|
||||
taskCount = lists.size
|
||||
}
|
||||
.launchIn(viewModelScope)
|
||||
}
|
||||
@@ -45,9 +49,9 @@ class ManageListsViewModel @Inject constructor(
|
||||
updateTaskListUseCase(taskList.id!!, taskList.name, taskList.order)
|
||||
}
|
||||
}
|
||||
fun deleteTaskList(taskId: Long) {
|
||||
fun deleteTaskList(taskListId: Long) {
|
||||
viewModelScope.launch {
|
||||
deleteTaskListUseCase(taskId)
|
||||
deleteTaskListUseCase(taskListId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,13 @@
|
||||
package com.wismna.geoffroy.donext.presentation.viewmodel
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskListWithOverdue
|
||||
import com.wismna.geoffroy.donext.domain.usecase.GetDueTodayTasksUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.GetTaskListsWithOverdueUseCase
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
@@ -14,17 +16,26 @@ import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class MenuViewModel @Inject constructor(
|
||||
getTaskListsWithOverdue: GetTaskListsWithOverdueUseCase
|
||||
getTaskListsWithOverdue: GetTaskListsWithOverdueUseCase,
|
||||
getDueTodayTasks: GetDueTodayTasksUseCase
|
||||
) : ViewModel() {
|
||||
|
||||
var taskLists by mutableStateOf<List<TaskListWithOverdue>>(emptyList())
|
||||
private set
|
||||
|
||||
var dueTodayTasksCount by mutableIntStateOf(0)
|
||||
private set
|
||||
|
||||
init {
|
||||
getTaskListsWithOverdue()
|
||||
.onEach { lists ->
|
||||
taskLists = lists
|
||||
}
|
||||
.launchIn(viewModelScope)
|
||||
getDueTodayTasks()
|
||||
.onEach { tasks ->
|
||||
dueTodayTasksCount = tasks.count()
|
||||
}
|
||||
.launchIn(viewModelScope)
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,60 @@
|
||||
package com.wismna.geoffroy.donext.presentation.viewmodel
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.wismna.geoffroy.donext.domain.model.TaskWithListName
|
||||
import com.wismna.geoffroy.donext.domain.usecase.EmptyRecycleBinUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.GetDeletedTasksUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.PermanentlyDeleteTaskUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.ToggleTaskDeletedUseCase
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class RecycleBinViewModel @Inject constructor(
|
||||
private val getDeletedTasks: GetDeletedTasksUseCase,
|
||||
private val restoreTask: ToggleTaskDeletedUseCase,
|
||||
private val permanentlyDeleteTask: PermanentlyDeleteTaskUseCase,
|
||||
private val emptyRecycleBinUseCase: EmptyRecycleBinUseCase
|
||||
) : ViewModel() {
|
||||
|
||||
var deletedTasks by mutableStateOf<List<TaskWithListName>>(emptyList())
|
||||
private set
|
||||
|
||||
init {
|
||||
loadDeletedTasks()
|
||||
}
|
||||
|
||||
fun loadDeletedTasks() {
|
||||
getDeletedTasks()
|
||||
.onEach { tasks ->
|
||||
deletedTasks = tasks
|
||||
}
|
||||
.launchIn(viewModelScope)
|
||||
}
|
||||
|
||||
fun restore(taskId: Long) {
|
||||
viewModelScope.launch {
|
||||
restoreTask(taskId, false)
|
||||
loadDeletedTasks()
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteForever(taskId: Long) {
|
||||
viewModelScope.launch {
|
||||
permanentlyDeleteTask(taskId)
|
||||
loadDeletedTasks()
|
||||
}
|
||||
}
|
||||
fun emptyRecycleBin() {
|
||||
viewModelScope.launch {
|
||||
emptyRecycleBinUseCase()
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,10 @@
|
||||
package com.wismna.geoffroy.donext.presentation.viewmodel
|
||||
|
||||
import com.wismna.geoffroy.donext.domain.extension.toLocalDate
|
||||
import com.wismna.geoffroy.donext.domain.model.Priority
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import java.time.Instant
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneOffset
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.FormatStyle
|
||||
import java.time.format.TextStyle
|
||||
@@ -15,21 +15,20 @@ class TaskItemViewModel(task: Task) {
|
||||
val name: String = task.name
|
||||
val description: String? = task.description
|
||||
val isDone: Boolean = task.isDone
|
||||
val isDeleted: Boolean = task.isDeleted
|
||||
val priority: Priority = task.priority
|
||||
|
||||
val today: LocalDate = LocalDate.now(ZoneOffset.UTC)
|
||||
val today: LocalDate = LocalDate.now(ZoneId.systemDefault())
|
||||
|
||||
val isOverdue: Boolean = task.dueDate?.let { millis ->
|
||||
val dueDate = Instant.ofEpochMilli(millis)
|
||||
.atZone(ZoneOffset.UTC)
|
||||
.toLocalDate()
|
||||
val dueDate = millis.toLocalDate()
|
||||
dueDate.isBefore(today)
|
||||
} ?: false
|
||||
|
||||
val dueDateText: String? = task.dueDate?.let { formatDueDate(it) }
|
||||
|
||||
private fun formatDueDate(dueMillis: Long): String {
|
||||
val dueDate = Instant.ofEpochMilli(dueMillis).atZone(ZoneOffset.UTC).toLocalDate()
|
||||
val dueDate = dueMillis.toLocalDate()
|
||||
|
||||
return when {
|
||||
dueDate.isEqual(today) -> "Today"
|
||||
|
@@ -7,8 +7,8 @@ import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.domain.usecase.DeleteTaskListUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.GetTasksForListUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.ToggleTaskDeletedUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.ToggleTaskDoneUseCase
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
@@ -19,8 +19,8 @@ import javax.inject.Inject
|
||||
@HiltViewModel
|
||||
class TaskListViewModel @Inject constructor(
|
||||
getTasks: GetTasksForListUseCase,
|
||||
private val toggleTaskDoneUseCase: ToggleTaskDoneUseCase,
|
||||
private val deleteTaskListUseCase: DeleteTaskListUseCase,
|
||||
private val toggleTaskDone: ToggleTaskDoneUseCase,
|
||||
private val toggleTaskDeleted: ToggleTaskDeletedUseCase,
|
||||
savedStateHandle: SavedStateHandle
|
||||
) : ViewModel() {
|
||||
|
||||
@@ -42,12 +42,12 @@ class TaskListViewModel @Inject constructor(
|
||||
|
||||
fun updateTaskDone(taskId: Long, isDone: Boolean) {
|
||||
viewModelScope.launch {
|
||||
toggleTaskDoneUseCase(taskId, isDone)
|
||||
toggleTaskDone(taskId, isDone)
|
||||
}
|
||||
}
|
||||
fun deleteTask(taskId: Long) {
|
||||
viewModelScope.launch {
|
||||
deleteTaskListUseCase(taskId)
|
||||
toggleTaskDeleted(taskId, true)
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,17 +8,18 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.wismna.geoffroy.donext.domain.model.Priority
|
||||
import com.wismna.geoffroy.donext.domain.model.Task
|
||||
import com.wismna.geoffroy.donext.domain.usecase.AddTaskUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.DeleteTaskUseCase
|
||||
import com.wismna.geoffroy.donext.domain.usecase.UpdateTaskUseCase
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import java.time.Instant
|
||||
import java.time.ZoneId
|
||||
import java.time.ZoneOffset
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class TaskViewModel @Inject constructor(
|
||||
private val createTaskUseCase: AddTaskUseCase,
|
||||
private val updateTaskUseCase: UpdateTaskUseCase,
|
||||
private val deleteTaskUseCase: DeleteTaskUseCase
|
||||
private val updateTaskUseCase: UpdateTaskUseCase
|
||||
) : ViewModel() {
|
||||
|
||||
var title by mutableStateOf("")
|
||||
@@ -31,10 +32,13 @@ class TaskViewModel @Inject constructor(
|
||||
private set
|
||||
var isDone by mutableStateOf(false)
|
||||
private set
|
||||
var isDeleted by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
private var editingTaskId: Long? = null
|
||||
private var taskListId: Long? = null
|
||||
|
||||
fun screenTitle(): String = if (isDeleted) "Task details" else if (isEditing()) "Edit Task" else "New Task"
|
||||
fun isEditing(): Boolean = editingTaskId != null
|
||||
|
||||
fun startNewTask(selectedListId: Long) {
|
||||
@@ -44,6 +48,7 @@ class TaskViewModel @Inject constructor(
|
||||
description = ""
|
||||
priority = Priority.NORMAL
|
||||
dueDate = null
|
||||
isDeleted = false
|
||||
}
|
||||
|
||||
fun startEditTask(task: Task) {
|
||||
@@ -54,14 +59,23 @@ class TaskViewModel @Inject constructor(
|
||||
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 }
|
||||
fun onDueDateChanged(value: Long?) { dueDate = value }
|
||||
fun onDueDateChanged(value: Long?) {
|
||||
dueDate = if (value == null) null else
|
||||
Instant.ofEpochMilli(value)
|
||||
.atZone(ZoneOffset.UTC)
|
||||
.toLocalDate()
|
||||
.atStartOfDay(ZoneId.systemDefault())
|
||||
.toInstant()
|
||||
.toEpochMilli()
|
||||
}
|
||||
|
||||
fun save(onDone: (() -> Unit)? = null) {
|
||||
fun save(onDone: (() -> Unit)? = null) {
|
||||
if (title.isBlank()) return
|
||||
|
||||
viewModelScope.launch {
|
||||
@@ -76,15 +90,6 @@ class TaskViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun delete() {
|
||||
editingTaskId?.let { id ->
|
||||
viewModelScope.launch {
|
||||
deleteTaskUseCase(id)
|
||||
reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
editingTaskId = null
|
||||
taskListId = null
|
||||
|
@@ -18,4 +18,5 @@
|
||||
# org.gradle.parallel=true
|
||||
android.enableJetifier=false
|
||||
android.useAndroidX=true
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.jvmargs=-Xmx4g
|
Reference in New Issue
Block a user