mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 19:36:50 +01:00
Reset the battery icon if battery level is unknown
This commit is contained in:
parent
7e0f44d3f9
commit
b0f22815b0
@ -179,6 +179,10 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
|
|||||||
} else if (BatteryState.NO_BATTERY.equals(batteryState) && batteryVoltage != GBDevice.BATTERY_UNKNOWN) {
|
} else if (BatteryState.NO_BATTERY.equals(batteryState) && batteryVoltage != GBDevice.BATTERY_UNKNOWN) {
|
||||||
batteryStatusLabels[batteryIndex].setText(String.format(Locale.getDefault(), "%.2f", batteryVoltage));
|
batteryStatusLabels[batteryIndex].setText(String.format(Locale.getDefault(), "%.2f", batteryVoltage));
|
||||||
batteryIcons[batteryIndex].setImageLevel(200);
|
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;
|
final int finalBatteryIndex = batteryIndex;
|
||||||
batteryStatusBoxes[batteryIndex].setOnClickListener(new View.OnClickListener() {
|
batteryStatusBoxes[batteryIndex].setOnClickListener(new View.OnClickListener() {
|
||||||
|
Loading…
Reference in New Issue
Block a user