Merge pull request #2469 from KryptKode/fix/delete_position_in_view_pager

fix: position returning to 0
This commit is contained in:
Tibor Kaputa 2022-05-16 21:29:55 +02:00 committed by GitHub
commit bbb806a5e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1136,7 +1136,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<Medium>
if (media.isNotEmpty()) {
runOnUiThread {
refreshUI(media, true)
refreshUI(media, false)
}
}
@ -1169,7 +1169,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<Medium>
if (media.isNotEmpty()) {
runOnUiThread {
refreshUI(media, true)
refreshUI(media, false)
}
}
@ -1413,7 +1413,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun getCurrentPath() = getCurrentMedium()?.path ?: ""
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
if (position == 0) {
onPageSelected(0)
}
}
override fun onPageSelected(position: Int) {
if (mPos != position) {