mirror of
https://github.com/nextcloud/android.git
synced 2024-12-18 15:01:57 +03:00
remove combined click
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
312e793fb2
commit
4796b67943
3 changed files with 15 additions and 41 deletions
|
@ -226,7 +226,15 @@ private fun ShowOverlayState(
|
||||||
val newState =
|
val newState =
|
||||||
ScreenOverlayState.AddTask(taskType, state.task.input?.input ?: "")
|
ScreenOverlayState.AddTask(taskType, state.task.input?.input ?: "")
|
||||||
viewModel.updateScreenState(newState)
|
viewModel.updateScreenState(newState)
|
||||||
}
|
},
|
||||||
|
Triple(
|
||||||
|
R.drawable.ic_delete,
|
||||||
|
R.string.assistant_screen_task_more_actions_bottom_sheet_delete_action
|
||||||
|
) {
|
||||||
|
val newState =
|
||||||
|
ScreenOverlayState.DeleteTask(state.task.id)
|
||||||
|
viewModel.updateScreenState(newState)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
MoreActionsBottomSheet(
|
MoreActionsBottomSheet(
|
||||||
|
@ -263,10 +271,6 @@ private fun AssistantContent(
|
||||||
|
|
||||||
items(taskList) { task ->
|
items(taskList) { task ->
|
||||||
TaskView(task,
|
TaskView(task,
|
||||||
showDeleteTaskAlertDialog = {
|
|
||||||
val newState = ScreenOverlayState.DeleteTask(task.id)
|
|
||||||
viewModel.updateScreenState(newState)
|
|
||||||
},
|
|
||||||
showTaskActions = {
|
showTaskActions = {
|
||||||
val newState = ScreenOverlayState.TaskActions(task)
|
val newState = ScreenOverlayState.TaskActions(task)
|
||||||
viewModel.updateScreenState(newState)
|
viewModel.updateScreenState(newState)
|
||||||
|
|
|
@ -9,9 +9,8 @@ package com.nextcloud.client.assistant.task
|
||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.animation.core.Spring
|
import androidx.compose.animation.core.Spring
|
||||||
import androidx.compose.animation.core.spring
|
import androidx.compose.animation.core.spring
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
@ -42,16 +41,13 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.nextcloud.client.assistant.task.model.TaskViewBottomSheetType
|
import com.nextcloud.client.assistant.task.model.TaskViewBottomSheetType
|
||||||
import com.nextcloud.client.assistant.taskDetail.TaskDetailBottomSheet
|
import com.nextcloud.client.assistant.taskDetail.TaskDetailBottomSheet
|
||||||
import com.nextcloud.ui.composeComponents.bottomSheet.MoreActionsBottomSheet
|
|
||||||
import com.owncloud.android.R
|
|
||||||
import com.owncloud.android.lib.resources.assistant.model.Task
|
import com.owncloud.android.lib.resources.assistant.model.Task
|
||||||
import com.owncloud.android.lib.resources.assistant.model.TaskInput
|
import com.owncloud.android.lib.resources.assistant.model.TaskInput
|
||||||
import com.owncloud.android.lib.resources.assistant.model.TaskOutput
|
import com.owncloud.android.lib.resources.assistant.model.TaskOutput
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Suppress("LongMethod", "MagicNumber")
|
@Suppress("LongMethod", "MagicNumber")
|
||||||
@Composable
|
@Composable
|
||||||
fun TaskView(task: Task, showDeleteTaskAlertDialog: (Long) -> Unit, showTaskActions: () -> Unit) {
|
fun TaskView(task: Task, showTaskActions: () -> Unit) {
|
||||||
var bottomSheetType by remember { mutableStateOf<TaskViewBottomSheetType?>(null) }
|
var bottomSheetType by remember { mutableStateOf<TaskViewBottomSheetType?>(null) }
|
||||||
|
|
||||||
Box {
|
Box {
|
||||||
|
@ -60,11 +56,9 @@ fun TaskView(task: Task, showDeleteTaskAlertDialog: (Long) -> Unit, showTaskActi
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(8.dp))
|
||||||
.background(MaterialTheme.colorScheme.primary)
|
.background(MaterialTheme.colorScheme.primary)
|
||||||
.combinedClickable(onClick = {
|
.clickable {
|
||||||
bottomSheetType = TaskViewBottomSheetType.Detail
|
bottomSheetType = TaskViewBottomSheetType.Detail
|
||||||
}, onLongClick = {
|
}
|
||||||
bottomSheetType = TaskViewBottomSheetType.MoreAction
|
|
||||||
})
|
|
||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
) {
|
) {
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
@ -107,9 +101,7 @@ fun TaskView(task: Task, showDeleteTaskAlertDialog: (Long) -> Unit, showTaskActi
|
||||||
TaskStatusView(task, foregroundColor = Color.White)
|
TaskStatusView(task, foregroundColor = Color.White)
|
||||||
|
|
||||||
bottomSheetType?.let {
|
bottomSheetType?.let {
|
||||||
TaskViewBottomSheet(it, task, showDeleteTaskAlertDialog = {
|
TaskViewBottomSheet(it, task, dismiss = {
|
||||||
showDeleteTaskAlertDialog(task.id)
|
|
||||||
}, dismiss = {
|
|
||||||
bottomSheetType = null
|
bottomSheetType = null
|
||||||
}, showTaskActions = {
|
}, showTaskActions = {
|
||||||
showTaskActions()
|
showTaskActions()
|
||||||
|
@ -136,7 +128,6 @@ private fun TaskViewBottomSheet(
|
||||||
bottomSheetType: TaskViewBottomSheetType,
|
bottomSheetType: TaskViewBottomSheetType,
|
||||||
task: Task,
|
task: Task,
|
||||||
showTaskActions: () -> Unit,
|
showTaskActions: () -> Unit,
|
||||||
showDeleteTaskAlertDialog: () -> Unit,
|
|
||||||
dismiss: () -> Unit
|
dismiss: () -> Unit
|
||||||
) {
|
) {
|
||||||
when (bottomSheetType) {
|
when (bottomSheetType) {
|
||||||
|
@ -148,25 +139,6 @@ private fun TaskViewBottomSheet(
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskViewBottomSheetType.MoreAction -> {
|
|
||||||
val bottomSheetAction = listOf(
|
|
||||||
Triple(
|
|
||||||
R.drawable.ic_delete,
|
|
||||||
R.string.assistant_screen_task_more_actions_bottom_sheet_delete_action
|
|
||||||
) {
|
|
||||||
showDeleteTaskAlertDialog()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
MoreActionsBottomSheet(
|
|
||||||
title = task.input?.input,
|
|
||||||
actions = bottomSheetAction,
|
|
||||||
dismiss = {
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,8 +163,6 @@ private fun TaskViewPreview() {
|
||||||
1707692337,
|
1707692337,
|
||||||
), showTaskActions = {
|
), showTaskActions = {
|
||||||
|
|
||||||
}, showDeleteTaskAlertDialog = {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
package com.nextcloud.client.assistant.task.model
|
package com.nextcloud.client.assistant.task.model
|
||||||
|
|
||||||
enum class TaskViewBottomSheetType {
|
enum class TaskViewBottomSheetType {
|
||||||
Detail, MoreAction
|
Detail
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue