HirayClay / StackLayoutManager

:neckbeard:customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
454 stars 64 forks source link

Slugness while scrolling #11

Open shaz-tech opened 6 years ago

shaz-tech commented 6 years ago

Cards are overlapping and getting stuck over others while scrolling and release in the middle of the screen and sometimes in fast scroll.

timtsj commented 3 years ago

replace brewAndStartAnimator like this:

private void brewAndStartAnimator(int dur, int finalXorY) {
        if (animator != null && animator.isRunning())
            animator.cancel();
        animator = ObjectAnimator.ofInt(StackLayoutManager.this, "animateValue", 0, finalXorY);
        animator.setDuration(dur);
        animator.start();
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                lastAnimateValue = 0;
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                lastAnimateValue = 0;
            }
        });
    }