diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index f566b6333..0f1d6fa01 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -228,7 +228,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } 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) { view_pager.apply { adapter = pagerAdapter diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt index b1d72481b..b7e5640ad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt @@ -42,9 +42,9 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m return fragment } - override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) { + override fun destroyItem(container: ViewGroup?, position: Int, any: Any?) { mFragments.remove(position) - super.destroyItem(container, position, `object`) + super.destroyItem(container, position, any) } fun getCurrentFragment(position: Int) = mFragments.get(position)