Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created August 12, 2018 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jezinka/78e8bf8c2ca641cd4c7906772df398e8 to your computer and use it in GitHub Desktop.
Save jezinka/78e8bf8c2ca641cd4c7906772df398e8 to your computer and use it in GitHub Desktop.
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