mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
replace some GlobalLayoutListeners with the helper view extension
This commit is contained in:
parent
fd6f709aac
commit
0400612f86
1 changed files with 6 additions and 14 deletions
|
@ -123,17 +123,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
mDirectory = File(mPath).parent
|
mDirectory = File(mPath).parent
|
||||||
title = mPath.getFilenameFromPath()
|
title = mPath.getFilenameFromPath()
|
||||||
|
|
||||||
view_pager.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
view_pager.onGlobalLayout {
|
||||||
override fun onGlobalLayout() {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) {
|
||||||
view_pager.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed)
|
|
||||||
return
|
|
||||||
|
|
||||||
if (mMedia.isNotEmpty()) {
|
if (mMedia.isNotEmpty()) {
|
||||||
gotMedia(mMedia)
|
gotMedia(mMedia)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
reloadViewPager()
|
reloadViewPager()
|
||||||
scanPath(mPath) {}
|
scanPath(mPath) {}
|
||||||
|
@ -284,12 +280,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
|
|
||||||
private fun startSlideshow() {
|
private fun startSlideshow() {
|
||||||
if (getMediaForSlideshow()) {
|
if (getMediaForSlideshow()) {
|
||||||
view_pager.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
view_pager.onGlobalLayout {
|
||||||
override fun onGlobalLayout() {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) {
|
||||||
view_pager.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed)
|
|
||||||
return
|
|
||||||
|
|
||||||
hideSystemUI()
|
hideSystemUI()
|
||||||
mSlideshowInterval = config.slideshowInterval
|
mSlideshowInterval = config.slideshowInterval
|
||||||
mSlideshowMoveBackwards = config.slideshowMoveBackwards
|
mSlideshowMoveBackwards = config.slideshowMoveBackwards
|
||||||
|
@ -297,7 +289,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
scheduleSwipe()
|
scheduleSwipe()
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue