mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-10-19 01:39:39 +02:00
Merge branch 'master' into background-javascript
This commit is contained in:
commit
fbef490419
@ -1,5 +1,8 @@
|
|||||||
### Changelog
|
### Changelog
|
||||||
|
|
||||||
|
#### Version 0.21.5
|
||||||
|
* Mi2/Bip: Support setting distance units (metric/imperial)
|
||||||
|
|
||||||
#### Version 0.21.4
|
#### Version 0.21.4
|
||||||
* Mi2/Bip: Fix sleep detection for newer firmwares
|
* Mi2/Bip: Fix sleep detection for newer firmwares
|
||||||
* Mi2/Bip: Fix ancient bug resulting in wrong activity data at the beginning in diagrams and aggregate data
|
* Mi2/Bip: Fix ancient bug resulting in wrong activity data at the beginning in diagrams and aggregate data
|
||||||
|
@ -27,7 +27,7 @@ android {
|
|||||||
|
|
||||||
// note: always bump BOTH versionCode and versionName!
|
// note: always bump BOTH versionCode and versionName!
|
||||||
versionName "0.21.5"
|
versionName "0.21.5"
|
||||||
versionCode 105
|
versionCode 106
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -37,6 +37,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband2.MiBand2FWInstallHandler;
|
import nodomain.freeyourgadget.gadgetbridge.devices.miband2.MiBand2FWInstallHandler;
|
||||||
@ -189,6 +190,16 @@ public class MiBand2Coordinator extends MiBandCoordinator {
|
|||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MiBandConst.DistanceUnit getDistanceUnit() {
|
||||||
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
String unit = prefs.getString(SettingsActivity.PREF_MEASUREMENT_SYSTEM, GBApplication.getContext().getString(R.string.p_unit_metric));
|
||||||
|
if (unit.equals(GBApplication.getContext().getString(R.string.p_unit_metric))) {
|
||||||
|
return MiBandConst.DistanceUnit.METRIC;
|
||||||
|
} else {
|
||||||
|
return MiBandConst.DistanceUnit.IMPERIAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static DoNotDisturb getDoNotDisturb(Context context) {
|
public static DoNotDisturb getDoNotDisturb(Context context) {
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
|
||||||
|
@ -144,6 +144,8 @@ public class MiBand2Service {
|
|||||||
public static final byte[] COMMAND_DISABLE_DISPLAY_CALLER = new byte[]{ENDPOINT_DISPLAY, 0x10, 0x00, 0x00, 0x00};
|
public static final byte[] COMMAND_DISABLE_DISPLAY_CALLER = new byte[]{ENDPOINT_DISPLAY, 0x10, 0x00, 0x00, 0x00};
|
||||||
public static final byte[] DISPLAY_XXX = new byte[] {ENDPOINT_DISPLAY, 0x03, 0x0, 0x0 };
|
public static final byte[] DISPLAY_XXX = new byte[] {ENDPOINT_DISPLAY, 0x03, 0x0, 0x0 };
|
||||||
public static final byte[] DISPLAY_YYY = new byte[] {ENDPOINT_DISPLAY, 0x10, 0x0, 0x1, 0x1 };
|
public static final byte[] DISPLAY_YYY = new byte[] {ENDPOINT_DISPLAY, 0x10, 0x0, 0x1, 0x1 };
|
||||||
|
public static final byte[] COMMAND_DISTANCE_UNIT_METRIC = new byte[] { ENDPOINT_DISPLAY, 0x03, 0x00, 0x00 };
|
||||||
|
public static final byte[] COMMAND_DISTANCE_UNIT_IMPERIAL = new byte[] { ENDPOINT_DISPLAY, 0x03, 0x00, 0x01 };
|
||||||
|
|
||||||
// The third byte controls the threshold, in minutes
|
// The third byte controls the threshold, in minutes
|
||||||
// The last 8 bytes represent 2 separate time intervals for the inactivity warnings
|
// The last 8 bytes represent 2 separate time intervals for the inactivity warnings
|
||||||
|
@ -81,6 +81,11 @@ public final class MiBandConst {
|
|||||||
public static final Version MI2_FW_VERSION_MIN_TEXT_NOTIFICATIONS = new Version("1.0.1.28");
|
public static final Version MI2_FW_VERSION_MIN_TEXT_NOTIFICATIONS = new Version("1.0.1.28");
|
||||||
public static final Version MI2_FW_VERSION_INTERMEDIATE_UPGRADE_53 = new Version("1.0.0.53");
|
public static final Version MI2_FW_VERSION_INTERMEDIATE_UPGRADE_53 = new Version("1.0.0.53");
|
||||||
|
|
||||||
|
public enum DistanceUnit {
|
||||||
|
METRIC,
|
||||||
|
IMPERIAL
|
||||||
|
}
|
||||||
|
|
||||||
public static int getNotificationPrefIntValue(String pref, String origin, Prefs prefs, int defaultValue) {
|
public static int getNotificationPrefIntValue(String pref, String origin, Prefs prefs, int defaultValue) {
|
||||||
String key = getNotificationPrefKey(pref, origin);
|
String key = getNotificationPrefKey(pref, origin);
|
||||||
return prefs.getInt(key, defaultValue);
|
return prefs.getInt(key, defaultValue);
|
||||||
|
@ -48,6 +48,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.Logging;
|
import nodomain.freeyourgadget.gadgetbridge.Logging;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
||||||
@ -1252,6 +1253,9 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_END:
|
case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_END:
|
||||||
setInactivityWarnings(builder);
|
setInactivityWarnings(builder);
|
||||||
break;
|
break;
|
||||||
|
case SettingsActivity.PREF_MEASUREMENT_SYSTEM:
|
||||||
|
setDistanceUnit(builder);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -1452,6 +1456,17 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MiBand2Support setDistanceUnit(TransactionBuilder builder) {
|
||||||
|
MiBandConst.DistanceUnit unit = MiBand2Coordinator.getDistanceUnit();
|
||||||
|
LOG.info("Setting distance unit to " + unit);
|
||||||
|
if (unit == MiBandConst.DistanceUnit.METRIC) {
|
||||||
|
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), MiBand2Service.COMMAND_DISTANCE_UNIT_METRIC);
|
||||||
|
} else {
|
||||||
|
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), MiBand2Service.COMMAND_DISTANCE_UNIT_IMPERIAL);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void phase2Initialize(TransactionBuilder builder) {
|
public void phase2Initialize(TransactionBuilder builder) {
|
||||||
LOG.info("phase2Initialize...");
|
LOG.info("phase2Initialize...");
|
||||||
requestBatteryInfo(builder);
|
requestBatteryInfo(builder);
|
||||||
@ -1462,6 +1477,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
setDateDisplay(builder);
|
setDateDisplay(builder);
|
||||||
setTimeFormat(builder);
|
setTimeFormat(builder);
|
||||||
setUserInfo(builder);
|
setUserInfo(builder);
|
||||||
|
setDistanceUnit(builder);
|
||||||
setWearLocation(builder);
|
setWearLocation(builder);
|
||||||
setFitnessGoal(builder);
|
setFitnessGoal(builder);
|
||||||
setDisplayItems(builder);
|
setDisplayItems(builder);
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<changelog>
|
<changelog>
|
||||||
|
<release version="0.21.5" versioncode="106">
|
||||||
|
<change>Mi2/Bip: Support setting distance units (metric/imperial)</change>
|
||||||
|
</release>
|
||||||
<release version="0.21.4" versioncode="105">
|
<release version="0.21.4" versioncode="105">
|
||||||
<change>Mi2/Bip: Fix sleep detection for newer firmwares</change>
|
<change>Mi2/Bip: Fix sleep detection for newer firmwares</change>
|
||||||
<change>Mi2/Bip: Fix ancient bug resulting in wrong activity data at the beginning in diagrams and aggregate data</change>
|
<change>Mi2/Bip: Fix ancient bug resulting in wrong activity data at the beginning in diagrams and aggregate data</change>
|
||||||
|
1
fastlane/metadata/android/en-US/changelogs/106.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/106.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
* Mi2/Bip: Support setting distance units (metric/imperial)
|
Loading…
Reference in New Issue
Block a user