diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmiwatch3/RedmiWatch3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmiwatch3/RedmiWatch3Coordinator.java new file mode 100644 index 000000000..d95732971 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/redmiwatch3/RedmiWatch3Coordinator.java @@ -0,0 +1,79 @@ +/* Copyright (C) 2023-2024 Andreas Shimokawa, 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.redmiwatch3; + +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; +import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; + +public class RedmiWatch3Coordinator extends XiaomiCoordinator { + @Override + public boolean isExperimental() { + return true; + } + + @Override + public ConnectionType getConnectionType() { + return ConnectionType.BOTH; + } + + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("^Redmi Watch 3 [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_redmiwatch3; + } + + @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; + } + + @Override + public int getContactsSlotCount(final GBDevice device) { + return 10; // TODO:verify + } +} 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 ca378051c..a9c6ac769 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -180,6 +180,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartband2.Redmi import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmismartbandpro.RedmiSmartBandProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch2.RedmiWatch2Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch2lite.RedmiWatch2LiteCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.redmiwatch3.RedmiWatch3Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1.XiaomiWatchS1Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1active.XiaomiWatchS1ActiveCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1pro.XiaomiWatchS1ProCoordinator; @@ -244,6 +245,7 @@ public enum DeviceType { MIWATCHLITE(MiWatchLiteCoordinator.class), MIWATCHCOLORSPORT(MiWatchColorSportCoordinator.class), REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class), + REDMIWATCH3(RedmiWatch3Coordinator.class), REDMISMARTBAND2(RedmiSmartBand2Coordinator.class), REDMIWATCH2(RedmiWatch2Coordinator.class), REDMIWATCH2LITE(RedmiWatch2LiteCoordinator.class), diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dc72014a7..0cec08155 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1539,6 +1539,7 @@ Femometer Vinca II Xiaomi Watch Lite Redmi Watch 3 Active + Redmi Watch 3 Redmi Smart Band 2 Redmi Watch 2 Redmi Watch 2 Lite