TylerWilliamson / BatteryNotification

Creates a persistent notification to see battery information at a glance!
https://play.google.com/store/apps/details?id=com.ominous.batterynotification
GNU General Public License v3.0
33 stars 4 forks source link

Reported Ampere Reversed #7

Closed mxvin closed 2 years ago

mxvin commented 2 years ago

Hi, First of all, thanks for making this app, It's super simple and lightweight. 😃 I found a little problem, that app shows ampere when charge in negative number, but when discharge it reports positive number. here's the illustration: photo_2022-06-08_11-19-03 SS on #6

OS is Lineage 17.1 Android 10 App version 1.4.3 / latest

Thanks

FINAL INVESTIGATION You're wrong on these logic https://github.com/TylerWilliamson/BatteryNotification/blob/e201b6a30f17b294d32c12aa1af5d213e24634c3/app/src/main/java/com/ominous/batterynotification/util/BatteryUtils.java#L119

const BATTERY_STATUS_CHARGING = 2 and const BATTERY_STATUS_DISCHARGING = 3 so the first IF true = 1 not -1

int batteryCurrent = (intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1) == BatteryManager.BATTERY_STATUS_CHARGING ? 1 : -1)

TylerWilliamson commented 2 years ago

You are correct. I was overcomplicating the logic. I'll be removing the ternary statement and the charging sign will be whatever the device is outputting. Expect the change in the next release.

TylerWilliamson commented 2 years ago

Fixed in 1.4.4