mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
added a fake drag check at slideshow
This commit is contained in:
parent
4d913527f5
commit
788885227a
1 changed files with 6 additions and 4 deletions
|
@ -327,10 +327,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
animator.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener {
|
||||
var oldDragPosition = 0
|
||||
override fun onAnimationUpdate(animation: ValueAnimator) {
|
||||
val dragPosition = animation.animatedValue as Int
|
||||
val dragOffset = dragPosition - oldDragPosition
|
||||
oldDragPosition = dragPosition
|
||||
view_pager?.fakeDragBy(dragOffset * (if (forward) 1f else -1f))
|
||||
if (view_pager?.isFakeDragging == true) {
|
||||
val dragPosition = animation.animatedValue as Int
|
||||
val dragOffset = dragPosition - oldDragPosition
|
||||
oldDragPosition = dragPosition
|
||||
view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue