androidessence / RecyclerViewCursorAdapter

A library that allows you to use a CursorAdapter as the underlying data source for a RecyclerView.Adapter so that it can be used with a CursorLoader as was previously possible using the ListView.
Apache License 2.0
58 stars 16 forks source link

Insert and remove animations do not work #2

Open opus1269 opened 8 years ago

opus1269 commented 8 years ago

Very clean library, thanks!

The call to notifyDataSetChanged interrupts the default onSwipe animations in RecyclerView

   /**
     * Swap the Cursor of the CursorAdapter and notify the RecyclerView.Adapter that data has
     * changed.
     * @param cursor The new Cursor representation of the data to be displayed.
     */
    public void swapCursor(Cursor cursor) {
        this.mCursorAdapter.swapCursor(cursor);
        notifyDataSetChanged();
    }

I was able to get it working using guidance from the answer in this post:

http://stackoverflow.com/questions/31697083/recycler-view-add-remove-item-animations-not-showing-in-swapcursor

No modifications of your library are needed, but it might be good to provide info. on this in the documentation and maybe a sample that implements swipe.

AdamMc331 commented 8 years ago

Thanks for the input! I will look into this. I can probably adjust the library to set the stable ids inside the adapter so users of the library don't have to worry about it, but as you said I should make a sample because there is nothing I can do for setHasFixedSize(), the users will have to set that.