From 5ded582c7876cefc59641693c452abbdbf791b32 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 23 Sep 2020 19:16:33 +0200 Subject: [PATCH] Don't showing an overlay anymore but button to fetch all transactions directly above transactions list --- .../banking/ui/android/home/HomeFragment.kt | 24 +-- .../src/main/res/layout/fragment_home.xml | 149 ++++++++---------- .../layout/list_item_account_transaction.xml | 6 +- .../src/main/res/values/dimens.xml | 8 +- .../dialogs/AccountTransactionsDialog.swift | 96 +++-------- 5 files changed, 100 insertions(+), 183 deletions(-) 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 e355c155..9c9e5956 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 @@ -53,8 +53,6 @@ class HomeFragment : Fragment() { private var accountsForWhichNotAllTransactionsHaveBeenFetched = listOf() - private var doNotShowFetchAllTransactionsOverlay = false - private val transactionAdapter: AccountTransactionAdapter @@ -99,11 +97,6 @@ class HomeFragment : Fragment() { fetchAllTransactions() } - rootView.btnHideFetchAllTransactionsOverlay.setOnClickListener { - doNotShowFetchAllTransactionsOverlay = true - setFetchAllTransactionsView() - } - rootView.btnRetrieveTransactions.setOnClickListener { fetchTransactions() } rootView.btnAddAccount.setOnClickListener { presenter.showAddAccountDialog() } @@ -275,7 +268,7 @@ class HomeFragment : Fragment() { btnRetrieveTransactions.visibility = if (TransactionsCannotBeRetrievedStates.contains(transactionsRetrievalState)) View.GONE else View.VISIBLE btnAddAccount.visibility = if (noAccountsAddedYet) View.VISIBLE else View.GONE - var messageArgs = mutableListOf() + val messageArgs = mutableListOf() val transactionsRetrievalStateMessageId = when (transactionsRetrievalState) { TransactionsRetrievalState.AccountTypeNotSupported -> R.string.fragment_home_transactions_retrieval_state_account_type_not_supported TransactionsRetrievalState.AccountDoesNotSupportFetchingTransactions -> R.string.fragment_home_transactions_retrieval_state_account_does_not_support_retrieving_transactions @@ -294,19 +287,14 @@ class HomeFragment : Fragment() { private fun setFetchAllTransactionsView() { accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched - var floatingActionMenuBottomMarginResourceId = R.dimen.fab_margin_bottom_without_toolbar + val hideFetchAllTransactionsView = accountsForWhichNotAllTransactionsHaveBeenFetched.isEmpty() + || presenter.selectedAccountsTransactionRetrievalState != TransactionsRetrievalState.RetrievedTransactions - if (doNotShowFetchAllTransactionsOverlay || accountsForWhichNotAllTransactionsHaveBeenFetched.isEmpty() - || presenter.selectedAccountsTransactionRetrievalState != TransactionsRetrievalState.RetrievedTransactions) { - lytFetchAllTransactionsOverlay.visibility = View.GONE + if (hideFetchAllTransactionsView) { + lytFetchAllTransactions.visibility = View.GONE } else { - lytFetchAllTransactionsOverlay.visibility = View.VISIBLE - floatingActionMenuBottomMarginResourceId = R.dimen.fab_margin_bottom_with_fetch_all_transactions_overlay - } - - (requireActivity().findViewById(R.id.floatingActionMenu).layoutParams as? ViewGroup.MarginLayoutParams)?.let { params -> - params.bottomMargin = requireContext().getDimension(floatingActionMenuBottomMarginResourceId) + lytFetchAllTransactions.visibility = View.VISIBLE } } diff --git a/ui/BankingAndroidApp/src/main/res/layout/fragment_home.xml b/ui/BankingAndroidApp/src/main/res/layout/fragment_home.xml index 1c03edbf..0192a21d 100644 --- a/ui/BankingAndroidApp/src/main/res/layout/fragment_home.xml +++ b/ui/BankingAndroidApp/src/main/res/layout/fragment_home.xml @@ -12,22 +12,23 @@ app:layout_constraintTop_toTopOf="parent" > - - - - -