Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 21, 2025

This PR implements two highly requested features for the V2er Android app to enhance the topic discussion experience.

Reply Sorting by Popularity

Users can now sort replies by the number of thanks (感谢) received, making it easier to find the most appreciated responses. A new sort menu item toggles between:

  • 按时间排序 (Sort by time) - Default chronological ordering
  • 按热门排序 (Sort by popularity) - Ordered by thanks count descending

The sorting preference is automatically saved and restored across app sessions. Sorting happens locally without requiring a network reload, providing instant feedback.

Threaded Reply Support (楼中楼)

The app now automatically detects and visually represents reply relationships through @mentions:

  • Parses both @username and @<a href="/member/username">username</a> formats
  • Applies progressive indentation (up to 3 levels) to show conversation threads
  • Adds a 💬 emoji indicator to the floor number for threaded replies
  • Uses subtle background styling to distinguish threaded conversations

For example:

1楼 alice                   ♥ 5
    Original question...

2楼 bob                     ♥ 3
    First response...

    3楼 charlie 💬           ♥ 1
        @bob Good point!
        [Visually indented with background]

Technical Implementation

The implementation follows the existing MVP architecture and coding patterns:

  • Extended TopicInfo.getItems() with a ReplySortMode parameter for sorting control
  • Added mention parsing logic with regex support for V2EX's HTML format
  • Enhanced TopicReplyItemDelegate to apply visual threading through margin and background styling
  • Integrated with the existing preference system for state persistence
  • Added comprehensive unit tests for mention parsing and threading logic

The changes are minimal and surgical, maintaining compatibility with existing functionality while adding the new features seamlessly.

Fixes #41.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=512m --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/gradle-daemon-main-8.13.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/agents/gradle-instrumentation-agent-8.13.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.13 (dns block)
  • maven.aliyun.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=512m --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/gradle-daemon-main-8.13.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/agents/gradle-instrumentation-agent-8.13.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.13 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits September 21, 2025 06:27
Co-authored-by: graycreate <5203798+graycreate@users.noreply.github.com>
… reply features

Co-authored-by: graycreate <5203798+graycreate@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 评论可以加个按热门程度显示不 Add reply sorting by popularity and threaded reply support (楼中楼) Sep 21, 2025
@Copilot Copilot AI requested a review from graycreate September 21, 2025 06:33
Copilot finished work on behalf of graycreate September 21, 2025 06:33
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