diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/CheckableValueAdapterItem.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/CheckableValueAdapterItem.kt new file mode 100644 index 00000000..0d18d1d0 --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/CheckableValueAdapterItem.kt @@ -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() { + + 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) + } + +} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/FastAdapterRecyclerView.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/FastAdapterRecyclerView.kt index 1ce5fa60..5351e464 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/FastAdapterRecyclerView.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/FastAdapterRecyclerView.kt @@ -78,4 +78,9 @@ open class FastAdapterRecyclerView( itemDropped?.invoke(oldPosition, itemAdapter.getAdapterItem(oldPosition), newPosition, itemAdapter.getAdapterItem(newPosition)) } + + open fun setItems(items: List) { + itemAdapter.set(items) + } + } \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanMethodAdapterItem.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanMethodAdapterItem.kt new file mode 100644 index 00000000..49798d3a --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanMethodAdapterItem.kt @@ -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) \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/CheckableValueViewHolder.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/CheckableValueViewHolder.kt new file mode 100644 index 00000000..153950e2 --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/CheckableValueViewHolder.kt @@ -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(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) { + 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 + } + +} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt index e1a97d33..72ebd6a0 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt @@ -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.adapter.DraggableBankAccountAdapterItem 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.model.TypedBankAccount import net.dankito.banking.ui.model.TypedBankData +import net.dankito.banking.ui.model.tan.TanMethod open class BankSettingsDialog : SettingsDialogBase() { @@ -25,6 +27,8 @@ open class BankSettingsDialog : SettingsDialogBase() { protected lateinit var bank: TypedBankData + protected var selectedTanMethod: TanMethod? = null + protected lateinit var bankAccountsAdapter: FastAdapterRecyclerView protected var banksChangedListener = { _: List -> @@ -35,6 +39,7 @@ open class BankSettingsDialog : SettingsDialogBase() { fun show(bank: TypedBankData, activity: AppCompatActivity) { this.bank = bank + this.selectedTanMethod = bank.selectedTanMethod show(activity, DialogTag) } @@ -60,16 +65,23 @@ open class BankSettingsDialog : SettingsDialogBase() { edtxtUserName.text = bank.userName edtxtPassword.text = bank.password - 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) } + val tanMethodItems = createTanMethodItems() + val tanMethodsAdapter = FastAdapterRecyclerView(rootView.rcyTanMethods, tanMethodItems) + tanMethodsAdapter.onClickListener = { + selectedTanMethod = it.tanMethod + tanMethodsAdapter.setItems(createTanMethodItems()) + } lvlBankCode.value = bank.bankCode lvlBic.value = bank.bic lvlCustomerName.value = bank.customerName 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() } } } @@ -82,6 +94,11 @@ open class BankSettingsDialog : SettingsDialogBase() { } + protected open fun createTanMethodItems(): List { + return bank.supportedTanMethods.map { TanMethodAdapterItem(it, it == selectedTanMethod) } + } + + protected open fun createBankAccountsAdapterItems(): List { return bank.accountsSorted.map { DraggableBankAccountAdapterItem(it) } } @@ -108,12 +125,15 @@ open class BankSettingsDialog : SettingsDialogBase() { get() = didChange(edtxtBankName, bank.displayName) || didChange(edtxtUserName, bank.userName) || didChange(edtxtPassword, bank.password) + || bank.selectedTanMethod != selectedTanMethod override fun saveChanges() { bank.userSetDisplayName = edtxtBankName.text bank.userName = edtxtUserName.text bank.password = edtxtPassword.text + bank.selectedTanMethod = selectedTanMethod + presenter.bankUpdated(bank) } diff --git a/ui/BankingAndroidApp/src/main/res/drawable/ic_baseline_check_24.xml b/ui/BankingAndroidApp/src/main/res/drawable/ic_baseline_check_24.xml new file mode 100644 index 00000000..0432fa69 --- /dev/null +++ b/ui/BankingAndroidApp/src/main/res/drawable/ic_baseline_check_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml index 1fbdcd0d..7bfeefa5 100644 --- a/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml +++ b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml @@ -93,6 +93,29 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="@dimen/form_section_extra_margin_top" + > + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml index 29fa05af..c55eefb8 100644 --- a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml +++ b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml @@ -110,6 +110,7 @@ Name + TAN Verfahren Bankdaten Konto löschen diff --git a/ui/BankingAndroidApp/src/main/res/values/dimens.xml b/ui/BankingAndroidApp/src/main/res/values/dimens.xml index d6793aa5..5d15501d 100644 --- a/ui/BankingAndroidApp/src/main/res/values/dimens.xml +++ b/ui/BankingAndroidApp/src/main/res/values/dimens.xml @@ -166,6 +166,16 @@ 2dp 16sp + + 120dp + + + 30dp + 2dp + 24dp + 8dp + 16sp + 4dp 8dp 120dp diff --git a/ui/BankingAndroidApp/src/main/res/values/ids.xml b/ui/BankingAndroidApp/src/main/res/values/ids.xml index 50943bac..0f48dd79 100644 --- a/ui/BankingAndroidApp/src/main/res/values/ids.xml +++ b/ui/BankingAndroidApp/src/main/res/values/ids.xml @@ -8,4 +8,6 @@ + + \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/res/values/strings.xml b/ui/BankingAndroidApp/src/main/res/values/strings.xml index 6664100a..5f4e8bf7 100644 --- a/ui/BankingAndroidApp/src/main/res/values/strings.xml +++ b/ui/BankingAndroidApp/src/main/res/values/strings.xml @@ -84,7 +84,7 @@ Frequency: - TAN procedure + TAN method TAN medium Hint from your bank: Enter TAN: @@ -110,6 +110,7 @@ Name + TAN method Bank data Delete account diff --git a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings index 31f5b823..c2c54441 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings @@ -185,7 +185,7 @@ Unfortunately, Bankmeister cannot know whether a bank charges for real-time tran "Supports" = "Supports"; "Supports Retrieving Balance" = "Retrieve balance"; "Supports Retrieving Account Transactions" = "Retrieve transactions"; -"Supports Transferring Money" = "Transfer money"; +"Supports Transferring Money" = "Money transfer"; "Supports Real-time transfer" = "Real-time transfer";