version 1.0.0 #67

Merged
Seil0 merged 137 commits from develop into master 2022-10-12 15:36:39 +02:00
Showing only changes of commit 062013489d - Show all commits

View File

@ -111,8 +111,9 @@ class MediaFragment(private val mediaId: Int) : Fragment() {
} }
// clear fragments, since it lives in onCreate scope (don't do this in onPause/onStop -> FragmentManager transaction) // clear fragments, since it lives in onCreate scope (don't do this in onPause/onStop -> FragmentManager transaction)
val fragmentsSize = if (fragments.lastIndex < 0) 0 else fragments.lastIndex
fragments.clear() fragments.clear()
pagerAdapter.notifyDataSetChanged() pagerAdapter.notifyItemRangeRemoved(0, fragmentsSize)
// specific gui // specific gui
if (media.type == MediaType.TVSHOW) { if (media.type == MediaType.TVSHOW) {
@ -131,8 +132,10 @@ class MediaFragment(private val mediaId: Int) : Fragment() {
) )
// episodes // episodes
fragments.add(MediaFragmentEpisodes()) MediaFragmentEpisodes().also {
pagerAdapter.notifyDataSetChanged() fragments.add(it)
pagerAdapter.notifyItemInserted(fragments.indexOf(it))
}
} else if (media.type == MediaType.MOVIE) { } else if (media.type == MediaType.MOVIE) {
val tmdbMovie = (tmdbResult as TMDBMovie?) val tmdbMovie = (tmdbResult as TMDBMovie?)
@ -149,8 +152,10 @@ class MediaFragment(private val mediaId: Int) : Fragment() {
// if has similar titles // if has similar titles
if (media.similar.isNotEmpty()) { if (media.similar.isNotEmpty()) {
fragments.add(MediaFragmentSimilar()) MediaFragmentSimilar().also {
pagerAdapter.notifyDataSetChanged() fragments.add(it)
pagerAdapter.notifyItemInserted(fragments.indexOf(it))
}
} }
// disable scrolling on appbar, if no tabs where added // disable scrolling on appbar, if no tabs where added