Switch to ViewPager2 was successful; it was essentially a drop-in replacement. There's a bug in the connected TabLayout where, if the app starts and scrolls programmatically to Wednesday or later, the tab won't be focussed until the user starts scrolling again

This commit is contained in:
denizk0461
2023-04-12 16:46:38 +02:00
parent 8b690a4593
commit 4f78eb8373
5 changed files with 41 additions and 90 deletions
@@ -7,7 +7,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.denizk0461.studip.model.StudIPEvent
import com.denizk0461.studip.databinding.ItemEventPageBinding
class StudIPEventPageAdapter(private val events: List<StudIPEvent>) : RecyclerView.Adapter<StudIPEventPageAdapter.EventPageViewHolder>() {
class StudIPEventPageAdapter(private var events: List<StudIPEvent>) : RecyclerView.Adapter<StudIPEventPageAdapter.EventPageViewHolder>() {
class EventPageViewHolder(val binding: ItemEventPageBinding) : RecyclerView.ViewHolder(binding.root)
@@ -29,4 +29,9 @@ class StudIPEventPageAdapter(private val events: List<StudIPEvent>) : RecyclerVi
scheduleLayoutAnimation()
}
}
fun setNewItems(items: List<StudIPEvent>) {
events = items
notifyDataSetChanged()
}
}