mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
Add multine line for add task alert dialog
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
631ddf5250
commit
6f777580e2
2 changed files with 23 additions and 13 deletions
|
@ -148,10 +148,18 @@ fun AssistantScreen(viewModel: AssistantViewModel, activity: Activity) {
|
|||
}
|
||||
|
||||
if (showAddTaskAlertDialog) {
|
||||
selectedTaskType?.let {
|
||||
AddTaskAlertDialog(viewModel, it) {
|
||||
showAddTaskAlertDialog = false
|
||||
}
|
||||
selectedTaskType?.let { taskType ->
|
||||
AddTaskAlertDialog(
|
||||
title = taskType.name,
|
||||
description = taskType.description,
|
||||
addTask = { input ->
|
||||
taskType.id?.let {
|
||||
viewModel.createTask(input = input, type = it)
|
||||
}
|
||||
}, dismiss = {
|
||||
showAddTaskAlertDialog = false
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,25 +31,22 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import com.nextcloud.client.assistant.AssistantViewModel
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.nextcloud.ui.composeComponents.alertDialog.SimpleAlertDialog
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.resources.assistant.model.TaskType
|
||||
|
||||
@Composable
|
||||
fun AddTaskAlertDialog(viewModel: AssistantViewModel, taskType: TaskType, dismiss: () -> Unit) {
|
||||
fun AddTaskAlertDialog(title: String?, description: String?, addTask: (String) -> Unit, dismiss: () -> Unit) {
|
||||
var input by remember {
|
||||
mutableStateOf("")
|
||||
}
|
||||
|
||||
SimpleAlertDialog(
|
||||
title = taskType.name ?: "",
|
||||
description = taskType.description,
|
||||
title = title ?: "",
|
||||
description = description ?: "",
|
||||
dismiss = { dismiss() },
|
||||
onComplete = {
|
||||
taskType.id?.let {
|
||||
viewModel.createTask(input = input, type = it)
|
||||
}
|
||||
addTask(input)
|
||||
},
|
||||
content = {
|
||||
TextField(
|
||||
|
@ -65,8 +62,13 @@ fun AddTaskAlertDialog(viewModel: AssistantViewModel, taskType: TaskType, dismis
|
|||
onValueChange = {
|
||||
input = it
|
||||
},
|
||||
singleLine = true
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
private fun AddTaskAlertDialogPreview() {
|
||||
AddTaskAlertDialog(title = "Title", description = "Description", addTask = { }, dismiss = {})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue