From 827e10f49e6b80dce6faa9f81c4a69b15fa6691e Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Sun, 1 May 2016 22:03:40 +0200 Subject: [PATCH 1/4] Updated Mi Band features --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b790dedf..9367cd44 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,8 @@ For more information read [this wiki article](https://github.com/Freeyourgadget/ * Generic Android notifications * Synchronize the time to the Mi Band * Display firmware version and battery state +* Firmware Update +* Heartrate Measurement (alpha) * Synchronize activity data * Display sleep data (alpha) * Display sports data (step count) (alpha) From 619a17425f59b99543f3ab92e4333eeff87e4ce6 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Wed, 4 May 2016 12:31:29 +0200 Subject: [PATCH 2/4] Mi Band: Display hint about starting Activity Activity instead of App Manager TODO: Fix the string, I have no idea how to properly name the Activity Activity --- .../gadgetbridge/activities/ControlCenter.java | 3 ++- .../gadgetbridge/devices/DeviceCoordinator.java | 2 ++ .../gadgetbridge/devices/UnknownDeviceCoordinator.java | 5 +++++ .../gadgetbridge/devices/miband/MiBandCoordinator.java | 6 ++++++ .../gadgetbridge/devices/pebble/PebbleCoordinator.java | 6 ++++++ app/src/main/res/values/strings.xml | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java index 7ddb5a88..702aa134 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java @@ -390,7 +390,8 @@ public class ControlCenter extends GBActivity { } if (connected) { - hintTextView.setText(R.string.tap_connected_device_for_app_mananger); + DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(selectedDevice); + hintTextView.setText(coordinator.getTapString()); } else if (!deviceList.isEmpty()) { hintTextView.setText(R.string.tap_a_device_to_connect); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceCoordinator.java index e1bfe822..7ecc3e8d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceCoordinator.java @@ -107,4 +107,6 @@ public interface DeviceCoordinator { * @return */ boolean supportsAlarmConfiguration(); + + int getTapString(); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/UnknownDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/UnknownDeviceCoordinator.java index 7d9b88d8..1af8da27 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/UnknownDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/UnknownDeviceCoordinator.java @@ -88,4 +88,9 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator { public boolean supportsAlarmConfiguration() { return false; } + + @Override + public int getTapString() { + return 0; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java index a669412e..c4e8e83c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java @@ -8,6 +8,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import nodomain.freeyourgadget.gadgetbridge.GBApplication; +import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; @@ -78,6 +79,11 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator { return true; } + @Override + public int getTapString() { + return R.string.tap_connected_device_for_activity; + } + public static boolean hasValidUserInfo() { String dummyMacAddress = MiBandService.MAC_ADDRESS_FILTER_1_1A + ":00:00:00"; try { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java index d76e7126..c74db054 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java @@ -5,6 +5,7 @@ import android.content.Context; import android.net.Uri; import nodomain.freeyourgadget.gadgetbridge.GBApplication; +import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.AppManagerActivity; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; @@ -80,4 +81,9 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator { public boolean supportsAlarmConfiguration() { return false; } + + @Override + public int getTapString() { + return R.string.tap_connected_device_for_app_mananger; + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1ec538ec..a3392096 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -87,6 +87,7 @@ Bluetooth is not supported. Bluetooth is disabled. Tap connected device for App Manager + Tap connected device for Activiy Tap a device to connect Cannot connect. BT address invalid? Gadgetbridge running From 045d5119ff356bec3138307af3d1d1902deac24e Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Wed, 4 May 2016 13:07:11 +0200 Subject: [PATCH 3/4] Do not update summary for checkbox preference Was causing summary to get overwritten by "true" or "false" when changing preferences --- .../gadgetbridge/devices/miband/MiBandPreferencesActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java index 919e7d2c..e49ae1ab 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java @@ -61,7 +61,6 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity { PREF_USER_ALIAS, PREF_MIBAND_ADDRESS, PREF_MIBAND_FITNESS_GOAL, - PREF_MIBAND_DONT_ACK_TRANSFER, PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR, getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_SMS), getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_INCOMING_CALL), From 65a95366f4e9b49ac85137456ebc660bcb2121ae Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Wed, 4 May 2016 13:24:32 +0200 Subject: [PATCH 4/4] Mi Band: Allow setting low-latency FW update mode in Mi Band development settings --- .../devices/miband/operations/UpdateFirmwareOperation.java | 7 ++++++- app/src/main/res/values/strings.xml | 5 ++++- app/src/main/res/xml/miband_preferences.xml | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/UpdateFirmwareOperation.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/UpdateFirmwareOperation.java index 4bb7d6ba..5b733b3f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/UpdateFirmwareOperation.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/UpdateFirmwareOperation.java @@ -13,6 +13,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.UUID; +import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventDisplayMessage; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandFWHelper; @@ -25,6 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.AbstractMiFir import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.MiBandSupport; import nodomain.freeyourgadget.gadgetbridge.util.CheckSums; import nodomain.freeyourgadget.gadgetbridge.util.GB; +import nodomain.freeyourgadget.gadgetbridge.util.Prefs; public class UpdateFirmwareOperation extends AbstractMiBandOperation { private static final Logger LOG = LoggerFactory.getLogger(UpdateFirmwareOperation.class); @@ -32,6 +34,7 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation { private final Uri uri; private boolean firmwareInfoSent = false; private UpdateCoordinator updateCoordinator; + final Prefs prefs = GBApplication.getPrefs(); public UpdateFirmwareOperation(Uri uri, MiBandSupport support) { super(support); @@ -285,7 +288,9 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation { int firmwareProgress = 0; TransactionBuilder builder = performInitialized("send firmware packet"); -// getSupport().setLowLatency(builder); + if (prefs.getBoolean("mi_low_latency_fw_update", false)) { + getSupport().setLowLatency(builder); + } for (int i = 0; i < packets; i++) { byte[] fwChunk = Arrays.copyOfRange(fwbytes, i * packetLength, i * packetLength + packetLength); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a3392096..133216e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -199,9 +199,12 @@ Steps Live Activity Steps today, target: %1$s + Do not ack activity data transfer If the activity data are not acked to the band, they will not be cleared. Useful if GB is used together with other apps. Will keep activity data on the Mi Band even after synchronization. Useful if GB is used together with other apps. - Do not ack activity data transfer + Use low-latency mode for FW updates + This might help on devices where firmware updates fail + Steps History Current steps/min Total Steps diff --git a/app/src/main/res/xml/miband_preferences.xml b/app/src/main/res/xml/miband_preferences.xml index bccb1348..041fc628 100644 --- a/app/src/main/res/xml/miband_preferences.xml +++ b/app/src/main/res/xml/miband_preferences.xml @@ -161,5 +161,10 @@ android:title="@string/pref_title_keep_data_on_device" android:summary="@string/pref_summary_keep_data_on_device" android:defaultValue="false" /> + \ No newline at end of file