meter icon indicating copy to clipboard operation
meter copied to clipboard

Update BatteryDrawer.java

Open androidnaut opened this issue 10 years ago • 1 comments

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.

androidnaut avatar Oct 16 '15 17:10 androidnaut

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.

androidnaut avatar Oct 23 '15 22:10 androidnaut