From 2b0a1e9e14e2c44abc076de1f7c1acc36925cb33 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 10 Sep 2020 16:10:24 +0200 Subject: [PATCH] Fixed that for non optical TAN procedures entering TAN options haven't been set --- .../ui/android/dialogs/EnterTanDialog.kt | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt index 2e5038d8..db3ec877 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt @@ -86,11 +86,9 @@ open class EnterTanDialog : DialogFragment() { setupTanView(rootView) - rootView.txtvwCollapsibleText.text = tanChallenge.messageToShowToUser.getSpannedFromHtml() + setupEnteringTan(rootView) - if (tanChallenge.tanProcedure.allowedTanFormat == AllowedTanFormat.Numeric) { - rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER - } + rootView.txtvwCollapsibleText.text = tanChallenge.messageToShowToUser.getSpannedFromHtml() rootView.btnCancel.setOnClickListener { enteringTanDone(null) } @@ -156,23 +154,24 @@ open class EnterTanDialog : DialogFragment() { else if (tanChallenge is ImageTanChallenge) { setupImageTanView(rootView) } + } + } + protected open fun setupEnteringTan(rootView: View) { + if (tanChallenge.tanProcedure.isNumericTan) { + rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER + } - if (tanChallenge.tanProcedure.isNumericTan) { - rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER - } - - tanChallenge.tanProcedure.maxTanInputLength?.let { maxInputLength -> - rootView.edtxtEnteredTan.filters = arrayOf(InputFilter.LengthFilter(maxInputLength)) - } - - rootView.edtxtEnteredTan.setOnKeyListener { _, keyCode, _ -> - if (keyCode == KeyEvent.KEYCODE_ENTER) { - enteringTanDone(rootView.edtxtEnteredTan.text.toString()) - return@setOnKeyListener true - } - false + tanChallenge.tanProcedure.maxTanInputLength?.let { maxInputLength -> + rootView.edtxtEnteredTan.filters = arrayOf(InputFilter.LengthFilter(maxInputLength)) + } + + rootView.edtxtEnteredTan.setOnKeyListener { _, keyCode, _ -> + if (keyCode == KeyEvent.KEYCODE_ENTER) { + enteringTanDone(rootView.edtxtEnteredTan.text.toString()) + return@setOnKeyListener true } + false } }