mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-25 08:05:55 +01:00
Redmi Buds 4 Active: Initial support
This commit is contained in:
parent
a0948ee1cb
commit
b1b4c81857
@ -0,0 +1,75 @@
|
|||||||
|
/* 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 <https://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
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 abstract class AbstractRedmiBudsCoordinator 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<? extends DeviceSupport> getDeviceSupportClass() {
|
||||||
|
return RedmiBuds5ProDeviceSupport.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 int getDefaultIconResource() {
|
||||||
|
return R.drawable.ic_device_nothingear;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDisabledIconResource() {
|
||||||
|
return R.drawable.ic_device_nothingear_disabled;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/* 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 <https://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
|
|
||||||
|
public class RedmiBuds4ActiveCoordinator extends AbstractRedmiBudsCoordinator {
|
||||||
|
@Override
|
||||||
|
public int getDeviceNameResource() {
|
||||||
|
return R.string.devicetype_redmi_buds_4_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Pattern getSupportedDeviceName() {
|
||||||
|
return Pattern.compile("Redmi Buds 4 Active");
|
||||||
|
}
|
||||||
|
}
|
@ -16,39 +16,14 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro;
|
package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
|
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.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<? extends DeviceSupport> getDeviceSupportClass() {
|
|
||||||
return RedmiBuds5ProDeviceSupport.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class RedmiBuds5ProCoordinator extends AbstractRedmiBudsCoordinator {
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceNameResource() {
|
public int getDeviceNameResource() {
|
||||||
return R.string.devicetype_redmi_buds_5_pro;
|
return R.string.devicetype_redmi_buds_5_pro;
|
||||||
@ -59,24 +34,6 @@ public class RedmiBuds5ProCoordinator extends AbstractDeviceCoordinator {
|
|||||||
return Pattern.compile("Redmi Buds 5 Pro");
|
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
|
@Override
|
||||||
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
||||||
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
||||||
@ -90,14 +47,4 @@ public class RedmiBuds5ProCoordinator extends AbstractDeviceCoordinator {
|
|||||||
public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) {
|
public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) {
|
||||||
return new RedmiBuds5ProSettingsCustomizer(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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -281,6 +281,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband9.MiBand9Coordi
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband9pro.MiBand9ProCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband9pro.MiBand9ProCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatch.MiWatchLiteCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatch.MiWatchLiteCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatchcolorsport.MiWatchColorSportCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatchcolorsport.MiWatchColorSportCoordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.RedmiBuds4ActiveCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.RedmiBuds5ProCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmibuds5pro.RedmiBuds5ProCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartband2.RedmiSmartBand2Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartband2.RedmiSmartBand2Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartbandpro.RedmiSmartBandProCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartbandpro.RedmiSmartBandProCoordinator;
|
||||||
@ -356,6 +357,7 @@ public enum DeviceType {
|
|||||||
MIBAND9PRO(MiBand9ProCoordinator.class),
|
MIBAND9PRO(MiBand9ProCoordinator.class),
|
||||||
MIWATCHLITE(MiWatchLiteCoordinator.class),
|
MIWATCHLITE(MiWatchLiteCoordinator.class),
|
||||||
MIWATCHCOLORSPORT(MiWatchColorSportCoordinator.class),
|
MIWATCHCOLORSPORT(MiWatchColorSportCoordinator.class),
|
||||||
|
REDMIBUDS4ACTIVE(RedmiBuds4ActiveCoordinator.class),
|
||||||
REDMIBUDS5PRO(RedmiBuds5ProCoordinator.class),
|
REDMIBUDS5PRO(RedmiBuds5ProCoordinator.class),
|
||||||
REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class),
|
REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class),
|
||||||
REDMIWATCH3(RedmiWatch3Coordinator.class),
|
REDMIWATCH3(RedmiWatch3Coordinator.class),
|
||||||
|
@ -1888,6 +1888,7 @@
|
|||||||
<string name="devicetype_xiaomi_watch_lite">Xiaomi Watch Lite</string>
|
<string name="devicetype_xiaomi_watch_lite">Xiaomi Watch Lite</string>
|
||||||
<string name="devicetype_redmiwatch3active">Redmi Watch 3 Active</string>
|
<string name="devicetype_redmiwatch3active">Redmi Watch 3 Active</string>
|
||||||
<string name="devicetype_redmiwatch3">Redmi Watch 3</string>
|
<string name="devicetype_redmiwatch3">Redmi Watch 3</string>
|
||||||
|
<string name="devicetype_redmi_buds_4_active">Redmi Buds 4 Active</string>
|
||||||
<string name="devicetype_redmi_buds_5_pro">Redmi Buds 5 Pro</string>
|
<string name="devicetype_redmi_buds_5_pro">Redmi Buds 5 Pro</string>
|
||||||
<string name="devicetype_redmi_smart_band_2">Redmi Smart Band 2</string>
|
<string name="devicetype_redmi_smart_band_2">Redmi Smart Band 2</string>
|
||||||
<string name="devicetype_redmi_watch_2">Redmi Watch 2</string>
|
<string name="devicetype_redmi_watch_2">Redmi Watch 2</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user