feat: add Quick Settings tile to start timer with last used duration - #51
Open
Xitee1 wants to merge 4 commits into
Open
feat: add Quick Settings tile to start timer with last used duration#51Xitee1 wants to merge 4 commits into
Xitee1 wants to merge 4 commits into
Conversation
Adds a Quick Settings tile that starts the sleep timer with the persisted preset (the last dial-committed duration) directly from the QS panel, without opening the app. While a timer is running the tile shows the remaining minutes and a tap cancels it, mirroring the notification's Cancel action. The tile observes the in-process TimerRepository StateFlow while the panel is open, so it stays in sync with the foreground service tick. Tile strings are localized in both en and de. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4QRUoCmfQgD6xgUE9Phn
…settings-tile-nxvxre # Conflicts: # app/src/main/AndroidManifest.xml
Rebuild the tap path: onClick now starts the service synchronously from the preset cached by the listening collector, with an in-flight flag against double-taps — no more cancellable DataStore read racing the tile's destruction and the tap's FGS start exemption. Add SleepTimerService.intent()/start()/cancel() companion helpers so all five dispatch surfaces share one intent shape and start() owns the ForegroundServiceStartNotAllowedException catch; drop the hand-rolled builders in the tile, widget provider/renderer, notification manager, and TimerViewModel. Make cancelTimer's teardown NonCancellable so a second ACTION_CANCEL tripping the stale-intent guard can no longer strand a phantom running phase before the volume restore and IDLE write. Fold the status into tile.label below API 29 (no subtitle there), reuse app_name and widget_minutes instead of tile-private duplicates, document that lock-screen tapping is deliberate, and correct the stale doc comments. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An ACTION_QS_TILE_PREFERENCES intent filter on MainActivity makes the system launch the app for the tile's long-press action; without one it falls back to the App-info screen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 hidden 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.
Summary
Adds an Android Quick Settings tile that starts the sleep timer with the last used duration directly from the QS panel, without opening the app.
SleepTimerTileService(:app, next to the other platform entry points): a Hilt-injectedTileServicethat dispatches the existingACTION_START/ACTION_CANCELservice contract.UserSettings.presetMinutes, which the dial already writes on every commit — no new state or setting needed.startForegroundService.TimerRepositoryStateFlow); tap cancels, mirroring the notification's Cancel action.stopSelf— noForegroundServiceDidNotStartInTimeException.values/andvalues-de/.Testing
assembleDebug+lint) verifies the build — no Android SDK was available in the sandbox for a local build.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kk4QRUoCmfQgD6xgUE9Phn
Generated by Claude Code