Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit 79b5578

Browse files
committed
Post FlingRunnable using ViewCompat.postOnAnimation to sync with next animation timestep
1 parent 28d2a6b commit 79b5578

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

library/src/main/java/com/etsy/android/grid/ExtendableListView.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,17 +1884,16 @@ void start(int initialVelocity) {
18841884
int initialY = initialVelocity < 0 ? Integer.MAX_VALUE : 0;
18851885
mLastFlingY = initialY;
18861886
mScroller.fling(0, initialY, 0, initialVelocity, 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);
1887-
18881887
mTouchMode = TOUCH_MODE_FLINGING;
1889-
post(this);
1888+
postOnAnimate(this);
18901889
}
18911890

18921891
void startScroll(int distance, int duration) {
18931892
int initialY = distance < 0 ? Integer.MAX_VALUE : 0;
18941893
mLastFlingY = initialY;
18951894
mScroller.startScroll(0, initialY, 0, distance, duration);
18961895
mTouchMode = TOUCH_MODE_FLINGING;
1897-
post(this);
1896+
postOnAnimate(this);
18981897
}
18991898

19001899
private void endFling() {
@@ -1947,7 +1946,7 @@ public void run() {
19471946
if (more && !atEnd) {
19481947
invalidate();
19491948
mLastFlingY = y;
1950-
post(this);
1949+
postOnAnimate(this);
19511950
}
19521951
else {
19531952
endFling();
@@ -1956,6 +1955,11 @@ public void run() {
19561955
}
19571956
}
19581957
}
1958+
1959+
}
1960+
1961+
private void postOnAnimate(Runnable runnable) {
1962+
ViewCompat.postOnAnimation(this, runnable);
19591963
}
19601964

19611965
// //////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)