Skip to content

Add a read aloud button to the comment listing - #1395

Open
MarkMad wants to merge 1 commit into
QuantumBadger:masterfrom
MarkMad:tts-upstream-pr-a
Open

MarkMad wants to merge 1 commit into
QuantumBadger:masterfrom
MarkMad:tts-upstream-pr-a

Conversation

@MarkMad

@MarkMad MarkMad commented Oct 23, 2026 •

Copy link
Copy Markdown

Adds a "Read aloud" button to the floating toolbar in the comment listing. It reads the post title, self text, and every expanded comment using the system text-to-speech engine, starting from the first visible item, and scrolls to each comment as it is read. Tapping the button again stops it, and leaving the screen stops it too.

This is a first, deliberately small step towards #1360. Things like a media notification, lockscreen controls, pause/resume, and skipping between comments are not included, and I'm happy to follow up with those separately if there's interest.

Details

  • NativeTTSManager is a small singleton wrapper around TextToSpeech. Text over the engine's maximum input length is split (without splitting surrogate pairs), and callbacks from a previous run are ignored after a stop or restart.
  • Engine initialization failures, unsupported languages, and speak() failures show an error toast instead of failing silently.
  • The manifest declares a TTS_SERVICE query. Without it, Android 11+ hides third-party engines from the app, and it quietly falls back to the Google engine instead of the user's chosen one.
  • New strings are English only.

Testing

  • Added NativeTTSManagerTest (18 tests, Robolectric with a fake engine) covering ordering, chunking, stale callbacks, error handling, and listener handling.
  • pmd checkstyle lint test all pass.
  • Tried manually on an Android 17 emulator (Google TTS) and on a Motorola edge 50 neo running Android 16 with a third-party engine: read-aloud starts, advances through comments in order, scrolls to each one, and stops from the button and when navigating back.

One thing you may notice: there is a short gap between items, because each item is only sent to the engine once the previous one finishes.

🤖 Generated with Claude Code

Reads the post title, self text, and expanded comments aloud using the
system text-to-speech engine, scrolling to each comment as it is read.
Starts from the first visible item, so the user can pick where to begin.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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