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 b46d88011..df75d769a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -237,20 +237,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun reloadViewPager() { - val adapter = view_pager.adapter as MyPagerAdapter - val curPos = view_pager.currentItem mMedia = getMedia() - if (isDirEmpty()) return runOnUiThread { - adapter.updateItems(mMedia!!) - - val newPos = Math.min(curPos, adapter.count) - view_pager.currentItem = newPos - updateActionbarTitle() - mPos = newPos + updatePagerItems() } } 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 5cb9ade53..df836427e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt @@ -55,10 +55,4 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m (-1..1).map { mFragments[pos + it] } .forEach { it?.updateItem() } } - - fun updateItems(newPaths: List) { - media.clear() - media.addAll(newPaths) - notifyDataSetChanged() - } }