Skip to content

Conversation

@graycreate
Copy link
Member

Summary

Problem

When scrolling through posts in the topic detail page, the font styles (bold, italic, links) would randomly appear on text that shouldn't have them. This was caused by RecyclerView's view recycling mechanism where previously styled TextViews weren't properly cleared before reuse.

Solution

Added explicit clearing of TextView content and movement method before applying new RichText content across all adapters that use RichText rendering:

  • TopicReplyItemDelegate: Clear reply content TextView before rendering
  • SearchModule: Clear search result content before applying RichText
  • UserHomeModule: Clear reply content TextView in user profile
  • MsgModule: Clear notification content TextView

Testing

  • ✅ Built debug APK successfully
  • ✅ Lint checks passed
  • ✅ No compilation errors

Fixes

Closes #120

🤖 Generated with Claude Code

…#120)

Clear TextView content and movement method before applying RichText to prevent
style persistence issues when views are recycled during scrolling.

This fix addresses the font style changing problem reported in issue #120 where
text formatting would randomly change when scrolling through topic replies.

Fixed adapters:
- TopicReplyItemDelegate: Clear reply content TextView before rendering
- SearchModule: Clear search result content before applying RichText
- UserHomeModule: Clear reply content TextView in user profile
- MsgModule: Clear notification content TextView

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 20, 2025 02:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a font style persistence issue in RecyclerView where text formatting (bold, italic, links) would randomly appear on inappropriate text when scrolling through lists. The fix ensures proper clearing of TextView content and movement methods before applying new RichText content to prevent style carryover during view recycling.

  • Adds explicit clearing of TextView content and movement methods before RichText rendering
  • Applies the fix consistently across all adapters that use RichText rendering
  • Prevents recycled views from carrying over styling from previously displayed content

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
TopicReplyItemDelegate.java Clears reply content TextView before rendering and when hiding content
UserHomeModule.java Clears reply content TextView in user profile before applying RichText
SearchModule.java Clears search result content TextView before RichText rendering
MsgModule.java Clears notification content TextView before and after RichText application
Comments suppressed due to low confidence (1)

app/src/main/java/me/ghui/v2er/module/topic/TopicReplyItemDelegate.java:74

  • The line contentView = holder.getView(R.id.content_tv); was removed but this assignment appears to be necessary since contentView is used in subsequent lines. Without this assignment, the clearing operations and RichText rendering will operate on the wrong TextView reference.
        TextView contentView = holder.getView(R.id.content_tv);

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@graycreate graycreate closed this Sep 20, 2025
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.

部分帖子详情页面,上下滑动页面时,帖子内容字体样式会变动

2 participants