Skip to content

feat(app): add Android TV support and remote D-Pad navigation - #201

Open
Aryan447 wants to merge 2 commits into
mainfrom
android-tv-support
Open

Aryan447 wants to merge 2 commits into
mainfrom
android-tv-support

Conversation

@Aryan447

@Aryan447 Aryan447 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds comprehensive Android TV and Google TV platform support, including Leanback launcher declaration, banner resources, orientation constraints, visual D-Pad focus indicators across player controls, sheets, and preferences, and key event handling for remote-driven playback control.

Before / After

  • Before: The app was not discoverable in Android TV launchers; navigation required touch input with no visible focus cues on D-Pad direction keys; settings cards and player sheets stretched unconstrained across wide 16:9 television screens.
  • After: The app launches directly from the Android TV Leanback home screen with a branded 320x180 vector banner; all interactive controls (hero transport buttons, seekbar, action pills, settings tiles, and sheet options) feature prominent D-Pad focus borders, scale morphing, and auto-focusing on sheet open; seekbar scrubbing operates smoothly via D-Pad Left/Right.

How measured

Unmeasured (architectural and UI adaptation).

Verification

  • Local Build: bash ./gradlew assembleStandardDebug completed with code 0 (BUILD SUCCESSFUL in 37s / 1m 3s).
  • Unit Tests: bash ./gradlew testStandardDebugUnitTest completed with code 0 (BUILD SUCCESSFUL in 1m 42s).
  • Formatting: git diff --check clean with 0 warnings.
  • Commit Validation: .opencode/skills/commit-messages/scripts/check-commit-msg.sh passed.
  • Target / Devices Checked: Android TV 1080p emulator / Leanback launcher with remote D-Pad navigation.

Changelog

  • Added Android TV Leanback launcher support with vector banner and landscape orientation locks.
  • Added visual D-Pad focus rings and scaling to Modern player transport controls, action buttons, seekbar, and bottom sheets.
  • Added D-Pad Left/Right scrub navigation for the Modern player seekbar.
  • Added centered 16:9 width constraints for preferences and settings dashboards.
  • Added remote control navigation guidelines to AGENTS, CONTRIBUTING, README, and UNRELEASED.

Risks

Low. Non-TV touch workflows preserve identical touch ripples and gesture interactions; TV-specific orientation locks and auto-focus logic only trigger when DeviceUtils.isTv() evaluates to true or D-Pad navigation events are detected.

Summary by Sourcery

Add comprehensive Android TV and Google TV support with remote navigation, TV-optimized layouts, and accessible focus feedback throughout the app.

New Features:

  • Add Android TV and Google TV launcher support with Leanback discovery, branded banner artwork, and TV-appropriate orientation handling.
  • Enable remote-driven playback controls, including D-Pad transport navigation, media keys, control visibility, and seekbar scrubbing.
  • Provide prominent focus indicators, scaling, and initial focus behavior across player controls, sheets, settings, library cards, and other interactive surfaces.

Bug Fixes:

  • Keep suitable transferred and sideloaded TV media visible in the Movies and Titles libraries.
  • Improve TV back-button behavior and navigation rail presentation.

Enhancements:

  • Constrain and center preferences, settings dashboards, choice sheets, and related layouts for wide television displays.
  • Add reusable TV focus behavior and propagate TV device context through the UI.

Documentation:

  • Document Android TV and Google TV support and remote-navigation requirements in user and contributor documentation.

Tests:

  • Add classifier coverage for TV-specific handling of downloaded media.

Chores:

  • Add the generated database schema migration for the updated database version.

Users on Android TV and Google TV devices could not launch or navigate the app with a directional pad or remote control.

Add Leanback launcher banners, landscape locks on TV, visual D-Pad focus indicators across playback and preferences, and remote key handling for seekbar and sheet navigation.

Unmeasured.
@sourcery-ai

sourcery-ai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Sorry @Aryan447, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 5 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T08:01:29.886055Z 4e98d42 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Deploying mpvium with  Cloudflare Pages  Cloudflare Pages

Latest commit: 440ed7d
Status: ✅  Deploy successful!
Preview URL: https://5de0e7fd.mpvium.pages.dev
Branch Preview URL: https://android-tv-support.mpvium.pages.dev

View logs

@sourcery-ai

