Introduce HASearchField#7151
Open
TimoPtr wants to merge 1 commit into
Open
Conversation
4 tasks
4 tasks
ebb8d64 to
9ff5691
Compare
ae1eaca to
048ca8d
Compare
9ff5691 to
6a124f9
Compare
048ca8d to
8e2d83b
Compare
Base automatically changed from
feature/get-entities-for-display-usecase
to
main
July 16, 2026 07:27
8e2d83b to
85fa87a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces a reusable Compose HASearchField component (built on HATextField) that encapsulates debounced search behavior behind a SearchFieldState, along with interaction and screenshot tests, and a debug-catalog entry to showcase the component.
Changes:
- Added
HASearchFieldcomposable andSearchFieldState+rememberSearchFieldStatehelper to centralize debounced search input behavior. - Added Robolectric Compose UI tests validating label/clear-icon behavior and debounce timing semantics.
- Added screenshot tests (light/dark + with/without leading icon) and wired the component into the debug UI catalog.
Reviewed changes
Copilot reviewed 4 out of 10 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| common/src/main/kotlin/io/homeassistant/companion/android/common/compose/composable/HASearchField.kt | Adds the debounced search field composable and its state holder/helper. |
| common/src/test/kotlin/io/homeassistant/companion/android/common/compose/composable/HASearchFieldTest.kt | Adds interaction tests for debounce behavior, label visibility, and clearing. |
| common/src/screenshotTest/kotlin/io/homeassistant/companion/android/compose/composable/HASearchFieldScreenshotTest.kt | Adds screenshot coverage for empty/filled states and optional leading icon. |
| app/src/debug/kotlin/io/homeassistant/companion/android/developer/catalog/HAUserInputScreen.kt | Showcases HASearchField in the developer catalog. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Extracted the debounce search logic within a
HASearchField, this was initially made in #6567 by @danielgomezrico. Since I'm currently redoing the EntityPicker I took the opportunity to extract it into a smaller PR. I've also added a small state object and a remember helper on top of tests.It's built on top of our existing
HATextField, it can be extended later.Checklist
Screenshots
Any other notes
Based on #7149