summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-12-11 21:30:54 +0000
committernebkat <nebkat@teamhacksung.org>2012-12-11 22:03:07 +0000
commit04f9c23295e5b23e3ee813839e236e81f4556fd2 (patch)
tree0cbf305044a393f82e28d1b38c484095d3e50762 /src/com
parent0806c35c0ee30cde9395c1c83b0d8f0cceace6b7 (diff)
downloadpackages_apps_trebuchet-04f9c23295e5b23e3ee813839e236e81f4556fd2.zip
packages_apps_trebuchet-04f9c23295e5b23e3ee813839e236e81f4556fd2.tar.gz
packages_apps_trebuchet-04f9c23295e5b23e3ee813839e236e81f4556fd2.tar.bz2
Workspace: Quad interpolator
Change-Id: I995a311c60ed775e818c4b17393964111214ff7d
Diffstat (limited to 'src/com')
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedView.java26
-rw-r--r--src/com/cyanogenmod/trebuchet/Workspace.java6
2 files changed, 26 insertions, 6 deletions
diff --git a/src/com/cyanogenmod/trebuchet/PagedView.java b/src/com/cyanogenmod/trebuchet/PagedView.java
index 0e744d6..39f245f 100644
--- a/src/com/cyanogenmod/trebuchet/PagedView.java
+++ b/src/com/cyanogenmod/trebuchet/PagedView.java
@@ -58,9 +58,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// the min drag distance for a fling to register, to prevent random page shifts
private static final int MIN_LENGTH_FOR_FLING = 25;
- protected static final int PAGE_SNAP_ANIMATION_DURATION = 550;
- protected static final int MAX_PAGE_SNAP_DURATION = 750;
- protected static final int SLOW_PAGE_SNAP_ANIMATION_DURATION = 950;
+ protected static final int PAGE_SNAP_ANIMATION_DURATION = 400;
+ protected static final int MAX_PAGE_SNAP_DURATION = 550;
+ protected static final int SLOW_PAGE_SNAP_ANIMATION_DURATION = 750;
protected static final float NANOTIME_DIV = 1000000000.0f;
private static final float OVERSCROLL_ACCELERATE_FACTOR = 2;
@@ -234,7 +234,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected void init() {
mDirtyPageContent = new ArrayList<Boolean>();
mDirtyPageContent.ensureCapacity(32);
- mScroller = new Scroller(getContext(), new ScrollInterpolator());
+ mScroller = new Scroller(getContext(), getScrollInterpolator());
mCurrentPage = 0;
mCenterPagesVertically = true;
@@ -1441,8 +1441,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
snapToPage(getPageNearestToCenterOfScreen(), PAGE_SNAP_ANIMATION_DURATION);
}
- private static class ScrollInterpolator implements Interpolator {
- public ScrollInterpolator() {
+ public static class QuintInterpolator implements Interpolator {
+ public QuintInterpolator() {
}
public float getInterpolation(float t) {
@@ -1451,6 +1451,20 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
}
+ public static class QuadInterpolator implements Interpolator {
+ public QuadInterpolator() {
+ }
+
+ public float getInterpolation(float t) {
+ t -= 1.0f;
+ return -(t*t*t*t - 1);
+ }
+ }
+
+ protected Interpolator getScrollInterpolator() {
+ return new QuintInterpolator();
+ }
+
// We want the duration of the page snap animation to be influenced by the distance that
// the screen has to travel, however, we don't want this duration to be effected in a
// purely linear fashion. Instead, we use this method to moderate the effect that the distance
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java
index e9dbd1c..15a620c 100644
--- a/src/com/cyanogenmod/trebuchet/Workspace.java
+++ b/src/com/cyanogenmod/trebuchet/Workspace.java
@@ -56,6 +56,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
+import android.view.animation.Interpolator;
import android.widget.ImageView;
import android.widget.TextView;
@@ -1116,6 +1117,11 @@ public class Workspace extends SmoothPagedView
}
}
+ @Override
+ protected Interpolator getScrollInterpolator() {
+ return new PagedView.QuadInterpolator();
+ }
+
class WallpaperOffsetInterpolator {
float mFinalHorizontalWallpaperOffset = 0.0f;
float mHorizontalWallpaperOffset = 0.0f;