recyclerview-animators icon indicating copy to clipboard operation
recyclerview-animators copied to clipboard

Removed items will keep floating onto the recycler view when using SlideInUpAnimator

Open ydongzhu opened this issue 9 years ago • 7 comments
trafficstars

There should be a bug in SlideInUpAnimator, I am currently using recycler view with 23.1.1 version and animators with 2.0.1. I also tried to upgrade the version to 2.2.1, but the problem is still there.

The item won't disappear and will keep floating onto the recycler view after the animation when I call notifyItemRemoved().

ydongzhu avatar Mar 19 '16 01:03 ydongzhu

I used it, it worked:

public void remove(int pos) {
    data.remove(pos);
    notifyItemRemoved(pos);

    final Handler h = new Handler() {
        public void handleMessage(android.os.Message msg) {
             if(msg.what == 0x01) notifyDataSetChanged();
        }
    };
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                Thread.sleep(1000); //animation time
                h.obtainMessage(0x01).sendToTarget();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }).start();
}

Edit: Ignore the response, even refresh the entire list, continued the problem!

CaiqueJhones avatar Mar 19 '16 05:03 CaiqueJhones

@CaiqueJhones I didn't call notifyDataSetChanged() after notifyItemRemoved() since I don't want to refresh the whole list. I am using StaggeredGridLayoutManager in my recycler view, is it related to this issue?

ydongzhu avatar Mar 21 '16 18:03 ydongzhu

@ydongzhu Ignore the response, even refresh the entire list, continued the problem!

CaiqueJhones avatar Mar 22 '16 19:03 CaiqueJhones

Same problem here too.

yourdaum avatar Mar 25 '16 22:03 yourdaum

I have the same problem. To be more accurate, in my case, it happens when calling notifyItemRangeRemoved after having called notifyItemChanged previously on an element. the 2 calls are distinct and there is too much time between them to be an overlap. If I scroll the recyclerview between the 2 calls it doesn't happen though. Maybe because onBindViewHolder gets called in the middle

OzTK avatar Aug 29 '16 16:08 OzTK

Same here

Shailevy avatar May 21 '18 11:05 Shailevy

Did anyone find a solution for this yet? I tried notifyItemRemoved(myItemAdapterPos) and notifyItemRangeChanged(typingIndicatorPosition, itemCount - 1), but none of them solved this issue, even tried using myViewHolder.setIsRecyclable(false) for that specific viewholder (because I have different viewholders for different items)

dr4gonAndroidDev avatar Dec 13 '19 16:12 dr4gonAndroidDev