mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-01-30 19:24:51 +01:00
add a medium null check at scrollStateChanged trigger
This commit is contained in:
parent
aca83d7fad
commit
498cd10ba6
@ -730,10 +730,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||
}
|
||||
|
||||
private fun getCurrentMedium(): Medium? {
|
||||
return if (getCurrentMedia().isEmpty() || mPos == -1)
|
||||
return if (getCurrentMedia().isEmpty() || mPos == -1) {
|
||||
null
|
||||
else
|
||||
} else {
|
||||
getCurrentMedia()[Math.min(mPos, getCurrentMedia().size - 1)]
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCurrentMedia() = if (mAreSlideShowMediaVisible) mSlideshowMedia else mMedia
|
||||
@ -756,7 +757,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||
}
|
||||
|
||||
override fun onPageScrollStateChanged(state: Int) {
|
||||
if (state == ViewPager.SCROLL_STATE_IDLE) {
|
||||
if (state == ViewPager.SCROLL_STATE_IDLE && getCurrentMedium() != null) {
|
||||
checkOrientation()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user