Skip to content

Fix Compose UI design issues: theme tokens, a11y, lazy keys, effect keying, adaptive grids#404

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/review-project
Draft

Fix Compose UI design issues: theme tokens, a11y, lazy keys, effect keying, adaptive grids#404
Copilot wants to merge 2 commits into
masterfrom
copilot/review-project

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the UI design issues identified in the Compose audit (COMPOSE-AUDIT-REPORT.md): hardcoded colors bypassing the theme, missing accessibility labels, unkeyed lazy lists, mis-keyed side effects, and fixed grid columns that ignore window size on tablets/foldables.

  • Theme color tokens
    • New material/model/Colors.kt with a single FavoriteColor token; replaces the duplicated Color(0xffffcd3c) literal in ChannelMask.kt and ChannelItem.kt.
    • New material/components/ProgressIndicators.kt wrapper around the foundation CircularProgressIndicator defaulting to LocalContentColor.current instead of hardcoded Color.Gray; 8 smartphone call sites switched via import. core/foundation is untouched (stays platform-neutral).
  • Accessibility
    • Favorite star in ChannelItem now has a contentDescription (reuses existing feat_channel_tooltip_favourite string).
  • Lazy list stability
    • DlnaDevicesBottomSheet: key = { it.udn } + contentType.
    • FormatsBottomSheet: key = { "${group.hashCode()}-${index}" } + contentType.
  • Side-effect keying (ChannelScreen)
    • Brightness collector moved to its own LaunchedEffect(isSupportBrightnessGesture) so it starts/stops when gesture support changes (was gated by a one-shot LaunchedEffect(Unit)).
    • Brightness-restore DisposableEffect(Unit)DisposableEffect(brightnessGestureEnabled) to avoid restoring a stale value.
  • Adaptive grid columns
    • New Helper.adaptiveRowCount(rowCount) combines the existing landscape +2 rule with WindowWidthSizeClass (Medium +1, Expanded +2, taking the max). Replaces three duplicated orientation-only computations in ForyouScreen, FavouriteScreen, and PlaylistScreen, so tablets/foldables in portrait no longer default to a single column.
@Composable
fun Helper.adaptiveRowCount(rowCount: Int): Int {
    val landscapeExtra = if (orientation == ORIENTATION_LANDSCAPE) 2 else 0
    val widthExtra = when (windowSizeClass.widthSizeClass) {
        WindowWidthSizeClass.Expanded -> 2
        WindowWidthSizeClass.Medium -> 1
        else -> 0
    }
    return rowCount + maxOf(landscapeExtra, widthExtra)
}

Investigated but intentionally not changed: TV palette is already mapped into the tv-material darkColorScheme in MainActivity; shared-element transitions are infeasible while the player lives in a separate PlayerActivity; the XtreamEpisode list body in PlayerPanel is a // TODO stub.

AI Agent Checklist

Before submitting this PR, confirm:

  • I identified the task type.
  • I read the root AGENTS.md.
  • I read all relevant directory-level AGENTS.md files.
  • I avoided unrelated refactors.
  • I respected module dependency boundaries.
  • I did not move low-level data access into UI.
  • I did not introduce unnecessary dependencies.
  • I ran the smallest relevant validation command.
  • I documented any validation that could not be run.
  • I listed risks or compatibility concerns.

Instructions Read

List the instruction files read for this change:

  • AGENTS.md

Validation

Commands run:

git submodule update --init --recursive
./gradlew :app:smartphone:compileDebugKotlin

Results:

BUILD SUCCESSFUL (only pre-existing deprecation warnings)
CodeQL: no alerts

Commands not run:

Device/instrumented tests; TV variant build

Reason:

No emulator/device in sandbox; no TV-module sources were modified.

Risk Notes

Mention any risk areas:

  • Playback behavior: brightness effect re-keying changes when the brightness collector starts/stops and which value is restored on exit — intended fix, worth a manual check of the brightness gesture.
  • UI behavior: grid column counts increase on Medium/Expanded width windows (tablets/foldables); phone portrait/landscape behavior unchanged.
  • Visual: progress indicators now follow LocalContentColor instead of fixed gray; favorite star color unchanged (single token).
  • Lazy keys: track key uses TrackGroup.hashCode() — collision would throw; considered practically unique per Media3 equality semantics.
  • No API, database, TV focus, i18n, or binary-size impact.

Copilot AI changed the title Add Jetpack Compose audit report (68/100) Fix Compose UI design issues: theme tokens, a11y, lazy keys, effect keying, adaptive grids Jun 11, 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.

2 participants