Repository navigation
Add a home screen audio player widget - #4000
Open
AhmedEljanady wants to merge 1 commit into
Open
AhmedEljanady wants to merge 1 commit into
AhmedEljanady wants to merge 1 commit into
Conversation
Adds a configurable "Quran Audio Player" widget that plays a chosen range of verses with a chosen reciter, repeat count, and playback speed. Each widget keeps its own settings, and the widget shows the title, reciter, and live playback status with previous, play/pause, and next controls. Widget playback is independent of the reader: while a widget is playing, the reader is not sent its playback status, so it does not highlight ayahs, change pages, update the last read position, or show the audio bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidde
6D9B
n Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3999
What this adds
A "Quran Audio Player" home screen widget that plays a chosen range of verses with a chosen reciter, independently of the reader.
Settings: adding the widget opens
AudioWidgetConfigureActivity. It offers:Cancelling removes the widget. Tapping the widget's text reopens the settings, since the widget is
reconfigurable.Several widgets: settings are stored per
appWidgetIdin their own preferences file and removed when the widget is deleted.Layout: a single row, 4×1 by default and resizable. It shows an app icon that opens the app, the title (or the sura name), the reciter, the live status (Loading / Playing / Paused with the current ayah), and Previous / Play-Pause / Next.
Preview: a
previewLayoutfor Android 12+ and apreviewImagefor older versions.Translations: the widget strings are added in all 28 languages the app ships.
Keeping the reader separate
The reader's ayah highlighting, page following and audio bar all come from
AudioStatusRepository.AudioServicekeeps the widget's id. Until something else starts playback, it publishesAudioStatus.Stoppedto the repository and sends the real status only to the widget, throughAudioWidgetUpdater.Related changes in
AudioService:ACTION_WIDGET_PLAYBACKbuilds theAudioRequestfrom the widget's saved settings inAudioWidgetRequestFactory.QuranActivitysendsACTION_STOPon resume to clean up leftover playback. It now passesEXTRA_KEEP_WIDGET_PLAYBACK, so opening the app doesn't stop the widget's audio. The notification's Stop button still stops it.Testing
Manually on an Android 16 emulator (Pixel 9 Pro XL):
Automated:
AudioWidgetPreferencesTest(Robolectric) covers round-tripping settings, isolation between widgets, reconfiguring, and deleting one widget without touching another, for example ids 1 and 11.assembleMadaniDebugandlintMadaniDebugpass.Screenshots
Notes for review
layoutDirection="ltr"), like other media players.android:tintis kept on the widget's buttons, withUseAppTintsuppressed, becauseapp:tintdoesn't work inRemoteViews.🤖 Generated with Claude Code