diff --git a/CHANGELOG.md b/CHANGELOG.md
index 49b131bd0..9264f7164 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
### Changelog
+#### Version 0.40.0 (WIP)
+* Fossil Q Hybrid: Initial support
+* Bangle.js: Initial support
+* Reserve Alarm for Calendar feature restricted to Mi Band 1/2 and moved to per-device settings
+* New icon for App Manager
+
#### Version 0.39.1
* Try to actively re-connect when a connection gets interrupted (interval grows up to 64 seconds)
* Mi Band2/Amazfip Bip: Make button action settings per-device and enable for Amazfit Bip
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 958f3a737..d283f50fd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java
index 64950a5f2..460f85eb7 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java
@@ -106,7 +106,7 @@ public class GBApplication extends Application {
private static SharedPreferences sharedPrefs;
private static final String PREFS_VERSION = "shared_preferences_version";
//if preferences have to be migrated, increment the following and add the migration logic in migratePrefs below; see http://stackoverflow.com/questions/16397848/how-can-i-migrate-android-preferences-with-a-new-version
- private static final int CURRENT_PREFS_VERSION = 6;
+ private static final int CURRENT_PREFS_VERSION = 7;
private static LimitedQueue mIDSenderLookup = new LimitedQueue(16);
private static Prefs prefs;
private static GBPrefs gbPrefs;
@@ -888,6 +888,9 @@ public class GBApplication extends Application {
migrateStringPrefToPerDevicePref("mi_button_press_count_match_delay", "0", "button_action_broadcast_delay", new ArrayList<>(Collections.singletonList(MIBAND2)));
migrateStringPrefToPerDevicePref("mi_button_press_broadcast", "nodomain.freeyourgadget.gadgetbridge.ButtonPressed", "button_action_broadcast", new ArrayList<>(Collections.singletonList(MIBAND2)));
}
+ if (oldVersion < 7) {
+ migrateStringPrefToPerDevicePref("mi_reserve_alarm_calendar","0","reserve_alarms_calendar", new ArrayList<>(Arrays.asList(MIBAND, MIBAND2)));
+ }
editor.putString(PREFS_VERSION, Integer.toString(CURRENT_PREFS_VERSION));
editor.apply();
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java
index 2990f827e..d7d9cd7c0 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java
@@ -21,4 +21,5 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_TIMEFORMAT = "timeformat";
public static final String PREF_WEARLOCATION = "wearlocation";
public static final String PREF_SCREEN_ORIENTATION = "screen_orientation";
+ public static final String PREF_RESERVER_ALARMS_CALENDAR = "reserve_alarms_calendar";
}
\ No newline at end of file
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
index 2fae9fa98..85be47676 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
@@ -395,7 +395,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat {
setInputTypeFor(HuamiConst.PREF_BUTTON_ACTION_PRESS_COUNT, InputType.TYPE_CLASS_NUMBER);
setInputTypeFor(MiBandConst.PREF_MIBAND_DEVICE_TIME_OFFSET_HOURS, InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
setInputTypeFor(MakibesHR3Constants.PREF_FIND_PHONE_DURATION, InputType.TYPE_CLASS_NUMBER);
-
+ setInputTypeFor(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, InputType.TYPE_CLASS_NUMBER);
}
static DeviceSpecificSettingsFragment newInstance(String settingsFileSuffix, @NonNull int[] supportedSettings) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/DBHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/DBHelper.java
index bb9284d56..3b5fda4d3 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/DBHelper.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/DBHelper.java
@@ -43,6 +43,8 @@ import de.greenrobot.dao.query.Query;
import de.greenrobot.dao.query.QueryBuilder;
import de.greenrobot.dao.query.WhereCondition;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
+import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsActivity;
+import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
import nodomain.freeyourgadget.gadgetbridge.entities.ActivityDescription;
@@ -582,9 +584,9 @@ public class DBHelper {
@NonNull
public static List getAlarms(@NonNull GBDevice gbDevice) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice);
- Prefs prefs = GBApplication.getPrefs();
- // TODO: this alarm reservation is a device dependent detail
- int reservedSlots = prefs.getInt(MiBandConst.PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR, 0);
+ Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
+
+ int reservedSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, 0);
int alarmSlots = coordinator.getAlarmSlotCount();
try (DBHandler db = GBApplication.acquireDB()) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java
index 26562edcd..b6bcd466c 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java
@@ -1,25 +1,23 @@
package nodomain.freeyourgadget.gadgetbridge.devices.banglejs;
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.bluetooth.le.ScanFilter;
+import android.content.Context;
+import android.net.Uri;
+import android.os.Build;
+import android.os.ParcelUuid;
+
+import androidx.annotation.NonNull;
+
import java.util.Collection;
import java.util.Collections;
-
-import android.app.Activity;
-import android.content.Context;
-import android.net.Uri;
-import android.bluetooth.le.ScanFilter;
-import android.os.ParcelUuid;
-import androidx.annotation.NonNull;
-
-import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
-import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusConstants;
-import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115SampleProvider;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
-import nodomain.freeyourgadget.gadgetbridge.entities.HPlusHealthActivitySampleDao;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
@@ -37,7 +35,9 @@ public class BangleJSCoordinator extends AbstractDeviceCoordinator {
return "Espruino";
}
+ @NonNull
@Override
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
public Collection extends ScanFilter> createBLEScanFilters() {
// TODO: filter on name beginning Bangle.js? Doesn't appear to be built-in :(
// https://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder.html#setDeviceName(java.lang.String)
@@ -46,6 +46,7 @@ public class BangleJSCoordinator extends AbstractDeviceCoordinator {
return Collections.singletonList(filter);
}
+ @NonNull
@Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
String name = candidate.getDevice().getName();
@@ -130,7 +131,7 @@ public class BangleJSCoordinator extends AbstractDeviceCoordinator {
@Override
- protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
+ protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) {
}
@Override
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java
index f39fd61f7..7573541f5 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java
@@ -83,8 +83,9 @@ public class MiBand2Coordinator extends HuamiCoordinator {
R.xml.devicesettings_donotdisturb_withauto,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_rotatewrist_cycleinfo,
- R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_buttonactions,
+ R.xml.devicesettings_reserve_alarms_calendar,
+ R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_pairingkey
};
}
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 ff7b69883..2d1c09414 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,7 +26,6 @@ public final class MiBandConst {
public static final String PREF_MIBAND_ADDRESS = "development_miaddr"; // FIXME: should be prefixed mi_
public static final String PREF_MIBAND_ALARMS = "mi_alarms";
public static final String PREF_MIBAND_DONT_ACK_TRANSFER = "mi_dont_ack_transfer";
- public static final String PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR = "mi_reserve_alarm_calendar";
public static final String PREF_MIBAND_USE_HR_FOR_SLEEP_DETECTION = "mi_hr_sleep_detection";
public static final String PREF_MIBAND_DEVICE_TIME_OFFSET_HOURS = "device_time_offset_hours";
public static final String PREF_MI2_DATEFORMAT = "mi2_dateformat";
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 1676d1249..ababb3842 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
@@ -248,8 +248,8 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
}
public static int getReservedAlarmSlots(String miBandAddress) throws IllegalArgumentException {
- Prefs prefs = GBApplication.getPrefs();
- return prefs.getInt(MiBandConst.PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR, 0);
+ Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(miBandAddress));
+ return prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, 0);
}
@Override
@@ -263,6 +263,7 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
return new int[]{
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_lowlatency_fwupdate,
+ R.xml.devicesettings_reserve_alarms_calendar,
R.xml.devicesettings_fake_timeoffset
};
}
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 ad5993c31..bedc55cf2 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
@@ -22,10 +22,11 @@ import android.os.Bundle;
import android.preference.Preference;
import android.widget.Toast;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+
import java.util.HashSet;
import java.util.Set;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.AbstractSettingsActivity;
@@ -36,13 +37,8 @@ import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
-import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT;
-import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ON_LIFT_END;
-import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ON_LIFT_START;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.ORIGIN_ALARM_CLOCK;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.ORIGIN_INCOMING_CALL;
-import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_OFF;
-import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_SCHEDULED;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_GOAL_NOTIFICATION;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND;
@@ -51,9 +47,7 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PR
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_END;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_START;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD;
-import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_ROTATE_WRIST_TO_SWITCH_INFO;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MIBAND_ADDRESS;
-import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MIBAND_USE_HR_FOR_SLEEP_DETECTION;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_USER_ALIAS;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.VIBRATION_COUNT;
@@ -270,7 +264,6 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity {
prefKeys.add(PREF_USER_ALIAS);
prefKeys.add(PREF_MIBAND_ADDRESS);
prefKeys.add(ActivityUser.PREF_USER_STEPS_GOAL);
- prefKeys.add(PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR);
prefKeys.add(PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD);
prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_ALARM_CLOCK));
prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_INCOMING_CALL));
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
index ea1569f63..8d1500ff5 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
@@ -64,7 +64,7 @@ public enum DeviceType {
MISCALE2(131, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_miscale2),
BFH16(140, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_bfh16),
MAKIBESHR3(150, R.drawable.ic_device_default, R.drawable.ic_device_hplus_disabled, R.string.devicetype_makibes_hr3),
- BANGLEJS(160, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_banglejs),
+ BANGLEJS(160, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_banglejs),
MIJIA_LYWSD02(200, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_mijia_lywsd02),
TEST(1000, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_test);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java
index e571cf192..638ffae11 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java
@@ -1,44 +1,30 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.banglejs;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.TimeZone;
-import java.util.UUID;
-
-
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.content.Context;
import android.net.Uri;
import android.widget.Toast;
-import androidx.annotation.NonNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import org.json.JSONArray;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.UUID;
-import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
-import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
-import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
-import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventNotificationControl;
-import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo;
import nodomain.freeyourgadget.gadgetbridge.devices.banglejs.BangleJSConstants;
-import nodomain.freeyourgadget.gadgetbridge.devices.no1f1.No1F1Constants;
-import nodomain.freeyourgadget.gadgetbridge.devices.no1f1.No1F1SampleProvider;
-import nodomain.freeyourgadget.gadgetbridge.entities.No1F1ActivitySample;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
@@ -56,8 +42,8 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
private static final Logger LOG = LoggerFactory.getLogger(BangleJSDeviceSupport.class);
- public BluetoothGattCharacteristic rxCharacteristic = null;
- public BluetoothGattCharacteristic txCharacteristic = null;
+ private BluetoothGattCharacteristic rxCharacteristic = null;
+ private BluetoothGattCharacteristic txCharacteristic = null;
private String receivedLine = "";
@@ -93,27 +79,21 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
}
/// Write a string of data, and chunk it up
- public void uartTx(TransactionBuilder builder, String str) {
- LOG.info("UART TX: ", str);
- byte bytes[];
- try {
- bytes = str.getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- LOG.error("TX: UnsupportedEncodingException");
- return;
- }
+ private void uartTx(TransactionBuilder builder, String str) {
+ LOG.info("UART TX: " + str);
+ byte[] bytes;
+ bytes = str.getBytes(StandardCharsets.UTF_8);
for (int i=0;i20) l=20;
- byte packet[] = new byte[l];
- for (int b=0;bUncaught ReferenceError: \"gb\" is not defined")
+ if (">Uncaught ReferenceError: \"gb\" is not defined".equals(line))
GB.toast(getContext(), "Gadgetbridge plugin not installed on Bangle.js", Toast.LENGTH_LONG, GB.ERROR);
else if (line.charAt(0)=='{') {
// JSON - we hope!
@@ -139,7 +119,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
}
}
- void handleUartRxJSON(JSONObject json) throws JSONException {
+ private void handleUartRxJSON(JSONObject json) throws JSONException {
switch (json.getString("t")) {
case "info":
GB.toast(getContext(), "Bangle.js: " + json.getString("msg"), Toast.LENGTH_LONG, GB.INFO);
@@ -222,11 +202,11 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
return true;
}
if (BangleJSConstants.UUID_CHARACTERISTIC_NORDIC_UART_RX.equals(characteristic.getUuid())) {
- byte chars[] = characteristic.getValue();
+ byte[] chars = characteristic.getValue();
String packetStr = new String(chars);
LOG.info("RX: " + packetStr);
receivedLine += packetStr;
- while (receivedLine.indexOf("\n")>=0) {
+ while (receivedLine.contains("\n")) {
int p = receivedLine.indexOf("\n");
String line = receivedLine.substring(0,p-1);
receivedLine = receivedLine.substring(p+1);
@@ -316,7 +296,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
try {
JSONObject o = new JSONObject();
o.put("t", "call");
- String cmdString[] = {"","undefined","accept","incoming","outgoing","reject","start","end"};
+ String[] cmdString = {"", "undefined", "accept", "incoming", "outgoing", "reject", "start", "end"};
o.put("cmd", cmdString[callSpec.command]);
o.put("name", callSpec.name);
o.put("number", callSpec.number);
@@ -336,7 +316,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
try {
JSONObject o = new JSONObject();
o.put("t", "musicstate");
- String musicStates[] = {"play","pause","stop",""};
+ String[] musicStates = {"play", "pause", "stop", ""};
o.put("state", musicStates[stateSpec.state]);
o.put("position", stateSpec.position);
o.put("shuffle", stateSpec.shuffle);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java
index a0a6f891d..ef827101e 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java
@@ -1542,8 +1542,8 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
private HuamiSupport sendCalendarEvents(TransactionBuilder builder) {
BluetoothGattCharacteristic characteristic = getCharacteristic(HuamiService.UUID_CHARACTERISTIC_3_CONFIGURATION);
- Prefs prefs = GBApplication.getPrefs();
- int availableSlots = prefs.getInt(MiBandConst.PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR, 0);
+ Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
+ int availableSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, 0);
if (availableSlots > 0) {
CalendarEvents upcomingEvents = new CalendarEvents();
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java
index 72dcffb8d..d6eb3b299 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java
@@ -24,6 +24,9 @@ import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;
+import androidx.annotation.Nullable;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,10 +39,9 @@ import java.util.GregorianCalendar;
import java.util.List;
import java.util.UUID;
-import androidx.annotation.Nullable;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
@@ -1224,16 +1226,18 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
TransactionBuilder builder = performInitialized("Send upcoming events");
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT);
- Prefs prefs = GBApplication.getPrefs();
- int availableSlots = prefs.getInt(MiBandConst.PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR, 0);
-
+ Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
+ int availableSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, 0);
+ if (availableSlots >3) {
+ availableSlots = 3;
+ }
if (availableSlots > 0) {
CalendarEvents upcomingEvents = new CalendarEvents();
List mEvents = upcomingEvents.getCalendarEventList(getContext());
int iteration = 0;
for (CalendarEvents.CalendarEvent mEvt : mEvents) {
- if (iteration >= availableSlots || iteration > 2) {
+ if (iteration >= availableSlots) {
break;
}
int slotToUse = 2 - iteration;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/file/FilePutRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/file/FilePutRequest.java
index e703c6cdd..aeeaaf09f 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/file/FilePutRequest.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/file/FilePutRequest.java
@@ -201,7 +201,7 @@ public class FilePutRequest extends FossilRequest {
CRC32C crc = new CRC32C();
- crc.update(file,0,data.length);
+ crc.update(file,0,file.length);
buffer.putInt((int) crc.getValue());
byte[] data = buffer.array();
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 217a536bf..ffd6bbe92 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -813,9 +813,12 @@
Tasten überschreiben
Aktivitätshand als Benachrichtigungszähler verwenden
Bitte stelle die Schrittzahl auf eine Million ein, um dies zu aktivieren.
- Tasten erfolgreich überschrieben
+ Tasten überschrieben
Fehler beim Überschreiben der Tasten
Verschiebung der Zeitzone um
- Änderung kann einige Sekunden dauern...
+ Änderung kann einige Sekunden dauern…
Zeitverschiebung um
+ Deaktivieren des neuen BLE-Scans
+ Aktiviere diese Option, wenn dein Gerät bei der Erkennung nicht gefunden wird
+ Bangle.js
\ No newline at end of file
diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml
index b6d594e8d..eb81dc4e1 100644
--- a/app/src/main/res/values-he/strings.xml
+++ b/app/src/main/res/values-he/strings.xml
@@ -799,7 +799,14 @@
היסט אזור זמן שני ביחס ל־UTC
דריסת כפתורים
נא להגדיר את מניין הצעדים למיליון כדי להפעיל זאת.
- הכפתורים נדרסו בהצלחה
+ הכפתורים נדרסו
דריסת הכפתורים נכשלה
השינויים יתבצעו בהקדם…
+ הקפצת התראה ב־Q Hybrid
+ להשתמש ביד הפעילות כמונה התראות
+ מרחק מאזור זמן
+ מרחק מהשעה
+ השבתת סריקת BLE חדשה
+ יש לסמן את האפשרות הזאת אם המכשיר שלך לא נמצא במהלך האיתור
+ Bangle.js
\ No newline at end of file
diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml
index 372f1b8ec..adc4e2580 100644
--- a/app/src/main/res/values-nb-rNO/strings.xml
+++ b/app/src/main/res/values-nb-rNO/strings.xml
@@ -792,4 +792,7 @@
\n
\nFORTSETT PÅ EGEN RISIKO!
nodomain.freeyourgadget.gadgetbridge.ButtonPressed
+ Klokke ikke tilkoblet
+ vibrasjonsstyrke:
+ Bangle.js
\ No newline at end of file
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index 111ccc084..50ef80a6c 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -794,4 +794,22 @@
\n
\nGA VERDER OP EIGEN RISICO!
nodomain.freeyourgadget.gadgetbridge.ButtonPressed
+ Fossil Q Hybrid
+ Q Hybrid Instellingen
+ Horloge niet verbonden
+ trillingssterkte:
+ Doel in stappen
+ tijdsverschuiving
+ tweede tijdzone offset ten opzichte van UTC
+ knoppen overschrijven
+ gebruik activiteitswijzer als notificatieteller
+ Zet het aantal stappen op een miljoen om dat te activeren.
+ Knoppen overschreven
+ Fout bij het overschrijven van knoppen
+ offset tijdzone met
+ wijziging kan enkele seconden duren…
+ offset tijdzone met
+ Nieuwe BLE-scanning uitschakelen
+ Vink deze optie aan als uw apparaat niet kan worden gevonden tijdens discovery
+ Bangle.js
\ No newline at end of file
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index c32f948eb..65c2fa551 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -811,9 +811,12 @@
sobrescrever botões
usar mão de atividade como contador da notificação
Defina a contagem de passos para um milhão para ativá-lo.
- Botões sobrescritos com sucesso
+ Botões sobrescritos
Erro ao sobrescrever botões
deslocar fuso horário por
- a alteração pode levar alguns segundos...
+ a alteração pode levar alguns segundos…
deslocar tempo por
+ Desabilitar nova varredura de BLE
+ Marque essa opção se seu dispositivo não pode ser encontrado durante descobertas
+ Bangle.js
\ No newline at end of file
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index f35dc410b..32cd703c9 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -804,9 +804,12 @@
覆盖按钮
使用活动手作为通知计数
请将步数设置为100万来激活它。
- 已成功覆盖按钮
+ 按钮覆盖
覆盖按钮时出错
基于时区偏移
修改可能需要几秒…
经由时间偏移
+ 禁用新低功率蓝牙扫描
+ 若您的设备无法在扫描过程中发现,请选中此选项
+ Bangle.js
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5db09d28e..f7afb71a9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -293,7 +293,6 @@
Disable new BLE scanning
Check this option if your device cannot be found during discovery
-
Not connected
Connecting
Connected
@@ -808,10 +807,10 @@
overwrite buttons
use activity hand as notification counter
Please set the step count to a million to activate that.
- Successfully overwritten buttons
+ Buttons overwritten
Error overwriting buttons
offset timezone by
- change might take some seconds...
+ change might take some seconds…
offset time by
- %d hour
diff --git a/app/src/main/res/xml/miband_preferences.xml b/app/src/main/res/xml/miband_preferences.xml
index 9cda47158..3705fa73e 100644
--- a/app/src/main/res/xml/miband_preferences.xml
+++ b/app/src/main/res/xml/miband_preferences.xml
@@ -22,13 +22,6 @@
android:summary="@string/mi2_prefs_goal_notification_summary"
android:title="@string/mi2_prefs_goal_notification" />
-