Add battery indicator to widget - #1
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The hairline separator slot is now the always-on battery indicator, rendered unconditionally in DotGrid. Removes the dead hairline field, its DataStore key, view-model handler, settings-screen toggle, and the tests that covered them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The gauge filled its row from the edge, so its left side jutted out past the leftmost dot toward the widget border. Inset it by (cell-dot)/2 so the left edge lines up with the dots. Height now scales with the icon (0.6*dot) and the track+fill are pill-rounded (cornerRadius = height/2) instead of a thin square bar. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Gauge height 0.6->0.4*dot (the 0.6 read as too heavy); battery-section icon 0.8*dot, smaller than the grid icons since it's secondary info. Rounded corners kept (API 31+; square fallback below is accepted). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Battery row height was dictated by the glyph slot (height=dot), letting the thin gauge float in a band wider than the dot-row gaps. Pin it to gaugeHeight + (cell - dot) so its content carries the same (cell-dot)/2 of air as the dots, making all inter-component gaps equal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…being squeezed cell = minOf(w/6, h/4) budgeted height for four rows, but the face now renders five components (four dot rows + the battery band). The band overflowed the widget height and the launcher squeezed the bottom date rows, making day-month tighter than hours-minutes. Reserve the band's fraction in the divisor and name the layout fractions so the budget and BatteryIndicatorRow stay in sync. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The solid gauge bar drew too much attention for secondary info. Spacing stays uniform automatically — GAUGE_DOT_FRACTION feeds both the band height and the height budget. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The gauge is secondary info that groups with the battery glyph, so it now shares the icon tone rather than the dot tone. The empty track is rendered as an outline (nested background-tone pill inside a gauge-tone pill, since Glance has no border modifier) instead of a low-alpha fill, echoing the grid's ring-vs-filled-dot language for a two-region partial-charge look. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rebuild the empty-track outline as a fill-based capsule annulus (ic_gauge_track) tinted like the dots, replacing the nested-opaque-box hole which could not render a truly transparent centre. The hollow now shows the wallpaper through on translucent-background widgets. Size to the visible dot: gaugeHeight = dot/2 (the dot circle is radius 6 of a 24 viewport, filling half its box), with the outline rim baked at 1/8 of the vector height so it lands the off-dot ring's dot/16 weight. Band is one full cell, so the grid reads as five even rows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Replaces the optional hairline separator between the minutes and day rows with an always-on battery indicator: a proportional level gauge (columns 1–5) plus a mutually-exclusive state glyph (column 6).
ic_gauge_track) with a genuinely transparent centre, so it shows the wallpaper through on translucent-background widgets. Tinted in the icon tone, sized to the visible dot (dot/2) with the rim matched to the off-dot ring weight (dot/16). Battery band is one full cell, so the grid reads as five even rows.ACTION_BATTERY_CHANGEDbroadcast — no new scheduling.Test Plan
./gradlew testDebugUnitTest— green (mapper boundary tests, resolver battery mapping, charging-glyph, over-100% clamp)