Time to full: estimated charge-completion row in the details table (#124)#148
Merged
Conversation
6a7e596 to
90124b5
Compare
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>
90124b5 to
d5971a2
Compare
4 tasks
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.
Closes #124. Part of the charger-notification redesign.
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:
so it works even where the charge counter is unreliable (Kirin Mate 10 Pro) — it reuses the
BatteryRatealready computed inaddRateRows, 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, andformatTimeToFull(...)→~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.values/+values-ar/(Arabic drafted — pending your review).Verified
testDebugUnitTest+assembleDebug+lintDebugall green (newEstimateMinutesToFullparam tests: level 99/100, rate 0/1, rounding).🤖 Generated with Claude Code