From 921447bda83fdd495c090a741ff349999d5ccac3 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 10 Sep 2020 02:44:55 +0200 Subject: [PATCH] Implemented displaying an info label to explain what instant payment is about --- .../ui/android/dialogs/TransferMoneyDialog.kt | 26 ++++- .../main/res/drawable/ic_baseline_info_24.xml | 10 ++ .../main/res/layout/dialog_transfer_money.xml | 95 +++++++++++++++++-- .../res/layout/view_instant_payment_info.xml | 45 +++++++++ .../src/main/res/values-de/strings.xml | 7 +- .../src/main/res/values/colors.xml | 2 + .../src/main/res/values/dimens.xml | 9 ++ .../src/main/res/values/strings.xml | 7 +- 8 files changed, 190 insertions(+), 11 deletions(-) create mode 100644 ui/BankingAndroidApp/src/main/res/drawable/ic_baseline_info_24.xml create mode 100644 ui/BankingAndroidApp/src/main/res/layout/view_instant_payment_info.xml diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt index ec6df293..bc99e0ce 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt @@ -5,10 +5,11 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.text.TextWatcher import android.text.method.DigitsKeyListener +import android.view.Gravity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.EditText +import android.widget.* import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.DialogFragment @@ -153,6 +154,10 @@ open class TransferMoneyDialog : DialogFragment() { val decimalSeparator = DecimalFormatSymbols.getInstance().getDecimalSeparator() rootView.edtxtAmount.keyListener = DigitsKeyListener.getInstance("0123456789$decimalSeparator") + rootView.txtvwInstantPaymentLabel.setOnClickListener { rootView.swtchInstantPayment.toggle() } + rootView.txtvwInstantPaymentMayWithConstsLabel.setOnClickListener { rootView.swtchInstantPayment.toggle() } + rootView.btnShowInstantPaymentInfo.setOnClickListener { showInstantPaymentInfo(rootView.btnShowInstantPaymentInfo, rootView) } + setInstantPaymentControlsVisibility(rootView) rootView.btnCancel.setOnClickListener { dismiss() } @@ -161,7 +166,7 @@ open class TransferMoneyDialog : DialogFragment() { } private fun setInstantPaymentControlsVisibility(rootView: View) { - rootView.chkbxInstantPayment.visibility = + rootView.lytInstantPayment.visibility = if (bankAccount.supportsInstantPaymentMoneyTransfer) { View.VISIBLE } @@ -170,6 +175,21 @@ open class TransferMoneyDialog : DialogFragment() { } } + protected open fun showInstantPaymentInfo(btnShowInstantPaymentInfo: ImageButton, rootView: View) { + context?.asActivity()?.layoutInflater?.inflate(R.layout.view_instant_payment_info, null)?.let { contentView -> + val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) + + popupWindow.isFocusable = true + popupWindow.isOutsideTouchable = true + + contentView.findViewById