diff --git a/README.md b/README.md index ca28239e7..a19f01fa2 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ vendor's servers. - Xiaomi Smart Band 7 Pro (experimental) [**\[!\]**](#special-pairing-procedures) - [Xiaomi Smart Band 7](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Mi-Band-7) [**\[!\]**](#special-pairing-procedures) - [Xiaomi Smart Band 8 (experimental)](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Mi-Band-8) [**\[!\]**](#special-pairing-procedures) + - Mi Watch Color Sport (experimental) - Mi Watch Lite (experimental) - Redmi Watch 3 Active (experimental) [**\[!\]**](#special-pairing-procedures) - Watch S1 Active (experimental) [**\[!\]**](#special-pairing-procedures) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miwatchcolorsport/MiWatchColorSportCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miwatchcolorsport/MiWatchColorSportCoordinator.java new file mode 100644 index 000000000..c69791a08 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/miwatchcolorsport/MiWatchColorSportCoordinator.java @@ -0,0 +1,64 @@ +/* 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.miwatchcolorsport; + +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 MiWatchColorSportCoordinator extends XiaomiCoordinator { + + @Override + public int getDeviceNameResource() { + return R.string.devicetype_mi_watch_color_sport; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("^Mi ColorS [0-9A-Z]{4}$"); + } + + @Override + public boolean isExperimental() { + return true; + } + + @Nullable + @Override + public InstallHandler findInstallHandler(Uri uri, Context context) { + final XiaomiInstallHandler handler = new XiaomiInstallHandler(uri, context); + return handler.isValid() ? handler : null; + } + + @Override + public int getDefaultIconResource() { + return R.drawable.ic_device_miwatch; + } + + @Override + public int getDisabledIconResource() { + return R.drawable.ic_device_miwatch_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 0656d482f..f41b262b9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -142,6 +142,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.watch9.Watch9DeviceCoordinat import nodomain.freeyourgadget.gadgetbridge.devices.withingssteelhr.WithingsSteelHRDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband7pro.MiBand7ProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8.MiBand8Coordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatchcolorsport.MiWatchColorSportCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1active.XiaomiWatchS1ActiveCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeCoordinator; @@ -200,6 +201,7 @@ public enum DeviceType { MIBAND7PRO(MiBand7ProCoordinator.class), MIBAND8(MiBand8Coordinator.class), MIWATCHLITE(MiWatchLiteCoordinator.class), + MIWATCHCOLORSPORT(MiWatchColorSportCoordinator.class), REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class), XIAOMI_WATCH_S1_ACTIVE(XiaomiWatchS1ActiveCoordinator.class), AMAZFITGTS3(AmazfitGTS3Coordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f3decd289..b0d712421 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2431,4 +2431,5 @@ Sleep Mode Schedule Send a reminder and enter sleep mode at bedtime. At the scheduled wake-up time, the wake-up alarm will sound. Xiaomi Watch S1 Active + Mi Watch Color Sport