Skip to content
This repository has been archived by the owner on Apr 10, 2022. It is now read-only.

Update BatteryDrawer.java #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

androidnaut
Copy link

The battery life indicator is a circle within a circle.

The inner circle currently has its radius set to the battery life percentage of the radius of the overall circle. Thus, when battery life is at 50%, the radius or diameter of the smaller circle is 50% of the radius or diameter of the overall circle. This is not an accurate representation of battery life. Instead, the AREA of the circles should represent the battery percentage left. Remember pi r-squared is the area of a circle, so if square the radius of the large circle, multiply by the battery percentage, and then take the square root of that, we'll have a smaller circle which area is proportional to the larger circle according to the percentage battery life left. This is a much more accurate indication of battery life.

The battery life indicator is a circle within a circle.

The inner circle currently has its radius set to the battery life percentage of the radius of the overall circle.  Thus, when battery life is at 50%, the radius or diameter of the smaller circle is 50% of the radius or diameter of the overall circle.  This is not an accurate representation of battery life.  Instead, the AREA of the circles should represent the battery percentage left.  Remember pi r-squared is the area of a circle, so if square the radius of the large circle, multiply by the battery percentage, and then take the square root of that, we'll have a smaller circle which area is proportional to the larger circle according to the percentage battery life left.  This is a much more accurate indication of battery life.
Oops -- forgot to cast my edited 3rd argument to float.  Fixed.  Works great on N6 running 5.1.1 and more accurately represents remaining battery life.
@androidnaut
Copy link
Author

Oops -- I forgot to cast the 3rd argument I changed to drawCircle to float. That has now been done. The app runs great on an N6 with 5.1.1 and now more accurately represents remaining battery life.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants