Skip to content

feat: Implement a sleep timer button to the currently playing screen#617

Merged
eddyizm merged 12 commits intoeddyizm:developmentfrom
CtznSniiips:development
May 9, 2026
Merged

feat: Implement a sleep timer button to the currently playing screen#617
eddyizm merged 12 commits intoeddyizm:developmentfrom
CtznSniiips:development

Conversation

@CtznSniiips
Copy link
Copy Markdown
Contributor

Adds a sleep timer to the now-playing screen. A new timer button sits in the bottom bar between the equalizer and queue buttons. Tapping it opens a dialog with preset durations — 5, 10, 15, 20, 30, 45, or 60 minutes — plus a "Custom…" option that accepts any number of minutes via a text input.

While the timer is counting down, the button turns accent-colored and a small countdown label (e.g. 4:37) appears beneath it. When the timer expires, playback pauses automatically. Tapping the button again while a timer is active shows the remaining time and offers a "Cancel Timer" button to stop it early.

Addresses #296

Screenshot_20260504-114226
Screenshot_20260504-114241
Screenshot_20260504-114208
Screenshot_20260504-114218

@CtznSniiips CtznSniiips marked this pull request as ready for review May 4, 2026 15:52
@CtznSniiips CtznSniiips changed the title Feature: Implement a sleep timer button to the currently playing screen feat: Implement a sleep timer button to the currently playing screen May 4, 2026
@tvillega
Copy link
Copy Markdown
Contributor

tvillega commented May 4, 2026

This is fantastic!

I want to add that the quick actions bar is also available in landscape. It is hidden by default but can be brought back by long-pressing the codec chip or the bitrate. Commenting it for tablet users that default to landscape view.

@CtznSniiips
Copy link
Copy Markdown
Contributor Author

I want to add that the quick actions bar is also available in landscape. It is hidden by default but can be brought back by long-pressing the codec chip or the bitrate. Commenting it for tablet users that default to landscape view.

Good to know, thanks!

@pLum0
Copy link
Copy Markdown

pLum0 commented May 6, 2026

great. Thanks for the PR 👍

In the same time I implemented a sleep-timer as well, but you were faster 🥇
You still might want to compare with my implementation: https://github.com/pLum0/tempus/tree/sleep-timer

I let my AI tool check the differences:

What PR 617 does better

  1. Placement in the bottom bar is more conventional for a sleep timer (matches other music apps)
  2. Visible countdown label right under the button — you can see remaining time at a glance without opening the dialog
  3. Custom minute input — more flexible for users who want non-preset values
  4. Proper constraint chain management — adjusts layout when equalizer is hidden/shown
  5. Simpler architecture — no service/BroadcastReceiver coupling, just a singleton + listener

What my version does better

  1. Process death survival — the PR's singleton is lost if Android kills the process
  2. End-of-track mode — very useful for "stop after this song"
  3. Fade-out — much better UX than an abrupt pause
  4. Full i18n — all 15 locales translated vs. English only
  5. Theme-aware icon — uses @color/titleTextColor instead of hardcoded black
  6. Localized duration labels (PR has hardcoded "5 minutes" strings)
    Recommendation

Both implementations have strengths. The ideal PR would combine:

So maybe we can merge the strengths of both implementations. What would you suggest ?

@CtznSniiips
Copy link
Copy Markdown
Contributor Author

Thanks for your feedback @pLum0. I implemented all except for translations - I'll leave that to the experts.

skajmer added a commit to skajmer/tempus-polish-translation that referenced this pull request May 8, 2026
@tvillega
Copy link
Copy Markdown
Contributor

tvillega commented May 8, 2026

Hey @CtznSniiips, our first batch of merges brought some conflicts to your PR. Once you solve them we will merge this as part of the second batch for a pre-release.

@CtznSniiips CtznSniiips marked this pull request as draft May 9, 2026 11:52
@CtznSniiips CtznSniiips marked this pull request as ready for review May 9, 2026 11:56
eddyizm pushed a commit that referenced this pull request May 9, 2026
* Add #576

* #570 (arrays.xml)

* #570 (strings.xml)

* Add #595

* for you

* Add #606

* Add #609

* Add #620 and rename replaygain

* typo

* Missing stuff

* Add #617

* Add #611

* Add #614 (strings.xml)

* Add #614 (arrays.xml)
@eddyizm eddyizm merged commit 1784173 into eddyizm:development May 9, 2026
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.

4 participants