Skip to content

Expandable ongoing notification: Now / Average breakdown on pull-down (#194)#195

Merged
almothafar merged 2 commits into
masterfrom
feat/194-expandable-status-notification
Jul 19, 2026
Merged

Expandable ongoing notification: Now / Average breakdown on pull-down (#194)#195
almothafar merged 2 commits into
masterfrom
feat/194-expandable-status-notification

Conversation

@almothafar

Copy link
Copy Markdown
Owner

Follow-up to #192 (which made the title the stable headline and the content the volatile details). This turns the ongoing status notification into a BigTextStyle two-state notification — the mockup-approved v2 shape.

Collapsed (the glance)

  • Title (unchanged): 85% · Discharging / 85% · Charging.
  • Content: rate/power · current · time —
    • discharging: 9%/h · −250 mA · ~9h 27m remaining
    • charging: ~18 W · +2000 mA · ~1h 0m to full
    • Adds the instantaneous current; temperature moves to the expanded view; "left" → "remaining" (matches the details table).

Expanded (pull down)

Labelled label: value lines:

DischargingNow: −250 mA / Average: −338 mA · 9%/h / Time remaining: ~9h 27m / Temperature: 34.6 °C
ChargingNow: +2000 mA · ~10 W / Average: +1900 mA / Time to full: ~1h 0m / Temperature: 34.6 °C

  • Now = instantaneous current (+ wattage while charging); Average = the windowed-average current (from Current row flickers and disagrees between surfaces — show moment value with windowed average, gate visibility on the average #173).
  • Honest adjustment from the mock: the app computes a single smoothed rate (which is itself an average), so there's no separate instantaneous %/h — the %/h rides the Average line rather than being faked onto Now. When the average current isn't ready yet, the %/h gets its own Drain rate: line so it isn't lost.
  • Every line is dropped when its data is absent; the notification is only made expandable when the breakdown is genuinely multi-line (so Temperature-only never shows a pointless expand chevron).

Arabic / RTL

The Latin values (−250 mA, %/h, ~18 W, durations) are wrapped with BidiFormatter so they don't reorder inside an Arabic line — the garbling seen before. It's a no-op in LTR locales, so the LTR values are untouched (and the tests stay clean). New labels Now / Average + the %1$s: %2$s line format in EN + AR; the rest reuse the details table's existing strings (Time remaining / Time to full / Temperature / Drain rate). Arabic drafted — pending review.

Data / scope

No new device reads — reuses the same snapshot + rate the tick already computed (#157). No new tracking (the Screen-on/off split stays as #193).

Testing

OngoingStatusLines reworked to 10 tests: collapsed (discharge / charge / no-current-yet), expanded (discharge / charge / drain-rate fallback), the built notification's EXTRA_BIG_TEXT, temperature-only-and-not-expandable when the toggle is off, and the null snapshot. Full :app:testDebugUnitTest (439) + lintDebug green; installed on the Mate 10 Pro.

(Couldn't grab a live shot — the foreground-service notification isn't staying alive under EMUI's background killer — but the Robolectric tests assert the exact posted title and expanded text.)

Closes #194
Related: #192, #193, #173/#188.

🤖 Generated with Claude Code

…194)

Follow-up to #192. The ongoing status notification becomes a BigTextStyle
two-state notification:

- Collapsed: the volatile numbers on one line — rate/power · current · time,
  e.g. "9%/h · −250 mA · ~9h 27m remaining" / "~18 W · +2000 mA · ~1h 0m to
  full". Temperature moves to the expanded view; "left" → "remaining".
- Expanded: a labelled breakdown — Now (instant current, + wattage while
  charging), Average (windowed-average current, carrying the smoothed %/h while
  discharging), Time remaining / Time to full, and Temperature. Each line is
  dropped when its data is absent; expansion is only offered when the breakdown
  is genuinely multi-line.

The app has a single smoothed rate (itself an average), so there is no separate
instantaneous %/h — the %/h rides the Average line rather than being faked onto
a "Now" line.

RTL: the Latin values (mA, %/h, watts, durations) are wrapped with
BidiFormatter so they don't reorder inside an Arabic line (the garbling seen
before). No-op in LTR. New labels reuse the details table's strings (Time
remaining / Time to full / Temperature / Drain rate); new: Now, Average, and the
"label: value" line format. All EN + AR (Arabic drafted, pending review).

Tests: OngoingStatusLines reworked to 10 — collapsed (discharge/charge/no-current),
expanded (discharge/charge/drain-rate-fallback), the built notification's BigText,
temperature-only-and-not-expandable when the toggle is off, and null-snapshot.

Closes #194

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…age")

EN "Now" → "Live", AR "الآن" → "مباشر". Only the string values change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@almothafar
almothafar merged commit d359cb2 into master Jul 19, 2026
2 checks passed
@almothafar
almothafar deleted the feat/194-expandable-status-notification branch July 19, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ongoing notification v2: expandable Now / Average breakdown (follow-up to #192)

1 participant