mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 01:55:50 +01:00
Merge branch 'master' of github.com:Freeyourgadget/Gadgetbridge into fossil-q-hybrid
This commit is contained in:
commit
f5c8ea39b1
@ -1,8 +1,9 @@
|
||||
### Changelog
|
||||
|
||||
#### master
|
||||
* Mi Band 4: Unconfirmed and probably completely broken initial support
|
||||
#### Version 0.34.1
|
||||
* Mi Band 1: Fix crash when entering per-device settings
|
||||
* Mi Band 3: Allow setting date format in per-device settings
|
||||
* ZeTime: Fix timestmaps
|
||||
* Fix a crash when flashing an non-whitelisted firmware while using Gadgetbridge in Spanish
|
||||
|
||||
#### Version 0.34.0
|
||||
|
@ -19,7 +19,6 @@ vendor's servers.
|
||||
[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/Gadgetbridge/donate)
|
||||
|
||||
|
||||
[![Build](https://travis-ci.org/Freeyourgadget/Gadgetbridge.svg?branch=master)](https://travis-ci.org/Freeyourgadget/Gadgetbridge)
|
||||
[![Code Quality: Java](https://img.shields.io/lgtm/grade/java/g/Freeyourgadget/Gadgetbridge.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Freeyourgadget/Gadgetbridge/context:java)
|
||||
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/Freeyourgadget/Gadgetbridge.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Freeyourgadget/Gadgetbridge/alerts)
|
||||
|
||||
|
@ -25,8 +25,8 @@ android {
|
||||
targetSdkVersion 27
|
||||
|
||||
// Note: always bump BOTH versionCode and versionName!
|
||||
versionName "0.34.0"
|
||||
versionCode 150
|
||||
versionName "0.34.1"
|
||||
versionCode 151
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -282,6 +282,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
addPreferenceHandlerFor(PREF_SWIPE_UNLOCK);
|
||||
addPreferenceHandlerFor(PREF_MI2_DATEFORMAT);
|
||||
addPreferenceHandlerFor("dateformat");
|
||||
addPreferenceHandlerFor(HuamiConst.PREF_DISPLAY_ITEMS);
|
||||
|
||||
String displayOnLiftState = prefs.getString(PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_DO_NOT_DISTURB_OFF);
|
||||
|
@ -136,6 +136,7 @@ public class HuamiService {
|
||||
public static final byte[] DATEFORMAT_TIME = new byte[] {ENDPOINT_DISPLAY, 0x0a, 0x0, 0x0 };
|
||||
public static final byte[] DATEFORMAT_TIME_12_HOURS = new byte[] {ENDPOINT_DISPLAY, 0x02, 0x0, 0x0 };
|
||||
public static final byte[] DATEFORMAT_TIME_24_HOURS = new byte[] {ENDPOINT_DISPLAY, 0x02, 0x0, 0x1 };
|
||||
public static final byte[] DATEFORMAT_DATE_MM_DD_YYYY = new byte[]{ENDPOINT_DISPLAY, 30, 0x00, 'M', 'M', '/', 'd', 'd', '/', 'y', 'y', 'y', 'y'};
|
||||
public static final byte[] COMMAND_ENABLE_DISPLAY_ON_LIFT_WRIST = new byte[]{ENDPOINT_DISPLAY, 0x05, 0x00, 0x01};
|
||||
public static final byte[] COMMAND_DISABLE_DISPLAY_ON_LIFT_WRIST = new byte[]{ENDPOINT_DISPLAY, 0x05, 0x00, 0x00};
|
||||
public static final byte[] COMMAND_SCHEDULE_DISPLAY_ON_LIFT_WRIST = new byte[]{ENDPOINT_DISPLAY, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};
|
||||
|
@ -103,6 +103,7 @@ public class MiBand3Coordinator extends HuamiCoordinator {
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_miband3,
|
||||
R.xml.devicesettings_dateformat,
|
||||
R.xml.devicesettings_nightmode,
|
||||
R.xml.devicesettings_donotdisturb_withauto,
|
||||
R.xml.devicesettings_liftwrist_display,
|
||||
|
@ -1553,6 +1553,9 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
case MiBandConst.PREF_SWIPE_UNLOCK:
|
||||
setBandScreenUnlock(builder);
|
||||
break;
|
||||
case "dateformat":
|
||||
setDateFormat(builder);
|
||||
break;
|
||||
}
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException e) {
|
||||
@ -1567,11 +1570,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
try {
|
||||
new FetchSportsSummaryOperation(this).perform();
|
||||
} catch (IOException ex) {
|
||||
LOG.error("Unable to fetch MI activity data", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1593,6 +1592,26 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected HuamiSupport setDateFormat(TransactionBuilder builder) {
|
||||
String dateFormat = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString("dateformat", "MM/dd/yyyy");
|
||||
if (dateFormat == null) {
|
||||
return null;
|
||||
}
|
||||
switch (dateFormat) {
|
||||
case "MM/dd/yyyy":
|
||||
case "dd.MM.yyyy":
|
||||
case "dd/MM/yyyy":
|
||||
byte[] command = HuamiService.DATEFORMAT_DATE_MM_DD_YYYY;
|
||||
System.arraycopy(dateFormat.getBytes(), 0, command, 3, 10);
|
||||
builder.write(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_3_CONFIGURATION), command);
|
||||
break;
|
||||
default:
|
||||
LOG.warn("unsupported date format " + dateFormat);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private HuamiSupport setTimeFormat(TransactionBuilder builder) {
|
||||
boolean is24Format = DateFormat.is24HourFormat(getContext());
|
||||
LOG.info("Setting 24h time format to " + is24Format);
|
||||
|
@ -60,6 +60,7 @@ public class MiBand3FirmwareInfo extends HuamiFirmwareInfo {
|
||||
crcToVersion.put(62735, "2.3.0.6");
|
||||
crcToVersion.put(40949, "2.3.0.28");
|
||||
crcToVersion.put(59213, "2.4.0.12");
|
||||
crcToVersion.put(10810, "2.4.0.20");
|
||||
|
||||
// firmware (Mi Band 3 NFC)
|
||||
crcToVersion.put(46724, "1.7.0.4");
|
||||
@ -73,7 +74,7 @@ public class MiBand3FirmwareInfo extends HuamiFirmwareInfo {
|
||||
crcToVersion.put(1815, "2.0.0.4");
|
||||
crcToVersion.put(7225, "2.2.0.12-2.3.0.6");
|
||||
crcToVersion.put(52754, "2.3.0.28");
|
||||
crcToVersion.put(17930, "2.4.0.12");
|
||||
crcToVersion.put(17930, "2.4.0.12-20");
|
||||
|
||||
// font
|
||||
crcToVersion.put(19775, "1");
|
||||
|
@ -36,7 +36,6 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordin
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3FWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Service;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
@ -164,6 +163,7 @@ public class MiBand3Support extends AmazfitBipSupport {
|
||||
setLanguage(builder);
|
||||
setBandScreenUnlock(builder);
|
||||
setNightMode(builder);
|
||||
setDateFormat(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,7 +76,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
private final GBDeviceEventBatteryInfo batteryCmd = new GBDeviceEventBatteryInfo();
|
||||
private final GBDeviceEventVersionInfo versionCmd = new GBDeviceEventVersionInfo();
|
||||
private final GBDeviceEventMusicControl musicCmd = new GBDeviceEventMusicControl();
|
||||
private final int sevenHourOffset = 25200;
|
||||
private final int eightHourOffset = 28800;
|
||||
private byte[] lastMsg;
|
||||
private byte msgPart;
|
||||
private int availableSleepData;
|
||||
@ -1171,8 +1171,10 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
private void handleStepsData(byte[] msg)
|
||||
{
|
||||
ZeTimeActivitySample sample = new ZeTimeActivitySample();
|
||||
Calendar now = GregorianCalendar.getInstance();
|
||||
int timestamp = (msg[10] << 24)&0xff000000 | (msg[9] << 16)&0xff0000 | (msg[8] << 8)&0xff00 | (msg[7]&0xff);
|
||||
timestamp += sevenHourOffset; // the timestamp from the watch has an offset of seven hours, do not know why...
|
||||
timestamp += eightHourOffset; // the timestamp from the watch has an offset of eight hours, do not know why...
|
||||
timestamp -= ((now.get(Calendar.ZONE_OFFSET)/1000) + (now.get(Calendar.DST_OFFSET)/1000)); // TimeZone hour + daylight saving
|
||||
sample.setTimestamp(timestamp);
|
||||
sample.setSteps((msg[14] << 24)&0xff000000 | (msg[13] << 16)&0xff0000 | (msg[12] << 8)&0xff00 | (msg[11]&0xff));
|
||||
sample.setCaloriesBurnt((msg[18] << 24)&0xff000000 | (msg[17] << 16)&0xff0000 | (msg[16] << 8)&0xff00 | (msg[15]&0xff));
|
||||
@ -1217,8 +1219,10 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
private void handleSleepData(byte[] msg)
|
||||
{
|
||||
ZeTimeActivitySample sample = new ZeTimeActivitySample();
|
||||
Calendar now = GregorianCalendar.getInstance();
|
||||
int timestamp = (msg[10] << 24)&0xff000000 | (msg[9] << 16)&0xff0000 | (msg[8] << 8)&0xff00 | (msg[7]&0xff);
|
||||
timestamp += sevenHourOffset; // the timestamp from the watch has an offset of seven hours, do not know why...
|
||||
timestamp += eightHourOffset; // the timestamp from the watch has an offset of eight hours, do not know why...
|
||||
timestamp -= ((now.get(Calendar.ZONE_OFFSET)/1000) + (now.get(Calendar.DST_OFFSET)/1000)); // TimeZone hour + daylight saving
|
||||
sample.setTimestamp(timestamp);
|
||||
if(msg[11] == 0) {
|
||||
sample.setRawKind(ActivityKind.TYPE_DEEP_SLEEP);
|
||||
@ -1260,8 +1264,10 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
private void handleHeartRateData(byte[] msg)
|
||||
{
|
||||
ZeTimeActivitySample sample = new ZeTimeActivitySample();
|
||||
Calendar now = GregorianCalendar.getInstance();
|
||||
int timestamp = (msg[10] << 24)&0xff000000 | (msg[9] << 16)&0xff0000 | (msg[8] << 8)&0xff00 | (msg[7]&0xff);
|
||||
timestamp += sevenHourOffset; // the timestamp from the watch has an offset of seven hours, do not know why...
|
||||
timestamp += eightHourOffset; // the timestamp from the watch has an offset of eight hours, do not know why...
|
||||
timestamp -= ((now.get(Calendar.ZONE_OFFSET)/1000) + (now.get(Calendar.DST_OFFSET)/1000)); // TimeZone hour + daylight saving
|
||||
sample.setHeartRate(msg[11]);
|
||||
sample.setTimestamp(timestamp);
|
||||
|
||||
@ -1278,10 +1284,11 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
progressHeartRate = (msg[5]&0xff) | ((msg[6] << 8)&0xff00);
|
||||
GB.updateTransferNotification(null, getContext().getString(R.string.busy_task_fetch_activity_data), true, (int) (progressHeartRate *100 / availableHeartRateData), getContext());
|
||||
|
||||
if(((msg[4] << 8)&0xff00 | (msg[3]&0xff)) == 0xe) // if the message is longer than 0x7, than it has to measurements (payload = 0xe)
|
||||
if(((msg[4] << 8)&0xff00 | (msg[3]&0xff)) == 0xe) // if the message is longer than 0x7, than it has two measurements (payload = 0xe)
|
||||
{
|
||||
timestamp = (msg[17] << 24)&0xff000000 | (msg[16] << 16)&0xff0000 | (msg[15] << 8)&0xff00 | (msg[14]&0xff);
|
||||
timestamp += sevenHourOffset; // the timestamp from the watch has an offset of seven hours, do not know why...
|
||||
timestamp += eightHourOffset; // the timestamp from the watch has an offset of eight hours, do not know why...
|
||||
timestamp -= ((now.get(Calendar.ZONE_OFFSET)/1000) + (now.get(Calendar.DST_OFFSET)/1000)); // TimeZone hour + daylight saving
|
||||
sample.setHeartRate(msg[18]);
|
||||
sample.setTimestamp(timestamp);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
<string-array name="pref_language_options">
|
||||
<item name="default">System Default</item>
|
||||
<item name="ca">Català</item>
|
||||
<item name="cs">Čeština</item>
|
||||
<item name="de">Deutsch</item>
|
||||
<item name="en">English</item>
|
||||
@ -31,6 +32,7 @@
|
||||
|
||||
<string-array name="pref_language_values">
|
||||
<item>default</item>
|
||||
<item>ca</item>
|
||||
<item>cs</item>
|
||||
<item>de</item>
|
||||
<item>en</item>
|
||||
@ -148,6 +150,18 @@
|
||||
<item>@string/p_dateformat_datetime</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="dateformats">
|
||||
<item>dd.MM.yyyy</item>
|
||||
<item>dd/MM/yyyy</item>
|
||||
<item>MM/dd/yyyy</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="dateformats_values">
|
||||
<item>dd.MM.yyyy</item>
|
||||
<item>dd/MM/yyyy</item>
|
||||
<item>MM/dd/yyyy</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="mi2_do_not_disturb">
|
||||
<item>@string/mi2_dnd_off</item>
|
||||
<item>@string/mi2_dnd_automatic</item>
|
||||
|
@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog>
|
||||
|
||||
<release version="0.34.1" versioncode="151">
|
||||
<change>Mi Band 1: Fix crash when entering per-device settings</change>
|
||||
<change>Mi Band 3: Allow setting date format in per-device settings</change>
|
||||
<change>ZeTime: Fix timestmaps</change>
|
||||
<change>Fix a crash when flashing an non-whitelisted firmware while using Gadgetbridge in Spanish</change>
|
||||
</release>
|
||||
<release version="0.34.0" versioncode="150">
|
||||
<change>Mi Band 1/2/3/Bip/Cor: Migrate many settings to per-device settings (new settings icon in device card in main activity)</change>
|
||||
<change>Mi Band 3: Fix setting menu items with 2.4 firmware and add support for the new timer menu</change>
|
||||
|
12
app/src/main/res/xml/devicesettings_dateformat.xml
Normal file
12
app/src/main/res/xml/devicesettings_dateformat.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ListPreference
|
||||
android:defaultValue="MM/dd/yyyy"
|
||||
android:icon="@drawable/ic_access_time"
|
||||
android:entries="@array/dateformats"
|
||||
android:entryValues="@array/dateformats_values"
|
||||
android:key="dateformat"
|
||||
android:summary="%s"
|
||||
android:title="@string/miband2_prefs_dateformat" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
4
fastlane/metadata/android/en-US/changelogs/151.txt
Normal file
4
fastlane/metadata/android/en-US/changelogs/151.txt
Normal file
@ -0,0 +1,4 @@
|
||||
* Mi Band 1: Fix crash when entering per-device settings
|
||||
* Mi Band 3: Allow setting date format in per-device settings
|
||||
* ZeTime: Fix timestmaps
|
||||
* Fix a crash when flashing an non-whitelisted firmware while using Gadgetbridge in Spanish
|
Loading…
Reference in New Issue
Block a user