sourcery-ai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add TV-device detection and a composition local so downstream UI and playback behavior can distinguish television devices.

  • app/src/main/java/app/aryan447/mpvium/ui/utils/CompositionLocales.kt L18-23
  • app/src/main/java/app/aryan447/mpvium/utils/DeviceUtils.kt L1-34

API

Declare optional Leanback and device features, launcher categories, and TV banners, and register the Leanback banner resource.

  • app/src/main/AndroidManifest.xml L28-63 (+3 small edits)
  • app/src/main/res/drawable/tv_banner.xml L1-71

Implementation

Handle TV playback orientation, Back behavior, and remote media and D-Pad key events, while refreshing the controls timeout on remote interaction.

  • app/src/main/java/app/aryan447/mpvium/MainActivity.kt L87-90, L176-180, L251-255 (+1 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/player/PlayerActivity.kt L565-579, L2855-2890, L2895-2945 (+3 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/player/PlayerViewModel.kt L347-353
  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/PlayerControls.kt L284-294, L301-311 (+4 small edits)

UI

Add shared focus highlighting and apply it to browsing and streaming cards, player controls, and preference navigation tiles.

  • app/src/main/java/app/aryan447/mpvium/ui/browser/cards/FolderCard.kt L48, L131-135
  • app/src/main/java/app/aryan447/mpvium/ui/browser/cards/VideoCard.kt L54-55, L116-132
  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/components/ControlsButton.kt L42, L90-95
  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/components/TransportButtons.kt L82-91, L181-190, L242-247 (+3 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/preferences/PreferencesScreen.kt L159-171, L465-471, L501-516 (+9 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/preferences/components/ThemePreviewCard.kt L3-7, L117-129, L134-139 (+8 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/streaming/components/ContinueWatchingRow.kt L140-148 (+3 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/streaming/components/MoviePosterCard.kt L67-75 (+3 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/streaming/components/SeriesPosterCard.kt L93-106 (+3 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/streaming/home/StreamingHomeScreen.kt L257-270, L277-290, L297-310 (+2 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/utils/FocusUtils.kt L1-56

Make Modern player transport, action buttons, and seekbar focusable with visible focus state, initial play/pause focus, and D-Pad seek steps.

  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/ModernPlayerControls.kt L1032-1060, L1190-1247, L1573-1606 (+21 small edits)

Add focus borders and focus targeting for track, chapter, playlist, and subtitle sheet controls, and constrain preference cards and choice sheets for wide displays.

  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/components/sheets/AudioTracksSheet.kt L26-36, L67-77, L156-165 (+5 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/components/sheets/ChaptersSheet.kt L17-25, L89-98 (+5 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/components/sheets/GenericTracksSheet.kt L21-41, L101-134, L144-175 (+4 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/components/sheets/PlaylistSheet.kt L455-464, L479-486 (+2 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/player/controls/components/sheets/SubtitleTracksSheet.kt L72-82, L88-106, L211-224 (+8 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/preferences/CardPreferences.kt L94-119, L148-182, L393-430 (+12 small edits)
  • app/src/main/java/app/aryan447/mpvium/ui/preferences/ExpressiveListPreference.kt L125-167, L183-189, L206-214 (+9 small edits)

Other changes

Files not grouped.

  • AGENTS.md L125-128
  • CONTRIBUTING.md L49, L97-100
  • README.md L56, L78-80
  • UNRELEASED.md L9-11, L24
  • app/schemas/app.aryan447.mpvium.database.MpviumDatabase/10.json L1-737

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

@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: 4e98d42260

ℹ️ 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".

val areControlsVisible = viewModel.controlsShown.value

if (areControlsVisible) {
viewModel.keepControlsAlive()

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 Keep controls alive during D-pad focus navigation

On Android TV, when playback is running and the user moves between Compose focus targets without activating one, Compose consumes those D-pad events before they reach Activity.onKeyDown. This leaves the key-interaction timer unchanged, so the 5-second auto-hide can dismiss the controls mid-navigation and drop focus. Refresh the timer from Compose focus/key handling too, or suppress the timeout while a control is focused.

AGENTS.md reference: AGENTS.md:L125-L128

Useful? React with 👍 / 👎.

Landscape media stored in Downloads was excluded from Titles on Android TV because mobile transient clip thresholds hid files under 20 minutes.

Exempt Android TV environments from the 20-minute download threshold in MovieLibraryClassifier so sideloaded and downloaded media appears in Titles.

Unmeasured.

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

Sourcery assessment

Approved.

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.

1 participant