From 208d6c79e9fd627e95342a2630b6cbff6e6bffa6 Mon Sep 17 00:00:00 2001 From: williamvds Date: Sat, 6 Apr 2019 15:26:06 +0100 Subject: [PATCH] Make long click on edit FAB launch the editor --- .../main/java/kvj/taskw/ui/TaskActivity.kt | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/kvj/taskw/ui/TaskActivity.kt b/app/src/main/java/kvj/taskw/ui/TaskActivity.kt index bc18f2f..507889b 100644 --- a/app/src/main/java/kvj/taskw/ui/TaskActivity.kt +++ b/app/src/main/java/kvj/taskw/ui/TaskActivity.kt @@ -82,18 +82,24 @@ class TaskActivity : AppActivity() { startActivityForResult(intent, App.TAG_REQUEST) } + fun openEditor() { + EditTask(this) { + val intent = Intent(this, EditorActivity::class.java) + it.intentForEditor(intent, task.uuid) + startActivityForResult(intent, App.EDIT_REQUEST) + }.execute() + } + edit.setOnClickListener { - if (editExpanded) { - EditTask(this@TaskActivity) { - val intent = Intent(this, EditorActivity::class.java) - it.intentForEditor(intent, task.uuid) - startActivityForResult(intent, App.EDIT_REQUEST) - }.execute() - } + if (editExpanded) openEditor() editExpanded = !editExpanded updateEditList() } + edit.setOnLongClickListener { + openEditor() + true + } done.setOnClickListener { EditTask(this@TaskActivity) { -- 2.45.2