mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 09:01:55 +01:00
Set default low battery threshold for Sony devices
At least WF-C700N and WF-C510 only support the battery levels 0%, 20%, 50%, 70% and 100%
This commit is contained in:
parent
b00248ce45
commit
7f439f2a03
@ -97,16 +97,16 @@ public abstract class SonyHeadphonesCoordinator extends AbstractBLClassicDeviceC
|
||||
final List<BatteryConfig> batteries = new ArrayList<>(3);
|
||||
|
||||
if (supports(SonyHeadphonesCapabilities.BatterySingle)) {
|
||||
batteries.add(new BatteryConfig(batteries.size()));
|
||||
batteries.add(new BatteryConfig(batteries.size(), GBDevice.BATTERY_ICON_DEFAULT, GBDevice.BATTERY_LABEL_DEFAULT, getBatteryDefaultLowThreshold(), getBatteryDefaultFullThreshold()));
|
||||
}
|
||||
|
||||
if (supports(SonyHeadphonesCapabilities.BatteryCase)) {
|
||||
batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_tws_case, R.string.battery_case));
|
||||
batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_tws_case, R.string.battery_case, getBatteryDefaultLowThreshold(), getBatteryDefaultFullThreshold()));
|
||||
}
|
||||
|
||||
if (supports(SonyHeadphonesCapabilities.BatteryDual) || supports(SonyHeadphonesCapabilities.BatteryDual2)) {
|
||||
batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_l, R.string.left_earbud));
|
||||
batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_r, R.string.right_earbud));
|
||||
batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_l, R.string.left_earbud, getBatteryDefaultLowThreshold(), getBatteryDefaultFullThreshold()));
|
||||
batteries.add(new BatteryConfig(batteries.size(), R.drawable.ic_galaxy_buds_r, R.string.right_earbud, getBatteryDefaultLowThreshold(), getBatteryDefaultFullThreshold()));
|
||||
}
|
||||
|
||||
return batteries.toArray(new BatteryConfig[0]);
|
||||
@ -216,6 +216,14 @@ public abstract class SonyHeadphonesCoordinator extends AbstractBLClassicDeviceC
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getBatteryDefaultLowThreshold() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public int getBatteryDefaultFullThreshold() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Class<? extends DeviceSupport> getDeviceSupportClass() {
|
||||
|
@ -28,7 +28,7 @@ public class SonyWFC700NCoordinator extends SonyHeadphonesCoordinator {
|
||||
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(".*WF-C700N.*");
|
||||
return Pattern.compile("WF-C700N");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user