Improved TV Back Button UX (extension content -> extension selection Bttn -> home nav Bttn -> exit dialog)#2468
Improved TV Back Button UX (extension content -> extension selection Bttn -> home nav Bttn -> exit dialog)#2468okibcn wants to merge 12 commits intorecloudstream:masterfrom
Conversation
fire-light42
left a comment
There was a problem hiding this comment.
Everything looks good, will merge after testing.
@fire-light42 Any update? |
fire-light42
left a comment
There was a problem hiding this comment.
When testing I found that the back button does not always scroll to the top and focus the plugin selection button. Sometimes it only scrolls to one of the top two rows. I suspect this is a race condition in the smooth scrolling and focus request.
@fire-light42 Great catch on that race condition. You were absolutely right to flag it. What was happening is that The fix ended up being surprisingly simple: swap the two calls. By moving the focus request first, we avoid any scroll interruption. With no focused child to protect, the scroll can complete cleanly every time. Now it should always work as intended. |
Pull Request: Improved TV Back Button Navigation
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.