From 11adc132aa455232a9e218236103dd1d7cdbc585 Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 24 May 2020 22:52:01 +0200 Subject: [PATCH] Implemented displaying formatted TAN challenges (that is challenges contains html tags) --- .../net/dankito/banking/ui/android/dialogs/EnterAtcDialog.kt | 3 ++- .../net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt | 3 ++- .../dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterAtcDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterAtcDialog.kt index 7967e365..92b069f1 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterAtcDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterAtcDialog.kt @@ -12,6 +12,7 @@ import kotlinx.android.synthetic.main.dialog_enter_atc.view.* import net.dankito.banking.ui.android.R import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult import net.dankito.banking.ui.model.tan.TanMedium +import net.dankito.utils.android.extensions.getSpannedFromHtml open class EnterAtcDialog : DialogFragment() { @@ -49,7 +50,7 @@ open class EnterAtcDialog : DialogFragment() { protected open fun setupUI(rootView: View) { val explanationHtml = rootView.context.getString(R.string.dialog_enter_atc_explanation, tanMedium.displayName) - rootView.txtAtcExplanationToShowToUser.text = Html.fromHtml(explanationHtml, Html.FROM_HTML_MODE_LEGACY) + rootView.txtAtcExplanationToShowToUser.text = explanationHtml.getSpannedFromHtml() rootView.btnCancel.setOnClickListener { enteringAtcDone(null, null) } 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 760577e9..aee68b00 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 @@ -24,6 +24,7 @@ import net.dankito.banking.ui.model.Account import net.dankito.banking.ui.model.responses.BankingClientResponse import net.dankito.banking.ui.model.tan.* import net.dankito.banking.ui.presenter.BankingPresenter +import net.dankito.utils.android.extensions.getSpannedFromHtml import javax.inject.Inject @@ -84,7 +85,7 @@ open class EnterTanDialog : DialogFragment() { setupTanView(rootView) - rootView.txtTanDescriptionToShowToUser.text = getString(R.string.dialog_enter_tan_hint_from_bank, tanChallenge.messageToShowToUser) + rootView.txtTanDescriptionToShowToUser.text = getString(R.string.dialog_enter_tan_hint_from_bank, tanChallenge.messageToShowToUser.getSpannedFromHtml()) rootView.btnCancel.setOnClickListener { enteringTanDone(null) } diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt index a0bc7d95..c2792351 100644 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt @@ -130,7 +130,8 @@ open class EnterTanDialog( hbox { maxWidth = 400.0 - label(String.format(messages["enter.tan.dialog.hint.from.bank"], challenge.messageToShowToUser)) { + // TODO: also display rich text like , not only new lines + label(String.format(messages["enter.tan.dialog.hint.from.bank"], challenge.messageToShowToUser.htmlToPlainText())) { isWrapText = true }