StwParser.kt now collects all its data before adding everything to the database all at once, fixing problems where LiveData would update before all transactions were finished; ViewPagers have been updated to use Adapters extending FragmentStateAdapter instead of RecyclerView.Adapter

This commit is contained in:
denizk0461
2023-04-27 21:58:10 +02:00
parent ccd77a5daf
commit ce7b854e8c
15 changed files with 373 additions and 164 deletions
@@ -49,6 +49,15 @@ class CanteenOfferItemAdapter(
// Retrieve item for current position
val currentItem = offers[position]
/*
* Children of the line container MUST be removed before any are added, as otherwise, during
* recycling, lines will be duplicated when they are scrolled off the visible screen area
* and then scrolled onto the screen again. In other terms, if removeAllViews() wasn't
* called and the user was to scroll down a list and then back up again, the items at the
* top of the list would be added again, creating duplicates.
*/
holder.binding.lineContainer.removeAllViews()
// If an item has been added to mark that there are no offers available, tell the user
if (currentItem.category == "NO\$ITEMS") {