Improved TV Back Button UX (extension content -> extension selection Bttn -> home nav Bttn -> exit dialog) #2468
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request: Improved TV Back Button Navigation for HomeFragment
Summary
This PR implements a custom back button navigation flow for Android TV interface in
HomeFragment, improving the user experience by providing logical focus transitions instead of immediately showing the exit dialog. The Back button transitions focus from and to the following items:extension content -> extension selection Button -> home button -> exit dialog
the Phone interface remains unaffected by this change.
Problem
Previously, when navigating plugin content on Android TV, pressing the back button would immediately show the "exit app" dialog regardless of the current focus position. This created a poor user experience as users couldn't easily navigate back to the plugin selector or home navigation without dismissing the dialog.
Solution
Implemented a three-step back button navigation sequence specifically for TV interface:
Changes Made
Modified Files
app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.ktImplementation Details
1. Added Back Press Callback Registration
In
onBindingCreated():2. Created Custom Back Press Handler
New method
handleTvBackPress()that:isLayout(TV))3. Added Callback Cleanup
In
onDestroyView():Key Features
isLayout(TV)check to ensure mobile interface is unaffectedTesting
Technical Notes
Uses Cloudstream's existing
BackPressedCallbackHelpersystem to hook into the back press dispatcher, ensuring compatibility with the app's architecture.Related Issues
Resolves user-reported navigation issues on TV interface where back button behavior was unintuitive for plugin content browsing.