I want to implement swipeable items in my recycler view.
I'm using a custom recycler adapter populated with a Loader (Github link here) and a custom listener for swipe (Github link here).
Data is stored locally with a SQLite and retrieved with a call to a filtered Cursor.
I think I'm doing something wrong with the implementations, because what happens when I try to swipe is that my recycler item get like "flashed" for a very short time and then disappear.
Everything works fine except for this strange behavior.
This is my method for delete the item from the database:
public void swipeItem(int position) {
mDatabase.open();
String cursor_string = recyclerFilter.getText().toString();
final Cursor filterCursor = mDatabase.fetchVisible(cursor_string);
filterCursor.moveToPosition(position);
int pID = filterCursor.getColumnIndex("_id");
final String iD = filterCursor.getString(pID);
mDatabase.deleteItem(iD);
getLoaderManager().restartLoader(MAIN_LOADER_ID, null, mCallbacks);
}
I think that this flash is due to the fact that the animation performs faster than the swipeItem(position) method, but I'm not really sure about it.
At this point, any help would be very very appreciated, thanks in advance.