1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

Merge branch 'master' into db-refactoring

This commit is contained in:
cpfeiffer 2016-05-16 23:01:16 +02:00
commit 40a376bbd0
16 changed files with 91 additions and 15 deletions

View File

@ -1,12 +1,20 @@
###Changelog ###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 * Again some UI/theme improvements
* New preference to reconnect after connection loss (defaults to true) * New preference to reconnect after connection loss (defaults to true)
* Fix crash when dealing with certain old preference values * Fix crash when dealing with certain old preference values
* Mi Band: automatically reconnect when back in range after connection loss * 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 * 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 * Several UI Improvements
* Easier First-time setup by using a FAB * Easier First-time setup by using a FAB
* Optional Dark Theme * Optional Dark Theme
@ -16,7 +24,7 @@
* Mi Band 1S: Initial live heartrate tracking * Mi Band 1S: Initial live heartrate tracking
* Fix certain crash in charts activity on slower devices (#277) * 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: 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: 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) * Pebble: delay between reconnection attempts (from 1 up to 64 seconds)

View File

@ -16,8 +16,8 @@ android {
targetSdkVersion 23 targetSdkVersion 23
// note: always bump BOTH versionCode and versionName! // note: always bump BOTH versionCode and versionName!
versionName "0.9.6" versionName "0.9.7"
versionCode 50 versionCode 51
} }
buildTypes { buildTypes {
release { release {

View File

@ -183,7 +183,7 @@ public class GBApplication extends Application {
root.addAppender(fileLogger); root.addAppender(fileLogger);
} }
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e("GBApplication", "Error removing logger FILE appender", ex); Log.e("GBApplication", "Error adding logger FILE appender", ex);
} }
} }

View File

@ -351,6 +351,7 @@ public class LiveActivityFragment extends AbstractChartFragment {
@Override @Override
public void onDestroyView() { public void onDestroyView() {
onMadeInvisibleInActivity();
LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mReceiver); LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mReceiver);
super.onDestroyView(); super.onDestroyView();
} }

View File

