1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-10 12:09:27 +01:00

Add device coordinator for Xiaomi Watch S1 Active

This commit is contained in:
MrYoranimo 2023-11-26 21:24:12 +01:00
parent 8ef80a2565
commit 6933b8a793
3 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,70 @@
/* Copyright (C) 2023 Yoran Vulker
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 <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1active;
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 XiaomiWatchS1ActiveCoordinator extends XiaomiEncryptedCoordinator {
@Override
public int getDeviceNameResource() {
return R.string.devicetype_xiaomi_watch_s1_active;
}
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("^XiaomiWatchS1Active [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_watchxplus;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_watchxplus_disabled;
}
@Override
public boolean supportsMultipleWeatherLocations() {
return true;
}
}

View File

@ -141,6 +141,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.waspos.WaspOSCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.watch9.Watch9DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.withingssteelhr.WithingsSteelHRDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miband8.MiBand8Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.watchs1active.XiaomiWatchS1ActiveCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.miwatch.MiWatchLiteCoordinator;
@ -198,6 +199,7 @@ public enum DeviceType {
MIBAND8(MiBand8Coordinator.class),
MIWATCHLITE(MiWatchLiteCoordinator.class),
REDMIWATCH3ACTIVE(RedmiWatch3ActiveCoordinator.class),
XIAOMI_WATCH_S1_ACTIVE(XiaomiWatchS1ActiveCoordinator.class),
AMAZFITGTS3(AmazfitGTS3Coordinator.class),
AMAZFITGTR3(AmazfitGTR3Coordinator.class),
AMAZFITGTR4(AmazfitGTR4Coordinator.class),

View File

@ -2429,4 +2429,5 @@
<string name="wake_up_time">Wake Up</string>
<string name="pref_sleep_mode_schedule_title">Sleep Mode Schedule</string>
<string name="pref_sleep_mode_schedule_summary">Send a reminder and enter sleep mode at bedtime. At the scheduled wake-up time, the wake-up alarm will sound.</string>
<string name="devicetype_xiaomi_watch_s1_active">Xiaomi Watch S1 Active</string>
</resources>