summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/PagedView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/PagedView.java')
-rw-r--r--src/com/android/launcher3/PagedView.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index c456f06d6..ec69b7f8f 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -207,6 +207,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected boolean mAllowLongPress = true;
+ private boolean mWasInOverscroll = false;
+
// Page Indicator
private int mPageIndicatorViewId;
private PageIndicator mPageIndicator;
@@ -645,6 +647,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
mDelayedSnapToPageRunnable.run();
mDelayedSnapToPageRunnable = null;
}
+ mWasInOverscroll = false;
}
/**
@@ -683,6 +686,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (isXBeforeFirstPage) {
super.scrollTo(0, y);
if (mAllowOverScroll) {
+ mWasInOverscroll = true;
if (isRtl) {
overScroll(x - mMaxScrollX);
} else {
@@ -692,6 +696,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
} else if (isXAfterLastPage) {
super.scrollTo(mMaxScrollX, y);
if (mAllowOverScroll) {
+ mWasInOverscroll = true;
if (isRtl) {
overScroll(x);
} else {
@@ -699,6 +704,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
}
} else {
+ if (mWasInOverscroll) {
+ overScroll(0);
+ mWasInOverscroll = false;
+ }
mOverScrollX = x;
super.scrollTo(x, y);
}
@@ -1608,6 +1617,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
mLastMotionXRemainder = 0;
mTouchX = getViewportOffsetX() + getScrollX();
mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
+ onScrollInteractionBegin();
pageBeginMoving();
}
}
@@ -1847,6 +1857,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
mActivePointerId = ev.getPointerId(0);
if (mTouchState == TOUCH_STATE_SCROLLING) {
+ onScrollInteractionBegin();
pageBeginMoving();
}
break;
@@ -2036,6 +2047,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
getScrollY(), vX, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0);
invalidate();
}
+ onScrollInteractionEnd();
} else if (mTouchState == TOUCH_STATE_PREV_PAGE) {
// at this point we have not moved beyond the touch slop
// (otherwise mTouchState would be TOUCH_STATE_SCROLLING), so
@@ -2121,6 +2133,15 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
mActivePointerId = INVALID_POINTER;
}
+ /**
+ * Triggered by scrolling via touch
+ */
+ protected void onScrollInteractionBegin() {
+ }
+
+ protected void onScrollInteractionEnd() {
+ }
+
protected void onUnhandledTap(MotionEvent ev) {
((Launcher) getContext()).onClick(this);
}