Skip to content

Time to full: estimated charge-completion row in the details table (#124)#148

Merged
almothafar merged 1 commit into
masterfrom
feat/124-time-to-full-row
Jul 14, 2026
Merged

Time to full: estimated charge-completion row in the details table (#124)#148
almothafar merged 1 commit into
masterfrom
feat/124-time-to-full-row

Conversation

@almothafar

Copy link
Copy Markdown
Owner

Closes #124. Part of the charger-notification redesign.

Stacked on #147 (the lint fix) so the diff is just this feature. Base retargets to master once #147 merges.

What

A single Time to full · ~1h 20m row in the battery details table, directly below the charge rate it is derived from. Shown only while charging, with a trustworthy rate, and below the taper top (level < 99%) — hidden otherwise, so it never shows a garbage "0m" or a wildly optimistic figure as the charge tapers.

How

Capacity-free linear projection from #108s smoothed charge rate:

minutes_to_full = (100 − level) / ratePercentPerHour × 60

so it works even where the charge counter is unreliable (Kirin Mate 10 Pro) — it reuses the BatteryRate already computed in addRateRows, no extra reads. Deliberately simple: no taper modeling, so it overshoots near full. Precision is an explicit non-goal — the OS/OEM owns the accurate figure (Samsung lock screen, Settings → Battery). Its a glanceable rough number.

Code

  • BatteryRateTracker.estimateMinutesToFull(level, ratePph) — pure, and formatTimeToFull(...)~1h 20m / ~45m, Western digits (Battery details table: fix RTL alignment + use Western digits for numbers #96), units stay Latin like the other rate values.
  • BatteryDetailsFragment.addTimeToFullRow(...) — the gated row.
  • New strings in values/ + values-ar/ (Arabic drafted — pending your review).

Verified

  • testDebugUnitTest + assembleDebug + lintDebug all green (new EstimateMinutesToFull param tests: level 99/100, rate 0/1, rounding).
  • Installed on the Mate 10 Pro. On-device check pending (your step): charge below 99% and confirm the row appears with a sane estimate.

🤖 Generated with Claude Code

Base automatically changed from fix/146-lint-formatted-full-charge to master July 13, 2026 22:48
@almothafar almothafar force-pushed the feat/124-time-to-full-row branch from 6a7e596 to 90124b5 Compare July 14, 2026 15:31
A single "Time to full · ~1h 20m" row directly below the charge rate,
shown only while charging with a trustworthy rate and below the taper
top (level < 99%) — hidden otherwise, so it never shows a garbage 0m.

Capacity-free linear projection from #108's smoothed charge rate:
(100 - level) / ratePercentPerHour, so it works on devices with an
unreliable charge counter (Kirin) too. Deliberately simple: no taper
modeling, precision is a non-goal (the OS owns the accurate figure).

New pure BatteryRateTracker.estimateMinutesToFull + a Western-digit
duration formatter. The estimate is unit-tested (level 99/100, rate 0/1,
rounding); the formatter is tested under Robolectric (~1h 20m / ~45m,
and Western digits even under the Arabic locale). New strings localized
in values-ar (units stay Latin like the other rate values).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@almothafar almothafar force-pushed the feat/124-time-to-full-row branch from 90124b5 to d5971a2 Compare July 14, 2026 16:12
@almothafar almothafar merged commit 82e4dd6 into master Jul 14, 2026
2 checks passed
@almothafar almothafar deleted the feat/124-time-to-full-row branch July 14, 2026 23:05
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.

Charging: time-to-full as a details-table row (rescoped — no standalone feature)

1 participant