Open jompon opened 8 years ago
@jompon
notifyDataSetChanged as a standard behavior of RecyclerView dose not animation.
Please use the notifyItemRemoved
and notifyItemInserted
.
I changed notifyDataSetChanged to notifyItemRemoved but it doesn't update UI, animate. I have activity A, B and then A -> B by activityforresult then B finish to A A receive data and call notifyItemRemoved and it doesn't happen.
When data is added to your data set, you're calling notifyItemRemoved(position) inside your recyclerview's adapter, yeah?
issue confirmed, this is the method (inside my own adapter) that I use for item addition:
public void add(@NonNull Entry entry) {
data.add(entry);
Collections.sort(data);
int index = data.indexOf(entry);
notifyItemInserted(index);
}
//the index is 0 in most cases, so the new item should appear on top of the list
Used with the ScaleInAnimationAdapter
the newly added item does not appear until I scroll down and then up again. Any ideas?
I'm seeing this issue as well. When I comment out the AnimationAdapters the UI bound to my dataset updates the single item just fine.
I am seeing the issue to with this library. Again, updates fine with my normal adapter
@bveenvliet @ashmosaheb
Please use the following
notifyItemChanged(int)
notifyItemInserted(int)
notifyItemRemoved(int)
notifyItemRangeChanged(int, int)
notifyItemRangeInserted(int, int)
notifyItemRangeRemoved(int, int)
If you want your animations to work, do not rely on calling notifyDataSetChanged()
;
as it is the RecyclerView's default behavior, animations are not triggered to start inside this method.
Item doesn't shown when load data from internet connection.
mAdapter = new RecyclerAdapter(listItem); AlphaInAnimationAdapter alphaAdapter = new AlphaInAnimationAdapter(mAdapter); ScaleInAnimationAdapter scaleAdapter = new ScaleInAnimationAdapter(alphaAdapter); mRecyclerView.setAdapter(scaleAdapter); LoadDataAsycnTask(); . .. ... listItem.addAll(objects); mAdapter.notifyDataSetChanged();