Open gewuxy opened 7 years ago
Hi. Have you disabled change animations like this?
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
I find that some items would flash sometimes on long pressed, it seems that it is caused by the following code in DraggableItemWrapperAdapter:
Actually, those notifyDataSetChanged()
calls may not be required as you pointed it out.
At least, this library expects to update dragging state flags (= setDragStateFlags()
) of all items on start/finish dragging, so probably they can be replaced to notifyItemRangeChanged()
with a payload parameter. However, I am not willing to change them because;
notifyDataSetChange()
is the safest optionnotifyItemRangeChanged(0, adapter.getItemCount())
has no performance advantage compared to notifyDataSetChanged()
with stable ID adapteryou have disable change animation in DraggableItemAnimator
@Override protected void onSetup() { super.onSetup(); super.setSupportsChangeAnimations(false); }
the animation is fresco's fade-in animation, but after disable fade-in duration, some item still flash unexpectedly
I find that some items would flash sometimes on long pressed, it seems that it is caused by the following code in DraggableItemWrapperAdapter: ` void onDragItemStarted(DraggingItemInfo draggingItemInfo, RecyclerView.ViewHolder holder, ItemDraggableRange range, int wrappedItemPosition, int itemMoveMode) { if (LOCAL_LOGD) { Log.d(TAG, "onDragItemStarted(holder = " + holder + ")"); }
void onDragItemFinished(boolean result) { if (LOCAL_LOGD) { Log.d(TAG, "onDragItemFinished(result = " + result + ")"); }
notifyDataSetChanged() needed here?
after remove it, the flash disappear.