prevent vertical scrolling during swipe

This commit is contained in:
kosyak 2023-06-22 11:13:18 +03:00 committed by Konstantin Aleksashin
parent 5bb72ec049
commit 8f0fb0f2a3

View file

@ -50,7 +50,6 @@ public class SwipeDetector implements View.OnTouchListener {
public boolean onTouch(View v, MotionEvent event) {
if (touchSlop == -1) {
touchSlop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop();
android.util.Log.e("25fd", touchSlop + " ");
}
switch (event.getAction()) {
@ -68,8 +67,8 @@ public class SwipeDetector implements View.OnTouchListener {
float deltaY = downY - upY;
if (
(allowedActions.contains(Action.LR) && deltaX > touchSlop ||
allowedActions.contains(Action.RL) && deltaX < -touchSlop) && Math.abs(deltaY) < touchSlop
(allowedActions.contains(Action.LR) && deltaX < -touchSlop ||
allowedActions.contains(Action.RL) && deltaX > touchSlop) && Math.abs(deltaX) > Math.abs(deltaY)
) {
v.getParent().requestDisallowInterceptTouchEvent(true);
}