From 7ed2c26b2f66d5fd42aeb82208a0bf9ef13dbe8c Mon Sep 17 00:00:00 2001 From: vanous Date: Mon, 21 Oct 2019 21:08:09 +0200 Subject: [PATCH 01/16] Catch crash during ChangeLog displaying --- .../gadgetbridge/activities/ControlCenterv2.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java index 7afc7bc3a..0b75e6b72 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java @@ -31,6 +31,7 @@ import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.view.MenuItem; import android.view.View; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; @@ -202,7 +203,12 @@ public class ControlCenterv2 extends AppCompatActivity ChangeLog cl = createChangeLog(); if (cl.isFirstRun()) { - cl.getLogDialog().show(); + try { + cl.getLogDialog().show(); + } catch (Exception ignored){ + GB.toast(getBaseContext(), "Error showing Changelog", Toast.LENGTH_LONG, GB.ERROR); + + } } GBApplication.deviceService().start(); From 21525adaaeaf5b4031ad1efe513a3fc7cd0e5136 Mon Sep 17 00:00:00 2001 From: vanous Date: Mon, 21 Oct 2019 21:12:07 +0200 Subject: [PATCH 02/16] Add uncommited second occurance of the same --- .../gadgetbridge/activities/ControlCenterv2.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java index 0b75e6b72..a9a0fd3be 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java @@ -291,7 +291,11 @@ public class ControlCenterv2 extends AppCompatActivity return true; case R.id.external_changelog: ChangeLog cl = createChangeLog(); - cl.getFullLogDialog().show(); + try { + cl.getLogDialog().show(); + } catch (Exception ignored) { + GB.toast(getBaseContext(), "Error showing Changelog", Toast.LENGTH_LONG, GB.ERROR); + } return true; } From d627577e6fd3dada8a6bb1d53829c1090b8f6801 Mon Sep 17 00:00:00 2001 From: HardLight Date: Wed, 23 Oct 2019 20:11:52 +0300 Subject: [PATCH 03/16] Mi Band 4: Enable Emoji Font setting --- .../gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java index c451e8d49..b21acc66a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java @@ -89,6 +89,7 @@ public class MiBand4Coordinator extends HuamiCoordinator { return new int[]{ R.xml.devicesettings_miband3, R.xml.devicesettings_wearlocation, + R.xml.devicesettings_custom_emoji_font, R.xml.devicesettings_dateformat, R.xml.devicesettings_nightmode, R.xml.devicesettings_liftwrist_display, From cbd47a81cc04ce15195959813a5a1a310cd92351 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Tue, 22 Oct 2019 21:53:38 +0200 Subject: [PATCH 04/16] Amazfit GTR: initial support for testing --- .../amazfitgtr/AmazfitGTRCoordinator.java | 61 +++++++++++++++++++ .../gadgetbridge/model/DeviceType.java | 1 + .../service/DeviceSupportFactory.java | 4 ++ .../huami/amazfitgtr/AmazfitGTRSupport.java | 44 +++++++++++++ .../gadgetbridge/util/DeviceHelper.java | 2 + app/src/main/res/values/strings.xml | 1 + 6 files changed, 113 insertions(+) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java new file mode 100644 index 000000000..5d9fc3ad7 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java @@ -0,0 +1,61 @@ +/* Copyright (C) 2017-2019 Andreas Shimokawa, Carsten Pfeiffer, Daniele + Gobbetti, João Paulo Barraca + + 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.amazfitgtr; + +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.devices.InstallHandler; +import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipCoordinator; +import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; +import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; + +public class AmazfitGTRCoordinator extends AmazfitBipCoordinator { + private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRCoordinator.class); + + @Override + public DeviceType getDeviceType() { + return DeviceType.AMAZFITGTR; + } + + @NonNull + @Override + public DeviceType getSupportedType(GBDeviceCandidate candidate) { + try { + BluetoothDevice device = candidate.getDevice(); + String name = device.getName(); + if (name != null && name.equalsIgnoreCase("Amazfit GTR")) { + return DeviceType.AMAZFITGTR; + } + } catch (Exception ex) { + LOG.error("unable to check device support", ex); + } + return DeviceType.UNKNOWN; + } + + @Override + public InstallHandler findInstallHandler(Uri uri, Context context) { + return null; + } +} 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 8e3bf22ea..22da2501c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -40,6 +40,7 @@ public enum DeviceType { AMAZFITCOR2(15, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor2), MIBAND4(16, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband4), AMAZFITBIP_LITE(17, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_amazfit_bip_lite), + AMAZFITGTR(18, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_amazfit_gtr), VIBRATISSIMO(20, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled, R.string.devicetype_vibratissimo), 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), 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 ce3f7a039..4efede4db 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java @@ -35,6 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.hplus.HPlusSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipLiteSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport; +import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.AmazfitGTRSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor.AmazfitCorSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor2.AmazfitCor2Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support; @@ -141,6 +142,9 @@ public class DeviceSupportFactory { case AMAZFITBIP_LITE: deviceSupport = new ServiceDeviceSupport(new AmazfitBipLiteSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING)); break; + case AMAZFITGTR: + deviceSupport = new ServiceDeviceSupport(new AmazfitGTRSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING)); + break; case AMAZFITCOR: deviceSupport = new ServiceDeviceSupport(new AmazfitCorSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING)); break; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java new file mode 100644 index 000000000..08183be60 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java @@ -0,0 +1,44 @@ +/* Copyright (C) 2017-2019 Andreas Shimokawa, Carsten Pfeiffer, Matthieu + Baerts, Roi Greenberg + + 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.amazfitgtr; + +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.amazfitbip.AmazfitBipSupport; + +public class AmazfitGTRSupport extends AmazfitBipSupport { + + @Override + public byte getCryptFlags() { + return (byte) 0x80; + } + + @Override + protected byte getAuthFlags() { + return 0x00; + } + + @Override + public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException { + return null; + } +} 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 e1af93727..096933338 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java @@ -46,6 +46,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.hplus.EXRIZUK8Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.hplus.MakibesF68Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipLiteCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.makibeshr3.MakibesHR3Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.hplus.Q8Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipCoordinator; @@ -207,6 +208,7 @@ public class DeviceHelper { result.add(new AmazfitBipLiteCoordinator()); result.add(new AmazfitCorCoordinator()); result.add(new AmazfitCor2Coordinator()); + result.add(new AmazfitGTRCoordinator()); result.add(new MiBand3Coordinator()); result.add(new MiBand4Coordinator()); result.add(new MiBand2HRXCoordinator()); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d7ab28a1..adb4c79d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -657,6 +657,7 @@ Amazfit Bip Lite Amazfit Cor Amazfit Cor 2 + Amazfit GTR Vibratissimo LiveView HPlus From c2c240d7beb8eb7faa6f3e340ae08f2d2546aec1 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 24 Oct 2019 21:51:10 +0200 Subject: [PATCH 05/16] Amazfit GTR: Enforce auth key input when pairing, try to fix notifications --- .../devices/huami/amazfitgtr/AmazfitGTRCoordinator.java | 5 +++++ .../service/devices/huami/amazfitbip/AmazfitBipSupport.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java index 5d9fc3ad7..50cc3345b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java @@ -58,4 +58,9 @@ public class AmazfitGTRCoordinator extends AmazfitBipCoordinator { public InstallHandler findInstallHandler(Uri uri, Context context) { return null; } + + @Override + public int getBondingStyle() { + return BONDING_STYLE_REQUIRE_KEY; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java index 469e360c7..e2fc11879 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipSupport.java @@ -124,7 +124,7 @@ public class AmazfitBipSupport extends HuamiSupport { appSuffix = appName.getBytes(); suffixlength = appSuffix.length; } - if (gbDevice.getType() == DeviceType.MIBAND4) { + if (gbDevice.getType() == DeviceType.MIBAND4 || gbDevice.getType() == DeviceType.AMAZFITGTR) { prefixlength += 4; } @@ -134,7 +134,7 @@ public class AmazfitBipSupport extends HuamiSupport { byte[] command = new byte[length + prefixlength + suffixlength]; int pos = 0; command[pos++] = (byte) alertCategory.getId(); - if (gbDevice.getType() == DeviceType.MIBAND4) { + if (gbDevice.getType() == DeviceType.MIBAND4 || gbDevice.getType() == DeviceType.AMAZFITGTR) { command[pos++] = 0; // TODO command[pos++] = 0; command[pos++] = 0; From 4110f0764a2a7be55885f0bcd799d0eab42a7357 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 24 Oct 2019 22:35:57 +0200 Subject: [PATCH 06/16] Amazfit GTR: enable firmware flashing for those who dare (untested) --- .../amazfitgtr/AmazfitGTRCoordinator.java | 3 +- .../huami/amazfitgtr/AmazfitGTRFWHelper.java | 44 +++++++ .../AmazfitGTRFWInstallHandler.java | 49 ++++++++ .../amazfitgtr/AmazfitGTRFirmwareInfo.java | 116 ++++++++++++++++++ .../huami/amazfitgtr/AmazfitGTRSupport.java | 3 +- app/src/main/res/values/strings.xml | 1 + 6 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWHelper.java create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWInstallHandler.java create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRFirmwareInfo.java diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java index 50cc3345b..568c167fc 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java @@ -56,7 +56,8 @@ public class AmazfitGTRCoordinator extends AmazfitBipCoordinator { @Override public InstallHandler findInstallHandler(Uri uri, Context context) { - return null; + AmazfitGTRFWInstallHandler handler = new AmazfitGTRFWInstallHandler(uri, context); + return handler.isValid() ? handler : null; } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWHelper.java new file mode 100644 index 000000000..ea770d694 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWHelper.java @@ -0,0 +1,44 @@ +/* Copyright (C) 2016-2019 Andreas Shimokawa, Carsten Pfeiffer, 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.devices.huami.amazfitgtr; + +import android.content.Context; +import android.net.Uri; + +import androidx.annotation.NonNull; + +import java.io.IOException; + +import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; +import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.AmazfitGTRFirmwareInfo; + +public class AmazfitGTRFWHelper extends HuamiFWHelper { + + public AmazfitGTRFWHelper(Uri uri, Context context) throws IOException { + super(uri, context); + } + + @NonNull + @Override + protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) { + firmwareInfo = new AmazfitGTRFirmwareInfo(wholeFirmwareBytes); + if (!firmwareInfo.isHeaderValid()) { + throw new IllegalArgumentException("Not a an Amazifit GTR firmware"); + } + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWInstallHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWInstallHandler.java new file mode 100644 index 000000000..0b997c9de --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRFWInstallHandler.java @@ -0,0 +1,49 @@ +/* Copyright (C) 2015-2019 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.amazfitgtr; + +import android.content.Context; +import android.net.Uri; + +import java.io.IOException; + +import nodomain.freeyourgadget.gadgetbridge.R; +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 AmazfitGTRFWInstallHandler extends AbstractMiBandFWInstallHandler { + AmazfitGTRFWInstallHandler(Uri uri, Context context) { + super(uri, context); + } + + @Override + protected String getFwUpgradeNotice() { + return mContext.getString(R.string.fw_upgrade_notice_amazfitgtr, helper.getHumanFirmwareVersion()); + } + + @Override + protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { + return new AmazfitGTRFWHelper(uri, context); + } + + @Override + protected boolean isSupportedDeviceType(GBDevice device) { + return device.getType() == DeviceType.AMAZFITGTR; + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRFirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRFirmwareInfo.java new file mode 100644 index 000000000..d4830455b --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRFirmwareInfo.java @@ -0,0 +1,116 @@ +/* Copyright (C) 2017-2019 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.amazfitgtr; + +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 AmazfitGTRFirmwareInfo extends HuamiFirmwareInfo { + private static final int FW_OFFSET = 2; + + private static final byte[] FW_HEADER = new byte[]{ + 0x09, 0x20, (byte) 0x99, 0x12, 0x01, 0x08 // completely nonsense probably + }; + + private static final byte[] GPS_ALMANAC_HEADER = new byte[]{ // probably wrong + (byte) 0xa0, (byte) 0x80, 0x08, 0x00, (byte) 0x8b, 0x07 + }; + + private static final byte[] GPS_CEP_HEADER = new byte[]{ // probably wrong + 0x2a, 0x12, (byte) 0xa0, 0x02 + }; + + // gps detection is totally bogus, just the first 16 bytes + private static final byte[][] GPS_HEADERS = { + new byte[]{ + 0x73, 0x75, 0x68, (byte) 0xd0, 0x70, 0x73, (byte) 0xbb, 0x5a, + 0x3e, (byte) 0xc3, (byte) 0xd3, 0x09, (byte) 0x9e, 0x1d, (byte) 0xd3, (byte) 0xc9 + } + }; + private static Map crcToVersion = new HashMap<>(); + + static { + // firmware + + // Latin Firmware + + // resources + + // font + + // gps + crcToVersion.put(62532, "18344,eb2f43f,126"); + } + + public AmazfitGTRFirmwareInfo(byte[] bytes) { + super(bytes); + } + + @Override + protected HuamiFirmwareType determineFirmwareType(byte[] bytes) { + if (ArrayUtils.equals(bytes, NEWRES_HEADER, COMPRESSED_RES_HEADER_OFFSET_NEW)) { + return HuamiFirmwareType.RES_COMPRESSED; + } + if (ArrayUtils.equals(bytes, FW_HEADER, FW_OFFSET)) { + if (searchString32BitAligned(bytes, "Amazfit GTR")) { + return HuamiFirmwareType.FIRMWARE; + } + return HuamiFirmwareType.INVALID; + } + if (ArrayUtils.startsWith(bytes, WATCHFACE_HEADER)) { + return HuamiFirmwareType.WATCHFACE; + } + if (ArrayUtils.startsWith(bytes, NEWFT_HEADER)) { + if (bytes[10] == 0x01) { + return HuamiFirmwareType.FONT; + } else if (bytes[10] == 0x02) { + return HuamiFirmwareType.FONT_LATIN; + } + } + + if (ArrayUtils.startsWith(bytes, GPS_ALMANAC_HEADER)) { + return HuamiFirmwareType.GPS_ALMANAC; + } + if (ArrayUtils.startsWith(bytes, GPS_CEP_HEADER)) { + return HuamiFirmwareType.GPS_CEP; + } + + for (byte[] gpsHeader : GPS_HEADERS) { + if (ArrayUtils.startsWith(bytes, gpsHeader)) { + return HuamiFirmwareType.GPS; + } + } + + return HuamiFirmwareType.INVALID; + } + + @Override + public boolean isGenerallyCompatibleWith(GBDevice device) { + return isHeaderValid() && device.getType() == DeviceType.AMAZFITGTR; + } + + @Override + protected Map getCrcMap() { + return crcToVersion; + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java index 08183be60..7b064a973 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java @@ -23,6 +23,7 @@ import android.net.Uri; import java.io.IOException; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; +import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRFWHelper; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport; public class AmazfitGTRSupport extends AmazfitBipSupport { @@ -39,6 +40,6 @@ public class AmazfitGTRSupport extends AmazfitBipSupport { @Override public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException { - return null; + return new AmazfitGTRFWHelper(uri, context); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index adb4c79d4..4101e3e37 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -66,6 +66,7 @@ \nPROCEED AT YOUR OWN RISK! \n \nCOMPLETELY UNTESTED, PROBABLY YOU NEED TO FLASH A BEATS_W FIRMWARE IF YOUR DEVICE NAME IS \"Amazfit Band 2\" + You are about to install the %s firmware on your Amazfit GTR.\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 %1$s and %2$s firmware, instead of the ones currently on your Mi Band. From 953f7b2850a43a9a361afddd698e726d6d857133 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Wed, 16 Oct 2019 20:22:19 +0000 Subject: [PATCH 07/16] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (712 of 712 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/pt_BR/ --- app/src/main/res/values-pt-rBR/strings.xml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index db4592514..19bda4831 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -367,12 +367,12 @@ Conectando… Tirar captura de tela do dispositivo Blacklist do Calendário - Você está prestes a instalar o firmware %s no seu Amazip Bip. -\n -\nCertifique-se de instalar o firmware .gps, depois o arquivo .res e, finalmente, o arquivo .fw. Seu relógio será reiniciado após a instalação do arquivo .fw. -\n -\nNota: você não precisa instalar .res e .gps se esses arquivos forem exatamente os mesmos que os instalados anteriormente. -\n + Você está prestes a instalar o firmware %s no seu Amazfit Bip. +\n +\nCertifique-se de instalar o firmware .fw, depois o arquivo .res e finalmente o arquivo .gps. Seu relógio será reiniciado após a instalação do arquivo .fw. +\n +\nNota: você não precisa instalar .res e .gps se esses arquivos forem exatamente os mesmos que os instalados anteriormente. +\n \nPROSSIGA POR SUA CONTA E RISCO! Você está prestes a instalar o firmware %s no seu Amazfit Cor. \n @@ -770,4 +770,11 @@ Duração do toque sonoro em segundos Duração Esse dispositivo precisa de sua chave de autenticação secreta, realize pressionamento longo no dispositivo para inseri-lo. Leia o wiki. + Você está prestes a instalar o firmware %s no seu Amazit Bip Lite. +\n +\nCertifique-se de instalar o arquivo .fw, e depois o arquivo .res. Seu relógio será reiniciado após a instalação do arquivo .fw. +\n +\nNota: você não precisa instalar .res se esse arquivo for exatamente o mesmo que os instalados anteriormente. +\n +\nPROSSIGA POR SUA CONTA E RISCO! \ No newline at end of file From 6b25ce3b9e14c9649749516344b61ac69f7d653c Mon Sep 17 00:00:00 2001 From: FransM Date: Thu, 17 Oct 2019 16:46:55 +0000 Subject: [PATCH 08/16] Translated using Weblate (Dutch) Currently translated at 100.0% (712 of 712 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/nl/ --- app/src/main/res/values-nl/strings.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index af03566fd..7ff82a5ed 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -758,4 +758,17 @@ Makibes HR3 instellingen Makibes HR3 Amazfit Bip Lite + Vind telefoon + Zet \\\'Vind telefoon\\\' aan + Gebruik je band om de beltoon van je telefoon af te spelen. + Belduur in seconden + Duur + Dit apparaat heeft een geheime verificatiesleutel nodig, druk lang op het apparaat om deze in te voeren. Lees de wiki. + U staat op het punt om de firmware %s te installeren op uw Amazfit Bip Lite. +\n +\nZorg ervoor dat u het .fw-bestand installeert, daarna het .res-bestand en als laatste het .gps-bestand. Uw horloge wordt opnieuw gestart na het installeren van het .fw-bestand. +\n +\nOpmerking: U hoeft de .res niet te installeren als deze exact dezelfde is als degene die ervoor al was geïnstalleerd. +\n +\nGA VERDER OP EIGEN RISICO! \ No newline at end of file From 01d2dfe5a17c874cbd058a27b4dabd90db34c936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=91=E4=B8=BE?= Date: Thu, 17 Oct 2019 02:01:13 +0000 Subject: [PATCH 09/16] Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (712 of 712 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/zh_Hans/ --- app/src/main/res/values-zh-rCN/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 3cdd4d045..8ff3f3c29 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -767,4 +767,11 @@ 铃声将持续数秒 持续 此设备需要认证密钥,请在设备上长按以输入密钥。具体请阅读 Wiki 。 + "您即将在米动手表青春版 Lite(Amazfit Bip Lite)上安装 %s 版本的固件 +\n +\n请确保先安装 .fw 文件,再安装 .res 文件。您的手环将会在安装了 .fw 文件后重启 +\n +\n备注:如果您安装的 .res 文件和之前相同,则无需安装 .res 文件 +\n +\n风险自担!" \ No newline at end of file From 5ca648ad83f211bdfae67aa8f53e62e67ced86fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Tue, 15 Oct 2019 22:58:07 +0000 Subject: [PATCH 10/16] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 97.9% (697 of 712 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/nb_NO/ --- app/src/main/res/values-nb-rNO/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 2d903e5a1..290e78c39 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -762,4 +762,11 @@ Anropsvarighet i sekunder Varighet Denne enheten trenger en hemmelig identitetsbekreftelsesnøkkel. Trykk lenge på enheten for å skrive den inn. Les wiki-en. + Du er i ferd med å installere %s-fastvaren på din Amazfit Bip Lite. +\n +\nForsikre deg om at du installerer ..fw-fila, så .res-fila, og til sist gps-fila. Armbåndsuret ditt vil starte på nytt etter at .fw-fila er installert. +\n +\nMerk: Du trenger ikke å installere .res-filen hvis den er akkurat den samme som den som allerede er installert. +\n +\nFORTSETT PÅ EGEN RISIKO! \ No newline at end of file From d56dae0ca955d196777119462b114ccd9e18aa42 Mon Sep 17 00:00:00 2001 From: nautilusx Date: Sat, 19 Oct 2019 12:26:43 +0000 Subject: [PATCH 11/16] Translated using Weblate (German) Currently translated at 100.0% (712 of 712 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/de/ --- app/src/main/res/values-de/strings.xml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index e37211021..c87748522 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -419,11 +419,11 @@ Nicht koppeln Geschwindigkeitszonen Du bist dabei, die Firmware %s auf deine Amazfit Bip zu installieren. -\n +\n \nBitte stelle sicher, dass du die .fw Datei, dann die .res Datei und schließlich die .gps Datei installierst. Deine Uhr wird nach der Installation der .fw Datei neu gestartet. -\n +\n \nHinweis: Du musst die .res und .gps nicht installieren, wenn diese Dateien genau die gleichen sind wie die zuvor installierten. -\n +\n \nINSTALLATION AUF EIGENE GEFAHR! Tastenaktionen Bestimmte Aktion bei Tastendruck auf dem Mi Band 2 @@ -446,7 +446,7 @@ Englisch Du bist dabei, die Firmware %s auf deine Amazfit Cor zu installieren. \n -\nBitte stelle sicher, dass du die .fw Datei und die .res Datei installierst. Dein Band wird nach der Installation der .fw Datei neu gestartet. +\nBitte stelle sicher, dass du die .fw Datei und danach die .res Datei installierst. Dein Band wird nach der Installation der .fw Datei neu gestartet. \n \nHinweis: Du musst .res nicht installieren, wenn es genau das gleiche ist, wie die zuvor installierte. \n @@ -694,17 +694,13 @@ Ändere den Authentifizierungsschlüssel in einen gemeinsamen Schlüssel auf all deinen Android-Geräten, von denen aus du eine Verbindung herstellen möchtet. Der bisherige Standardschlüssel für alle Geräte ist 0123456789@ABCDE BFH-16 Du bist dabei, die %s-Firmware auf deine Amazfit Cor 2 zu installieren. -\n -\n -\nBitte stelle sicher, dass Du die .fw-Datei und danach die .res-Datei installierst. Dein Band wird nach der Installation der.fw-Datei neu gestartet: -\n \n +\nBitte stelle sicher, dass Du die .fw-Datei und danach die .res-Datei installierst. Dein Band wird nach der Installation der.fw-Datei neu gestartet. +\n \nHinweis: Du musst .res nicht installieren, wenn es genau das gleiche ist, wie die zuvor installierte. \n -\n \nAUF EIGENE GEFAHR! \n -\n \nVOLLSTÄNDIG UNGETESTET, WAHRSCHEINLICH MUSST DU EINE BEATS_W FIRMWARE FLASHEN, WENN DEIN GERÄTENAME \"Amazfit Band 2\" IST Niederländisch Türkisch @@ -775,4 +771,12 @@ Verwende dein Band, um den Klingelton deines Handys wiederzugeben. Klingeldauer in Sekunden Dauer + Dieses Gerät benötigt eine geheime Authentifikationstaste, die du mit einem langen Druck auf das Gerät eingeben kannst. Lies das Wiki. + Du bist dabei, die Firmware %s auf deine Amazfit Bip Lite zu installieren. +\n +\nBitte stelle sicher, dass du die .fw Datei und danach die .res Datei installierst. Dein Uhr wird nach der Installation der .fw Datei neu gestartet. +\n +\nHinweis: Du musst .res nicht installieren, wenn es genau das gleiche ist, wie die zuvor installierte. +\n +\nINSTALLATION AUF EIGENE GEFAHR! \ No newline at end of file From 7a1a2ddd278c9e7e1528a64076d0856a2640085d Mon Sep 17 00:00:00 2001 From: Full Name Date: Sun, 20 Oct 2019 11:44:21 +0000 Subject: [PATCH 12/16] Translated using Weblate (Czech) Currently translated at 100.0% (712 of 712 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/cs/ --- app/src/main/res/values-cs/strings.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 0f4602f2d..f29a689bd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -757,8 +757,16 @@ Makibes HR3 Amazfit Bip Lite Vyhledat telefon - Povolit vyhledání telefonu + Zapnout \\\'Vyhledání telefonu\\\' Použijte náramek/hodinky k prozvonění telefonu. Délka zvonění ve vteřinách Délka + Toto zařízení vyžaduje tajný klíč, podržte dlouze na jménu zařízení pro jeho vložení. pro více detailů čtěte wiki. + Chystáte se nainstalovat firmvér %s na vašem Amazfit Bip Lite. +\n +\nProsím nezapomeňte nainstalovat soubor .fw, a poté soubor .res . Vaše hodinky se po instalaci souboru .fw restartují. +\n +\nPoznámka: Nemusíte instalovat soubory .res , pokud je tento soubor přesně stejný jako ten, který byl nainstalován dříve. +\n +\nPOKRAČUJTE TO NA VLASTNÍ NEBEZPEČÍ! \ No newline at end of file From 5b35247feee4527587c31b0c5447832b4b0cfaca Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Sat, 19 Oct 2019 08:57:38 +0000 Subject: [PATCH 13/16] Translated using Weblate (Hebrew) Currently translated at 100.0% (712 of 712 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/he/ --- app/src/main/res/values-he/strings.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index 2a292a311..d710c1282 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -755,9 +755,16 @@ Makibes HR3 Amazfit Bip Lite איתור הטלפון - הפעלת איתור הטלפון + הפעלת ‚איתור הטלפון’ ניתן להשתמש בצמיד כדי שהטלפון שלך ישמיע צלצול. משך זמן הצלצול בשניות משך למכשיר זה נדרש מפתח אימות סודי, יש לגעת נגיעה ארוכה על המכשיר כדי להזין אותו. פרטים נוספים בוויקי. + פעולה זו תתקין את הקושחה %s על ה־Amazfit Bip Lite שלך. +\n +\nנא לוודא את התקנת קושחת ה־‎.fw בהתחלה, לאחר מכן את קובץ ה־‎.res השעון שלך יופעל מחדש לאחר התקנת קובץ ה־fw. +\n +\nלתשומת לבך: אין צורך בהתקנת קובץ ה־‎.res אם הוא כבר זהה לזה שהתקנת בעבר. +\n +\nהמשך התהליך הוא על אחריותך! \ No newline at end of file From 81321f27be17e9d54974fec29c601b1b92dcfa14 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Thu, 24 Oct 2019 19:59:36 +0000 Subject: [PATCH 14/16] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (713 of 713 strings) Translation: Freeyourgadget/Gadgetbridge Translate-URL: https://hosted.weblate.org/projects/freeyourgadget/gadgetbridge/pt_BR/ --- app/src/main/res/values-pt-rBR/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 19bda4831..99a4f3e6e 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -777,4 +777,5 @@ \nNota: você não precisa instalar .res se esse arquivo for exatamente o mesmo que os instalados anteriormente. \n \nPROSSIGA POR SUA CONTA E RISCO! + Amazfit GTR \ No newline at end of file From 877a9be2717ae7fc6dc073c0bb7fd0eed1fa1be9 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 24 Oct 2019 22:57:39 +0200 Subject: [PATCH 15/16] draft changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a25b8ee75..abe86b871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ### Changelog +#### NEXT +* Amazfit GTR: Initial and incomplete support +* Mi Band 4: Enable emoji font setting +* Makibes HR3: Support the english version +* Makibes HR3: Enable bluetooth pairing for working reconnection +* Work around crash when trying to display changelog +* "Limit sleep charts range" (FIXME) +* " Check for non empty list of sleep sessions" (FIXME) + #### Version 0.37.1 * Amazfit Bip Lite: Support flashing firmware and watchfaces From 31ce36e335f9b1d77824917084dfbbfe4f80829f Mon Sep 17 00:00:00 2001 From: vanous Date: Thu, 24 Oct 2019 21:48:51 +0200 Subject: [PATCH 16/16] Add alternative color to heartrate in charts --- .../activities/charts/AbstractChartFragment.java | 9 ++++++++- app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 3 +++ app/src/main/res/xml/charts_preferences.xml | 9 +++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java index 411c74293..6a08744ec 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java @@ -69,6 +69,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils; import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper; +import nodomain.freeyourgadget.gadgetbridge.util.Prefs; /** * A base class fragment to be used with ChartsActivity. The fragment can supply @@ -170,12 +171,18 @@ public abstract class AbstractChartFragment extends AbstractGBFragment { } protected void init() { + Prefs prefs = GBApplication.getPrefs(); TypedValue runningColor = new TypedValue(); BACKGROUND_COLOR = GBApplication.getBackgroundColor(getContext()); LEGEND_TEXT_COLOR = DESCRIPTION_COLOR = GBApplication.getTextColor(getContext()); CHART_TEXT_COLOR = ContextCompat.getColor(getContext(), R.color.secondarytext); - HEARTRATE_COLOR = ContextCompat.getColor(getContext(), R.color.chart_heartrate); + if (prefs.getBoolean("chart_heartrate_color", false)) { + HEARTRATE_COLOR = ContextCompat.getColor(getContext(), R.color.chart_heartrate_alternative); + }else{ + HEARTRATE_COLOR = ContextCompat.getColor(getContext(), R.color.chart_heartrate); + } HEARTRATE_FILL_COLOR = ContextCompat.getColor(getContext(), R.color.chart_heartrate_fill); + getContext().getTheme().resolveAttribute(R.attr.chart_activity, runningColor, true); AK_ACTIVITY_COLOR = runningColor.data; getContext().getTheme().resolveAttribute(R.attr.chart_deep_sleep, runningColor, true); diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index cf32627f0..c73916a5f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -18,6 +18,7 @@ #1f000000 #ffab40 + #8B0000 #fadab1 #0071b7 #4c5aff diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4101e3e37..0103a073b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -527,6 +527,9 @@ Charts Range Charts range is set to a Month Charts range is set to a Week + Red + Orange + Heart rate color Steps per month Sleep per month Authenticating diff --git a/app/src/main/res/xml/charts_preferences.xml b/app/src/main/res/xml/charts_preferences.xml index 95d7453d0..c3cbd2971 100644 --- a/app/src/main/res/xml/charts_preferences.xml +++ b/app/src/main/res/xml/charts_preferences.xml @@ -17,6 +17,15 @@ android:maxLength="3" android:defaultValue="10" android:title="@string/activity_prefs_chart_min_heart_rate" /> + + +