@ -26,6 +26,7 @@ public final class MiBandConst {
public static final String MI_1 = "1"; public static final String MI_1 = "1";
public static final String MI_1A = "1A"; public static final String MI_1A = "1A";
public static final String MI_1S = "1S"; 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) { public static int getNotificationPrefIntValue(String pref, String origin, Prefs prefs, int defaultValue) {
String key = getNotificationPrefKey(pref, origin); String key = getNotificationPrefKey(pref, origin);

View File

@ -85,7 +85,7 @@ public class UserInfo {
sequence[8] = (byte) (type & 0xff); sequence[8] = (byte) (type & 0xff);
int aliasFrom = 9; int aliasFrom = 9;
if (mDeviceInfo.isMili1A() || mDeviceInfo.isMili1S()) { if (!mDeviceInfo.isMili1()) {
sequence[9] = (byte) (mDeviceInfo.feature & 255); sequence[9] = (byte) (mDeviceInfo.feature & 255);
sequence[10] = (byte) (mDeviceInfo.appearance & 255); sequence[10] = (byte) (mDeviceInfo.appearance & 255);
aliasFrom = 11; aliasFrom = 11;

View File

@ -112,6 +112,10 @@ public class DeviceInfo extends AbstractInfo {
return (feature == 4 && appearance == 0) || hwVersion == 4; return (feature == 4 && appearance == 0) || hwVersion == 4;
} }
public boolean isAmazFit() {
return hwVersion == 6;
}
public String getHwVersion() { public String getHwVersion() {
if (isMili1()) { if (isMili1()) {
return MiBandConst.MI_1; return MiBandConst.MI_1;
@ -122,6 +126,9 @@ public class DeviceInfo extends AbstractInfo {
if (isMili1S()) { if (isMili1S()) {
return MiBandConst.MI_1S; return MiBandConst.MI_1S;
} }
if (isAmazFit()) {
return MiBandConst.MI_AMAZFIT;
}
return "?"; return "?";
} }
} }

View File

@ -288,7 +288,7 @@ public class UpdateFirmwareOperation extends AbstractMiBandOperation {
int firmwareProgress = 0; int firmwareProgress = 0;
TransactionBuilder builder = performInitialized("send firmware packet"); 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); getSupport().setLowLatency(builder);
} }
for (int i = 0; i < packets; i++) { for (int i = 0; i < packets; i++) {

View File

@ -396,6 +396,14 @@ public class PebbleIoThread extends GBDeviceIoThread {
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
LOG.info("error while reconnecting"); LOG.info("error while reconnecting");
} finally {
try {
if (mBtServerSocket != null) {
mBtServerSocket.close();
mBtServerSocket = null;
}
} catch (IOException ignore) {
}
} }
} }
if (!mIsConnected) { if (!mIsConnected) {

View File

@ -5,6 +5,11 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context; import android.content.Context;
import android.widget.Toast; 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.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
@ -22,6 +27,9 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
public class DeviceHelper { public class DeviceHelper {
private static final Logger LOG = LoggerFactory.getLogger(DeviceHelper.class);
private static final DeviceHelper instance = new DeviceHelper(); private static final DeviceHelper instance = new DeviceHelper();
public static DeviceHelper getInstance() { public static DeviceHelper getInstance() {
@ -95,12 +103,23 @@ public class DeviceHelper {
public GBDevice toSupportedDevice(BluetoothDevice device) { public GBDevice toSupportedDevice(BluetoothDevice device) {
GBDeviceCandidate candidate = new GBDeviceCandidate(device, GBDevice.RSSI_UNKNOWN); 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)) { 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()) { for (DeviceCoordinator coordinator : getAllCoordinators()) {
if (coordinator.supports(candidate)) { if (coordinator.supports(candidate)) {
return new GBDevice(device.getAddress(), device.getName(), coordinator.getDeviceType()); return new GBDevice(device.getAddress(), deviceName, coordinator.getDeviceType());
} }
} }
return null; return null;

View File

@ -1,6 +1,7 @@
package nodomain.freeyourgadget.gadgetbridge.util; package nodomain.freeyourgadget.gadgetbridge.util;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.util.Log;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -11,7 +12,9 @@ import java.util.Set;
* Wraps SharedPreferences to avoid ClassCastExceptions and others. * Wraps SharedPreferences to avoid ClassCastExceptions and others.
*/ */
public class Prefs { 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; private final SharedPreferences preferences;
@ -136,7 +139,7 @@ public class Prefs {
} }
private void logReadError(String key, Exception ex) { 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
} }
/** /**

View File

@ -32,6 +32,9 @@
<string name="pref_header_datetime">Datum und Zeit</string> <string name="pref_header_datetime">Datum und Zeit</string>
<string name="pref_title_datetime_syctimeonconnect">Uhrzeit synchronisieren</string> <string name="pref_title_datetime_syctimeonconnect">Uhrzeit synchronisieren</string>
<string name="pref_summary_datetime_syctimeonconnect">Synchronisiere die Urzeit mit dem Gerät (bei Verbindingsaufbau und wenn die Zeit oder Zeitzone auf dem Android Gerät eingestellt wird)</string> <string name="pref_summary_datetime_syctimeonconnect">Synchronisiere die Urzeit mit dem Gerät (bei Verbindingsaufbau und wenn die Zeit oder Zeitzone auf dem Android Gerät eingestellt wird)</string>
<string name="pref_title_theme">Thema</string>
<string name="pref_theme_light">Hell</string>
<string name="pref_theme_dark">Dunkel</string>
<string name="pref_header_notifications">Benachrichtigungen</string> <string name="pref_header_notifications">Benachrichtigungen</string>
<string name="pref_title_notifications_repetitions">Wiederholungen</string> <string name="pref_title_notifications_repetitions">Wiederholungen</string>
<string name="pref_title_notifications_call">Anrufe</string> <string name="pref_title_notifications_call">Anrufe</string>
@ -71,6 +74,7 @@
<string name="bluetooth_is_not_supported_">Bluetooth wird nicht unterstützt.</string> <string name="bluetooth_is_not_supported_">Bluetooth wird nicht unterstützt.</string>
<string name="bluetooth_is_disabled_">Bluetooth ist abgeschaltet.</string> <string name="bluetooth_is_disabled_">Bluetooth ist abgeschaltet.</string>
<string name="tap_connected_device_for_app_mananger">berühre das verbundene Gerät, um den App Manager zu starten</string> <string name="tap_connected_device_for_app_mananger">berühre das verbundene Gerät, um den App Manager zu starten</string>
<string name="tap_connected_device_for_activity">Tippe auf ein verbundenes Gerät, um die Aktivitäten anzuzeigen</string>
<string name="tap_a_device_to_connect">berühre ein Gerät zum Verbinden</string> <string name="tap_a_device_to_connect">berühre ein Gerät zum Verbinden</string>
<string name="cannot_connect_bt_address_invalid_">Verbindung kann nicht aufgebaut werden. BT Adresse ungültig?</string> <string name="cannot_connect_bt_address_invalid_">Verbindung kann nicht aufgebaut werden. BT Adresse ungültig?</string>
<string name="gadgetbridge_running">Gadgetbridge läuft</string> <string name="gadgetbridge_running">Gadgetbridge läuft</string>
@ -179,9 +183,11 @@
<string name="chart_steps">Schritte</string> <string name="chart_steps">Schritte</string>
<string name="liveactivity_live_activity">Live Aktivität</string> <string name="liveactivity_live_activity">Live Aktivität</string>
<string name="weeksteps_today_steps_description">Schritte heute, Ziel: %1$s</string> <string name="weeksteps_today_steps_description">Schritte heute, Ziel: %1$s</string>
<string name="pref_title_dont_ack_transfer">Transfer von Aktivitätsdaten nicht bestätigen</string>
<string name="pref_summary_dont_ack_transfers">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.</string> <string name="pref_summary_dont_ack_transfers">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.</string>
<string name="pref_summary_keep_data_on_device">Aktivitätsdaten verbleiben auf dem Mi Band, auch nach der Synchronisierung. Hilfreich wenn das Mi Band mit weiteren Apps verwendet wird.</string> <string name="pref_summary_keep_data_on_device">Aktivitätsdaten verbleiben auf dem Mi Band, auch nach der Synchronisierung. Hilfreich wenn das Mi Band mit weiteren Apps verwendet wird.</string>
<string name="pref_title_dont_ack_transfer">Transfer von Aktivitätsdaten nicht bestätigen</string> <string name="pref_title_low_latency_fw_update">Benutze Modus mit niedriger Latenz für FW-Updates</string>
<string name="pref_summary_low_latency_fw_update">Dies kann bei Geräten helfen, bei denen Firmwareupdates fehlschlagen</string>
<string name="live_activity_steps_history">Verlauf Schritte</string> <string name="live_activity_steps_history">Verlauf Schritte</string>
<string name="live_activity_current_steps_per_minute">Akt. Schritte pro Minute</string> <string name="live_activity_current_steps_per_minute">Akt. Schritte pro Minute</string>
<string name="live_activity_total_steps">Schritte insgesamt</string> <string name="live_activity_total_steps">Schritte insgesamt</string>
@ -196,6 +202,7 @@
<string name="pref_title_keep_data_on_device">Aktivitätsdaten auf dem Gerät lassen</string> <string name="pref_title_keep_data_on_device">Aktivitätsdaten auf dem Gerät lassen</string>
<string name="miband_fwinstaller_incompatible_version">Inkompatible Firmware</string> <string name="miband_fwinstaller_incompatible_version">Inkompatible Firmware</string>
<string name="fwinstaller_firmware_not_compatible_to_device">Diese Firmware ist nicht mit dem Gerät kompatibel</string> <string name="fwinstaller_firmware_not_compatible_to_device">Diese Firmware ist nicht mit dem Gerät kompatibel</string>
<string name="miband_prefs_hr_sleep_detection">Verwende den Herzfrequenzsensor um die Schlaferkennung zu verbessern</string>
<string name="waiting_for_reconnect">warte auf eingehende Verbindung</string> <string name="waiting_for_reconnect">warte auf eingehende Verbindung</string>
<string name="appmananger_app_reinstall">Erneut installieren</string> <string name="appmananger_app_reinstall">Erneut installieren</string>
<string name="activity_prefs_about_you">Über Dich</string> <string name="activity_prefs_about_you">Über Dich</string>
@ -205,10 +212,19 @@
<string name="activity_prefs_weight_kg">Gewicht in kg</string> <string name="activity_prefs_weight_kg">Gewicht in kg</string>
<string name="appmanager_health_activate">aktivieren</string> <string name="appmanager_health_activate">aktivieren</string>
<string name="appmanager_health_deactivate">deaktivieren</string> <string name="appmanager_health_deactivate">deaktivieren</string>
<string name="authenticating">Authentifiziere</string>
<string name="authentication_required">Authentifizierung erforderlich</string>
<string name="appwidget_text">Zzz</string> <string name="appwidget_text">Zzz</string>
<string name="add_widget">Widget hinzufügen</string> <string name="add_widget">Widget hinzufügen</string>
<string name="activity_prefs_sleep_duration">Gewünschte Schlafdauer in Stunden</string> <string name="activity_prefs_sleep_duration">Gewünschte Schlafdauer in Stunden</string>
<string name="appwidget_alarms_set">Ein Wecker wurde auf %1$02d:%2$02d gestellt</string> <string name="appwidget_alarms_set">Ein Wecker wurde auf %1$02d:%2$02d gestellt</string>
<string name="device_hw">HW: %1$s</string> <string name="device_hw">HW: %1$s</string>
<string name="device_fw">FW: %1$s</string> <string name="device_fw">FW: %1$s</string>
<string name="error_creating_directory_for_logfiles">Fehler beim Erstellen des Verzeichnisses für Logdateien: %1$s</string>
<string name="DEVINFO_HR_VER">HF:</string>
<string name="updatefirmwareoperation_update_in_progress">Firmwareupdate wird durchgeführt</string>
<string name="updatefirmwareoperation_firmware_not_sent">Firmware wurde nicht gesendet</string>
<string name="charts_legend_heartrate">Herzfrequenz</string>
<string name="live_activity_heart_rate">Herzfrequenz</string>
<string name="pref_title_general_autocreonnect">Verbindungen automatisch wiederherstellen</string>
</resources> </resources>

View File

@ -74,6 +74,7 @@
<string name="bluetooth_is_not_supported_">Bluetoothはサポートされていません。</string> <string name="bluetooth_is_not_supported_">Bluetoothはサポートされていません。</string>
<string name="bluetooth_is_disabled_">Bluetoothは無効です。</string> <string name="bluetooth_is_disabled_">Bluetoothは無効です。</string>
<string name="tap_connected_device_for_app_mananger">アプリマネージャーの接続されたデバイスをタップ</string> <string name="tap_connected_device_for_app_mananger">アプリマネージャーの接続されたデバイスをタップ</string>
<string name="tap_connected_device_for_activity">アクティビティの接続されたデバイスをタップ</string>
<string name="tap_a_device_to_connect">接続するデバイスをタップ</string> <string name="tap_a_device_to_connect">接続するデバイスをタップ</string>
<string name="cannot_connect_bt_address_invalid_">接続できません。 BTアドレスが無効?</string> <string name="cannot_connect_bt_address_invalid_">接続できません。 BTアドレスが無効?</string>
<string name="gadgetbridge_running">ガジェットブリッジは実行中</string> <string name="gadgetbridge_running">ガジェットブリッジは実行中</string>
@ -182,9 +183,11 @@
<string name="chart_steps">歩数</string> <string name="chart_steps">歩数</string>
<string name="liveactivity_live_activity">生活活動</string> <string name="liveactivity_live_activity">生活活動</string>
<string name="weeksteps_today_steps_description">今日の歩数、目標: %1$s</string> <string name="weeksteps_today_steps_description">今日の歩数、目標: %1$s</string>
<string name="pref_title_dont_ack_transfer">活動データ転送に応答しない</string>
<string name="pref_summary_dont_ack_transfers">活動データは、バンドが応答しない場合は、クリアされません。 GBを他のアプリと一緒に使用する場合に便利です。</string> <string name="pref_summary_dont_ack_transfers">活動データは、バンドが応答しない場合は、クリアされません。 GBを他のアプリと一緒に使用する場合に便利です。</string>
<string name="pref_summary_keep_data_on_device">同期後もMi Bandに活動データを保持します。 GBを他のアプリと一緒に使用する場合に便利です。</string> <string name="pref_summary_keep_data_on_device">同期後もMi Bandに活動データを保持します。 GBを他のアプリと一緒に使用する場合に便利です。</string>
<string name="pref_title_dont_ack_transfer">活動データ転送に応答しない</string> <string name="pref_title_low_latency_fw_update">FW の更新に低遅延モードを使用する</string>
<string name="pref_summary_low_latency_fw_update">これはファームウェアの更新が失敗するデバイスで役立つことがあります</string>
<string name="live_activity_steps_history">歩数履歴</string> <string name="live_activity_steps_history">歩数履歴</string>
<string name="live_activity_current_steps_per_minute">現在の歩数/分</string> <string name="live_activity_current_steps_per_minute">現在の歩数/分</string>
<string name="live_activity_total_steps">合計歩数</string> <string name="live_activity_total_steps">合計歩数</string>
@ -225,4 +228,5 @@
<string name="updatefirmwareoperation_firmware_not_sent">ファームウェアを送信しませんでした</string> <string name="updatefirmwareoperation_firmware_not_sent">ファームウェアを送信しませんでした</string>
<string name="charts_legend_heartrate">心拍数</string> <string name="charts_legend_heartrate">心拍数</string>
<string name="live_activity_heart_rate">心拍数</string> <string name="live_activity_heart_rate">心拍数</string>
<string name="pref_title_general_autocreonnect">自動的に再接続</string>
</resources> </resources>

View File

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<changelog> <changelog>
<release version="0.9.7" versioncode="51">
<change>Pebble: hopefully fix some reconnect issues</change>
<change>Mi Band: fix live activity monitoring running forever if back button pressed</change>
<change>Mi Band: allow low latency firmware updates, fixes update with some phones</change>
<change>Mi Band: inital experimental and probably broken support for Amazfit</change>
<change>Show aliases for BT Devices if they had been renamed in BT Settings</change>
<change>Do not show a hint about App Manager when a Mi Band is connected</change>
</release>
<release version="0.9.6" versioncode="50"> <release version="0.9.6" versioncode="50">
<change>Again some UI/theme improvements</change> <change>Again some UI/theme improvements</change>
<change>New preference to reconnect after connection loss (defaults to true)</change> <change>New preference to reconnect after connection loss (defaults to true)</change>

View File

@ -165,6 +165,6 @@
android:key="mi_low_latency_fw_update" android:key="mi_low_latency_fw_update"
android:title="@string/pref_title_low_latency_fw_update" android:title="@string/pref_title_low_latency_fw_update"
android:summary="@string/pref_summary_low_latency_fw_update" android:summary="@string/pref_summary_low_latency_fw_update"
android:defaultValue="false" /> android:defaultValue="true" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@ -11,6 +11,7 @@
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m # 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
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit