Automatically show soft keyboard when passwords are asked
This commit is contained in:
@@ -1118,6 +1118,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
messageView.text = message
|
messageView.text = message
|
||||||
}
|
}
|
||||||
val input = layout.findViewById(R.id.password) as EditText
|
val input = layout.findViewById(R.id.password) as EditText
|
||||||
|
input.requestFocus()
|
||||||
val checkBox = layout.findViewById(R.id.checkbox) as CheckBox
|
val checkBox = layout.findViewById(R.id.checkbox) as CheckBox
|
||||||
checkBox.setOnCheckedChangeListener { _, isChecked ->
|
checkBox.setOnCheckedChangeListener { _, isChecked ->
|
||||||
if (isChecked)
|
if (isChecked)
|
||||||
@@ -1126,9 +1127,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
input.transformationMethod = PasswordTransformationMethod()
|
input.transformationMethod = PasswordTransformationMethod()
|
||||||
}
|
}
|
||||||
val context = this
|
val context = this
|
||||||
with(AlertDialog.Builder(this)) {
|
val builder = AlertDialog.Builder(this)
|
||||||
|
with(builder) {
|
||||||
setView(layout)
|
setView(layout)
|
||||||
setPositiveButton(android.R.string.ok) { dialog, _ ->
|
setPositiveButton(android.R.string.ok) { dialog, _ ->
|
||||||
|
imm.hideSoftInputFromWindow(input.windowToken, 0)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
var password = input.text.toString().trim()
|
var password = input.text.toString().trim()
|
||||||
if (!Account.checkAuthPass(password)) {
|
if (!Account.checkAuthPass(password)) {
|
||||||
@@ -1146,9 +1149,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setNegativeButton(android.R.string.cancel) { dialog, _ ->
|
setNegativeButton(android.R.string.cancel) { dialog, _ ->
|
||||||
|
imm.hideSoftInputFromWindow(input.windowToken, 0)
|
||||||
dialog.cancel()
|
dialog.cancel()
|
||||||
}
|
}
|
||||||
show()
|
val dialog = builder.create()
|
||||||
|
dialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||||
|
dialog.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1168,6 +1174,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val message = getString(R.string.account) + " " + Utils.plainAor(aor)
|
val message = getString(R.string.account) + " " + Utils.plainAor(aor)
|
||||||
messageView.text = message
|
messageView.text = message
|
||||||
val input = layout.findViewById(R.id.password) as EditText
|
val input = layout.findViewById(R.id.password) as EditText
|
||||||
|
input.requestFocus()
|
||||||
val checkBox = layout.findViewById(R.id.checkbox) as CheckBox
|
val checkBox = layout.findViewById(R.id.checkbox) as CheckBox
|
||||||
checkBox.setOnCheckedChangeListener { _, isChecked ->
|
checkBox.setOnCheckedChangeListener { _, isChecked ->
|
||||||
if (isChecked)
|
if (isChecked)
|
||||||
@@ -1176,9 +1183,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
input.transformationMethod = PasswordTransformationMethod()
|
input.transformationMethod = PasswordTransformationMethod()
|
||||||
}
|
}
|
||||||
val context = this
|
val context = this
|
||||||
with(AlertDialog.Builder(this)) {
|
val builder = AlertDialog.Builder(this)
|
||||||
|
with(builder) {
|
||||||
setView(layout)
|
setView(layout)
|
||||||
setPositiveButton(android.R.string.ok) { dialog, _ ->
|
setPositiveButton(android.R.string.ok) { dialog, _ ->
|
||||||
|
imm.hideSoftInputFromWindow(input.windowToken, 0)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
val password = input.text.toString().trim()
|
val password = input.text.toString().trim()
|
||||||
if (!Account.checkAuthPass(password)) {
|
if (!Account.checkAuthPass(password)) {
|
||||||
@@ -1190,11 +1199,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
askPasswords(accounts)
|
askPasswords(accounts)
|
||||||
}
|
}
|
||||||
setNegativeButton(android.R.string.cancel) { dialog, _ ->
|
setNegativeButton(android.R.string.cancel) { dialog, _ ->
|
||||||
|
imm.hideSoftInputFromWindow(input.windowToken, 0)
|
||||||
dialog.cancel()
|
dialog.cancel()
|
||||||
aorPasswords.put(aor, "")
|
aorPasswords.put(aor, "")
|
||||||
askPasswords(accounts)
|
askPasswords(accounts)
|
||||||
}
|
}
|
||||||
show()
|
val dialog = builder.create()
|
||||||
|
dialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||||
|
dialog.show()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
askPasswords(accounts)
|
askPasswords(accounts)
|
||||||
|
|||||||
Reference in New Issue
Block a user