1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-10 23:44:05 +02:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/galaxy_buds/GalaxyBuds2DeviceCoordinator.java
narektor 2216b6b76a Galaxy Buds2 support (#2853)
Mostly copied from the Buds Pro as those earbuds have a similar feature set and mostly the same protocol.
Co-authored-by: narektor <narektor@noreply.codeberg.org>
Co-committed-by: narektor <narektor@noreply.codeberg.org>
2022-11-07 19:34:41 +01:00

56 lines
1.9 KiB
Java

package nodomain.freeyourgadget.gadgetbridge.devices.galaxy_buds;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.BatteryConfig;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
public class GalaxyBuds2DeviceCoordinator extends GalaxyBudsGenericCoordinator {
@NonNull
@Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
String name = candidate.getName();
if (name != null && (
name.startsWith("Galaxy Buds2 (")
)) {
return DeviceType.GALAXY_BUDS2;
}
return DeviceType.UNKNOWN;
}
@Override
public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) {
return new GalaxyBudsSettingsCustomizer(device);
}
@Override
public DeviceType getDeviceType() {
return DeviceType.GALAXY_BUDS2;
}
@Override
public int getBatteryCount() {
return 3;
}
@Override
public BatteryConfig[] getBatteryConfig() {
BatteryConfig battery1 = new BatteryConfig(0, R.drawable.ic_buds_pro_case, R.string.battery_case);
BatteryConfig battery2 = new BatteryConfig(1, R.drawable.ic_buds_pro_left, R.string.left_earbud);
BatteryConfig battery3 = new BatteryConfig(2, R.drawable.ic_buds_pro_right, R.string.right_earbud);
return new BatteryConfig[]{battery1, battery2, battery3};
}
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_galaxy_buds_2,
};
}
}