mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
convert mMedia to a mutable list before providing to MyPagerAdapter
This commit is contained in:
parent
a355b0a7b8
commit
ce41e5b7b9
2 changed files with 3 additions and 3 deletions
|
@ -228,7 +228,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePagerItems() {
|
private fun updatePagerItems() {
|
||||||
val pagerAdapter = MyPagerAdapter(this, supportFragmentManager, mMedia)
|
val pagerAdapter = MyPagerAdapter(this, supportFragmentManager, mMedia.toMutableList())
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) {
|
||||||
view_pager.apply {
|
view_pager.apply {
|
||||||
adapter = pagerAdapter
|
adapter = pagerAdapter
|
||||||
|
|
|
@ -42,9 +42,9 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
|
||||||
return fragment
|
return fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) {
|
override fun destroyItem(container: ViewGroup?, position: Int, any: Any?) {
|
||||||
mFragments.remove(position)
|
mFragments.remove(position)
|
||||||
super.destroyItem(container, position, `object`)
|
super.destroyItem(container, position, any)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCurrentFragment(position: Int) = mFragments.get(position)
|
fun getCurrentFragment(position: Int) = mFragments.get(position)
|
||||||
|
|
Loading…
Reference in a new issue