BUGFIX: opening CanteenFragment.kt more than once would disallow refreshing from working properly

BUGFIX: fragments launch slowly when quickly clicking through the bottom navigation view
This commit is contained in:
denizk0461
2023-04-26 19:49:29 +02:00
parent 450ce92dca
commit 939bc06441
3 changed files with 34 additions and 52 deletions
@@ -173,12 +173,6 @@ class CanteenFragment : AppFragment(), CanteenOfferItemAdapter.OnClickListener {
// Set the text for the opening hours dialogue
openingHours = viewModel.getCanteenOpeningHours()
/*
* Tell the swipe refresh layout to stop refreshing.
* TODO if an exception is raised, this will not be fired. This must be changed
*/
binding.swipeRefreshLayout.isRefreshing = false
}
// Set up functions for when the user swipes to refresh the view
@@ -352,6 +346,13 @@ class CanteenFragment : AppFragment(), CanteenOfferItemAdapter.OnClickListener {
viewModel.fetchOffers(viewModel.preferenceCanteen, onRefreshUpdate = { status ->
// TODO refresh updates
}, onFinish = {
/*
* Tell the swipe refresh layout to stop refreshing.
* TODO if an exception is raised, this will not be fired. This must be changed
*/
binding.swipeRefreshLayout.isRefreshing = false
// createTabLayoutMediator()
// binding.swipeRefreshLayout.isRefreshing = false
// createTabLayoutMediator()