Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79a5feff authored by Alan Viverette's avatar Alan Viverette
Browse files

Fix the build, use viscous fluid interpolator in OverScroller

Change-Id: I175a220d1d915161896b9b223acfee08e0face2c
parent 448835ae
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -70,7 +70,11 @@ public class OverScroller {
     * @hide
     */
    public OverScroller(Context context, Interpolator interpolator, boolean flywheel) {
        if (interpolator == null) {
            mInterpolator = new Scroller.ViscousFluidInterpolator();
        } else {
            mInterpolator = interpolator;
        }
        mFlywheel = flywheel;
        mScrollerX = new SplineOverScroller(context);
        mScrollerY = new SplineOverScroller(context);
@@ -112,8 +116,12 @@ public class OverScroller {
    }

    void setInterpolator(Interpolator interpolator) {
        if (interpolator == null) {
            mInterpolator = new Scroller.ViscousFluidInterpolator();
        } else {
            mInterpolator = interpolator;
        }
    }

    /**
     * The amount of friction applied to flings. The default value
@@ -302,14 +310,7 @@ public class OverScroller {

                final int duration = mScrollerX.mDuration;
                if (elapsedTime < duration) {
                    float q = (float) (elapsedTime) / duration;

                    if (mInterpolator == null) {
                        q = Scroller.viscousFluid(q);
                    } else {
                        q = mInterpolator.getInterpolation(q);
                    }

                    final float q = mInterpolator.getInterpolation(elapsedTime / (float) duration);
                    mScrollerX.updateScroll(q);
                    mScrollerY.updateScroll(q);
                } else {
+1 −1
Original line number Diff line number Diff line
@@ -559,7 +559,7 @@ public class Scroller {
                Math.signum(yvel) == Math.signum(mFinalY - mStartY);
    }

    private static class ViscousFluidInterpolator implements Interpolator {
    static class ViscousFluidInterpolator implements Interpolator {
        /** Controls the viscous fluid effect (how much of it). */
        private static final float VISCOUS_FLUID_SCALE = 8.0f;