question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't call notifyItemChanged(position) to trigger revert swipe

See original GitHub issue

As mentioned here https://stackoverflow.com/questions/31787272/android-recyclerview-itemtouchhelper-revert-swipe-and-restore-view-holder

probably the only way to trigger revert swipe animation is to call notifyItemChanged on your adapter directly. The problem is that this is not possible with epoxy since you get java.lang.IllegalStateException: You cannot notify item changes directly. Call requestModelBuild instead.

The issue is that requestModelBuild doesn’t trigger redraw since the backing model didn’t really change.

Here is the link to the exact place where I need to use notifyItemChanged but can’t https://github.com/toggl/android/blob/5e0c1882ab3ebcba4c7f83486168e300653cbd59/timer/src/main/java/com/toggl/timer/log/ui/TimeEntriesLogFragment.kt#L138

Do you have some workaround for this? Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
elihartcommented, Oct 30, 2020

It has not been released yet, I’ll try to make a new release soon

0reactions
Gelaciocommented, Feb 5, 2021

@elihart Calling notifyItemChanged(position) for PagedListEpoxyController to revert the swipe action is not working. Neither submitting a new page list with the swiped item changed in the data source.

Any idea to revert swipe action for PagedListEpoxyController? Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android RecyclerView ItemTouchHelper revert swipe and ...
Call notifyItemChanged on you adapter. This will make the swiped out view animate back into it's original position.
Read more >
Using the RecyclerView | CodePath Android Cliffnotes
A layout manager positions item views inside a RecyclerView and determines when to reuse item views that are no longer visible to the...
Read more >
Android Swipe to Delete RecyclerView items with UNDU
This class is used to create a swipe to delete the items of RecyclerView. ... this will redraw row in "undo" state; notifyItemChanged(position);;...
Read more >
Step by Step: RecyclerView Swipe to Delete and Undo - Medium
Snackbar : This is triggered once an item is deleted and gives the user the option to undo the delete. Step 1: ItemTouchHelper.SimpleCallback....
Read more >
Paging Library for Android With Kotlin: Creating Infinite Lists
Start by downloading the materials for this tutorial using the Download ... you call bindPost(redditPost) with the post at that position.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found