Migrate entity widget configuration to Compose#7007
Conversation
There was a problem hiding this comment.
Hi @himu-gupta
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates the Entity widget configuration UI from the legacy XML/ViewBinding implementation to a Jetpack Compose-based screen backed by a new ViewModel, and adds unit tests for key configuration behaviors.
Changes:
- Replaced
EntityWidgetConfigureActivity’s legacy view logic with Compose UI and a dedicatedEntityWidgetConfigureViewModel. - Added a Compose configuration screen with attribute selection UI (including custom attribute entry).
- Added unit tests for restoring/persisting widget configuration and handling server changes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| common/src/main/res/values/strings.xml | Adds a new string resource used by the Compose attribute picker UI. |
| app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureViewModelTest.kt | Introduces unit tests for the new configuration ViewModel behavior. |
| app/src/main/res/layout/widget_static_configure.xml | Removes the legacy XML layout now replaced by Compose UI. |
| app/src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureViewModel.kt | Adds a new ViewModel managing widget configuration state, persistence, and pin flow. |
| app/src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreen.kt | Adds the Compose configuration UI (server/entity pickers, attributes, separators, styling options). |
| app/src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureActivity.kt | Updates the activity to host Compose UI and delegate configuration actions to the ViewModel. |
f9669f5 to
3a51bce
Compare
|
The CLA check is now passing, but the original Home Assistant CLA bot review still shows Changes requested and keeps the PR in a blocked state. Could a maintainer please dismiss the stale review when convenient? All review threads are resolved, the branch is rebased onto the latest |
CLA was signed. |
|
Could you update the PR description to add screenshots, thanks. |
|
Added light and dark screenshots to the PR description. |
TimoPtr
left a comment
There was a problem hiding this comment.
I did a first very quick review of the code to identify the missing bits.
…n system Address review feedback by aligning the Media Player Controls widget configuration screen with the Compose pattern used in home-assistant#7007. - Add MediaPlayerControlsWidgetConfigureViewModel exposing an immutable ViewState, with server/entity/registry flows and a Snackbar message channel; the Activity is now a thin BaseActivity that delegates to it - Add unit tests for the ViewModel (MainDispatcherJUnit5Extension) - Use HATheme + Material 3 throughout to fix the broken dark/light colors - Replace the free-text entity field with EntityPicker, providing the entity/device/area registries for friendlier names - Surface widget create/update errors via Snackbar instead of Toast - Split the screen into smaller composables and use HaDimens for spacing - Proper HACheckbox row click, full-width inputs and action button, and a top-left close button - Regenerate screenshot reference images for the new UI Note: EntityPicker is single-select, so the widget now stores a single media_player entity instead of the previous comma-separated list.
…n system Address review feedback by aligning the Media Player Controls widget configuration screen with the Compose pattern used in home-assistant#7007. - Add MediaPlayerControlsWidgetConfigureViewModel exposing an immutable ViewState, with server/entity/registry flows and a Snackbar message channel; the Activity is now a thin BaseActivity that delegates to it - Add unit tests for the ViewModel (MainDispatcherJUnit5Extension) - Use HATheme + Material 3 throughout to fix the broken dark/light colors - Replace the free-text entity field with EntityPicker, providing the entity/device/area registries for friendlier names - Surface widget create/update errors via Snackbar instead of Toast - Split the screen into smaller composables and use HaDimens for spacing - Proper HACheckbox row click, full-width inputs and action button, and a top-left close button - Regenerate screenshot reference images for the new UI Note: EntityPicker is single-select, so the widget now stores a single media_player entity instead of the previous comma-separated list.
…n system Address review feedback by aligning the Media Player Controls widget configuration screen with the Compose pattern used in home-assistant#7007. - Add MediaPlayerControlsWidgetConfigureViewModel exposing an immutable ViewState, with server/entity/registry flows and a Snackbar message channel; the Activity is now a thin BaseActivity that delegates to it - Add unit tests for the ViewModel (MainDispatcherJUnit5Extension) - Use HATheme + Material 3 throughout to fix the broken dark/light colors - Replace the free-text entity field with EntityPicker, providing the entity/device/area registries for friendlier names - Surface widget create/update errors via Snackbar instead of Toast - Split the screen into smaller composables and use HaDimens for spacing - Proper HACheckbox row click, full-width inputs and action button, and a top-left close button - Regenerate screenshot reference images for the new UI Note: EntityPicker is single-select, so the widget now stores a single media_player entity instead of the previous comma-separated list.
218f3fd to
eca4235
Compare
|
Added a review-feedback screenshot to the PR description showing the updated centered form with the modern server picker and append-attributes section expanded, including the merged Add attribute input/chips and entity-derived label. |
|
Added a dedicated server picker fix screenshot to the PR description. This one matches the dark top-of-screen state from your attached image: the server picker now uses the HA dropdown style and is aligned with the selected entity picker. |
c2c3670 to
e483268
Compare


Summary
EntityWidgetConfigureActivityfrom XML views to Compose and Home Assistant Material 3 componentsCloses #6307
Screenshots
Server picker fix
Testing
./gradlew --no-daemon --console=plain :build-logic:convention:ktlintFormat ktlintFormat./gradlew --no-daemon --console=plain :app:testFullDebugUnitTest --tests io.homeassistant.companion.android.widgets.entity.EntityWidgetConfigureViewModelTest