android icon indicating copy to clipboard operation
android copied to clipboard

Migrate entity widget configuration to Compose

Open himu-gupta opened this issue 5 months ago • 10 comments

Summary

  • migrate EntityWidgetConfigureActivity from XML views to Compose and Home Assistant Material 3 components
  • move configuration state, validation, creation, and update persistence into an assisted ViewModel
  • preserve server selection, custom attributes, tap actions, widget themes, text colors, and existing widget values
  • add focused ViewModel tests for restoration, recreation, persistence, and server changes

Closes #6307

Screenshots

Light Dark Review feedback state
Entity widget configuration in light mode Entity widget configuration in dark mode Entity widget configuration with server picker and attributes expanded

Server picker fix

Entity widget configuration server picker in dark mode with selected entity

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

himu-gupta avatar Jun 12 '26 00:06 himu-gupta

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 main, and the focused tests, ktlint, and full debug build pass.

himu-gupta avatar Jun 12 '26 17:06 himu-gupta

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!

CLA was signed.

himu-gupta avatar Jun 14 '26 19:06 himu-gupta

Could you update the PR description to add screenshots, thanks.

TimoPtr avatar Jun 15 '26 12:06 TimoPtr

Added light and dark screenshots to the PR description.

himu-gupta avatar Jun 16 '26 16:06 himu-gupta

The UI does already look much better than from the old one.

image

Things to address

  • Should be centered
  • The picker should be aligned with the size of the inputs
  • Clicking Append attributes could animate nicely the hidden field
  • The Attributemenu could/should be merge with the Add attribute input, to improve the UX
  • Changing the entity selected doesn't update the label anymore
  • Server picker is using the old style image

Things to change/discuss

  • Update widget button logic should be improved (in another PR), to include validation on inputs today you can input a huge number for instance in the Widget text size.
  • We could add a top left close button in the topbar

TimoPtr avatar Jun 18 '26 12:06 TimoPtr

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.

himu-gupta avatar Jun 20 '26 20:06 himu-gupta

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.

himu-gupta avatar Jun 21 '26 13:06 himu-gupta

I think we could remove the "Append attribute value" checkbox by only showing the tags to pick. Does it make sense to even allow custom attributes? @jpelgrom wdyt

TimoPtr avatar Jun 23 '26 12:06 TimoPtr

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Jun 23 '26 13:06 home-assistant[bot]

Also I would like to see a close button in the topbar

TimoPtr avatar Jun 23 '26 13:06 TimoPtr