1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

Reset the battery icon if battery level is unknown

This commit is contained in:
Daniele Gobbetti 2021-11-05 18:33:33 +01:00
parent 7e0f44d3f9
commit b0f22815b0

View File

@ -179,6 +179,10 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
} else if (BatteryState.NO_BATTERY.equals(batteryState) && batteryVoltage != GBDevice.BATTERY_UNKNOWN) {
batteryStatusLabels[batteryIndex].setText(String.format(Locale.getDefault(), "%.2f", batteryVoltage));
batteryIcons[batteryIndex].setImageLevel(200);
} else {
//should be the "default" status, shown when the device is not connected
batteryStatusLabels[batteryIndex].setText("");
batteryIcons[batteryIndex].setImageLevel(50);
}
final int finalBatteryIndex = batteryIndex;
batteryStatusBoxes[batteryIndex].setOnClickListener(new View.OnClickListener() {