show keyboard when checklist dialog opens

This commit is contained in:
darthpaul 2021-10-06 23:43:50 +01:00
parent 2fdd2cc845
commit 059ba84775
1 changed files with 1 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import android.content.DialogInterface.BUTTON_POSITIVE
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.widget.EditText import android.widget.EditText
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
@ -34,8 +33,7 @@ class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayLis
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
activity.setupDialogStuff(view, this, R.string.add_new_checklist_items, cancelOnTouchOutside = false) { activity.setupDialogStuff(view, this, R.string.add_new_checklist_items, cancelOnTouchOutside = false) {
activity.showKeyboard(titles.first()) showKeyboard(titles.first())
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
getButton(BUTTON_POSITIVE).setOnClickListener { getButton(BUTTON_POSITIVE).setOnClickListener {
when { when {
titles.all { it.text.isEmpty() } -> activity.toast(R.string.empty_name) titles.all { it.text.isEmpty() } -> activity.toast(R.string.empty_name)