Skip to content

Commit

Permalink
fix: clear filter not working
Browse files Browse the repository at this point in the history
fix: clear filter not working

Fix clear filter not working when the current filtered list is empty
  • Loading branch information
AbrahamOsmondE committed Mar 26, 2024
1 parent 77c8119 commit 19d102a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class SavingAccountsTransactionFragment : BaseFragment() {
SavingsWithAssociations::class.java,
Constants.SAVINGS_ACCOUNTS
)
) }
)
}
}

/**
Expand Down Expand Up @@ -406,6 +407,10 @@ class SavingAccountsTransactionFragment : BaseFragment() {
}
.setNeutralButton(getString(R.string.clear_filters)) { _, _ ->
transactionListAdapter?.setSavingAccountsTransactionList(transactionsList)
sweetUIErrorHandler?.hideSweetErrorLayoutUI(
binding.rvSavingAccountsTransaction,
binding.layoutError.root,
)
initializeFilterVariables()
}
.setNegativeButton(R.string.cancel) { _, _ -> }
Expand All @@ -426,7 +431,8 @@ class SavingAccountsTransactionFragment : BaseFragment() {
*/
private fun filter(startDate: Long?, endDate: Long?, statusModelList: List<CheckboxStatus?>?) {
val hasOtherFilters = statusModelList?.any { it!!.isChecked }
val transactionListToFilter = if (hasOtherFilters == true) filterSavingsAccountTransactionsByType(statusModelList) else transactionsList
val transactionListToFilter =
if (hasOtherFilters == true) filterSavingsAccountTransactionsByType(statusModelList) else transactionsList

viewModel.filterTransactionList(
transactionListToFilter,
Expand Down

0 comments on commit 19d102a

Please sign in to comment.