googlecreativelab / meter

Meter is a data-driven wallpaper that displays your battery, wireless signal and notifications
http://androidexperiments.com
Apache License 2.0
362 stars 82 forks source link

Use percentage of area instead of radius to display battery remaining. #14

Closed jjsil closed 7 years ago

jjsil commented 9 years ago

Currently the radius of the inner battery circle is calculated by multiplying it by the battery fraction directly. This results in the circle looking smaller than expected because the area is smaller.

For example, when the battery is at 50% the battery fraction is 0.5. The area of the outer circle is Pi_r. The area of the inner circle is Pir(0.5)^2 which is Pi_r*0.25. So the area of the inner circle is 25% of the outer circle instead of 50%.

This changes the calculation so that the inner circle area reflects the battery percentage instead of the radius.

Tested on a Nexus 5X running Marshmellow.

Related issue: #6

longloop commented 7 years ago

Perfect! This makes complete sense to me. @hapticdata @trippedout Have a look here. I tested the code by merging on my local it seems to work fine.

HalfdanJ commented 7 years ago

I know its been a long time, but something similar to this has now been implemented in the app.