Skip to content

Commit be0b5d6

Browse files
authored
Smooth Scroll using inertia
1 parent ed8026e commit be0b5d6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

loopview/src/main/java/com/weigan/loopview/LoopView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ protected final void scrollBy(float velocityY) {
270270
mFuture = mExecutor.scheduleWithFixedDelay(new InertiaTimerTask(this, velocityY), 0, velocityFling,
271271
TimeUnit.MILLISECONDS);
272272
}
273+
274+
public void scrollWithSpeed(float velocityY, int velocityFling) {
275+
cancelFuture();
276+
mFuture = mExecutor.scheduleWithFixedDelay(new InertiaTimerTask(this, velocityY), 0, velocityFling,
277+
TimeUnit.MILLISECONDS);
278+
}
273279

274280
public void cancelFuture() {
275281
if (mFuture != null && !mFuture.isCancelled()) {

0 commit comments

Comments
 (0)