Skip to content

feat: add Quick Settings tile to start timer with last used duration#51

Open
Xitee1 wants to merge 1 commit into
mainfrom
claude/android-quick-settings-tile-nxvxre
Open

feat: add Quick Settings tile to start timer with last used duration#51
Xitee1 wants to merge 1 commit into
mainfrom
claude/android-quick-settings-tile-nxvxre

Conversation

@Xitee1

@Xitee1 Xitee1 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

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.

  • New SleepTimerTileService (:app, next to the other platform entry points): a Hilt-injected TileService that dispatches the existing ACTION_START / ACTION_CANCEL service contract.
  • Last used duration = the persisted UserSettings.presetMinutes, which the dial already writes on every commit — no new state or setting needed.
  • Tile behavior:
    • Idle → inactive tile, subtitle shows the preset (e.g. "15 min"); tap starts the timer via startForegroundService.
    • Running → active tile, subtitle shows remaining minutes (updates live while the panel is open by observing the in-process TimerRepository StateFlow); tap cancels, mirroring the notification's Cancel action.
    • Fading out → active tile with a "Fading out" subtitle; tap cancels (restores volume via the service's existing cancel path).
  • If a cancel tap races the countdown's natural expiry, the service's existing stale-intent guard turns it into a clean stopSelf — no ForegroundServiceDidNotStartInTimeException.
  • Tile label/subtitle strings are localized in both values/ and values-de/.

Testing

  • CI (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

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
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