-
Notifications
You must be signed in to change notification settings - Fork 736
Add search suggestions to search UI #2294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Implemented search suggestions using Google's autocomplete API. Added SearchSuggestionAdapter, SearchSuggestionApi, and related UI components to display and interact with suggestions in both mobile and TV search fragments. Suggestions are fetched with debounce and can be selected to search or fill the search box.
Changed root layout from LinearLayout to FrameLayout in both search and search_tv fragments. Moved search suggestions RecyclerView to overlay above content for better UI layering and increased elevation for improved visibility.
fire-light42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool pull request!
I only have minor code and UI+UX considerations.
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchSuggestionApi.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchSuggestionApi.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt
Show resolved
Hide resolved
Introduces a new setting to enable or disable search suggestions while typing. Updates UI logic to respect this setting, improves suggestion parsing, and adjusts search suggestion recycler margin for better layout.
|
Resolved. |
Updated the text size of search suggestions from 16sp to 18sp for improved readability in the UI.
fire-light42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is virtually unusable on TV due to the focus loss. I am unsure if we only want the focus loss on phone layout or if we disable this feature on TV.
Introduces a clear suggestions button to the search suggestions overlay, visible on TV layouts. Refactors the suggestions overlay into a FrameLayout to support the button, updates focus handling for TV, and adds a new string resource for the button label.
Removed focus loss for tv layout, alternatively added a clear suggestion button for tv layout to hide the suggestions and even enter or ok button also hides the suggestions in all layouts |
same done for emulator layout |
Kindly recheck with the updated layout |
fire-light42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good changes! I have some additional comments on TV layout specifically.
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt
Outdated
Show resolved
Hide resolved
Moved 'clear history' and 'clear suggestions' buttons into adapter footers for TV and emulator layouts, removing them from the main fragment layouts. Updated SearchHistoryAdaptor and SearchSuggestionAdapter to support footers, and adjusted SearchFragment logic to handle new clear actions. This improves modularity and focus handling, especially for non-phone devices.
fire-light42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good changes, I just have a comment about the removal of the search button on phone. Is that a copy paste error? Because I see no clear reason why we should remove it from phone.
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchHistoryAdaptor.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchHistoryAdaptor.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchHistoryAdaptor.kt
Outdated
Show resolved
Hide resolved
Changed SearchHistoryAdaptor and SearchSuggestionAdapter to always display the footer regardless of layout, instead of only on TV or EMULATOR. Updated footer visibility logic to use isGone when the list is empty and ensured footers rebind on list changes to update their state.
Added import for androidx.core.view.isGone in both SearchHistoryAdaptor and SearchSuggestionAdapter. This prepares the adapters to use the isGone extension for view visibility handling.
fire-light42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good 🔥 , will merge after testing if no problem is found.
|
@NivinCNC I think we should not use clear history btn as footer in search history, it will be kill the purpose as you need to scroll through the complete history to the end to clean history. |
Ensures the search history recycler view scrolls to the top when new items are added, so the newest entries are always visible first.
Fixed "search history shows end of list , it is intended to show the latest search history". But need to know whether i have to revert clear history btn logic to the older one that has the fixed button at the bottom or is there any workaround to firelights suggection?
|
|
I think he asked to have footer on suggestion area because of focus issue on tv. You can revert clear history as was before |
No, clear history should be like this on TV as it also has some focus issues. However on Phone it does not matter exactly where it is placed. Nevertheless, you have a great point, and it might be better for the UX to place it in a static location (on phone only). The main problem I wanted @NivinCNC solve was that of inaccessible/finicky navigation on TV. |
Implemented search suggestions using Google's autocomplete API. Added SearchSuggestionAdapter, SearchSuggestionApi, and related UI components to display and interact with suggestions in both mobile and TV search fragments. Suggestions are fetched with debounce and can be selected to search or fill the search box.