From 77cf6f8ba4f4a3faf2c836a6400611f8270b4d41 Mon Sep 17 00:00:00 2001 From: vanous Date: Sat, 6 Nov 2021 08:08:20 +0100 Subject: [PATCH] Perform battery config when new device is being paired --- .../gadgetbridge/devices/AbstractDeviceCoordinator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java index 9166f5b92..2a43a815e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java @@ -73,7 +73,12 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator { @Override public GBDevice createDevice(GBDeviceCandidate candidate) { - return new GBDevice(candidate.getDevice().getAddress(), candidate.getName(), null, getDeviceType()); + GBDevice gbDevice = new GBDevice(candidate.getDevice().getAddress(), candidate.getName(), null, getDeviceType()); + for (BatteryConfig batteryConfig : getBatteryConfig()) { + gbDevice.setBatteryIcon(batteryConfig.getBatteryIcon(), batteryConfig.getBatteryIndex()); + gbDevice.setBatteryLabel(batteryConfig.getBatteryLabel(), batteryConfig.getBatteryIndex()); + } + return gbDevice; } @Override