mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Cancel library swipe gestures if changing direction mid-swipe
This commit is contained in:
parent
ba26a56bb6
commit
32222476e0
2 changed files with 5 additions and 3 deletions
|
@ -77,8 +77,9 @@ class LibraryCategoryGestureDetector(private val controller: LibraryController?)
|
|||
val recycler = controller.binding.libraryGridRecycler.recycler
|
||||
var moved = false
|
||||
if (abs(diffX) >= abs(diffY) &&
|
||||
abs(diffX) > SWIPE_THRESHOLD * 5 &&
|
||||
abs(velocityX) > SWIPE_VELOCITY_THRESHOLD
|
||||
abs(diffX) > SWIPE_THRESHOLD * 3 &&
|
||||
abs(velocityX) > SWIPE_VELOCITY_THRESHOLD &&
|
||||
sign(diffX) == sign(velocityX)
|
||||
) {
|
||||
moved = controller.jumpToNextCategory((diffX >= 0).xor(controller.binding.root.resources.isLTR))
|
||||
result = true
|
||||
|
|
|
@ -56,7 +56,8 @@ class LibraryGestureDetector(private val controller: LibraryController) : Gestur
|
|||
}
|
||||
} else if (abs(diffX) >= abs(diffY) &&
|
||||
abs(diffX) > SWIPE_THRESHOLD * 5 &&
|
||||
abs(velocityX) > SWIPE_VELOCITY_THRESHOLD
|
||||
abs(velocityX) > SWIPE_VELOCITY_THRESHOLD &&
|
||||
sign(diffX) == sign(velocityX)
|
||||
) {
|
||||
val hopperGravity = (controller.binding.categoryHopperFrame.layoutParams as CoordinatorLayout.LayoutParams).gravity
|
||||
if (diffX <= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue