From 69c30c2ebcb3875f1360bda58a38cbed157bc925 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 9 Sep 2020 16:40:36 +0200 Subject: [PATCH] Little refactoring --- .../ui/android/dialogs/AddAccountDialog.kt | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt index 3786f087..b160319c 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt @@ -69,30 +69,32 @@ open class AddAccountDialog : DialogFragment() { } protected open fun setupUI(rootView: View) { - initBankListAutocompletion(rootView) + rootView.apply { + initBankListAutocompletion(edtxtBank) - rootView.edtxtCustomerId.addTextChangedListener(otherEditTextChangedWatcher) - rootView.edtxtPin.addTextChangedListener(otherEditTextChangedWatcher) + edtxtCustomerId.addTextChangedListener(otherEditTextChangedWatcher) + edtxtPin.addTextChangedListener(otherEditTextChangedWatcher) - addAccountIfEnterPressed(rootView.edtxtBank) - addAccountIfEnterPressed(rootView.edtxtCustomerId) - addAccountIfEnterPressed(rootView.edtxtPin) + addAccountIfEnterPressed(edtxtBank) + addAccountIfEnterPressed(edtxtCustomerId) + addAccountIfEnterPressed(edtxtPin) - rootView.btnAddAccount.setOnClickListener { addAccount() } - rootView.btnCancel.setOnClickListener { dismiss() } + btnAddAccount.setOnClickListener { addAccount() } + btnCancel.setOnClickListener { dismiss() } + } } - private fun initBankListAutocompletion(rootView: View) { + private fun initBankListAutocompletion(edtxtBank: EditText) { val autocompleteCallback = StandardAutocompleteCallback { _, item -> bankSelected(item) true } - Autocomplete.on(rootView.edtxtBank) + Autocomplete.on(edtxtBank) .with(6f) .with(ColorDrawable(Color.WHITE)) .with(autocompleteCallback) - .with(BankInfoPresenter(presenter, rootView.context)) + .with(BankInfoPresenter(presenter, edtxtBank.context)) .build() .closePopupOnBackButtonPress(dialog) }