summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/trebuchet/PagedView.java
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-12-25 15:33:18 +0000
committernebkat <nebkat@teamhacksung.org>2012-12-26 13:37:21 +0000
commit10a574501d4f4426ab5cec0a613b60d1d0baed44 (patch)
tree9f8718ecf66b46193d5eee04a947faf562318a73 /src/com/cyanogenmod/trebuchet/PagedView.java
parentb79406c0a85568dbc9150bbdb5339405b924f1fb (diff)
downloadandroid_packages_apps_Trebuchet-10a574501d4f4426ab5cec0a613b60d1d0baed44.tar.gz
android_packages_apps_Trebuchet-10a574501d4f4426ab5cec0a613b60d1d0baed44.tar.bz2
android_packages_apps_Trebuchet-10a574501d4f4426ab5cec0a613b60d1d0baed44.zip
Cleanup
Change-Id: Ied69f285305dbc3e1bf62676f23c47d6c6969e0a
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/PagedView.java')
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedView.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/trebuchet/PagedView.java b/src/com/cyanogenmod/trebuchet/PagedView.java
index a2b353f7f..0076b831d 100644
--- a/src/com/cyanogenmod/trebuchet/PagedView.java
+++ b/src/com/cyanogenmod/trebuchet/PagedView.java
@@ -177,7 +177,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected boolean mUsePagingTouchSlop = true;
// If true, the subclass should directly update scrollX itself in its computeScroll method
- // (SmoothPagedView does this)
protected boolean mDeferScrollUpdate = false;
protected boolean mIsPageMoving = false;
@@ -461,7 +460,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
}
- // we moved this functionality to a helper function so SmoothPagedView can reuse it
protected boolean computeScrollHelper() {
if (mScroller.computeScrollOffset()) {
// Don't bother scrolling if the page does not need to be moved
@@ -1696,6 +1694,30 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
}
+ public static class OvershootInterpolator implements Interpolator {
+ private static final float DEFAULT_TENSION = 1.3f;
+ private float mTension;
+
+ public OvershootInterpolator() {
+ mTension = DEFAULT_TENSION;
+ }
+
+ public void setDistance(int distance) {
+ mTension = distance > 0 ? DEFAULT_TENSION / distance : DEFAULT_TENSION;
+ }
+
+ public void disableSettle() {
+ mTension = 0.f;
+ }
+
+ public float getInterpolation(float t) {
+ // _o(t) = t * t * ((tension + 1) * t + tension)
+ // o(t) = _o(t - 1) + 1
+ t -= 1.0f;
+ return t * t * ((mTension + 1) * t + mTension) + 1.0f;
+ }
+ }
+
protected Interpolator getScrollInterpolator() {
return new QuintInterpolator();
}