diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java
index a505354ef..28b3304fc 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java
@@ -873,6 +873,9 @@ public class GBApplication extends Application {
case MIBAND4:
newWearside = prefs.getString("mi_wearside", "left");
break;
+ case MIBAND5:
+ newWearside = prefs.getString("mi_wearside", "left");
+ break;
case HPLUS:
newWearside = prefs.getString("hplus_wrist", "left");
newTimeformat = prefs.getString("hplus_timeformat", "24h");
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java
index 531b8699b..bc682e2f4 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java
@@ -49,6 +49,7 @@ public class HuamiConst {
public static final String MI_BAND3_NAME = "Mi Band 3";
public static final String MI_BAND3_NAME_2 = "Xiaomi Band 3";
public static final String MI_BAND4_NAME = "Mi Smart Band 4";
+ public static final String MI_BAND5_NAME = "Mi Smart Band 5";
public static final String PREF_ACTIVATE_DISPLAY_ON_LIFT = "activate_display_on_lift_wrist";
public static final String PREF_DISPLAY_ON_LIFT_START = "display_on_lift_start";
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java
new file mode 100644
index 000000000..7a0210999
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java
@@ -0,0 +1,110 @@
+/* Copyright (C) 2016-2020 Andreas Shimokawa, Carsten Pfeiffer, Daniele
+ Gobbetti, HardLight, 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.huami.miband5;
+
+import android.bluetooth.BluetoothDevice;
+import android.content.Context;
+import android.net.Uri;
+
+import androidx.annotation.NonNull;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
+import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
+import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
+import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
+
+public class MiBand5Coordinator extends HuamiCoordinator {
+ private static final Logger LOG = LoggerFactory.getLogger(MiBand5Coordinator.class);
+
+ @Override
+ public DeviceType getDeviceType() {
+ return DeviceType.MIBAND5;
+ }
+
+ @NonNull
+ @Override
+ public DeviceType getSupportedType(GBDeviceCandidate candidate) {
+ try {
+ BluetoothDevice device = candidate.getDevice();
+ String name = device.getName();
+ if (name != null && name.equalsIgnoreCase(HuamiConst.MI_BAND5_NAME)) {
+ return DeviceType.MIBAND5;
+ }
+ } catch (Exception ex) {
+ LOG.error("unable to check device support", ex);
+ }
+ return DeviceType.UNKNOWN;
+
+ }
+
+
+ @Override
+ public InstallHandler findInstallHandler(Uri uri, Context context) {
+ MiBand5FWInstallHandler handler = new MiBand5FWInstallHandler(uri, context);
+ return handler.isValid() ? handler : null;
+ }
+
+ @Override
+ public boolean supportsHeartRateMeasurement(GBDevice device) {
+ return true;
+ }
+
+ @Override
+ public boolean supportsWeather() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsActivityTracks() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsMusicInfo() {
+ return true;
+ }
+
+ @Override
+ public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
+ return new int[]{
+ R.xml.devicesettings_miband5,
+ R.xml.devicesettings_wearlocation,
+ R.xml.devicesettings_custom_emoji_font,
+ R.xml.devicesettings_timeformat,
+ R.xml.devicesettings_dateformat,
+ R.xml.devicesettings_nightmode,
+ R.xml.devicesettings_liftwrist_display,
+ R.xml.devicesettings_swipeunlock,
+ R.xml.devicesettings_sync_calendar,
+ R.xml.devicesettings_expose_hr_thirdparty,
+ R.xml.devicesettings_pairingkey,
+ R.xml.devicesettings_high_mtu
+ };
+ }
+
+ @Override
+ public int getBondingStyle() {
+ return BONDING_STYLE_REQUIRE_KEY;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5FWHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5FWHelper.java
new file mode 100644
index 000000000..b9fbfc40d
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5FWHelper.java
@@ -0,0 +1,40 @@
+/* Copyright (C) 2017-2020 Andreas Shimokawa, Carsten Pfeiffer
+
+ 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.huami.miband5;
+
+import android.content.Context;
+import android.net.Uri;
+
+import java.io.IOException;
+
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5FirmwareInfo;
+
+public class MiBand5FWHelper extends HuamiFWHelper {
+
+ public MiBand5FWHelper(Uri uri, Context context) throws IOException {
+ super(uri, context);
+ }
+
+ @Override
+ protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
+ firmwareInfo = new MiBand5FirmwareInfo(wholeFirmwareBytes);
+ if (!firmwareInfo.isHeaderValid()) {
+ throw new IllegalArgumentException("Not a Mi Band 5 firmware");
+ }
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5FWInstallHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5FWInstallHandler.java
new file mode 100644
index 000000000..b30248d04
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5FWInstallHandler.java
@@ -0,0 +1,50 @@
+/* Copyright (C) 2015-2020 Andreas Shimokawa, Carsten Pfeiffer
+
+ 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.huami.miband5;
+
+import android.content.Context;
+import android.net.Uri;
+
+import java.io.IOException;
+
+import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband5.MiBand5FWHelper;
+import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWInstallHandler;
+import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
+import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
+
+class MiBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
+ MiBand5FWInstallHandler(Uri uri, Context context) {
+ super(uri, context);
+ }
+
+ @Override
+ protected String getFwUpgradeNotice() {
+ return mContext.getString(R.string.fw_upgrade_notice_miband5, helper.getHumanFirmwareVersion());
+ }
+
+ @Override
+ protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException {
+ return new MiBand5FWHelper(uri, context);
+ }
+
+ @Override
+ protected boolean isSupportedDeviceType(GBDevice device) {
+ return device.getType() == DeviceType.MIBAND5;
+ }
+}
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 918f956fd..756c177d8 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
@@ -46,6 +46,7 @@ public enum DeviceType {
AMAZFITBIPS(20, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_bips),
AMAZFITGTR_LITE(21, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_gtr),
AMAZFITTREX(22, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_trex),
+ MIBAND5(23, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband5),
LIVEVIEW(30, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_liveview),
HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_hplus),
MAKIBESF68(41, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_makibes_f68),
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java
index 835c72010..461c0700b 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java
@@ -46,6 +46,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor2.Am
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4.MiBand4Support;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support;
import nodomain.freeyourgadget.gadgetbridge.service.devices.id115.ID115Support;
import nodomain.freeyourgadget.gadgetbridge.service.devices.itag.ITagSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.jyou.BFH16DeviceSupport;
@@ -146,6 +147,9 @@ public class DeviceSupportFactory {
case MIBAND4:
deviceSupport = new ServiceDeviceSupport(new MiBand4Support(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
break;
+ case MIBAND5:
+ deviceSupport = new ServiceDeviceSupport(new MiBand5Support(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
+ break;
case AMAZFITBIP:
deviceSupport = new ServiceDeviceSupport(new AmazfitBipSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
break;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5FirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5FirmwareInfo.java
new file mode 100644
index 000000000..1a8442098
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5FirmwareInfo.java
@@ -0,0 +1,91 @@
+/* Copyright (C) 2017-2020 Andreas Shimokawa, Daniele Gobbetti
+
+ 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.service.devices.huami.miband5;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
+import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
+import nodomain.freeyourgadget.gadgetbridge.util.ArrayUtils;
+
+public class MiBand5FirmwareInfo extends HuamiFirmwareInfo {
+
+ public static final byte[] FW_HEADER = new byte[]{
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x9c, (byte) 0xe3, 0x7d, 0x5c, 0x00, 0x04
+ };
+
+ public static final int FW_HEADER_OFFSET = 16;
+
+ private static Map crcToVersion = new HashMap<>();
+
+ static {
+ // firmware
+ crcToVersion.put(29062, "1.0.0.76");
+ crcToVersion.put(26302, "1.0.1.16");
+
+ // resources
+ crcToVersion.put(8009, "1.0.0.76");
+ crcToVersion.put(47040, "1.0.1.16");
+
+ // font
+ crcToVersion.put(31978, "1");
+ }
+
+ public MiBand5FirmwareInfo(byte[] bytes) {
+ super(bytes);
+ }
+
+ @Override
+ protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
+ if (ArrayUtils.equals(bytes, RES_HEADER, COMPRESSED_RES_HEADER_OFFSET) || ArrayUtils.equals(bytes, NEWRES_HEADER, COMPRESSED_RES_HEADER_OFFSET_NEW) || ArrayUtils.equals(bytes, NEWRES_HEADER, COMPRESSED_RES_HEADER_OFFSET)) {
+ return HuamiFirmwareType.RES_COMPRESSED;
+ }
+ if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET)) {
+ if (searchString32BitAligned(bytes, "Mi Smart Band 5")) {
+ return HuamiFirmwareType.FIRMWARE;
+ }
+ return HuamiFirmwareType.INVALID;
+ }
+ if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER)) {
+ return HuamiFirmwareType.WATCHFACE;
+ }
+ if (ArrayUtils.startsWith(bytes, NEWFT_HEADER)) {
+ if (bytes[10] == 0x03 || bytes[10] == 0x06) {
+ return HuamiFirmwareType.FONT;
+ }
+ }
+ // somebody might have unpacked the compressed res
+ if (ArrayUtils.startsWith(bytes, RES_HEADER)) {
+ return HuamiFirmwareType.RES;
+ }
+ return HuamiFirmwareType.INVALID;
+ }
+
+
+ @Override
+ public boolean isGenerallyCompatibleWith(GBDevice device) {
+ return isHeaderValid() && device.getType() == DeviceType.MIBAND5;
+ }
+
+ @Override
+ protected Map getCrcMap() {
+ return crcToVersion;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5Support.java
new file mode 100644
index 000000000..de9bf8ef1
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5Support.java
@@ -0,0 +1,109 @@
+/* Copyright (C) 2017-2020 Andreas Shimokawa, Carsten Pfeiffer
+
+ 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.service.devices.huami.miband5;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.net.Uri;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import nodomain.freeyourgadget.gadgetbridge.GBApplication;
+import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband5.MiBand5FWHelper;
+import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
+import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4.MiBand4Support;
+
+public class MiBand5Support extends MiBand4Support {
+ private static final Logger LOG = LoggerFactory.getLogger(MiBand5Support.class);
+
+ @Override
+ protected MiBand5Support setDisplayItems(TransactionBuilder builder) {
+ if (gbDevice.getFirmwareVersion() == null) {
+ LOG.warn("Device not initialized yet, won't set menu items");
+ return this;
+ }
+
+ SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress());
+ Set pages = prefs.getStringSet(HuamiConst.PREF_DISPLAY_ITEMS, new HashSet<>(Arrays.asList(getContext().getResources().getStringArray(R.array.pref_miband5_display_items_default))));
+ LOG.info("Setting display items to " + (pages == null ? "none" : pages));
+ byte[] command = new byte[]{
+ 0x1E,
+ 0x00, 0x00, (byte) 0xFF, 0x12, // Display clock?
+ 0x01, 0x00, (byte) 0xFF, 0x01, // Status
+ 0x02, 0x00, (byte) 0xFF, 0x19, // PAI
+ 0x03, 0x00, (byte) 0xFF, 0x02, // HR
+ 0x04, 0x00, (byte) 0xFF, 0x06, // Notifications
+ 0x05, 0x00, (byte) 0xFF, 0x33, // Breathing
+ 0x06, 0x00, (byte) 0xFF, 0x15, // Events
+ 0x07, 0x00, (byte) 0xFF, 0x04, // Weather
+ 0x08, 0x00, (byte) 0xFF, 0x03, // Workout
+ 0x09, 0x00, (byte) 0xFF, 0x07, // More
+ 0x0A, 0x00, (byte) 0xFF, 0x1c, // Stress
+ 0x0B, 0x00, (byte) 0xFF, 0x1d // Cycles
+ };
+
+ String[] keys = {"displayclock", "status", "pai", "hr", "notifications", "breathing", "eventreminder", "weather", "workout", "more", "stress", "cycles"};
+ byte[] ids = {0x12, 0x01, 0x19, 0x02, 0x06, 0x33, 0x15, 0x04, 0x03, 0x07, 0x1c, 0x1d};
+
+ if (pages != null) {
+ pages.add("displayclock");
+ // it seem that we first have to put all ENABLED items into the array
+ int pos = 1;
+ for (int i = 0; i < keys.length; i++) {
+ String key = keys[i];
+ byte id = ids[i];
+ if (pages.contains(key)) {
+ command[pos + 1] = 0x00;
+ command[pos + 3] = id;
+ pos += 4;
+ }
+ }
+ // And then all DISABLED ones
+ for (int i = 0; i < keys.length; i++) {
+ String key = keys[i];
+ byte id = ids[i];
+ if (!pages.contains(key)) {
+ command[pos + 1] = 0x01;
+ command[pos + 3] = id;
+ pos += 4;
+ }
+ }
+ writeToChunked(builder, 2, command);
+ }
+
+ return this;
+ }
+
+ @Override
+ public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
+ return new MiBand5FWHelper(uri, context);
+ }
+
+ @Override
+ public int getActivitySampleSize() {
+ return 8;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java
index 8e94fac27..04a89c302 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java
@@ -63,6 +63,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2Coordin
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband4.MiBand4Coordinator;
+import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband5.MiBand5Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30.TeclastH30Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.y5.Y5Coordinator;
@@ -213,6 +214,7 @@ public class DeviceHelper {
private List createCoordinators() {
List result = new ArrayList<>();
+ result.add(new MiBand5Coordinator());
result.add(new MiScale2DeviceCoordinator());
result.add(new AmazfitBipCoordinator());
result.add(new AmazfitBipLiteCoordinator());
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 99641dd85..1ecaa6052 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -313,6 +313,48 @@
- @string/p_heart_rate
+
+ - @string/menuitem_status
+ - @string/menuitem_pai
+ - @string/menuitem_hr
+ - @string/menuitem_notifications
+ - @string/menuitem_breathing
+ - @string/menuitem_eventreminder
+ - @string/menuitem_weather
+ - @string/menuitem_workout
+ - @string/menuitem_more
+ - @string/menuitem_stress
+ - @string/menuitem_cycles
+
+
+
+ - @string/p_menuitem_status
+ - @string/p_menuitem_pai
+ - @string/p_menuitem_hr
+ - @string/p_menuitem_notifications
+ - @string/p_menuitem_breathing
+ - @string/p_menuitem_eventreminder
+ - @string/p_menuitem_weather
+ - @string/p_menuitem_workout
+ - @string/p_menuitem_more
+ - @string/p_menuitem_stress
+ - @string/p_menuitem_cycles
+
+
+
+ - @string/p_menuitem_status
+ - @string/p_menuitem_pai
+ - @string/p_menuitem_hr
+ - @string/p_menuitem_notifications
+ - @string/p_menuitem_breathing
+ - @string/p_menuitem_eventreminder
+ - @string/p_menuitem_weather
+ - @string/p_menuitem_workout
+ - @string/p_menuitem_more
+ - @string/p_menuitem_stress
+ - @string/p_menuitem_cycles
+
+
- @string/menuitem_shortcut_alipay
- @string/menuitem_shortcut_weather
@@ -632,6 +674,24 @@
- ko_KO
+
+ - @string/automatic
+ - @string/simplified_chinese
+ - @string/traditional_chinese
+ - @string/english
+ - @string/russian
+ - @string/spanish
+
+
+
+ - auto
+ - zh_CN
+ - zh_TW
+ - en_US
+ - ru_RU
+ - es_ES
+
+
- @string/automatic
- @string/simplified_chinese
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 93ae3b496..7a192f04b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -72,6 +72,7 @@
You are about to install the %s firmware on your Amazfit T-Rex.\n\nPlease make sure to install the .fw file, then the .res file, and finally the .gps file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res and .gps if these files are exactly the same as the ones previously installed.\n\nPROCEED AT YOUR OWN RISK!
You are about to install the %s firmware on your Mi Band 3.\n\nPlease make sure to install the .fw file, and after that the .res file. Your band will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!
You are about to install the %s firmware on your Mi Band 4.\n\nPlease make sure to install the .fw file, and after that the .res file. Your band will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!
+ You are about to install the %s firmware on your Mi Band 5.\n\nPlease make sure to install the .fw file, and after that the .res file. Your band will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!
You are about to install the %1$s and %2$s firmware, instead of the ones currently on your Mi Band.
This firmware has been tested and is known to be compatible with Gadgetbridge.
"This firmware is untested and may not be compatible with Gadgetbridge.\n\nYou are DISCOURAGED from flashing it!"
@@ -721,6 +722,7 @@
Mi Band 2
Mi Band 3
Mi Band 4
+ Mi Band 5
Amazfit Bip
Amazfit Bip Lite
Amazfit Cor
@@ -764,6 +766,8 @@
Notifications
Activity
Weather
+ Breathing
+ Cycles
Alarm
Timer
Compass
@@ -773,6 +777,7 @@
Music
More
NFC
+ Stress
PAI
Heart Rate
Event Reminder
diff --git a/app/src/main/res/values/values.xml b/app/src/main/res/values/values.xml
index 5a8bff4a9..4b228a9d0 100644
--- a/app/src/main/res/values/values.xml
+++ b/app/src/main/res/values/values.xml
@@ -30,11 +30,14 @@
- settings
- alipay
- notifications
+ - breathing
- music
- more
- nfc
- hr
- pai
+ - stress
+ - cycles
- eventreminder
- workout
- worldclock
diff --git a/app/src/main/res/xml/devicesettings_miband5.xml b/app/src/main/res/xml/devicesettings_miband5.xml
new file mode 100644
index 000000000..2400d6365
--- /dev/null
+++ b/app/src/main/res/xml/devicesettings_miband5.xml
@@ -0,0 +1,20 @@
+
+
+
+
+