/* Copyright (C) 2024 Jonathan Gobbo This file is part of Gadgetbridge. Gadgetbridge is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Gadgetbridge is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro; import androidx.annotation.NonNull; import java.util.regex.Pattern; import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.Device; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.BatteryConfig; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.redmibuds5pro.RedmiBuds5ProDeviceSupport; public class RedmiBuds5ProCoordinator extends AbstractDeviceCoordinator { @Override protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException { } @Override public String getManufacturer() { return "Xiaomi"; } @NonNull @Override public Class getDeviceSupportClass() { return RedmiBuds5ProDeviceSupport.class; } @Override public int getDeviceNameResource() { return R.string.devicetype_redmi_buds_5_pro; } @Override protected Pattern getSupportedDeviceName() { return Pattern.compile("Redmi Buds 5 Pro"); } @Override public int getBondingStyle() { return BONDING_STYLE_NONE; } @Override public int getBatteryCount() { return 3; } @Override public BatteryConfig[] getBatteryConfig(GBDevice device) { BatteryConfig battery1 = new BatteryConfig(0, R.drawable.ic_tws_case, R.string.battery_case); BatteryConfig battery2 = new BatteryConfig(1, R.drawable.ic_nothing_ear_l, R.string.left_earbud); BatteryConfig battery3 = new BatteryConfig(2, R.drawable.ic_nothing_ear_r, R.string.right_earbud); return new BatteryConfig[]{battery1, battery2, battery3}; } @Override public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) { final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings(); deviceSpecificSettings.addRootScreen(R.xml.devicesettings_redmibuds5pro_headphones); deviceSpecificSettings.addRootScreen(R.xml.devicesettings_redmibuds5pro_gestures); deviceSpecificSettings.addRootScreen(R.xml.devicesettings_redmibuds5pro_sound); return deviceSpecificSettings; } @Override public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) { return new RedmiBuds5ProSettingsCustomizer(device); } @Override public int getDefaultIconResource() { return R.drawable.ic_device_nothingear; } @Override public int getDisabledIconResource() { return R.drawable.ic_device_nothingear_disabled; } }