Skip to content

fix(tv): re-enable navigation_home nextFocusRight so D-pad can reach the 'None' provider button - #3126

Open
RjBiermann wants to merge 2 commits into
recloudstream:masterfrom
RjBiermann:fix/2592-tv-home-none-dpad-focus
Open

fix(tv): re-enable navigation_home nextFocusRight so D-pad can reach the 'None' provider button#3126
RjBiermann wants to merge 2 commits into
recloudstream:masterfrom
RjBiermann:fix/2592-tv-home-none-dpad-focus

Conversation

@RjBiermann

@RjBiermann RjBiermann commented Aug 16, 2026

Copy link
Copy Markdown

Fixes #2592

Problem

On TV, the D-pad cannot reach the "None" / provider-selector button (home_change_api) on the home screen. After navigating away from Home and back (via Search/Favorites, the BACK button, or even a fresh load), pressing right from the nav rail does nothing — focus is stuck on the rail.

Root cause

onNavDestinationSelected (MainActivity.kt) sets nextFocusRightId on all nav-rail buttons when navigating to Search/Favorites/Downloads (pointing at e.g. main_search), but the navigation_home case was commented out with a stale id. Two problems followed:

  1. Returning Home never re-pointed the rail — it stayed aimed at the destroyed Search fragment's main_search, so right-focus from the rail was dead.
  2. That hook only fires on rail-button navigation anyway: the BACK-button return path and first app load never ran it at all.

Fix

Move the Home rail-focus handling into addOnDestinationChangedListener (MainActivity.kt), which fires on every arrival at Home regardless of how you got there:

if (navDestination.matchDestination(R.id.navigation_home)) {
    ...
    navRailView.nextFocusRightId = R.id.home_change_api
    // ... and for each nav rail button
}

so on every visit to Home, all rail buttons' nextFocusRightId point at the provider-selector button.

Verification

Reproduced on the TV emulator (blank home, "None" selected) across all three arrival paths:

  • Cold start: LEFT → RIGHT returns to "None"
  • Search → BACK → Home: RIGHT reaches home_change_api
  • Search → rail Home: RIGHT reaches home_change_api

Also verified with a plugin + home content loaded (StreamPlay): LEFT/RIGHT between rail and provider button works, and DOWN from the provider button drops into content as before.

Notes

  • The old commented mapping used a stale id (home_preview_change_api); the live id is home_change_api, which exists in both fragment_home.xml and fragment_home_tv.xml.
  • Initial focus still lands on the provider button via <requestFocus /> in fragment_home_tv.xml; this change additionally makes the rail→provider path work on every arrival.

AI note: this change was written with AI assistance per AI-POLICY.md; the logic was reproduced and verified on the TV emulator and every line is understood.

@RjBiermann
RjBiermann marked this pull request as draft August 16, 2026 17:58
The previous attempt only handled rail-button navigation to home via
onNavDestinationSelected. Returning via the back stack (popBackStack) or on
first load never re-pointed the rail's nextFocusRightId, so D-pad right from
the rail could not reach the 'None' / provider selector button.

Move the home case into addOnDestinationChangedListener, which fires on every
arrival at home regardless of navigation path (rail button, back stack pop,
first load).
@RjBiermann
RjBiermann marked this pull request as ready for review August 16, 2026 18:50
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.

Cannot select "none" button with D-pad on google TV

1 participant