diff --git a/CHANGELOG.md b/CHANGELOG.md index 285abea9a..bf801f266 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,20 @@ ###Changelog -####Version (0.9.6) +####Version 0.9.7 +* Pebble: hopefully fix some reconnect issues +* Mi Band: fix live activity monitoring running forever if back button pressed +* Mi Band: allow low latency firmware updates, fixes update with some phones +* Mi Band: inital experimental and probably broken support for Amazfit +* Show aliases for BT Devices if they had been renamed in BT Settings +* Do not show a hint about App Manager when a Mi Band is connected + +####Version 0.9.6 * Again some UI/theme improvements * New preference to reconnect after connection loss (defaults to true) * Fix crash when dealing with certain old preference values * Mi Band: automatically reconnect when back in range after connection loss * Mi Band 1S: display heart rate value again when invoked via the Debug view -####Version (0.9.5) +####Version 0.9.5 * Several UI Improvements * Easier First-time setup by using a FAB * Optional Dark Theme @@ -16,7 +24,7 @@ * Mi Band 1S: Initial live heartrate tracking * Fix certain crash in charts activity on slower devices (#277) -####Version (0.9.4) +####Version 0.9.4 * Pebble: support pebble health datalog messages of firmware 3.11 (this adds support for deep sleep!) * Pebble: try to reconnect on new notifications and phone calls when connection was lost unexpectedly * Pebble: delay between reconnection attempts (from 1 up to 64 seconds) diff --git a/app/build.gradle b/app/build.gradle index 920f9e0ba..a2f25e273 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { targetSdkVersion 23 // note: always bump BOTH versionCode and versionName! - versionName "0.9.6" - versionCode 50 + versionName "0.9.7" + versionCode 51 } buildTypes { release { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index dd8f70fde..f6a083f37 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -183,7 +183,7 @@ public class GBApplication extends Application { root.addAppender(fileLogger); } } catch (Throwable ex) { - Log.e("GBApplication", "Error removing logger FILE appender", ex); + Log.e("GBApplication", "Error adding logger FILE appender", ex); } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/LiveActivityFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/LiveActivityFragment.java index 7b2013729..19a62a4b4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/LiveActivityFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/LiveActivityFragment.java @@ -351,6 +351,7 @@ public class LiveActivityFragment extends AbstractChartFragment { @Override public void onDestroyView() { + onMadeInvisibleInActivity(); LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mReceiver); super.onDestroyView(); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java index 6853b3714..8379d75bd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java @@ -26,6 +26,7 @@ public final class MiBandConst { public static final String MI_1 = "1"; public static final String MI_1A = "1A"; public static final String MI_1S = "1S"; + public static final String MI_AMAZFIT = "Amazfit"; public static int getNotificationPrefIntValue(String pref, String origin, Prefs prefs, int defaultValue) { String key = getNotificationPrefKey(pref, origin); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/UserInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/UserInfo.java index 5bb901b3d..4bc728c4c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/UserInfo.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/UserInfo.java @@ -85,7 +85,7 @@ public class UserInfo { sequence[8] = (byte) (type & 0xff); int aliasFrom = 9; - if (mDeviceInfo.isMili1A() || mDeviceInfo.isMili1S()) { + if (!mDeviceInfo.isMili1()) { sequence[9] = (byte) (mDeviceInfo.feature & 255); sequence[10] = (byte) (mDeviceInfo.appearance & 255); aliasFrom = 11; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/DeviceInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/DeviceInfo.java index 1072ff50c..3ba149df6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/DeviceInfo.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/DeviceInfo.java @@ -112,6 +112,10 @@ public class DeviceInfo extends AbstractInfo { return (feature == 4 && appearance == 0) || hwVersion == 4; } + public boolean isAmazFit() { + return hwVersion == 6; + } + public String getHwVersion() { if (isMili1()) { return MiBandConst.MI_1; @@ -122,6 +126,9 @@ public class DeviceInfo extends AbstractInfo { if (isMili1S()) { return MiBandConst.MI_1S; } + if (isAmazFit()) { + return MiBandConst.MI_AMAZFIT; + } return "?"; } } 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 5b733b3f1..32185d832 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 @@ -288,7 +288,7 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation { int firmwareProgress = 0; TransactionBuilder builder = performInitialized("send firmware packet"); - if (prefs.getBoolean("mi_low_latency_fw_update", false)) { + if (prefs.getBoolean("mi_low_latency_fw_update", true)) { getSupport().setLowLatency(builder); } for (int i = 0; i < packets; i++) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java index d22650273..43b86e2f1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java @@ -396,6 +396,14 @@ public class PebbleIoThread extends GBDeviceIoThread { } catch (IOException ex) { ex.printStackTrace(); LOG.info("error while reconnecting"); + } finally { + try { + if (mBtServerSocket != null) { + mBtServerSocket.close(); + mBtServerSocket = null; + } + } catch (IOException ignore) { + } } } if (!mIsConnected) { 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 05a629768..ee274dc7b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java @@ -5,6 +5,11 @@ import android.bluetooth.BluetoothDevice; import android.content.Context; import android.widget.Toast; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; @@ -22,6 +27,9 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; public class DeviceHelper { + + private static final Logger LOG = LoggerFactory.getLogger(DeviceHelper.class); + private static final DeviceHelper instance = new DeviceHelper(); public static DeviceHelper getInstance() { @@ -95,12 +103,23 @@ public class DeviceHelper { public GBDevice toSupportedDevice(BluetoothDevice device) { GBDeviceCandidate candidate = new GBDeviceCandidate(device, GBDevice.RSSI_UNKNOWN); + + String deviceName = device.getName(); + try { + Method method = device.getClass().getMethod("getAliasName"); + if (method != null) { + deviceName = (String) method.invoke(device); + } + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignore) { + LOG.info("Could not get device alias for " + deviceName); + } + if (coordinator != null && coordinator.supports(candidate)) { - return new GBDevice(device.getAddress(), device.getName(), coordinator.getDeviceType()); + return new GBDevice(device.getAddress(), deviceName, coordinator.getDeviceType()); } for (DeviceCoordinator coordinator : getAllCoordinators()) { if (coordinator.supports(candidate)) { - return new GBDevice(device.getAddress(), device.getName(), coordinator.getDeviceType()); + return new GBDevice(device.getAddress(), deviceName, coordinator.getDeviceType()); } } return null; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/Prefs.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/Prefs.java index 2b4fcdb62..03aca1aa2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/Prefs.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/Prefs.java @@ -1,6 +1,7 @@ package nodomain.freeyourgadget.gadgetbridge.util; import android.content.SharedPreferences; +import android.util.Log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -11,7 +12,9 @@ import java.util.Set; * Wraps SharedPreferences to avoid ClassCastExceptions and others. */ public class Prefs { - private static final Logger LOG = LoggerFactory.getLogger(Prefs.class); + private static final String TAG = "Prefs"; + // DO NOT use slf4j logger here, this would break its configuration via GBApplication +// private static final Logger LOG = LoggerFactory.getLogger(Prefs.class); private final SharedPreferences preferences; @@ -136,7 +139,7 @@ public class Prefs { } private void logReadError(String key, Exception ex) { - LOG.error("Error reading preference value: " + key + "; returning default value", ex); // log the first exception + Log.e(TAG, "Error reading preference value: " + key + "; returning default value", ex); // log the first exception } /** diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 7dfeb3f71..121df48e8 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -32,6 +32,9 @@ Datum und Zeit Uhrzeit synchronisieren Synchronisiere die Urzeit mit dem Gerät (bei Verbindingsaufbau und wenn die Zeit oder Zeitzone auf dem Android Gerät eingestellt wird) + Thema + Hell + Dunkel Benachrichtigungen Wiederholungen Anrufe @@ -71,6 +74,7 @@ Bluetooth wird nicht unterstützt. Bluetooth ist abgeschaltet. berühre das verbundene Gerät, um den App Manager zu starten + Tippe auf ein verbundenes Gerät, um die Aktivitäten anzuzeigen berühre ein Gerät zum Verbinden Verbindung kann nicht aufgebaut werden. BT Adresse ungültig? Gadgetbridge läuft @@ -179,9 +183,11 @@ Schritte Live Aktivität Schritte heute, Ziel: %1$s + Transfer von Aktivitätsdaten nicht bestätigen Wenn der Transfer der Aktivitätsdaten nicht bestätigt wird, werden die Daten nicht auf dem Mi Band gelöscht. Das ist Sinnvoll, wenn neben Gadgetbridge noch andere Apps auf das Mi Band zugreifen. Aktivitätsdaten verbleiben auf dem Mi Band, auch nach der Synchronisierung. Hilfreich wenn das Mi Band mit weiteren Apps verwendet wird. - Transfer von Aktivitätsdaten nicht bestätigen + Benutze Modus mit niedriger Latenz für FW-Updates + Dies kann bei Geräten helfen, bei denen Firmwareupdates fehlschlagen Verlauf Schritte Akt. Schritte pro Minute Schritte insgesamt @@ -196,6 +202,7 @@ Aktivitätsdaten auf dem Gerät lassen Inkompatible Firmware Diese Firmware ist nicht mit dem Gerät kompatibel + Verwende den Herzfrequenzsensor um die Schlaferkennung zu verbessern warte auf eingehende Verbindung Erneut installieren Über Dich @@ -205,10 +212,19 @@ Gewicht in kg aktivieren deaktivieren + Authentifiziere + Authentifizierung erforderlich Zzz Widget hinzufügen Gewünschte Schlafdauer in Stunden Ein Wecker wurde auf %1$02d:%2$02d gestellt HW: %1$s FW: %1$s + Fehler beim Erstellen des Verzeichnisses für Logdateien: %1$s + HF: + Firmwareupdate wird durchgeführt + Firmware wurde nicht gesendet + Herzfrequenz + Herzfrequenz + Verbindungen automatisch wiederherstellen diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 5018b7d20..864ce5412 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -74,6 +74,7 @@ Bluetoothはサポートされていません。 Bluetoothは無効です。 アプリマネージャーの接続されたデバイスをタップ + アクティビティの接続されたデバイスをタップ 接続するデバイスをタップ 接続できません。 BTアドレスが無効? ガジェットブリッジは実行中 @@ -182,9 +183,11 @@ 歩数 生活活動 今日の歩数、目標: %1$s + 活動データ転送に応答しない 活動データは、バンドが応答しない場合は、クリアされません。 GBを他のアプリと一緒に使用する場合に便利です。 同期後もMi Bandに活動データを保持します。 GBを他のアプリと一緒に使用する場合に便利です。 - 活動データ転送に応答しない + FW の更新に低遅延モードを使用する + これはファームウェアの更新が失敗するデバイスで役立つことがあります 歩数履歴 現在の歩数/分 合計歩数 @@ -225,4 +228,5 @@ ファームウェアを送信しませんでした 心拍数 心拍数 + 自動的に再接続 diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index ab86fe0d9..425e5c4a0 100644 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -1,5 +1,13 @@ + + Pebble: hopefully fix some reconnect issues + Mi Band: fix live activity monitoring running forever if back button pressed + Mi Band: allow low latency firmware updates, fixes update with some phones + Mi Band: inital experimental and probably broken support for Amazfit + Show aliases for BT Devices if they had been renamed in BT Settings + Do not show a hint about App Manager when a Mi Band is connected + Again some UI/theme improvements New preference to reconnect after connection loss (defaults to true) diff --git a/app/src/main/res/xml/miband_preferences.xml b/app/src/main/res/xml/miband_preferences.xml index 041fc6282..37e5d7777 100644 --- a/app/src/main/res/xml/miband_preferences.xml +++ b/app/src/main/res/xml/miband_preferences.xml @@ -165,6 +165,6 @@ android:key="mi_low_latency_fw_update" android:title="@string/pref_title_low_latency_fw_update" android:summary="@string/pref_summary_low_latency_fw_update" - android:defaultValue="false" /> + android:defaultValue="true" /> \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 1d3591c8a..8c1449720 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,6 +11,7 @@ # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit