Skip to content

fix(player): respect user defined auto-hide delay and add Never option - #255

Open
sonnayasomnambula wants to merge 13 commits into
Aryan447:mainfrom
sonnayasomnambula:fix-time-disappear
Open

sonnayasomnambula wants to merge 13 commits into
Aryan447:mainfrom
sonnayasomnambula:fix-time-disappear

Conversation

@sonnayasomnambula

@sonnayasomnambula sonnayasomnambula commented Dec 1, 2026 •

Copy link
Copy Markdown

Summary

  • Fixed: Player controls auto-hide delay setting is now respected across all layouts (Modern, Classic, TV) instead of using hardcoded timeouts.
  • Added: Simplified auto-hide delay options to Default, Never, and Custom (with Default as the new default value).
  • Cleanup: Moved hardcoded strings in the auto-hide timeout dialog/preferences to strings.xml resources.

Tested on

Samsung Galaxy Z Flip 5 (Android 16 / One UI 8.0)

Summary by Sourcery

Let users choose when player controls auto-hide, including keeping them visible until manually hidden.

New Features:

  • Add a controls auto-hide delay setting with Default, Never, and adjustable custom delays up to 30 seconds.

Bug Fixes:

  • Make Modern and TV player layouts respect the configured auto-hide delay; Classic retains its configured delay behavior.

Enhancements:

  • Move the setting from Appearance to Behavior and update preference search terms to reflect the delay and Never option.

Documentation:

  • Add changelog entries describing the controls auto-hide delay setting and layout behavior.

Chores:

  • Add English and Russian strings for the behavior setting and its delay labels.

@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Define the shared auto-hide delay sentinel values, valid slider range, and layout-specific defaults used by preferences and playback behavior.

  • app/src/main/java/app/aryan447/mpvium/domain/player/ControlsHideDelay.kt L1-20

Implementation

Use the shared delay values to resolve Default per layout, preserve the locked-controls timeout, and leave controls visible for Never.

  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt L304-316 (+19 small edits)

UI

Replace the old timeout choices and custom-entry dialog with a slider for Default, Never, and custom delays, and move the preference into Behavior.

  • app/src/main/java/app/aryan447/mpvium/ui/preferences/PlayerControlsPreferencesScreen.kt L66-69, L389-461 (+11 small edits)
  • app/src/main/res/values-ru/strings.xml L622-626
  • app/src/main/res/values/strings.xml L637-641

Rename the searchable preference key to its Behavior location and include delay and Never-related search terms.

  • app/src/main/java/app/aryan447/mpvium/ui/preferences/SearchablePreference.kt L220-223

Documentation

Record the new delay selector and the layouts' adherence to the configured auto-hide delay in the unreleased changelog.

  • UNRELEASED.md L3-4, L14-15

Other changes

Files not grouped.

  • app/src/main/java/app/aryan447/mpvium/preferences/PlayerPreferences.kt L4, L64

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 6 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt" line_range="328" />
<code_context>
+          isModern -> ControlsDisappearTimeout.Defaults.MODERN
+          else -> ControlsDisappearTimeout.Defaults.CLASSIC
+        }
+        else -> playerTimeToDisappear // or user pref
+      }
+
</code_context>
<issue_to_address>
**Changed delay leaves old timer active**

When the auto-hide preference changes while controls are shown and the effect is running, `LaunchedEffect` reads `playerTimeToDisappear` without using it as a key, so the active timer is not canceled or restarted; controls hide according to the old delay, or a timer does not start when changing from Never to a timed option.

Add `playerTimeToDisappear` to the `LaunchedEffect` keys so preference changes cancel and recalculate the timer.
</issue_to_address>

### Comment 2
<location path="app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt" line_range="321" />
<code_context>
-        isTv -> 5000L
-        isModern -> 2500L
-        else -> playerTimeToDisappear.toLong()
+        areControlsLocked -> ControlsDisappearTimeout.Defaults.LOCKED
+        playerTimeToDisappear == ControlsDisappearTimeout.NEVER -> 0
+        playerTimeToDisappear == ControlsDisappearTimeout.DEFAULT -> when {
</code_context>
<issue_to_address>
**Never still hides locked controls**

When controls are locked during playback and Never is selected, `areControlsLocked` selects the locked timeout before the Never check, so `hideControls()` runs after two seconds and the controls disappear despite the user's setting.

Check for Never before selecting the locked-controls timeout.

Also at `app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt:322`.
</issue_to_address>

### Comment 3
<location path="app/src/main/java/app/aryan447/mpvium/domain/player/ControlsDisappearTimeout.kt" line_range="8" />
<code_context>
+  const val NEVER = 0
+
+  object Constraints {
+    const val MIN = 500
+    const val MAX = 1000000000000
+  }
</code_context>
<issue_to_address>
**Saved short delays no longer hide controls**

When an installation has a saved custom delay between 100 and 499 ms, the new 500 ms minimum excludes these previously accepted values, so `PlayerControls` skips both `delay` and `hideControls()` and the controls remain visible.

Allow existing 100–499 ms delays through the runtime check, or migrate them to a valid delay before applying the check.

Also at `app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt:331`.
</issue_to_address>

### Comment 4
<location path="app/src/main/java/app/aryan447/mpvium/ui/preferences/PlayerControlsPreferencesScreen.kt" line_range="422" />
<code_context>
+                    AutoHideOption.Never -> playerPrefs.playerTimeToDisappear.set(ControlsDisappearTimeout.NEVER)
+                    AutoHideOption.Custom -> {
+                      if (playerTimeToDisappear >= ControlsDisappearTimeout.Constraints.MIN) {
+                        playerTimeToDisappear.toString()
+                      } else {
+                        ControlsDisappearTimeout.Defaults.CLASSIC
</code_context>
<issue_to_address>
**Custom delay field loses its value**

When the user selects Custom, the Custom branch evaluates the saved delay or fallback but never assigns it to `customTimeValue`, so the dialog opens blank or retains a canceled draft; users must re-enter the configured value to edit it.

Assign the saved delay or fallback to `customTimeValue` whenever Custom is selected.
</issue_to_address>

### Comment 5
<location path="app/src/main/res/values/strings.xml" line_range="635" />
<code_context>
   <string name="swap_the_volume_and_brightness_slider">Swap volume and brightness slider</string>
   <string name="pref_player_display_reduce_player_animation">Reduce player animation</string>
-  <string name="pref_player_display_hide_player_control_time">Hide player control time</string>
+  <string name="pref_player_display_hide_player_control_time">Controls auto-hide delay</string>
   <string name="show_splash_ovals_on_double_tap_to_seek">Show ripple when double tap seeking</string>
   <string name="show_time_on_double_tap_to_seek">Show seek time</string>
</code_context>
<issue_to_address>
**Localized label describes wrong setting**

When the app is displayed in a locale other than English or Russian, users selecting one of the other translated resources still see wording about hiding the time on player controls, so the label misdescribes the new auto-hide-delay preference.

Update the corresponding translated `pref_player_display_hide_player_control_time` strings to describe the controls auto-hide delay.
</issue_to_address>

### Comment 6
<location path="app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt" line_range="328" />
<code_context>
+          isModern -> ControlsDisappearTimeout.Defaults.MODERN
+          else -> ControlsDisappearTimeout.Defaults.CLASSIC
+        }
+        else -> playerTimeToDisappear // or user pref
+      }
+
</code_context>
<issue_to_address>
**Release changelog stays stale**

When this user-visible auto-hide behavior is introduced, the new auto-hide behavior is recorded in `UNRELEASED.md` but not `CHANGELOG.md`, so the required corresponding entry in the source-of-truth release notes is missing.

Add corresponding user-facing notes to `CHANGELOG.md` in the same change.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 4 findings to address first, and choosing Never stores 0 in the existing preference, and that value survives an app rollback; the old implementation interprets it as a zero-delay hide, so controls may disappear until the user changes the setting. The effect is limited to this preference and is repairable in the settings.

Blocking findings: app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt:328, app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt:321, app/src/main/java/app/aryan447/mpvium/domain/player/ControlsDisappearTimeout.kt:8, app/src/main/java/app/aryan447/mpvium/ui/preferences/PlayerControlsPreferencesScreen.kt:422


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread app/src/main/res/values/strings.xml Resolved
@sonnayasomnambula

Copy link
Copy Markdown
Author

My first impulse was simply to remove the hardcoded constants — it felt confusing when my custom setting was silently ignored. However, after 1.6 was released and I gave it a bit more thought, I came up with what I hope is a cleaner approach that aligns well with the "Sane defaults, pro-level control" motto.

Please review this PR carefully — Kotlin isn't really my "native" language, and Android/Gradle aren't quite my home turf either. Let me know if any packages, enums, or constants are placed in an inappropriate location or need better naming.

@Aryan447

Aryan447 commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR! A few small notes before merging:

  1. Typo in values-ru/strings.xml: милисекундах -> миллисекундах.
  2. Custom dialog validation: Raising the minimum to 500 ms means entering something like 200 (or an empty/overflowing value) makes the OK button silently do nothing. Could we show an error/supporting text (>= 500 ms) or disable OK when invalid?
  3. TV / D-Pad UX: Dropping all numeric presets in favor of only Default / Never / Custom means TV users have to type milliseconds with an on-screen keyboard if they want anything other than 5s or Never. Would it make sense to keep a couple of quick presets (e.g., 2s, 3s, 5s, 10s), or was removing them intentional?
  4. Nit: UNRELEASED.md can mention both Modern and TV layouts in the Fixed line since TV also previously ignored the setting.

@sonnayasomnambula

sonnayasomnambula commented Dec 2, 2026 •

Copy link
Copy Markdown
Author

I removed the presets to keep the list clean, though I see nothing wrong with bringing back a reasonable number of them. That would be the simplest solution.

Another option is to keep just Default, Never, and Custom, and use a Slider instead of OutlinedTextField on TV layouts, capped within reasonable bounds. I tried 500..30000 with a 500 step and actually really liked how it works. I didn't bother fighting vertical icon alignment and just removed the icon.

Screenshot_20261202_092850_mpvium

The only open question is whether I can cap Constraints.MAX at 30000 for all layouts, or if that's too restrictive for Classic/Modern layouts and we need to complicate the validation logic with a separate Constraints.MAX_TV.

A custom-made spinbox feels like overengineering for a single field in the entire app. Even an initial draft shows it would take more time than I expected and need extra testing across different devices. Still, that option is on the table too — I can test it on a TV Box, a tablet, and even an Android car head unit.

Screenshot_20261202_102805_mpvium

Which option do you think works best?

@Aryan447

Aryan447 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

The slider looks better, yes — it's much easier to hit a value on a TV remote than a numeric keyboard, and dropping the icon in favour of a clean row helps too. Let's go with it.

Two things:

  1. Add a reset. Next to the slider, a small "Reset" (or a restart icon) that drops the preference back to Default — i.e. writes the DEFAULT sentinel, not a hardcoded number, so it keeps following the per-layout values (2.5s Modern, 4s Classic, 5s TV). That gives users a way out of a custom value without guessing what the original was, and it's a good argument for keeping the list preset-free.
  2. The slider should show it's on Default. When the option is Default, show the resolved value for the current layout in the summary (e.g. "Default (4s)"), otherwise a reset feels like it does nothing visible.

On the cap: keep a single Constraints.MAX = 30000 for all layouts — no need for a separate MAX_TV. A minute of auto-hide is plenty anywhere, and anyone who genuinely wants controls to stay forever has Never, which is clearer than a 10-minute timeout. The spinbox is overengineering for one field; skip it.

One bonus of the slider: the 500 ms floor is enforced by the control itself, so the earlier problem of the OK button silently doing nothing on an invalid value goes away with it.

@sonnayasomnambula

Copy link
Copy Markdown
Author

That actually works cleanly as a single inline slider instead of a 3-option picker + a dialog with a text field, OK, and Cancel, if we start the range at 0 (0..30000, step 500):

  • 0 resolves to Never
  • Reset writes the DEFAULT sentinel and shows Default (2.5s) / Default (4s) / Default (5s) based on the active layout
  • Any other step (500..30000) sets a custom timeout

One quick question: should we use this inline slider for TV only (keeping the picker + dialog for Modern/Classic), or replace the setting with this slider across all layouts?

@Aryan447

Aryan447 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Slider everywhere — one code path, one behaviour to test, one set of strings. Keeping the picker + dialog for Modern/Classic means two UIs that drift apart, and the dialog isn't better on a phone anyway: any non-preset value already costs a tap, a keyboard, and an OK. The slider reads fine on touch too, so there's no reason to split it.

Two things to keep in mind with 0..30000:

  1. Thumb position on Default. The stored value stays the DEFAULT sentinel, so resolve it to the layout default purely for display (thumb at 4s on Classic) and label it Default (4s). The summary is what tells the user they're on Default — otherwise a reset looks like it did nothing.
  2. 0 = Never deserves a hint, since it's the one value that changes player behaviour rather than just the timing. The summary saying Never covers it, but don't leave the thumb at 0 looking like "hides instantly".

Either way, the 500 ms floor and the silent-OK problem both fall out with the slider — only clamping is left, and the control does that.

One more thing — are you around anywhere else, like Discord, Telegram, or email? A lot of this would be faster to hash out in chat than in comment rounds, and I'd rather have you reachable while the slider and the reset land.

@sonnayasomnambula

Copy link
Copy Markdown
Author

Thanks for the invite — it's very flattering, though I feel more comfortable communicating here, where I always have time to think things through. The first idea isn't always the best one, which this thread itself shows pretty clearly. Even right now: I'm mostly ready to update the PR, but I want to test the build at home first. For instance, I'm not sure the Reset button should be placed to the right of the slider — would a D-Pad even be able to focus it when pressing right adjusts the slider?

@Aryan447

Aryan447 commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Completely fair — keeping everything here on GitHub works great, and you're right that taking the time to think it through led
to a much cleaner design.

Good catch on the Reset placement too. In Compose Material 3, a focused Slider consumes DirectionLeft / DirectionRight to scrub
its value, so putting Reset to the right of the slider would indeed make it awkward or impossible to reach with a D-Pad.

Putting the Reset button above or below the slider instead (for example, right-aligned in the title/summary row above the
slider, or in a row below it) avoids that completely — DirectionUp / DirectionDown will move focus cleanly between Reset and
the slider without fighting horizontal scrubbing.

Take your time testing on your devices at home, and just ping when you've pushed the update!

@sonnayasomnambula

sonnayasomnambula commented Dec 5, 2026 •

Copy link
Copy Markdown
Author

Hi @Aryan447!
I've updated the PR with the current changes.

Keyword search and navigation to the target section work — I've tested this on both mobile and TV. As a side note, the highlighting effect in the light theme is so subtle that I initially thought I had broken the indices and rushed to dig into the code responsible for it. Then it occurred to me to temporarily modify SettingsHighlight.kt, and I confirmed everything actually works. I only realized later that it's perfectly visible in the dark theme (yeah, I didn't immediately think to check both).

I fixed the indices for the TV layout on the screen I was working on. I didn't touch the other screens so as not to delay or clutter the PR. I can already see a couple of spots that need fixing in PlayerPreferencesScreen.kt, and there might be more. I should probably look through the source code more closely and open an issue for this - I'll definitely do that as soon as I have some free time.

A couple of things I also noticed:

  • The search engine can return preferences that aren't actually present in the current player layout. This seems to be a consequence of how the search registry and conditional Composable layout work together.
  • SearchablePreference.keywords are not localized. Search in other languages still works via localized titles alone, though I'm sure you know this better than I do.

Neither of these two points seems significant enough to open a separate issue for at this stage, but I still wanted to share them.

P.S. Sorry for the noisy import changes.
P.P.S. Noticed a couple of merge commits - thanks for resolving the conflicts for me.

@sonnayasomnambula

Copy link
Copy Markdown
Author
Screenshot_20261205_071825_mpvium

@Aryan447

Aryan447 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Looks really clean — the slider + Reset button below it works nicely, and the screenshot looks great!

Thanks for keeping the PR focused by only fixing the TV highlight indices on PlayerControlsPreferencesScreen.kt. Whenever you get a chance to file an issue for PlayerPreferencesScreen.kt (and any other screens you spot), that'd be super helpful.

Good catches on the rest too:

  • Light theme highlight: Fair point on SettingsHighlight.kt being too subtle in light mode — that's definitely worth tuning separately so it's actually noticeable there.
  • Search registry / keywords: Agreed those two aren't blockers right now, though filtering search results by active layout or localizing keywords is good to keep in mind for later.

No worries at all on the imports or merge conflicts. Once the CI checks finish up, I'll take a final look and get this merged!

…lt (Aryan447#264)

Previously users could only toggle the dark gradient vignette on or off behind player controls.

Replace the vignette switch with a 3-way Controls backdrop setting (Blur, Vignette, Off, defaulting to Blur) that renders a TextureView video surface inside Compose on Android 13+ with BlurRadiusSpec progressive blur behind the top and bottom controls while keeping SurfaceView for Vignette, Off, and Android 8-12. Unmeasured.
Android system media volume typically jumps in ~6-7% steps (e.g. 53% to 60% on 15-step devices), leaving no way to dial intermediate levels.

Add an opt-in Precise volume toggle (off by default) under Player -> Gestures that maps 1% touch-gesture targets to the ceiling system step plus mpv software volume attenuation (1..100), while hardware volume buttons continue snapping directly to system volume steps.

Unmeasured
…ing (Aryan447#271)

* feat(app): add LAN companion remote, handoff, and cross-device streaming

Add local-network Companion Mode so a phone can control a tablet or TV on the same Wi-Fi/LAN, browse and stream titles in both directions, and hand off playback at the exact timestamp.

Uses Android NSD (_mpvium._tcp.), NanoHTTPD with Range 206 streaming and SSE state updates, 4-digit PIN pairing, a haptic jog wheel and gesture touchpad, second-screen track/subtitle/MediaInfo/Anime4K controls, URL throwing, and Late-Night Private Audio.

* fix(app): resolve Compose TV modifier and mpv command signatures in companion UI

* fix(app): use existing R.string.close in CompanionScreen

This branch has not been deployed

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