From 67b282beb2d16d7398e4711e05971016a373402e Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 16 Sep 2020 03:43:27 +0200 Subject: [PATCH] Added horizontal divider to remittee list items --- .../ui/android/adapter/presenter/RemitteePresenter.kt | 3 +++ .../ui/android/extensions/RecyclerViewExtensions.kt | 9 +++++++++ .../net/dankito/banking/ui/android/home/HomeFragment.kt | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/extensions/RecyclerViewExtensions.kt diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt index cb57ed57..8ce877f7 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/presenter/RemitteePresenter.kt @@ -6,6 +6,7 @@ import com.otaliastudios.autocomplete.RecyclerViewPresenter import kotlinx.coroutines.* import net.dankito.banking.ui.android.adapter.RemitteeListAdapter import net.dankito.banking.search.Remittee +import net.dankito.banking.ui.android.extensions.addHorizontalItemDivider import net.dankito.banking.ui.presenter.BankingPresenter @@ -17,6 +18,8 @@ open class RemitteePresenter(protected val bankingPresenter: BankingPresenter, c override fun instantiateAdapter(): RecyclerView.Adapter<*> { + recyclerView?.addHorizontalItemDivider() + return adapter } diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/extensions/RecyclerViewExtensions.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/extensions/RecyclerViewExtensions.kt new file mode 100644 index 00000000..9f86f958 --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/extensions/RecyclerViewExtensions.kt @@ -0,0 +1,9 @@ +package net.dankito.banking.ui.android.extensions + +import androidx.recyclerview.widget.DividerItemDecoration +import androidx.recyclerview.widget.RecyclerView + + +fun RecyclerView.addHorizontalItemDivider() { + this.addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL)) +} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt index 0205a80c..5e601b0f 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt @@ -18,6 +18,7 @@ import kotlinx.android.synthetic.main.fragment_home.view.* import net.dankito.banking.ui.android.R import net.dankito.banking.ui.android.adapter.AccountTransactionAdapter import net.dankito.banking.ui.android.di.BankingComponent +import net.dankito.banking.ui.android.extensions.addHorizontalItemDivider import net.dankito.banking.ui.android.extensions.showAmount import net.dankito.banking.ui.model.TypedBankAccount import net.dankito.banking.ui.model.parameters.TransferMoneyData @@ -79,7 +80,7 @@ class HomeFragment : Fragment() { val rcyvwAccountTransactions: RecyclerView = rootView.findViewById(R.id.rcyvwAccountTransactions) rcyvwAccountTransactions.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) rcyvwAccountTransactions.adapter = transactionAdapter - rcyvwAccountTransactions.addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL)) + rcyvwAccountTransactions.addHorizontalItemDivider() rcyvwAccountTransactions.isNestedScrollingEnabled = false registerForContextMenu(rcyvwAccountTransactions) // this is actually bad, splits code as context menu is created in AccountTransactionAdapter