Skip to content

Instantly share code, notes, and snippets.

@mvn-vinhhuynh-dn
Last active July 1, 2019 13:54
Show Gist options
  • Select an option

  • Save mvn-vinhhuynh-dn/5a78fdbf31875cfc16f5cf31ce581de4 to your computer and use it in GitHub Desktop.

Select an option

Save mvn-vinhhuynh-dn/5a78fdbf31875cfc16f5cf31ce581de4 to your computer and use it in GitHub Desktop.
import android.content.Context;
import android.view.animation.Interpolator;
import android.widget.Scroller;
/**
*
* Created by VinhHlb on 1/14/16.
*/
public class FixedSpeedScroller extends Scroller {
private int mDuration;
public FixedSpeedScroller(Context context, Interpolator interpolator, boolean flywheel, int duration) {
super(context, interpolator, flywheel);
mDuration = duration;
}
@Override
public void startScroll(int startX, int startY, int dx, int dy, int duration) {
// Ignore received duration, use fixed one instead
super.startScroll(startX, startY, dx, dy, mDuration);
}
@Override
public void startScroll(int startX, int startY, int dx, int dy) {
// Ignore received duration, use fixed one instead
super.startScroll(startX, startY, dx, dy, mDuration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment