mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-25 16:50:44 +02:00
Merge branch 'master' of https://codeberg.org/Freeyourgadget/Gadgetbridge
This commit is contained in:
commit
0d8428437c
@ -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
|
||||
|
@ -15,7 +15,7 @@
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||
<uses-permission android:name="android.permission.SEND_SMS" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_CALENDAR" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
|
||||
|
@ -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();
|
||||
|
@ -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";
|
||||
}
|
@ -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) {
|
||||
|
@ -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<Alarm> 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()) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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";
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;i<bytes.length;i+=20) {
|
||||
int l = bytes.length-i;
|
||||
if (l>20) l=20;
|
||||
byte packet[] = new byte[l];
|
||||
for (int b=0;b<l;b++)
|
||||
packet[b] = bytes[i+b];
|
||||
byte[] packet = new byte[l];
|
||||
System.arraycopy(bytes, i, packet, 0, l);
|
||||
builder.write(txCharacteristic, packet);
|
||||
}
|
||||
}
|
||||
|
||||
/// Write a string of data, and chunk it up
|
||||
public void uartTxJSON(String taskName, JSONObject json) {
|
||||
private void uartTxJSON(String taskName, JSONObject json) {
|
||||
try {
|
||||
TransactionBuilder builder = performInitialized(taskName);
|
||||
uartTx(builder, "\u0010GB("+json.toString()+")\n");
|
||||
@ -123,10 +103,10 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
}
|
||||
}
|
||||
|
||||
void handleUartRxLine(String line) {
|
||||
private void handleUartRxLine(String line) {
|
||||
LOG.info("UART RX LINE: " + line);
|
||||
|
||||
if (line==">Uncaught 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);
|
||||
|
@ -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();
|
||||
|
@ -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<CalendarEvents.CalendarEvent> 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;
|
||||
|
@ -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();
|
||||
|
@ -813,9 +813,12 @@
|
||||
<string name="qhybrid_overwrite_buttons">Tasten überschreiben</string>
|
||||
<string name="qhybrid_use_activity_hand_as_notification_counter">Aktivitätshand als Benachrichtigungszähler verwenden</string>
|
||||
<string name="qhybrid_prompt_million_steps">Bitte stelle die Schrittzahl auf eine Million ein, um dies zu aktivieren.</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">Tasten erfolgreich überschrieben</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">Tasten überschrieben</string>
|
||||
<string name="qhybrid_buttons_overwrite_error">Fehler beim Überschreiben der Tasten</string>
|
||||
<string name="qhybrid_offset_timezone">Verschiebung der Zeitzone um</string>
|
||||
<string name="qhybrid_changes_delay_prompt">Änderung kann einige Sekunden dauern...</string>
|
||||
<string name="qhybrid_changes_delay_prompt">Änderung kann einige Sekunden dauern…</string>
|
||||
<string name="qhybrid_offset_time_by">Zeitverschiebung um</string>
|
||||
<string name="pref_disable_new_ble_scanning">Deaktivieren des neuen BLE-Scans</string>
|
||||
<string name="pref_summary_disable_new_ble_scanning">Aktiviere diese Option, wenn dein Gerät bei der Erkennung nicht gefunden wird</string>
|
||||
<string name="devicetype_banglejs">Bangle.js</string>
|
||||
</resources>
|
@ -799,7 +799,14 @@
|
||||
<string name="qhybrid_second_timezone_offset_relative_to_utc">היסט אזור זמן שני ביחס ל־UTC</string>
|
||||
<string name="qhybrid_overwrite_buttons">דריסת כפתורים</string>
|
||||
<string name="qhybrid_prompt_million_steps">נא להגדיר את מניין הצעדים למיליון כדי להפעיל זאת.</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">הכפתורים נדרסו בהצלחה</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">הכפתורים נדרסו</string>
|
||||
<string name="qhybrid_buttons_overwrite_error">דריסת הכפתורים נכשלה</string>
|
||||
<string name="qhybrid_changes_delay_prompt">השינויים יתבצעו בהקדם…</string>
|
||||
<string name="tasker_notification">הקפצת התראה ב־Q Hybrid</string>
|
||||
<string name="qhybrid_use_activity_hand_as_notification_counter">להשתמש ביד הפעילות כמונה התראות</string>
|
||||
<string name="qhybrid_offset_timezone">מרחק מאזור זמן</string>
|
||||
<string name="qhybrid_offset_time_by">מרחק מהשעה</string>
|
||||
<string name="pref_disable_new_ble_scanning">השבתת סריקת BLE חדשה</string>
|
||||
<string name="pref_summary_disable_new_ble_scanning">יש לסמן את האפשרות הזאת אם המכשיר שלך לא נמצא במהלך האיתור</string>
|
||||
<string name="devicetype_banglejs">Bangle.js</string>
|
||||
</resources>
|
@ -792,4 +792,7 @@
|
||||
\n
|
||||
\nFORTSETT PÅ EGEN RISIKO!</string>
|
||||
<string name="mi2_prefs_button_press_broadcast_default_value" translatable="false">nodomain.freeyourgadget.gadgetbridge.ButtonPressed</string>
|
||||
<string name="watch_not_connected">Klokke ikke tilkoblet</string>
|
||||
<string name="qhybrid_vibration_strength">vibrasjonsstyrke:</string>
|
||||
<string name="devicetype_banglejs">Bangle.js</string>
|
||||
</resources>
|
@ -794,4 +794,22 @@
|
||||
\n
|
||||
\nGA VERDER OP EIGEN RISICO!</string>
|
||||
<string name="mi2_prefs_button_press_broadcast_default_value" translatable="false">nodomain.freeyourgadget.gadgetbridge.ButtonPressed</string>
|
||||
<string name="devicetype_qhybrid">Fossil Q Hybrid</string>
|
||||
<string name="preferences_qhybrid_settings">Q Hybrid Instellingen</string>
|
||||
<string name="watch_not_connected">Horloge niet verbonden</string>
|
||||
<string name="qhybrid_vibration_strength">trillingssterkte:</string>
|
||||
<string name="qhybrid_goal_in_steps">Doel in stappen</string>
|
||||
<string name="qhybrid_time_shift">tijdsverschuiving</string>
|
||||
<string name="qhybrid_second_timezone_offset_relative_to_utc">tweede tijdzone offset ten opzichte van UTC</string>
|
||||
<string name="qhybrid_overwrite_buttons">knoppen overschrijven</string>
|
||||
<string name="qhybrid_use_activity_hand_as_notification_counter">gebruik activiteitswijzer als notificatieteller</string>
|
||||
<string name="qhybrid_prompt_million_steps">Zet het aantal stappen op een miljoen om dat te activeren.</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">Knoppen overschreven</string>
|
||||
<string name="qhybrid_buttons_overwrite_error">Fout bij het overschrijven van knoppen</string>
|
||||
<string name="qhybrid_offset_timezone">offset tijdzone met</string>
|
||||
<string name="qhybrid_changes_delay_prompt">wijziging kan enkele seconden duren…</string>
|
||||
<string name="qhybrid_offset_time_by">offset tijdzone met</string>
|
||||
<string name="pref_disable_new_ble_scanning">Nieuwe BLE-scanning uitschakelen</string>
|
||||
<string name="pref_summary_disable_new_ble_scanning">Vink deze optie aan als uw apparaat niet kan worden gevonden tijdens discovery</string>
|
||||
<string name="devicetype_banglejs">Bangle.js</string>
|
||||
</resources>
|
@ -811,9 +811,12 @@
|
||||
<string name="qhybrid_overwrite_buttons">sobrescrever botões</string>
|
||||
<string name="qhybrid_use_activity_hand_as_notification_counter">usar mão de atividade como contador da notificação</string>
|
||||
<string name="qhybrid_prompt_million_steps">Defina a contagem de passos para um milhão para ativá-lo.</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">Botões sobrescritos com sucesso</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">Botões sobrescritos</string>
|
||||
<string name="qhybrid_buttons_overwrite_error">Erro ao sobrescrever botões</string>
|
||||
<string name="qhybrid_offset_timezone">deslocar fuso horário por</string>
|
||||
<string name="qhybrid_changes_delay_prompt">a alteração pode levar alguns segundos...</string>
|
||||
<string name="qhybrid_changes_delay_prompt">a alteração pode levar alguns segundos…</string>
|
||||
<string name="qhybrid_offset_time_by">deslocar tempo por</string>
|
||||
<string name="pref_disable_new_ble_scanning">Desabilitar nova varredura de BLE</string>
|
||||
<string name="pref_summary_disable_new_ble_scanning">Marque essa opção se seu dispositivo não pode ser encontrado durante descobertas</string>
|
||||
<string name="devicetype_banglejs">Bangle.js</string>
|
||||
</resources>
|
@ -804,9 +804,12 @@
|
||||
<string name="qhybrid_overwrite_buttons">覆盖按钮</string>
|
||||
<string name="qhybrid_use_activity_hand_as_notification_counter">使用活动手作为通知计数</string>
|
||||
<string name="qhybrid_prompt_million_steps">请将步数设置为100万来激活它。</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">已成功覆盖按钮</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">按钮覆盖</string>
|
||||
<string name="qhybrid_buttons_overwrite_error">覆盖按钮时出错</string>
|
||||
<string name="qhybrid_offset_timezone">基于时区偏移</string>
|
||||
<string name="qhybrid_changes_delay_prompt">修改可能需要几秒…</string>
|
||||
<string name="qhybrid_offset_time_by">经由时间偏移</string>
|
||||
<string name="pref_disable_new_ble_scanning">禁用新低功率蓝牙扫描</string>
|
||||
<string name="pref_summary_disable_new_ble_scanning">若您的设备无法在扫描过程中发现,请选中此选项</string>
|
||||
<string name="devicetype_banglejs">Bangle.js</string>
|
||||
</resources>
|
@ -293,7 +293,6 @@
|
||||
<!-- developer/debug preferences-->
|
||||
<string name="pref_disable_new_ble_scanning">Disable new BLE scanning</string>
|
||||
<string name="pref_summary_disable_new_ble_scanning">Check this option if your device cannot be found during discovery</string>
|
||||
|
||||
<string name="not_connected">Not connected</string>
|
||||
<string name="connecting">Connecting</string>
|
||||
<string name="connected">Connected</string>
|
||||
@ -808,10 +807,10 @@
|
||||
<string name="qhybrid_overwrite_buttons">overwrite buttons</string>
|
||||
<string name="qhybrid_use_activity_hand_as_notification_counter">use activity hand as notification counter</string>
|
||||
<string name="qhybrid_prompt_million_steps">Please set the step count to a million to activate that.</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">Successfully overwritten buttons</string>
|
||||
<string name="qhybrid_buttons_overwrite_success">Buttons overwritten</string>
|
||||
<string name="qhybrid_buttons_overwrite_error">Error overwriting buttons</string>
|
||||
<string name="qhybrid_offset_timezone">offset timezone by</string>
|
||||
<string name="qhybrid_changes_delay_prompt">change might take some seconds...</string>
|
||||
<string name="qhybrid_changes_delay_prompt">change might take some seconds…</string>
|
||||
<string name="qhybrid_offset_time_by">offset time by</string>
|
||||
<plurals name="widget_alarm_target_hours">
|
||||
<item quantity="one">%d hour</item>
|
||||
|
@ -22,13 +22,6 @@
|
||||
android:summary="@string/mi2_prefs_goal_notification_summary"
|
||||
android:title="@string/mi2_prefs_goal_notification" />
|
||||
|
||||
<EditTextPreference
|
||||
android:defaultValue="0"
|
||||
android:inputType="number"
|
||||
android:key="mi_reserve_alarm_calendar"
|
||||
android:maxLength="1"
|
||||
android:digits="0123"
|
||||
android:title="@string/miband_prefs_reserve_alarm_calendar" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="mi_hr_sleep_detection"
|
||||
|
Loading…
Reference in New Issue
Block a user