Implemented selecting TAN method
This commit is contained in:
parent
1e812e4b8d
commit
b3d92d4e64
|
@ -0,0 +1,27 @@
|
||||||
|
package net.dankito.banking.ui.android.adapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.View
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import com.mikepenz.fastadapter.items.AbstractItem
|
||||||
|
import net.dankito.banking.ui.android.R
|
||||||
|
import net.dankito.banking.ui.android.adapter.viewholder.CheckableValueViewHolder
|
||||||
|
|
||||||
|
|
||||||
|
open class CheckableValueAdapterItem(open val isChecked: Boolean, open val text: String) : AbstractItem<CheckableValueViewHolder>() {
|
||||||
|
|
||||||
|
constructor(isChecked: Boolean, context: Context, @StringRes textStringResourceId: Int) : this(isChecked, context.getString(textStringResourceId))
|
||||||
|
|
||||||
|
|
||||||
|
override val type: Int
|
||||||
|
get() = R.id.checkable_value_item_id
|
||||||
|
|
||||||
|
override val layoutRes: Int
|
||||||
|
get() = R.layout.list_item_checkable_value
|
||||||
|
|
||||||
|
|
||||||
|
override fun getViewHolder(v: View): CheckableValueViewHolder {
|
||||||
|
return CheckableValueViewHolder(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -78,4 +78,9 @@ open class FastAdapterRecyclerView<Item : GenericItem>(
|
||||||
itemDropped?.invoke(oldPosition, itemAdapter.getAdapterItem(oldPosition), newPosition, itemAdapter.getAdapterItem(newPosition))
|
itemDropped?.invoke(oldPosition, itemAdapter.getAdapterItem(oldPosition), newPosition, itemAdapter.getAdapterItem(newPosition))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
open fun setItems(items: List<Item>) {
|
||||||
|
itemAdapter.set(items)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package net.dankito.banking.ui.android.adapter
|
||||||
|
|
||||||
|
import net.dankito.banking.ui.model.tan.TanMethod
|
||||||
|
|
||||||
|
|
||||||
|
open class TanMethodAdapterItem(open val tanMethod: TanMethod, isSelectedTanMethod: Boolean)
|
||||||
|
: CheckableValueAdapterItem(isSelectedTanMethod, tanMethod.displayName)
|
|
@ -0,0 +1,30 @@
|
||||||
|
package net.dankito.banking.ui.android.adapter.viewholder
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.mikepenz.fastadapter.FastAdapter
|
||||||
|
import net.dankito.banking.ui.android.R
|
||||||
|
import net.dankito.banking.ui.android.adapter.CheckableValueAdapterItem
|
||||||
|
|
||||||
|
|
||||||
|
open class CheckableValueViewHolder(view: View) : FastAdapter.ViewHolder<CheckableValueAdapterItem>(view) {
|
||||||
|
|
||||||
|
protected var imgCheckmark: ImageView = view.findViewById(R.id.imgCheckmark)
|
||||||
|
|
||||||
|
protected var txtValue: TextView = view.findViewById(R.id.txtValue)
|
||||||
|
|
||||||
|
|
||||||
|
override fun bindView(item: CheckableValueAdapterItem, payloads: List<Any>) {
|
||||||
|
imgCheckmark.visibility = if (item.isChecked) View.VISIBLE else View.INVISIBLE
|
||||||
|
|
||||||
|
txtValue.text = item.text
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun unbindView(item: CheckableValueAdapterItem) {
|
||||||
|
imgCheckmark.setImageURI(null)
|
||||||
|
|
||||||
|
txtValue.text = null
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -11,9 +11,11 @@ import kotlinx.android.synthetic.main.dialog_bank_settings.view.toolbar
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.android.adapter.DraggableBankAccountAdapterItem
|
import net.dankito.banking.ui.android.adapter.DraggableBankAccountAdapterItem
|
||||||
import net.dankito.banking.ui.android.adapter.FastAdapterRecyclerView
|
import net.dankito.banking.ui.android.adapter.FastAdapterRecyclerView
|
||||||
|
import net.dankito.banking.ui.android.adapter.TanMethodAdapterItem
|
||||||
import net.dankito.banking.ui.android.alerts.AskDeleteAccountAlert
|
import net.dankito.banking.ui.android.alerts.AskDeleteAccountAlert
|
||||||
import net.dankito.banking.ui.model.TypedBankAccount
|
import net.dankito.banking.ui.model.TypedBankAccount
|
||||||
import net.dankito.banking.ui.model.TypedBankData
|
import net.dankito.banking.ui.model.TypedBankData
|
||||||
|
import net.dankito.banking.ui.model.tan.TanMethod
|
||||||
|
|
||||||
|
|
||||||
open class BankSettingsDialog : SettingsDialogBase() {
|
open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
|
@ -25,6 +27,8 @@ open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
|
|
||||||
protected lateinit var bank: TypedBankData
|
protected lateinit var bank: TypedBankData
|
||||||
|
|
||||||
|
protected var selectedTanMethod: TanMethod? = null
|
||||||
|
|
||||||
protected lateinit var bankAccountsAdapter: FastAdapterRecyclerView<DraggableBankAccountAdapterItem>
|
protected lateinit var bankAccountsAdapter: FastAdapterRecyclerView<DraggableBankAccountAdapterItem>
|
||||||
|
|
||||||
protected var banksChangedListener = { _: List<TypedBankData> ->
|
protected var banksChangedListener = { _: List<TypedBankData> ->
|
||||||
|
@ -35,6 +39,7 @@ open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
|
|
||||||
fun show(bank: TypedBankData, activity: AppCompatActivity) {
|
fun show(bank: TypedBankData, activity: AppCompatActivity) {
|
||||||
this.bank = bank
|
this.bank = bank
|
||||||
|
this.selectedTanMethod = bank.selectedTanMethod
|
||||||
|
|
||||||
show(activity, DialogTag)
|
show(activity, DialogTag)
|
||||||
}
|
}
|
||||||
|
@ -60,16 +65,23 @@ open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
edtxtUserName.text = bank.userName
|
edtxtUserName.text = bank.userName
|
||||||
edtxtPassword.text = bank.password
|
edtxtPassword.text = bank.password
|
||||||
|
|
||||||
val items = createBankAccountsAdapterItems()
|
val tanMethodItems = createTanMethodItems()
|
||||||
bankAccountsAdapter = FastAdapterRecyclerView(rootView.rcyBankAccounts, items, true)
|
val tanMethodsAdapter = FastAdapterRecyclerView(rootView.rcyTanMethods, tanMethodItems)
|
||||||
bankAccountsAdapter.onClickListener = { navigationToBankAccountSettingsDialog(it.account) }
|
tanMethodsAdapter.onClickListener = {
|
||||||
bankAccountsAdapter.itemDropped = { oldPosition, oldItem, newPosition, newItem -> reorderedBankAccounts(oldPosition, oldItem.account, newPosition, newItem.account) }
|
selectedTanMethod = it.tanMethod
|
||||||
|
tanMethodsAdapter.setItems(createTanMethodItems())
|
||||||
|
}
|
||||||
|
|
||||||
lvlBankCode.value = bank.bankCode
|
lvlBankCode.value = bank.bankCode
|
||||||
lvlBic.value = bank.bic
|
lvlBic.value = bank.bic
|
||||||
lvlCustomerName.value = bank.customerName
|
lvlCustomerName.value = bank.customerName
|
||||||
lvlFinTsServerAddress.value = bank.finTsServerAddress
|
lvlFinTsServerAddress.value = bank.finTsServerAddress
|
||||||
|
|
||||||
|
val items = createBankAccountsAdapterItems()
|
||||||
|
bankAccountsAdapter = FastAdapterRecyclerView(rootView.rcyBankAccounts, items, true)
|
||||||
|
bankAccountsAdapter.onClickListener = { navigationToBankAccountSettingsDialog(it.account) }
|
||||||
|
bankAccountsAdapter.itemDropped = { oldPosition, oldItem, newPosition, newItem -> reorderedBankAccounts(oldPosition, oldItem.account, newPosition, newItem.account) }
|
||||||
|
|
||||||
btnDeleteAccount.setOnClickListener { askUserToDeleteAccount() }
|
btnDeleteAccount.setOnClickListener { askUserToDeleteAccount() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +94,11 @@ open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected open fun createTanMethodItems(): List<TanMethodAdapterItem> {
|
||||||
|
return bank.supportedTanMethods.map { TanMethodAdapterItem(it, it == selectedTanMethod) }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected open fun createBankAccountsAdapterItems(): List<DraggableBankAccountAdapterItem> {
|
protected open fun createBankAccountsAdapterItems(): List<DraggableBankAccountAdapterItem> {
|
||||||
return bank.accountsSorted.map { DraggableBankAccountAdapterItem(it) }
|
return bank.accountsSorted.map { DraggableBankAccountAdapterItem(it) }
|
||||||
}
|
}
|
||||||
|
@ -108,12 +125,15 @@ open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
get() = didChange(edtxtBankName, bank.displayName)
|
get() = didChange(edtxtBankName, bank.displayName)
|
||||||
|| didChange(edtxtUserName, bank.userName)
|
|| didChange(edtxtUserName, bank.userName)
|
||||||
|| didChange(edtxtPassword, bank.password)
|
|| didChange(edtxtPassword, bank.password)
|
||||||
|
|| bank.selectedTanMethod != selectedTanMethod
|
||||||
|
|
||||||
override fun saveChanges() {
|
override fun saveChanges() {
|
||||||
bank.userSetDisplayName = edtxtBankName.text
|
bank.userSetDisplayName = edtxtBankName.text
|
||||||
bank.userName = edtxtUserName.text
|
bank.userName = edtxtUserName.text
|
||||||
bank.password = edtxtPassword.text
|
bank.password = edtxtPassword.text
|
||||||
|
|
||||||
|
bank.selectedTanMethod = selectedTanMethod
|
||||||
|
|
||||||
presenter.bankUpdated(bank)
|
presenter.bankUpdated(bank)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
|
||||||
|
</vector>
|
|
@ -93,6 +93,29 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/form_section_extra_margin_top"
|
||||||
|
>
|
||||||
|
|
||||||
|
<net.dankito.banking.ui.android.views.FormSectionTitle
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/dialog_bank_settings_tan_method_section_title"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rcyTanMethods"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/form_section_extra_margin_top"
|
||||||
>
|
>
|
||||||
|
|
||||||
<net.dankito.banking.ui.android.views.FormSectionTitle
|
<net.dankito.banking.ui.android.views.FormSectionTitle
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/list_item_checkable_value_height"
|
||||||
|
android:padding="@dimen/list_item_checkable_value_padding"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgCheckmark"
|
||||||
|
android:layout_width="@dimen/list_item_checkable_value_icon_size"
|
||||||
|
android:layout_height="@dimen/list_item_checkable_value_icon_size"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginRight="@dimen/list_item_checkable_value_icon_margin_right"
|
||||||
|
android:layout_marginEnd="@dimen/list_item_checkable_value_icon_margin_right"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
app:srcCompat="@drawable/ic_baseline_check_24"
|
||||||
|
android:visibility="invisible"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_toRightOf="@+id/imgCheckmark"
|
||||||
|
android:layout_toEndOf="@+id/imgCheckmark"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textAlignment="gravity"
|
||||||
|
style="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
android:textSize="@dimen/list_item_checkable_value_text_size"
|
||||||
|
android:textColor="@color/formLabelledValueValueTextColor"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="end"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -110,6 +110,7 @@
|
||||||
|
|
||||||
|
|
||||||
<string name="dialog_bank_settings_bank_name">Name</string>
|
<string name="dialog_bank_settings_bank_name">Name</string>
|
||||||
|
<string name="dialog_bank_settings_tan_method_section_title">TAN Verfahren</string>
|
||||||
<string name="dialog_bank_settings_bank_data_section_title">Bankdaten</string>
|
<string name="dialog_bank_settings_bank_data_section_title">Bankdaten</string>
|
||||||
<string name="dialog_bank_settings_delete_account">Konto löschen</string>
|
<string name="dialog_bank_settings_delete_account">Konto löschen</string>
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,16 @@
|
||||||
<dimen name="list_item_draggable_bank_account_padding">2dp</dimen>
|
<dimen name="list_item_draggable_bank_account_padding">2dp</dimen>
|
||||||
<dimen name="list_item_draggable_bank_account_account_name_text_size">16sp</dimen>
|
<dimen name="list_item_draggable_bank_account_account_name_text_size">16sp</dimen>
|
||||||
|
|
||||||
|
<!-- = 4 x list_item_checkable_value_height -->
|
||||||
|
<dimen name="dialog_bank_accounts_settings_list_account_features_height">120dp</dimen>
|
||||||
|
|
||||||
|
<!-- when changing list_item_checkable_value_height, also change dialog_bank_accounts_settings_list_account_features_height -->
|
||||||
|
<dimen name="list_item_checkable_value_height">30dp</dimen>
|
||||||
|
<dimen name="list_item_checkable_value_padding">2dp</dimen>
|
||||||
|
<dimen name="list_item_checkable_value_icon_size">24dp</dimen>
|
||||||
|
<dimen name="list_item_checkable_value_icon_margin_right">8dp</dimen>
|
||||||
|
<dimen name="list_item_checkable_value_text_size">16sp</dimen>
|
||||||
|
|
||||||
<dimen name="dialog_send_message_log_padding">4dp</dimen>
|
<dimen name="dialog_send_message_log_padding">4dp</dimen>
|
||||||
<dimen name="dialog_send_message_log_message_log_label_bottom_margin">8dp</dimen>
|
<dimen name="dialog_send_message_log_message_log_label_bottom_margin">8dp</dimen>
|
||||||
<dimen name="dialog_send_message_log_buttons_width">120dp</dimen>
|
<dimen name="dialog_send_message_log_buttons_width">120dp</dimen>
|
||||||
|
|
|
@ -8,4 +8,6 @@
|
||||||
|
|
||||||
<item name="draggable_bank_account_item_id" type="id" />
|
<item name="draggable_bank_account_item_id" type="id" />
|
||||||
|
|
||||||
|
<item name="checkable_value_item_id" type="id" />
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
<string name="view_flicker_code_frequency">Frequency:</string>
|
<string name="view_flicker_code_frequency">Frequency:</string>
|
||||||
|
|
||||||
<string name="dialog_enter_tan_select_tan_method">TAN procedure</string>
|
<string name="dialog_enter_tan_select_tan_method">TAN method</string>
|
||||||
<string name="dialog_enter_tan_select_tan_medium">TAN medium</string>
|
<string name="dialog_enter_tan_select_tan_medium">TAN medium</string>
|
||||||
<string name="dialog_enter_tan_tan_description_label">Hint from your bank:</string>
|
<string name="dialog_enter_tan_tan_description_label">Hint from your bank:</string>
|
||||||
<string name="dialog_enter_tan_enter_tan">Enter TAN:</string>
|
<string name="dialog_enter_tan_enter_tan">Enter TAN:</string>
|
||||||
|
@ -110,6 +110,7 @@
|
||||||
|
|
||||||
|
|
||||||
<string name="dialog_bank_settings_bank_name">Name</string>
|
<string name="dialog_bank_settings_bank_name">Name</string>
|
||||||
|
<string name="dialog_bank_settings_tan_method_section_title">TAN method</string>
|
||||||
<string name="dialog_bank_settings_bank_data_section_title">Bank data</string>
|
<string name="dialog_bank_settings_bank_data_section_title">Bank data</string>
|
||||||
<string name="dialog_bank_settings_delete_account">Delete account</string>
|
<string name="dialog_bank_settings_delete_account">Delete account</string>
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ Unfortunately, Bankmeister cannot know whether a bank charges for real-time tran
|
||||||
"Supports" = "Supports";
|
"Supports" = "Supports";
|
||||||
"Supports Retrieving Balance" = "Retrieve balance";
|
"Supports Retrieving Balance" = "Retrieve balance";
|
||||||
"Supports Retrieving Account Transactions" = "Retrieve transactions";
|
"Supports Retrieving Account Transactions" = "Retrieve transactions";
|
||||||
"Supports Transferring Money" = "Transfer money";
|
"Supports Transferring Money" = "Money transfer";
|
||||||
"Supports Real-time transfer" = "Real-time transfer";
|
"Supports Real-time transfer" = "Real-time transfer";
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue