mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Add haptic feedback to Launcher recent apps scrolling
Add light LOW_TICK effects when the scrolling on RecentsView snaps to a page, and a stronger TICK effect when the edges absorb the scroll (by scrolling fast towards one of the edges). Fix: 182382085 Test: manual Change-Id: Ifb917ae499f73607707773f9870eb39cd6fe16ef
This commit is contained in:
@@ -479,9 +479,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
if (newPos < mMinScroll && oldPos >= mMinScroll) {
|
||||
mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity());
|
||||
mScroller.abortAnimation();
|
||||
onEdgeAbsorbingScroll();
|
||||
} else if (newPos > mMaxScroll && oldPos <= mMaxScroll) {
|
||||
mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity());
|
||||
mScroller.abortAnimation();
|
||||
onEdgeAbsorbingScroll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1332,6 +1334,13 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
|
||||
protected void onNotSnappingToPageInFreeScroll() { }
|
||||
|
||||
/**
|
||||
* Called when the view edges absorb part of the scroll. Subclasses can override this
|
||||
* to provide custom behavior during animation.
|
||||
*/
|
||||
protected void onEdgeAbsorbingScroll() {
|
||||
}
|
||||
|
||||
protected boolean shouldFlingForVelocity(int velocity) {
|
||||
float threshold = mAllowEasyFling ? mEasyFlingThresholdVelocity : mFlingThresholdVelocity;
|
||||
return Math.abs(velocity) > threshold;
|
||||
|
||||
Reference in New Issue
Block a user