Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8d5f328 authored by tibbi's avatar tibbi
Browse files

add a helper alertdialog extension for showing keyboard

parent 65923b64
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.14.1'
        propVersionName = '3.14.2'
        kotlin_version = '1.2.21'
        support_libs = '27.0.2'
    }
+1 −2
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ package com.simplemobiletools.commons.dialogs

import android.support.v7.app.AlertDialog
import android.view.View
import android.view.WindowManager
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.*
@@ -18,8 +17,8 @@ class CreateNewFolderDialog(val activity: BaseSimpleActivity, val path: String,
                .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.create_new_folder) {
                showKeyboard(view.folder_name)
                getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(View.OnClickListener {
                    val name = view.folder_name.value
                    when {
+1 −2
Original line number Diff line number Diff line
package com.simplemobiletools.commons.dialogs

import android.support.v7.app.AlertDialog
import android.view.WindowManager
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.*
@@ -32,8 +31,8 @@ class RenameItemDialog(val activity: BaseSimpleActivity, val path: String, val c
                .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) {
                showKeyboard(view.rename_item_name)
                getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
                    var newName = view.rename_item_name.value
                    val newExtension = view.rename_item_extension.value
+14 −0
Original line number Diff line number Diff line
package com.simplemobiletools.commons.extensions

import android.support.v7.app.AlertDialog
import android.view.WindowManager
import android.widget.EditText

fun AlertDialog.showKeyboard(editText: EditText) {
    window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
    editText.apply {
        onGlobalLayout {
            setSelection(text.toString().length)
        }
    }
}