1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-25 00:30:37 +02:00

Added support for xiaomi redmi watch 3 (#3582)

Co-authored-by: JdM <julien@rmbi.ch>
Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/3582
Co-authored-by: JdM <judemont@noreply.codeberg.org>
Co-committed-by: JdM <judemont@noreply.codeberg.org>
This commit is contained in:
JdM 2024-02-18 13:55:14 +00:00 committed by José Rebelo
parent 122ff5f7f4
commit 64c024a5ce
3 changed files with 82 additions and 0 deletions

View File

@ -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 <https://www.gnu.org/licenses/>. */
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
}
}

View File

@ -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),

View File

@ -1539,6 +1539,7 @@
<string name="devicetype_femometer_vinca2">Femometer Vinca II</string>
<string name="devicetype_xiaomi_watch_lite">Xiaomi Watch Lite</string>
<string name="devicetype_redmiwatch3active">Redmi Watch 3 Active</string>
<string name="devicetype_redmiwatch3">Redmi Watch 3</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>