Implemented displaying an info label to explain what instant payment is about

This commit is contained in:
dankito 2020-09-10 02:44:55 +02:00
parent 92fe48720c
commit 921447bda8
8 changed files with 190 additions and 11 deletions

View File

@ -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<Button>(R.id.btnDismissPopup)?.setOnClickListener { popupWindow.dismiss() }
popupWindow.showAtLocation(btnShowInstantPaymentInfo, Gravity.TOP, 0, 0)
popupWindow.showAsDropDown(btnShowInstantPaymentInfo)
}
}
private fun transferMoneyIfEnterPressed(editText: EditText) {
editText.addEnterPressedListener {
if (isRequiredDataEntered()) {
@ -262,7 +282,7 @@ open class TransferMoneyDialog : DialogFragment() {
remitteeBic?.replace(" ", "") ?: "", // should always be != null at this point
amount.toBigDecimal(),
inputValidator.convertToAllowedSepaCharacters(edtxtUsage.text.toString()),
chkbxInstantPayment.isChecked
swtchInstantPayment.isChecked
)
presenter.transferMoneyAsync(data) {

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>

View File

@ -125,17 +125,100 @@
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id="@+id/chkbxInstantPayment"
<RelativeLayout
android:id="@+id/lytInstantPayment"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="@dimen/dialog_transfer_money_instant_payment_margin_top"
android:layout_marginBottom="@dimen/dialog_transfer_money_instant_payment_margin_bottom"
style="@style/TextAppearance.AppCompat.Medium"
android:textSize="@dimen/dialog_transfer_money_instant_payment_text_size"
android:text="@string/dialog_transfer_money_instant_payment"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:visibility="gone"
/>
>
<RelativeLayout
android:id="@+id/lytInstantPaymentInfo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/swtchInstantPayment"
android:layout_toStartOf="@+id/swtchInstantPayment"
android:layout_alignParentBottom="true"
android:layout_marginRight="@dimen/dialog_transfer_money_instant_payment_show_info_button_margin_end"
android:layout_marginEnd="@dimen/dialog_transfer_money_instant_payment_show_info_button_margin_end"
>
<TextView
android:id="@+id/txtvwInstantPaymentLabel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
style="@style/TextAppearance.AppCompat.Medium"
android:textSize="@dimen/dialog_transfer_money_instant_payment_text_size"
android:lines="1"
android:ellipsize="end"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:textAlignment="gravity"
android:text="@string/dialog_transfer_money_instant_payment"
/>
<TextView
android:id="@+id/txtvwInstantPaymentMayWithConstsLabel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/txtvwInstantPaymentLabel"
android:layout_toEndOf="@+id/txtvwInstantPaymentLabel"
android:layout_toLeftOf="@+id/btnShowInstantPaymentInfo"
android:layout_toStartOf="@+id/btnShowInstantPaymentInfo"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/dialog_transfer_money_instant_payment_may_with_costs_margin_start"
android:layout_marginStart="@dimen/dialog_transfer_money_instant_payment_may_with_costs_margin_start"
style="@style/TextAppearance.AppCompat.Small"
android:lines="1"
android:ellipsize="end"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:textAlignment="gravity"
android:text="@string/dialog_transfer_money_instant_payment_may_with_costs"
/>
<ImageButton
android:id="@+id/btnShowInstantPaymentInfo"
android:layout_width="@dimen/dialog_transfer_money_instant_payment_show_info_button_size"
android:layout_height="@dimen/dialog_transfer_money_instant_payment_show_info_button_size"
android:layout_marginLeft="@dimen/dialog_transfer_money_instant_payment_show_info_button_margin_start"
android:layout_marginStart="@dimen/dialog_transfer_money_instant_payment_show_info_button_margin_start"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:background="@null"
app:srcCompat="@drawable/ic_baseline_info_24"
android:tint="@color/info_icon_color"
/>
</RelativeLayout>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swtchInstantPayment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
<RelativeLayout

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/backgroundColor_Light"
android:padding="8dp"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@+id/lytButtonBar"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AppCompat.Medium"
android:textSize="@dimen/view_instant_payment_info_text_size"
android:text="@string/dialog_transfer_money_instant_payment_info"
/>
</ScrollView>
<LinearLayout
android:id="@+id/lytButtonBar"
android:layout_width="match_parent"
android:layout_height="@dimen/view_instant_payment_info_dismiss_button_height"
android:layout_alignParentBottom="true"
android:gravity="center"
>
<Button
android:id="@+id/btnDismissPopup"
android:layout_width="@dimen/view_instant_payment_info_dismiss_button_width"
android:layout_height="match_parent"
style="?android:attr/buttonBarButtonStyle"
android:text="@android:string/ok"
/>
</LinearLayout>
</RelativeLayout>

View File

@ -57,7 +57,12 @@
<string name="dialog_transfer_money_could_not_determine_bic_from_iban">Keine BIC gefunden für BLZ %1$s</string>
<string name="dialog_transfer_money_amount">Betrag:</string>
<string name="dialog_transfer_money_usage">Verwendungszweck:</string>
<string name="dialog_transfer_money_instant_payment">Echtzeitüberweisung (evtl. kostenpflichtig)</string>
<string name="dialog_transfer_money_instant_payment">Echtzeitüberweisung</string>
<string name="dialog_transfer_money_instant_payment_may_with_costs">(evtl. kostenpflichtig)</string>
<string name="dialog_transfer_money_instant_payment_info">Normale Überweisungen werden in der Regel innerhalb eines Werktages gutgeschrieben. Dies gilt jedoch nur zu Geschäftszeiten der Banken, also schon mal nicht am Wochenende und an Feiertagen. Zudem unterscheiden sich die Geschäftszeiten von Bank zu Bank. Meistens gehen diese von 10 - 18 Uhr, manchmal auch bis 22 Uhr, manchmal (Freitags) aber auch nur bis 14 Uhr.
\n\nEchtzeitüberweisungen werden hingegen innerhalb von maximal 10 Sekunden überwiesen, egal an welchem Tag und zu welcher Uhrzeit.
\n\nHäufig sind Echtzeitüberweisungen jedoch kostenpflichtig.
\n\nOb eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leider nicht wissen. Dies entnehmen Sie bitte dem Preis- / Leistungsverzeichnis Ihrer Bank.</string>
<string name="dialog_transfer_money_transfer">Überweisen</string>
<string name="dialog_transfer_money_message_transfer_successful">%1$s %2$s wurden erfolgreich an %3$s überwiesen.</string>
<string name="dialog_transfer_money_message_transfer_failed">Konnte nicht %1$s %2$s an %3$s überweisen.\n\nFehlermeldung Ihrer Bank:\n\n%4$s</string>

View File

@ -21,6 +21,8 @@
<color name="list_item_bank_info_bank_supported">@color/colorAccent</color>
<color name="list_item_bank_info_bank_not_supported">@color/negativeAmount</color>
<color name="info_icon_color">#007aff</color>
<color name="fabTextColor">#FFFFFF</color>
<!-- <color name="fabLabelBackgroundColor">@color/black_semi_transparent</color>-->

View File

@ -63,8 +63,12 @@
<dimen name="dialog_transfer_money_input_fields_height">40dp</dimen>
<dimen name="dialog_transfer_money_input_fields_bottom_margin_when_displaying_validation_label">8dp</dimen>
<dimen name="dialog_transfer_money_instant_payment_text_size">14sp</dimen>
<dimen name="dialog_transfer_money_instant_payment_may_with_costs_margin_start">4dp</dimen>
<dimen name="dialog_transfer_money_instant_payment_margin_top">6dp</dimen>
<dimen name="dialog_transfer_money_instant_payment_margin_bottom">6dp</dimen>
<dimen name="dialog_transfer_money_instant_payment_show_info_button_size">20dp</dimen>
<dimen name="dialog_transfer_money_instant_payment_show_info_button_margin_start">6dp</dimen>
<dimen name="dialog_transfer_money_instant_payment_show_info_button_margin_end">12dp</dimen>
<dimen name="dialog_transfer_money_buttons_width">120dp</dimen>
<dimen name="list_item_bank_account_padding">2dp</dimen>
@ -75,6 +79,11 @@
<dimen name="list_item_remittee_space_between_fields">4dp</dimen>
<dimen name="list_item_remittee_bank_code_margin_bottom">6dp</dimen>
<dimen name="view_instant_payment_info_padding">8dp</dimen>
<dimen name="view_instant_payment_info_text_size">15sp</dimen>
<dimen name="view_instant_payment_info_dismiss_button_width">150dp</dimen>
<dimen name="view_instant_payment_info_dismiss_button_height">40dp</dimen>
<dimen name="view_tan_image_controls_buttons_height">40dp</dimen>
<dimen name="view_tan_image_controls_buttons_width">40dp</dimen>

View File

@ -57,7 +57,12 @@
<string name="dialog_transfer_money_could_not_determine_bic_from_iban">No BIC found for bank code %1$s</string>
<string name="dialog_transfer_money_amount">Amount:</string>
<string name="dialog_transfer_money_usage">Usage:</string>
<string name="dialog_transfer_money_instant_payment">Instant payment (may with costs)</string>
<string name="dialog_transfer_money_instant_payment">Instant payment</string>
<string name="dialog_transfer_money_instant_payment_may_with_costs">(may with costs)</string>
<string name="dialog_transfer_money_instant_payment_info">Bank transfers are usually credited within one business day. However, this only applies during bank business hours, and therefore not at weekends and on public holidays. In addition, business hours vary from bank to bank. Mostly they are from 10 - 18 o\'clock, sometimes also until 22 o\'clock, but sometimes (e. g. Fridays) only until 14 o\'clock.
\n\nInstant payment transfers on the other hand are transferred within a maximum of 10 seconds, regardless of the day and time of day.
\n\nHowever, real-time transfers are often subject to a fee.
\n\nUnfortunately, Bankmeister cannot know whether a bank charges for instant payment transfers. Please refer to the list of prices and services of your bank.</string>
<string name="dialog_transfer_money_transfer">Transfer</string>
<string name="dialog_transfer_money_message_transfer_successful">Successfully transferred %1$s %2$s to %3$s.</string>
<string name="dialog_transfer_money_message_transfer_failed">Could not transfer %1$s %2$s to %3$s.\n\nError message from your bank:\n\n%4$s</string>