show the keyboard at rename and new note dialogs

This commit is contained in:
tibbi 2017-01-06 21:29:50 +01:00
parent 02e005ec37
commit ff7d406c15
2 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,9 @@
package com.simplemobiletools.notes.dialogs
import android.app.Activity
import android.content.DialogInterface.BUTTON_POSITIVE
import android.support.v7.app.AlertDialog
import android.view.WindowManager
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.value
@ -17,8 +19,9 @@ class NewNoteDialog(val activity: Activity, val db: DBHelper, callback: (title:
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
activity.setupDialogStuff(view, this, R.string.new_note)
getButton(android.support.v7.app.AlertDialog.BUTTON_POSITIVE).setOnClickListener {
getButton(BUTTON_POSITIVE).setOnClickListener {
val title = view.note_name.value
if (title.isEmpty()) {
activity.toast(R.string.no_title)

View File

@ -1,8 +1,10 @@
package com.simplemobiletools.notes.dialogs
import android.app.Activity
import android.content.DialogInterface.BUTTON_POSITIVE
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.WindowManager
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.value
@ -21,8 +23,9 @@ class RenameNoteDialog(val activity: Activity, val db: DBHelper, val note: Note,
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
activity.setupDialogStuff(view, this, R.string.rename_note)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
getButton(BUTTON_POSITIVE).setOnClickListener({
val title = view.note_name.value
if (title.isEmpty()) {
activity.toast(R.string.no_title)