Redmi Watch 2: Experimental support

This commit is contained in:
José Rebelo 2024-01-29 18:13:09 +00:00
parent cf0e8be816
commit c472f0ab9a
4 changed files with 69 additions and 3 deletions

View File

@ -0,0 +1,63 @@
/* Copyright (C) 2024 José Rebelo
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.redmiwatch2;
import android.content.Context;
import android.net.Uri;
import androidx.annotation.Nullable;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiInstallHandler;
public class RedmiWatch2Coordinator extends XiaomiCoordinator {
@Override
public boolean isExperimental() {
return true;
}
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("^Redmi Watch 2 [A-Z0-9]{4}$");
}
@Nullable
@Override
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final XiaomiInstallHandler handler = new XiaomiInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_redmi_watch_2;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiInstallHandler;
public class RedmiWatch2Lite extends XiaomiCoordinator {
public class RedmiWatch2LiteCoordinator extends XiaomiCoordinator {
@Override
public boolean isExperimental() {
return true;

View File

@ -177,7 +177,8 @@ import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8pro.MiBand8Pro
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatchcolorsport.MiWatchColorSportCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartband2.RedmiSmartBand2Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartbandpro.RedmiSmartBandProCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch2lite.RedmiWatch2Lite;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch2.RedmiWatch2Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch2lite.RedmiWatch2LiteCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1.XiaomiWatchS1Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1active.XiaomiWatchS1ActiveCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1pro.XiaomiWatchS1ProCoordinator;
@ -243,7 +244,8 @@ public enum DeviceType {
MIWATCHCOLORSPORT(MiWatchColorSportCoordinator.class),
REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class),
REDMISMARTBAND2(RedmiSmartBand2Coordinator.class),
REDMIWATCH2LITE(RedmiWatch2Lite.class),
REDMIWATCH2(RedmiWatch2Coordinator.class),
REDMIWATCH2LITE(RedmiWatch2LiteCoordinator.class),
REDMISMARTBANDPRO(RedmiSmartBandProCoordinator.class),
XIAOMI_WATCH_S1_ACTIVE(XiaomiWatchS1ActiveCoordinator.class),
XIAOMI_WATCH_S1_PRO(XiaomiWatchS1ProCoordinator.class),

View File

@ -1539,6 +1539,7 @@
<string name="devicetype_xiaomi_watch_lite">Xiaomi Watch Lite</string>
<string name="devicetype_redmiwatch3active">Redmi Watch 3 Active</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_lite">Redmi Watch 2 Lite</string>
<string name="devicetype_redmi_smart_band_pro">Redmi Smart Band Pro</string>
<string name="choose_auto_export_location">Choose export location</string>