diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmiwatch3active/RedmiWatch3ActiveCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmiwatch3active/RedmiWatch3ActiveCoordinator.java new file mode 100644 index 000000000..7a60136a4 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmiwatch3active/RedmiWatch3ActiveCoordinator.java @@ -0,0 +1,63 @@ +/* Copyright (C) 2023 Andreas Shimokawa + + 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.redmiwatch3active; + +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.XiaomiEncryptedCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiInstallHandler; + +public class RedmiWatch3ActiveCoordinator extends XiaomiEncryptedCoordinator { + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("^Redmi Watch 3 Active [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_redmiwatch3active; + } + + @Override + public int getDefaultIconResource() { + return R.drawable.ic_device_amazfit_bip; + } + + @Override + public int getDisabledIconResource() { + return R.drawable.ic_device_amazfit_bip_disabled; + } + + @Override + public boolean supportsMultipleWeatherLocations() { + return true; + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java index 53f026eaa..8fc4aacc1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -144,6 +144,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8.MiBand8Coordi import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatch.MiWatchLiteCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch3active.RedmiWatch3ActiveCoordinator; /** * For every supported device, a device type constant must exist. @@ -196,6 +197,7 @@ public enum DeviceType { MIBAND7(MiBand7Coordinator.class), MIBAND8(MiBand8Coordinator.class), MIWATCHLITE(MiWatchLiteCoordinator.class), + REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class), AMAZFITGTS3(AmazfitGTS3Coordinator.class), AMAZFITGTR3(AmazfitGTR3Coordinator.class), AMAZFITGTR4(AmazfitGTR4Coordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4e6c5ffbf..299ebda9b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1388,6 +1388,7 @@ Binary sensor Femometer Vinca II Xiaomi Watch Lite + Redmi Watch 3 Active Choose export location General High-priority