From fa6489b300be7fb1a00cdd86c2660909931a842f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Mon, 1 Jan 2024 12:18:36 +0000 Subject: [PATCH] Redmi Smart Band Pro: Experimental support --- .../RedmiSmartBandProCoordinator.java | 63 +++++++++++++++++++ .../gadgetbridge/model/DeviceType.java | 2 + app/src/main/res/values/strings.xml | 1 + 3 files changed, 66 insertions(+) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java new file mode 100644 index 000000000..1a8b5c161 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmismartbandpro/RedmiSmartBandProCoordinator.java @@ -0,0 +1,63 @@ +/* Copyright (C) 2023 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 . */ +package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartbandpro; + +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 RedmiSmartBandProCoordinator extends XiaomiCoordinator { + @Override + public boolean isExperimental() { + return true; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("^Redmi Band Pro [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_smart_band_pro; + } + + @Override + public int getDefaultIconResource() { + return R.drawable.ic_device_default; + } + + @Override + public int getDisabledIconResource() { + return R.drawable.ic_device_default_disabled; + } +} 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 2daf3be23..a4ed75b2e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -148,6 +148,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband7pro.MiBand7Pro import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8.MiBand8Coordinator; 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.watchs1active.XiaomiWatchS1ActiveCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator; @@ -211,6 +212,7 @@ public enum DeviceType { REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class), REDMISMARTBAND2(RedmiSmartBand2Coordinator.class), REDMIWATCH2LITE(RedmiWatch2Lite.class), + REDMISMARTBANDPRO(RedmiSmartBandProCoordinator.class), XIAOMI_WATCH_S1_ACTIVE(XiaomiWatchS1ActiveCoordinator.class), AMAZFITGTS3(AmazfitGTS3Coordinator.class), AMAZFITGTR3(AmazfitGTR3Coordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 06cc32d84..207073c3f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1428,6 +1428,7 @@ Redmi Watch 3 Active Redmi Smart Band 2 Redmi Watch 2 Lite + Redmi Smart Band Pro Choose export location General High-priority