From 1c8f803c4849f71a64603cef4845388500077cc1 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Fri, 14 Oct 2022 22:00:04 +0530 Subject: [PATCH] fix: check MotionRawY if less than available height for threshold --- .../core/customviews/HorizontalPager.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/HorizontalPager.java b/app/src/main/java/foundation/e/blisslauncher/core/customviews/HorizontalPager.java index 60a085c2aa..843e2404cd 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/HorizontalPager.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/HorizontalPager.java @@ -60,7 +60,7 @@ public class HorizontalPager extends ViewGroup implements Insettable { private boolean mAllowLongPress; private DockGridLayout mDock; - private Set mListeners = new HashSet<>(); + private final Set mListeners = new HashSet<>(); private boolean mIsUiCreated; private GestureDetectorCompat gestureDetectorCompat; private Rect insets; @@ -143,7 +143,6 @@ public class HorizontalPager extends ViewGroup implements Insettable { scrollTo(x, y); } postInvalidateOnAnimation(); - return; } } @@ -343,11 +342,10 @@ public class HorizontalPager extends ViewGroup implements Insettable { boolean yMoved = yDiff > mTouchSlop; if (xMoved || yMoved) { - if (yMoved && (y - mLastMotionY) > 0 && yDiff > xDiff && inThresholdRegion() && currentPage != 0) { mTouchState = TOUCH_STATE_VERTICAL_SCROLLING; ((OnSwipeDownListener) getContext()).onSwipeStart(); - } else if (xMoved && yDiff < xDiff) { + } else if (xMoved && yDiff < xDiff && inThresholdRegion()) { // Scroll if the user moved far enough along the X axis mTouchState = TOUCH_STATE_HORIZONTAL_SCROLLING; enableChildrenCache(); @@ -363,12 +361,12 @@ public class HorizontalPager extends ViewGroup implements Insettable { currentScreen.cancelLongPress(); } } + } } private boolean inThresholdRegion() { - return (mLastMotionRawY - / BlissLauncher.getApplication(getContext()).getDeviceProfile().availableHeightPx) > (float) 1 / 5; + return mLastMotionRawY < BlissLauncher.getApplication(getContext()).getDeviceProfile().availableHeightPx; } void enableChildrenCache() { @@ -384,7 +382,7 @@ public class HorizontalPager extends ViewGroup implements Insettable { public boolean onTouchEvent(MotionEvent ev) { /* * if (gestureDetectorCompat.onTouchEvent(ev)) { return true; } else { - * + * * } */ if (mVelocityTracker == null) { -- GitLab