HalfStackDeveloper/SwipeCardRecyclerView

getMirrorView() 方法中有内存泄漏,设置SwipeCard 为无限循环时发生OOM,需要动画完成后移除View。。小问题就不PR了。项目很棒,正需要。谢谢

Closed this issue · 1 comments

Adapter 中设置循环
/**
* 删除最顶部Item
*/
public void delTopItem(){
int position=getItemCount()-1;
String item = mList.remove(position);
mList.add(0, item);
notifyDataSetChanged();
// notifyItemRemoved(position);
}

SwipeCardRecyclerView 中

final View animView2 = animView;
animView.animate()
.setDuration(500)
.x(targetX)
.y(targetY)
.setInterpolator(interpolator)
.setListener(new Animator.AnimatorListener() {
@OverRide
public void onAnimationStart(Animator animation) {

                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    mDecorView.removeView(animView2);
                }

                @Override
                public void onAnimationCancel(Animator animation) {

                }

                @Override
                public void onAnimationRepeat(Animator animation) {

                }
            })
            .setUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    if (!finalDel) {
                        updateNextItem(Math.abs(view.getX() - mTopViewX) * 0.2 / mBorder + 0.8);
                    }
                }
            });

谢谢提醒!