Skip to content

Widget: Improve rendering with live updates and better alignment#419

Merged
d4rken merged 1 commit intomainfrom
feat/glance-widget-migration
Mar 1, 2026
Merged

Widget: Improve rendering with live updates and better alignment#419
d4rken merged 1 commit intomainfrom
feat/glance-widget-migration

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented Mar 1, 2026

What changed

Widgets now update live as device data changes, and content is properly centered instead of appearing left-aligned. The configuration preview also renders more accurately.

Technical Context

  • Migrated widget rendering from RemoteViews (7 XML layouts) to Jetpack Glance composables, using Glance 1.2.0-rc01 with SizeMode.Exact for responsive sizing
  • Widget now reactively observes device data, profiles, and upgrade status instead of rendering once on refresh
  • New WidgetRenderState sealed class unifies all possible widget states into a single source of truth
  • Configuration preview migrated to pure Compose
  • Visual left-alignment was caused by hardcoded trailing padding in the old XML layouts
  • WidgetProvider reduced from ~470 lines to a thin wrapper around the Glance widget

Replace the legacy AppWidgetProvider/RemoteViews implementation with Glance AppWidget for reactive updates, proper centering, and a unified render state model.

- Add BatteryGlanceWidget with collectAsState for live device/profile/upgrade data

- Add WidgetRenderState sealed class and WidgetRenderStateMapper

- Add GlanceWidgetContent (Glance composables) and ComposeWidgetPreview (config preview)

- Fix centering by passing spacing via modifier param (no trailing padding on last item)

- Remove old XML widget layouts and RemoteViews rendering code
@d4rken d4rken added the enhancement Add a new feature of improve an existing feature label Mar 1, 2026
@d4rken d4rken changed the title feat(widget): Fix alignment and enable live battery updates feat(widget): Fix off-center layout and stale data after reconfiguration Mar 1, 2026
@d4rken d4rken changed the title feat(widget): Fix off-center layout and stale data after reconfiguration Widget: Fix misaligned content and delayed updates Mar 1, 2026
@d4rken d4rken changed the title Widget: Fix misaligned content and delayed updates feat(widget): Migrate to Jetpack Glance Mar 1, 2026
@d4rken d4rken merged commit c103c6a into main Mar 1, 2026
9 checks passed
@d4rken d4rken deleted the feat/glance-widget-migration branch March 1, 2026 14:56
@d4rken d4rken changed the title feat(widget): Migrate to Jetpack Glance Widget: Improve rendering with live updates and better alignment Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Add a new feature of improve an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant