Fixed that for non optical TAN procedures entering TAN options haven't been set

This commit is contained in:
dankito 2020-09-10 16:10:24 +02:00
parent bb0a2f9713
commit 2b0a1e9e14
1 changed files with 17 additions and 18 deletions

View File

@ -86,11 +86,9 @@ open class EnterTanDialog : DialogFragment() {
setupTanView(rootView) setupTanView(rootView)
rootView.txtvwCollapsibleText.text = tanChallenge.messageToShowToUser.getSpannedFromHtml() setupEnteringTan(rootView)
if (tanChallenge.tanProcedure.allowedTanFormat == AllowedTanFormat.Numeric) { rootView.txtvwCollapsibleText.text = tanChallenge.messageToShowToUser.getSpannedFromHtml()
rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER
}
rootView.btnCancel.setOnClickListener { enteringTanDone(null) } rootView.btnCancel.setOnClickListener { enteringTanDone(null) }
@ -156,23 +154,24 @@ open class EnterTanDialog : DialogFragment() {
else if (tanChallenge is ImageTanChallenge) { else if (tanChallenge is ImageTanChallenge) {
setupImageTanView(rootView) setupImageTanView(rootView)
} }
}
}
protected open fun setupEnteringTan(rootView: View) {
if (tanChallenge.tanProcedure.isNumericTan) {
rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER
}
if (tanChallenge.tanProcedure.isNumericTan) { tanChallenge.tanProcedure.maxTanInputLength?.let { maxInputLength ->
rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER rootView.edtxtEnteredTan.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(maxInputLength))
} }
tanChallenge.tanProcedure.maxTanInputLength?.let { maxInputLength -> rootView.edtxtEnteredTan.setOnKeyListener { _, keyCode, _ ->
rootView.edtxtEnteredTan.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(maxInputLength)) if (keyCode == KeyEvent.KEYCODE_ENTER) {
} enteringTanDone(rootView.edtxtEnteredTan.text.toString())
return@setOnKeyListener true
rootView.edtxtEnteredTan.setOnKeyListener { _, keyCode, _ ->
if (keyCode == KeyEvent.KEYCODE_ENTER) {
enteringTanDone(rootView.edtxtEnteredTan.text.toString())
return@setOnKeyListener true
}
false
} }
false
} }
} }