Fixed that after changing or even deleting a selected bank's name 'Add account' button still has been activated
This commit is contained in:
parent
45f926055f
commit
cccede436d
|
@ -24,6 +24,7 @@ import net.dankito.banking.ui.android.util.StandardAutocompleteCallback
|
|||
import net.dankito.banking.ui.model.responses.AddAccountResponse
|
||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||
import net.dankito.banking.bankfinder.BankInfo
|
||||
import net.dankito.banking.ui.android.util.StandardTextWatcher
|
||||
import net.dankito.utils.android.extensions.asActivity
|
||||
import net.dankito.utils.android.extensions.hide
|
||||
import net.dankito.utils.android.extensions.show
|
||||
|
@ -40,6 +41,8 @@ open class AddAccountDialog : DialogFragment() {
|
|||
|
||||
protected var selectedBank: BankInfo? = null
|
||||
|
||||
protected var justDidSelectBank: Boolean = false
|
||||
|
||||
|
||||
@Inject
|
||||
protected lateinit var presenter: BankingPresenter
|
||||
|
@ -87,6 +90,10 @@ open class AddAccountDialog : DialogFragment() {
|
|||
}
|
||||
|
||||
private fun initBankListAutocompletion(edtxtBank: EditText) {
|
||||
edtxtBank.addTextChangedListener(StandardTextWatcher {
|
||||
mayClearSelectedBank()
|
||||
})
|
||||
|
||||
val autocompleteCallback = StandardAutocompleteCallback<BankInfo> { _, item ->
|
||||
bankSelected(item)
|
||||
true
|
||||
|
@ -163,8 +170,12 @@ open class AddAccountDialog : DialogFragment() {
|
|||
protected open fun bankSelected(bank: BankInfo) {
|
||||
selectedBank = bank
|
||||
|
||||
justDidSelectBank = true
|
||||
|
||||
edtxtBank.text = bank.name
|
||||
|
||||
justDidSelectBank = false
|
||||
|
||||
edtxtUserName.requestFocus()
|
||||
|
||||
checkIfRequiredDataEnteredOnUiThread()
|
||||
|
@ -174,6 +185,14 @@ open class AddAccountDialog : DialogFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
protected open fun mayClearSelectedBank() {
|
||||
if (justDidSelectBank == false) {
|
||||
selectedBank = null
|
||||
}
|
||||
|
||||
checkIfRequiredDataEnteredOnUiThread()
|
||||
}
|
||||
|
||||
private fun showBankDoesNotSupportFinTs30ErrorMessage(bank: BankInfo) {
|
||||
activity?.let { context ->
|
||||
val errorMessage = context.getString(R.string.dialog_add_account_bank_does_not_support_fints_3_error_message, bank.name)
|
||||
|
|
Loading…
Reference in New Issue