Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created August 12, 2018 13:03
public int getBatteryColor() {
if (this.vbat > GOOD_BATTERY_VOLTAGE) {
return Color.parseColor(GREEN);
}
if (this.vbat > CRITICAL_BATTERY_VOLTAGE + VOLTAGE_BUFFOR) {
return Color.YELLOW;
}
return Color.RED;
}
public boolean batteryNeedRecharge() {
return this.vbat <= CRITICAL_BATTERY_VOLTAGE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment