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 {
|
animator.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener {
|
||||||
var oldDragPosition = 0
|
var oldDragPosition = 0
|
||||||
override fun onAnimationUpdate(animation: ValueAnimator) {
|
override fun onAnimationUpdate(animation: ValueAnimator) {
|
||||||
val dragPosition = animation.animatedValue as Int
|
if (view_pager?.isFakeDragging == true) {
|
||||||
val dragOffset = dragPosition - oldDragPosition
|
val dragPosition = animation.animatedValue as Int
|
||||||
oldDragPosition = dragPosition
|
val dragOffset = dragPosition - oldDragPosition
|
||||||
view_pager?.fakeDragBy(dragOffset * (if (forward) 1f else -1f))
|
oldDragPosition = dragPosition
|
||||||
|
view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue