Skip to content

Fix RecyclerView Inconsistency Crash in NovelReviewListActivity#169

Open
MewX wants to merge 2 commits intomasterfrom
fix-recyclerview-inconsistency-novelreviewlist-9747062809248964075
Open

Fix RecyclerView Inconsistency Crash in NovelReviewListActivity#169
MewX wants to merge 2 commits intomasterfrom
fix-recyclerview-inconsistency-novelreviewlist-9747062809248964075

Conversation

@MewX
Copy link
Owner

@MewX MewX commented Feb 7, 2026

Fixed IndexOutOfBoundsException: Inconsistency detected crash in NovelReviewListActivity.
The crash was caused by Wenku8Parser.parseReviewList modifying the ReviewList (which backs the RecyclerView adapter) on a background thread while the RecyclerView was layouting/scrolling on the main thread.
Additionally, the adapter was notified incorrectly using notifyItemRangeChanged even when items were added.

Changes:

  1. Modified Wenku8Parser.parseReviewList to be a pure function that returns a new ReviewList object instead of modifying the passed instance.
  2. Updated AsyncReviewListLoader in NovelReviewListActivity:
    • Changed doInBackground to return the parsed ReviewList.
    • Changed onPostExecute to update the main reviewList and notify the adapter on the main thread.
    • Used notifyDataSetChanged for full reloads and notifyItemRangeInserted for appending items.
    • Added isReload flag to handle logic for pull-to-refresh vs load-more correctly.
  3. Updated reloadAllReviews to use the new loader logic without clearing the list prematurely.

PR created automatically by Jules for task 9747062809248964075 started by @MewX

…lerView inconsistency.

- Refactor `Wenku8Parser.parseReviewList` to return a new `ReviewList` instead of modifying the argument, ensuring thread safety.
- Update `NovelReviewListActivity.AsyncReviewListLoader` to perform parsing in `doInBackground` and update the UI (and backing list) in `onPostExecute`.
- Properly use `notifyDataSetChanged` for reload and `notifyItemRangeInserted` for loading more items, preventing `Inconsistency detected` crashes.
- Improve UX by not clearing the list immediately on reload, preventing flickering.

Co-authored-by: MewX <[email protected]>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted.

Base automatically changed from v1.26 to master February 20, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant