Skip to content

feat(android): polish foldable details and player UI - #190

Merged
Quick104 merged 4 commits into
mainfrom
codex/foldable-detail-player-polish
Aug 7, 2026
Merged

Quick104 merged 4 commits into
mainfrom
codex/foldable-detail-player-polish

Conversation

@Quick104

@Quick104 Quick104 commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add adaptive expanded detail heroes for movies, series, and episodes, using stable season/series portrait artwork on episode pages
  • add a shared swipeable season/episode pager with route-scoped episode caching and automatic season-chip following
  • add vendor-neutral tabletop playback through Jetpack WindowManager, with hinge-aware video/control panes, improved progress controls, volume and brightness controls, and compact-layout fallbacks
  • redesign player chapters, tracks, settings, subtitle, quality, timer, stats, and translation sheets for regular phones and tabletop lower panes; unfolded settings use a left-side category rail
  • reduce unfolded Home loading jank by deferring only newly completed non-memory-cached artwork presentation during active vertical motion
  • consolidate shared player-sheet configuration, artwork state, adaptive control slots, and playback-speed formatting

Why

Foldable devices need layouts that react to window posture and available panes rather than Samsung-specific APIs or fixed screen assumptions. The existing detail and player surfaces also performed avoidable relayout/draw work while artwork loaded, and player sheets could expand across the hinge.

User impact

  • season swipes remain responsive and reuse already loaded episode lists
  • the focused season stays visible on compact cover screens
  • episode details use portrait season/series artwork without poster layout shifts
  • tabletop playback keeps video above the fold and reachable controls below it across WindowManager-compatible foldables
  • brightness remains available even in compact tabletop panes
  • cached Home posters remain immediate, while new poster presentation waits until vertical scrolling settles

Validation

  • git diff origin/main...HEAD --check
  • :androidApp:testDebugUnitTest --tests org.siloserver.silo.android.ui.screens.player.FoldablePlayerPostureTest --tests org.siloserver.silo.android.ui.screens.player.PlayerVerticalDragModeTest --tests org.siloserver.silo.android.ui.screens.detail.MobileDetailActionsSourceTest
  • focused Android compilation completed as part of the test task
  • two-axis review: 0 Standards findings, 0 Spec findings
  • iterative physical Fold QA with side-by-side debug build 220000044

Summary by CodeRabbit

  • New Features
    • Added adaptive detail pages with poster-focused layouts on larger screens.
    • Improved season and episode browsing with cached switching and animated navigation.
    • Added foldable/tabletop player layouts with dedicated video and control panes.
    • Redesigned player settings, tracks, chapters, and other sheets for responsive layouts.
    • Added tabletop playback controls, playback-speed selection, brightness adjustment, and next-episode support.
  • Improvements
    • Artwork now presents smoothly after scrolling stops.
    • Enhanced buffering feedback, accessibility, and remaining-time display.
    • Improved episode artwork selection, refresh behavior, and player controls.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f1fe25d5-afcc-4fd0-a48e-320f63d928e4

📥 Commits

Reviewing files that changed from the base of the PR and between 6fb9ca8 and 3e9bd36.

📒 Files selected for processing (1)
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSheetSupport.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSheetSupport.kt

📝 Walkthrough

Walkthrough

This change adds adaptive detail layouts, cached season episode paging, foldable tabletop player support, shared adaptive player sheets and controls, and scroll-aware image presentation on the home screen.

Changes

Adaptive detail screens

Layer / File(s) Summary
Season cache and episode paging
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/..., androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/detail/...
Detail state caches episodes by season, supports forced refreshes, preserves loaded content during switches, and restores cached seasons after errors.
Adaptive heroes and artwork
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/...
Detail screens select episode or series artwork and use an expanded hero at widths of at least 600dp.
Shared season pager integration
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/...
Series and movie screens use shared season chips, paged episode content, loading states, and episode actions.

Foldable player experience

Layer / File(s) Summary
Tabletop posture foundation
gradle/..., androidApp/build.gradle.kts, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/FoldablePlayerPosture.kt, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/FoldablePlayerPostureTest.kt
The AndroidX Window dependency, posture detection, fold bounds, pane sizing, and posture tests were added.
Tabletop player layout and controls
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt, PlayerOverlay.kt, PlayerControls.kt, PlayerProgressBar.kt
The player constrains video and controls around the fold and adds tabletop controls, playback speed, next-episode playback, persistent controls, and updated progress display.
Adaptive player sheets
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/...
Shared sheet infrastructure now supports tabletop sizing, categorized settings, adaptive track and chapter layouts, and consistent dismissal behavior across player sheets.

Home image presentation

Layer / File(s) Summary
Scroll-aware image presentation
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/ui/components/ThumbhashImage.kt, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/home/HomeScreen.kt
Home scrolling state is provided through LocalImagePresentationDeferral; decoded images remain behind the ThumbHash or fallback until scrolling stops.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant WindowInfoTracker
  participant PlayerScreen
  participant PlayerView
  participant PlayerOverlay
  participant PlayerSheetSupport
  WindowInfoTracker->>PlayerScreen: emit tabletop folding feature
  PlayerScreen->>PlayerView: apply fold-aware video pane
  PlayerScreen->>PlayerOverlay: pass tabletop mode and pane height
  PlayerOverlay->>PlayerSheetSupport: open sheets with tabletop sizing
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main Android changes to foldable detail screens and player UI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/foldable-detail-player-polish

Comment @coderabbitai help to get the list of available commands.

@Quick104
Quick104 marked this pull request as ready for review August 7, 2026 00:55

@coderabbitai coderabbitai 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.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlaybackStatsSheet.kt (1)

82-91: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

The header close action skips sheetState.hide() in three sheets. Each sheet wraps onBack with scope.launch { sheetState.hide() } but passes the bare onDismiss to PlayerSheetHeader. A close-button tap then removes the sheet without the hide animation, while onDismissRequest animates out. The shared root cause is one unwrapped dismiss callback.

  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlaybackStatsSheet.kt#L82-L91: wrap onDismiss with scope.launch { sheetState.hide() } before calling it, as done for onBack.
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/SleepTimerSheet.kt#L97-L106: apply the same wrapper to the onDismiss passed to PlayerSheetHeader.
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleStyleSheet.kt#L108-L117: apply the same wrapper to the onDismiss passed to PlayerSheetHeader.

A shared helper in PlayerSheetSupport.kt that builds the dismiss lambda would prevent the three copies from diverging again.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlaybackStatsSheet.kt`
around lines 82 - 91, Wrap the onDismiss callback passed to PlayerSheetHeader so
it launches sheetState.hide() before invoking the dismissal callback, matching
the existing onBack behavior. Apply this in PlaybackStatsSheet.kt (lines 82-91),
SleepTimerSheet.kt (lines 97-106), and SubtitleStyleSheet.kt (lines 108-117);
optionally centralize the shared dismiss-lambda construction in
PlayerSheetSupport.kt to prevent divergence.
🧹 Nitpick comments (4)
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt (1)

633-655: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Merge the row and switch into one accessible toggle target.

The Row is clickable and the Switch keeps its own onCheckedChange. Screen readers then expose two separate targets for one setting, and the row reports the generic button role instead of the switch state. The Material pattern is a toggleable row with Role.Switch and a non-interactive Switch.

♻️ Proposed refactor
     Row(
         modifier = Modifier
             .fillMaxWidth()
-            .clickable { onCheckedChange(!checked) }
+            .toggleable(
+                value = checked,
+                onValueChange = onCheckedChange,
+                role = Role.Switch,
+            )
             .heightIn(min = 68.dp)
             .padding(horizontal = 16.dp, vertical = 10.dp),
         verticalAlignment = Alignment.CenterVertically,
         horizontalArrangement = Arrangement.spacedBy(12.dp),
     ) {
         RowLabel(label = label, subtitle = subtitle, modifier = Modifier.weight(1f))
         Switch(
             checked = checked,
-            onCheckedChange = onCheckedChange,
+            onCheckedChange = null,

Add the imports:

import androidx.compose.foundation.selection.toggleable
import androidx.compose.ui.semantics.Role
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt`
around lines 633 - 655, Update the toggle row containing RowLabel and Switch to
use a single toggleable target with Role.Switch, replacing the row’s clickable
modifier and importing toggleable and Role. Keep the checked state and
onCheckedChange behavior on the row, and make the nested Switch non-interactive
by removing its onCheckedChange handler while preserving its visual checked
state and colors.
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerControls.kt (1)

456-460: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider syncing the volume slider with external volume changes.

volumeFraction is read once. If the user presses the hardware volume keys, or another app changes the music stream, the slider position becomes stale until TabletopUtilityRow leaves and re-enters composition. A ContentObserver on Settings.System.CONTENT_URI, or a periodic read while the controls are visible, keeps the slider aligned with the actual stream volume.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerControls.kt`
around lines 456 - 460, Update the volume state around volumeFraction and
TabletopUtilityRow so it observes external music-stream volume changes while the
controls remain visible, using a ContentObserver on Settings.System.CONTENT_URI
or an equivalent periodic refresh. Re-read AudioManager.STREAM_MUSIC and update
the slider state whenever changes occur, while preserving the existing
initialization and user-controlled volume behavior.
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerNextUpScreen.kt (1)

203-254: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The two action branches duplicate the same three buttons.

The compact branch and the fullscreen branch differ only in the container and the per-button modifier. Extract the button content into private composables, then place them in the chosen container. This keeps the two layouts in sync when labels or actions change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerNextUpScreen.kt`
around lines 203 - 254, Extract the shared Play Now, Keep Watching, and Back
button content from the compact and fullscreen branches into private
composables, preserving their existing click handlers, visibility conditions,
labels, icons, and colors. Keep only the branch-specific container and button
modifiers in each layout, and reuse the extracted composables so both branches
remain synchronized.
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/ChaptersSheet.kt (1)

107-111: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

weight(1f) makes the phone sheet always use the maximum height.

In phone mode playerSheetContent applies heightIn(max = ...), not a fixed height. A weighted child inside that Column forces the Column to the maximum constraint. A two-chapter list then renders in a sheet that is 80% of the screen height. If you want the phone sheet to size to content, apply weight(1f) only in tabletop mode.

♻️ Proposed change
                 LazyVerticalGrid(
                     columns = GridCells.Fixed(if (tabletopPaneHeight == null) 1 else 2),
                     modifier = Modifier
                         .fillMaxWidth()
-                        .weight(1f),
+                        .then(
+                            if (tabletopPaneHeight == null) Modifier else Modifier.weight(1f),
+                        ),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/ChaptersSheet.kt`
around lines 107 - 111, Update the LazyVerticalGrid modifier in ChaptersSheet so
weight(1f) is applied only when tabletopPaneHeight is non-null; preserve the
existing full-width behavior and allow phone-mode sheets to size to their
content under heightIn(max = ...).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/DetailSharedComponents.kt`:
- Around line 283-302: Update ExpandedHeroTitle so the episode hierarchy check
using isEpisode and seriesTitle runs before the logoUrl branch, matching
HeroTitle’s compact-layout ordering. Preserve the existing episode title and
SxEy subtitle rendering, then evaluate the logo branch before the regular-title
fallback.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/SeasonEpisodePager.kt`:
- Around line 69-75: Update the LaunchedEffect collecting pagerState.settledPage
in SeasonEpisodePager so it only calls onSeasonSelected when the settled page’s
seasonNumber differs from selectedSeasonNumber. Preserve the existing
seasons.getOrNull(page) lookup and avoid propagating the initial or otherwise
already-selected page.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerControls.kt`:
- Around line 405-416: Clamp the brightness value used to initialize
brightnessFraction within the slider’s 0f–1f range. Update the fallback
calculation in the remember block, while preserving the existing
originalWindowBrightness preference and 0.5f default behavior.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerNextUpScreen.kt`:
- Around line 159-196: Replace the compactTabletop action Row with a FlowRow so
all buttons wrap within narrower lower panes instead of extending beyond the
verticalScroll viewport. Configure verticalArrangement with
Arrangement.spacedBy(8.dp), preserve the existing spacing and alignment
behavior, and add the required ExperimentalLayoutApi opt-in for the containing
screen or relevant scope.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt`:
- Around line 116-119: Update dismissSheet in
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt:116-119
to invoke onDismiss only after sheetState.hide() completes, preserving animated
dismissal and follow-up sheet callbacks. Apply the same invokeOnCompletion
change to dismissSheet in
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/TracksSheet.kt:72-75.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSheetSupport.kt`:
- Around line 72-78: Update Modifier.tabletopPlayerSheet to retain only the
height(tabletopPaneHeight) constraint when the height is non-null; remove
paneTop, LocalConfiguration.current.screenHeightDp, and the offset call so
ModalBottomSheet remains responsible for positioning.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleSearchSheet.kt`:
- Around line 101-107: Update the LazyColumn result list in the outer Column to
use weight(1f) instead of the fixed 420.dp height constraint, allowing it to
occupy the remaining constrained tabletop-pane space. Apply the same change to
the corresponding list instance noted in the comment, while preserving the
existing scrolling behavior.

---

Outside diff comments:
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlaybackStatsSheet.kt`:
- Around line 82-91: Wrap the onDismiss callback passed to PlayerSheetHeader so
it launches sheetState.hide() before invoking the dismissal callback, matching
the existing onBack behavior. Apply this in PlaybackStatsSheet.kt (lines 82-91),
SleepTimerSheet.kt (lines 97-106), and SubtitleStyleSheet.kt (lines 108-117);
optionally centralize the shared dismiss-lambda construction in
PlayerSheetSupport.kt to prevent divergence.

---

Nitpick comments:
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/ChaptersSheet.kt`:
- Around line 107-111: Update the LazyVerticalGrid modifier in ChaptersSheet so
weight(1f) is applied only when tabletopPaneHeight is non-null; preserve the
existing full-width behavior and allow phone-mode sheets to size to their
content under heightIn(max = ...).

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerControls.kt`:
- Around line 456-460: Update the volume state around volumeFraction and
TabletopUtilityRow so it observes external music-stream volume changes while the
controls remain visible, using a ContentObserver on Settings.System.CONTENT_URI
or an equivalent periodic refresh. Re-read AudioManager.STREAM_MUSIC and update
the slider state whenever changes occur, while preserving the existing
initialization and user-controlled volume behavior.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerNextUpScreen.kt`:
- Around line 203-254: Extract the shared Play Now, Keep Watching, and Back
button content from the compact and fullscreen branches into private
composables, preserving their existing click handlers, visibility conditions,
labels, icons, and colors. Keep only the branch-specific container and button
modifiers in each layout, and reuse the extracted composables so both branches
remain synchronized.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt`:
- Around line 633-655: Update the toggle row containing RowLabel and Switch to
use a single toggleable target with Role.Switch, replacing the row’s clickable
modifier and importing toggleable and Role. Keep the checked state and
onCheckedChange behavior on the row, and make the nested Switch non-interactive
by removing its onCheckedChange handler while preserving its visual checked
state and colors.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 549c869d-a15e-4535-bb43-6f7471bcdb39

📥 Commits

Reviewing files that changed from the base of the PR and between 4ae38ab and ed77ead.

📒 Files selected for processing (30)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/ui/components/ThumbhashImage.kt
  • androidApp/build.gradle.kts
  • androidApp/gradle.lockfile
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/DetailSharedComponents.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemDetailScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemDetailViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/MovieDetailContent.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/SeasonEpisodePager.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/SeriesDetailContent.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/home/HomeScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/AiTranslateSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/ChaptersSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/FoldablePlayerPosture.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlaybackStatsSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerControls.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerNextUpScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerProgressBar.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSheetSupport.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/QualitySelector.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/SleepTimerSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleSearchSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleStyleSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/TracksSheet.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/detail/MobileDetailActionsSourceTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/FoldablePlayerPostureTest.kt
  • gradle/libs.versions.toml
  • gradle/verification-metadata.xml

Comment on lines +405 to +416
var brightnessFraction by remember(activity, originalWindowBrightness) {
mutableFloatStateOf(
originalWindowBrightness
?.takeIf { it >= 0f }
?: runCatching {
Settings.System.getInt(
context.contentResolver,
Settings.System.SCREEN_BRIGHTNESS,
) / 255f
}.getOrDefault(0.5f),
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clamp the initial brightness fraction to the slider range.

Settings.System.SCREEN_BRIGHTNESS is not guaranteed to use a 0–255 scale. Several OEM devices report a maximum of 1023 or 4095. On those devices value / 255f returns a number greater than 1f, so the brightness slider starts at a wrong position. Clamp the computed fraction.

🛠️ Proposed fix
     var brightnessFraction by remember(activity, originalWindowBrightness) {
         mutableFloatStateOf(
-            originalWindowBrightness
-                ?.takeIf { it >= 0f }
-                ?: runCatching {
-                    Settings.System.getInt(
-                        context.contentResolver,
-                        Settings.System.SCREEN_BRIGHTNESS,
-                    ) / 255f
-                }.getOrDefault(0.5f),
+            (
+                originalWindowBrightness
+                    ?.takeIf { it >= 0f }
+                    ?: runCatching {
+                        Settings.System.getInt(
+                            context.contentResolver,
+                            Settings.System.SCREEN_BRIGHTNESS,
+                        ) / 255f
+                    }.getOrDefault(0.5f)
+                ).coerceIn(0f, 1f),
         )
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var brightnessFraction by remember(activity, originalWindowBrightness) {
mutableFloatStateOf(
originalWindowBrightness
?.takeIf { it >= 0f }
?: runCatching {
Settings.System.getInt(
context.contentResolver,
Settings.System.SCREEN_BRIGHTNESS,
) / 255f
}.getOrDefault(0.5f),
)
}
var brightnessFraction by remember(activity, originalWindowBrightness) {
mutableFloatStateOf(
(
originalWindowBrightness
?.takeIf { it >= 0f }
?: runCatching {
Settings.System.getInt(
context.contentResolver,
Settings.System.SCREEN_BRIGHTNESS,
) / 255f
}.getOrDefault(0.5f)
).coerceIn(0f, 1f),
)
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerControls.kt`
around lines 405 - 416, Clamp the brightness value used to initialize
brightnessFraction within the slider’s 0f–1f range. Update the fallback
calculation in the remember block, while preserving the existing
originalWindowBrightness preference and 0.5f default behavior.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed77eadd1a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (tabletopPaneHeight == null) return this
val paneTop = (LocalConfiguration.current.screenHeightDp.dp - tabletopPaneHeight)
.coerceAtLeast(0.dp)
return height(tabletopPaneHeight).offset(y = paneTop)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Stop offsetting fixed-height tabletop sheets

In tabletop posture, ModalBottomSheet already positions a sheet with this fixed height against the bottom of the window. Adding paneTop again moves every player sheet downward a second time; with an evenly split display, the sheet starts at the bottom edge and becomes completely invisible, while asymmetric splits leave only a small portion visible. Apply the pane height without this extra offset so Chapters, Tracks, Quality, and Settings remain usable.

Useful? React with 👍 / 👎.

Comment on lines +418 to +422
DisposableEffect(activity, originalWindowBrightness) {
onDispose {
val window = activity?.window ?: return@onDispose
val attributes = window.attributes
attributes.screenBrightness = originalWindowBrightness ?: -1f

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve tabletop brightness until the player exits

Restore the original window brightness at the player-screen lifecycle rather than when TabletopUtilityRow leaves composition. The controls are disposed whenever state.showUpNext becomes true, so a user-adjusted brightness is reset at the end of every episode and remains lost when they choose the next episode without leaving the player.

Useful? React with 👍 / 👎.

Comment on lines +70 to +73
snapshotFlow { pagerState.settledPage }
.distinctUntilChanged()
.collect { page ->
seasons.getOrNull(page)?.let { onSeasonSelected(it.seasonNumber) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ignore the pager's initial settled-page emission

When a multi-season series first renders, snapshotFlow immediately emits the pager's initial settledPage and calls selectSeason even though that season is already selected. This cancels the initial loadEpisodes job started by loadSeasons; the replacement request lacks seasonsForDownloadRollup, so loadAllEpisodeFileIds is never started and the series-wide download badge cannot report partial or completed state for that route. Skip the initial/same-season emission and only select after the pager actually settles on a different season.

Useful? React with 👍 / 👎.

Comment on lines +114 to +115
val useSideRail = tabletopPaneHeight != null ||
LocalConfiguration.current.smallestScreenWidthDp >= 600

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate the settings side rail on available width

Any non-null tabletop pane forces the 212dp category rail, even on narrow clamshell foldables. At roughly 360–412dp of total width, the row's 48dp outer padding, 16dp gap, and fixed rail leave only about 84–136dp for the settings card; controls such as the 184dp delay spinner and toggle labels are consequently clipped or unusable. Base the rail decision on the current pane width and retain the tab layout for compact tabletop windows.

Useful? React with 👍 / 👎.

Comment on lines +159 to +162
if (compactTabletop) {
Row(
modifier = Modifier.widthIn(max = 620.dp).fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wrap compact tabletop next-up actions

On narrow tabletop devices, this single non-wrapping row cannot fit Play Now, Keep Watching, and Back together. Their intrinsic button widths plus spacing exceed the lower pane available on common 360–412dp-wide clamshell layouts, and the screen only scrolls vertically, leaving edge actions clipped with no way to reach them. Use a wrapping or stacked arrangement for the compact path.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08bf89e9fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +73 to +75
seasons.getOrNull(page)
?.takeIf { it.seasonNumber != selectedSeasonNumber }
?.let { onSeasonSelected(it.seasonNumber) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Prevent stale pager emissions from undoing chip selections

When a user taps a different season chip while the pager is still settled on the old page, updating selectedSeasonNumber restarts this LaunchedEffect; snapshotFlow immediately emits that old settledPage, passes this inequality check, and selects the old season again, cancelling the requested season load and bouncing the UI back. Fresh evidence beyond the earlier initial-emission report is that the new same-season guard does not reject this stale emission after a programmatic chip selection; suppress the collector while the pager is animating toward the selected page or otherwise ignore its first emission after this key change.

Useful? React with 👍 / 👎.

Comment on lines +653 to 655
if (castState.isConnected || !orientationLockSupported || tabletopPosture != null) {
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
return@LaunchedEffect

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Detect tabletop posture before forcing landscape

When the default locked-orientation setting resolves before the asynchronous WindowManager flow reports the current fold, tabletopPosture is still null here and the effect forces SENSOR_LANDSCAPE. On a clamshell already in tabletop posture, that rotates the window-relative horizontal folding feature to vertical, so isTabletopPlayerPosture can no longer recognize it and this effect never reaches the new unlock branch; the player remains in the ordinary landscape layout until exit. Defer applying the landscape lock until initial posture detection completes, rather than treating the producer's initial null as proof that the device is not tabletop.

Useful? React with 👍 / 👎.

Comment on lines +125 to +127
val deferNewArtworkPresentation = remember(listState) {
derivedStateOf { listState.isScrollInProgress }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Defer artwork during horizontal row flings too

The presentation gate observes only the outer LazyColumn state, but Home's media cards are primarily scrolled inside independent horizontal LazyRows. During a pure horizontal fling listState.isScrollInProgress remains false, so newly decoded images bypass the new deferral path and are presented/uploaded while that row is moving—the exact rendering work this change is intended to keep out of flings. Include the active row-scroll states in the provided gate, or provide a row-scoped deferral state from MediaRow.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fb9ca8171

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

scope.launch { sheetState.hide() }
onDismiss()
},
if (tabletopPaneHeight != null && audioTracks.isNotEmpty()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use one column for compact tabletop track sheets

On 360–412dp-wide clamshells in tabletop posture, this condition selects the two-column layout solely because a pane height is present. After the 48dp outer padding and 16dp gap, the audio card is only about 130–153dp wide, and its own padding, icon, and selection indicator leave too little room for language, codec, and channel labels; tracks with the same language become effectively indistinguishable. Gate the split layout on available width and use the existing stacked branch for compact panes.

Useful? React with 👍 / 👎.

@Quick104
Quick104 merged commit 5d670ec into main Aug 7, 2026
1 check passed
@Quick104
Quick104 deleted the codex/foldable-detail-player-polish branch August 7, 2026 14:45
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.

1 participant