mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Fixed a bunch of misspellings and formatting
This commit is contained in:
parent
c9d98e60a9
commit
40852d3641
@ -29,13 +29,14 @@ import android.preference.PreferenceManager;
|
|||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
import androidx.core.app.NavUtils;
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import androidx.core.app.NavUtils;
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ import android.webkit.WebView;
|
|||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.NavUtils;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -36,8 +39,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.app.NavUtils;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
|
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
|
||||||
|
@ -364,7 +364,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
|
|||||||
// enable touch gestures
|
// enable touch gestures
|
||||||
chart.setTouchEnabled(true);
|
chart.setTouchEnabled(true);
|
||||||
|
|
||||||
// commented out: this has weird bugs/sideeffects at least on WeekStepsCharts
|
// commented out: this has weird bugs/side-effects at least on WeekStepsCharts
|
||||||
// where only the first Day-label is drawn, because AxisRenderer.computeAxisValues(float,float)
|
// where only the first Day-label is drawn, because AxisRenderer.computeAxisValues(float,float)
|
||||||
// appears to have an overflow when calculating 'n' (number of entries)
|
// appears to have an overflow when calculating 'n' (number of entries)
|
||||||
// chart.getXAxis().setGranularity(60*5);
|
// chart.getXAxis().setGranularity(60*5);
|
||||||
|
@ -125,13 +125,13 @@ public abstract class AbstractWeekChartFragment extends AbstractChartFragment {
|
|||||||
ArrayList<String> labels = new ArrayList<String>();
|
ArrayList<String> labels = new ArrayList<String>();
|
||||||
|
|
||||||
long balance = 0;
|
long balance = 0;
|
||||||
long daily_balance=0;
|
long daily_balance = 0;
|
||||||
TOTAL_DAYS_FOR_AVERAGE=0;
|
TOTAL_DAYS_FOR_AVERAGE=0;
|
||||||
|
|
||||||
for (int counter = 0; counter < TOTAL_DAYS; counter++) {
|
for (int counter = 0; counter < TOTAL_DAYS; counter++) {
|
||||||
ActivityAmounts amounts = getActivityAmountsForDay(db, day, device);
|
ActivityAmounts amounts = getActivityAmountsForDay(db, day, device);
|
||||||
daily_balance=calculateBalance(amounts);
|
daily_balance=calculateBalance(amounts);
|
||||||
if (daily_balance>0){
|
if (daily_balance > 0) {
|
||||||
TOTAL_DAYS_FOR_AVERAGE++;
|
TOTAL_DAYS_FOR_AVERAGE++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import nodomain.freeyourgadget.gadgetbridge.entities.DaoMaster;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides lowlevel access to the database.
|
* Provides low-level access to the database.
|
||||||
*/
|
*/
|
||||||
public interface DBHandler extends AutoCloseable {
|
public interface DBHandler extends AutoCloseable {
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +22,9 @@ import android.database.Cursor;
|
|||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -36,17 +39,13 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import de.greenrobot.dao.Property;
|
import de.greenrobot.dao.Property;
|
||||||
import de.greenrobot.dao.query.Query;
|
import de.greenrobot.dao.query.Query;
|
||||||
import de.greenrobot.dao.query.QueryBuilder;
|
import de.greenrobot.dao.query.QueryBuilder;
|
||||||
import de.greenrobot.dao.query.WhereCondition;
|
import de.greenrobot.dao.query.WhereCondition;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsActivity;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.ActivityDescription;
|
import nodomain.freeyourgadget.gadgetbridge.entities.ActivityDescription;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.ActivityDescriptionDao;
|
import nodomain.freeyourgadget.gadgetbridge.entities.ActivityDescriptionDao;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.Alarm;
|
import nodomain.freeyourgadget.gadgetbridge.entities.Alarm;
|
||||||
@ -71,7 +70,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides utiliy access to some common entities, so you won't need to use
|
* Provides utility access to some common entities, so you won't need to use
|
||||||
* their DAO classes.
|
* their DAO classes.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Maybe this code should actually be in the DAO classes themselves, but then
|
* Maybe this code should actually be in the DAO classes themselves, but then
|
||||||
|
@ -20,9 +20,10 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipFirmwareInfo;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipFirmwareInfo;
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ public class AmazfitBipFWHelper extends HuamiFWHelper {
|
|||||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||||
firmwareInfo = new AmazfitBipFirmwareInfo(wholeFirmwareBytes);
|
firmwareInfo = new AmazfitBipFirmwareInfo(wholeFirmwareBytes);
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
if (!firmwareInfo.isHeaderValid()) {
|
||||||
throw new IllegalArgumentException("Not a an Amazifit Bip firmware");
|
throw new IllegalArgumentException("Not a an Amazfit Bip firmware");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class AmazfitBipLiteFWHelper extends HuamiFWHelper {
|
|||||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||||
firmwareInfo = new AmazfitBipLiteFirmwareInfo(wholeFirmwareBytes);
|
firmwareInfo = new AmazfitBipLiteFirmwareInfo(wholeFirmwareBytes);
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
if (!firmwareInfo.isHeaderValid()) {
|
||||||
throw new IllegalArgumentException("Not a an Amazifit Bip Lite firmware");
|
throw new IllegalArgumentException("Not a an Amazfit Bip Lite firmware");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||||
@ -37,7 +35,7 @@ public class AmazfitGTRFWHelper extends HuamiFWHelper {
|
|||||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||||
firmwareInfo = new AmazfitGTRFirmwareInfo(wholeFirmwareBytes);
|
firmwareInfo = new AmazfitGTRFirmwareInfo(wholeFirmwareBytes);
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
if (!firmwareInfo.isHeaderValid()) {
|
||||||
throw new IllegalArgumentException("Not a an Amazifit GTR firmware");
|
throw new IllegalArgumentException("Not a an Amazfit GTR firmware");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class AmazfitGTRLiteFWHelper extends HuamiFWHelper {
|
|||||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||||
firmwareInfo = new AmazfitGTRLiteFirmwareInfo(wholeFirmwareBytes);
|
firmwareInfo = new AmazfitGTRLiteFirmwareInfo(wholeFirmwareBytes);
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
if (!firmwareInfo.isHeaderValid()) {
|
||||||
throw new IllegalArgumentException("Not a an Amazifit GTR Lite Firmware");
|
throw new IllegalArgumentException("Not a an Amazfit GTR Lite Firmware");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class AmazfitGTSFWHelper extends HuamiFWHelper {
|
|||||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||||
firmwareInfo = new AmazfitGTSFirmwareInfo(wholeFirmwareBytes);
|
firmwareInfo = new AmazfitGTSFirmwareInfo(wholeFirmwareBytes);
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
if (!firmwareInfo.isHeaderValid()) {
|
||||||
throw new IllegalArgumentException("Not a an Amazifit GTS firmware");
|
throw new IllegalArgumentException("Not a an Amazfit GTS firmware");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||||
@ -37,7 +35,7 @@ public class AmazfitTRexFWHelper extends HuamiFWHelper {
|
|||||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||||
firmwareInfo = new AmazfitTRexFirmwareInfo(wholeFirmwareBytes);
|
firmwareInfo = new AmazfitTRexFirmwareInfo(wholeFirmwareBytes);
|
||||||
if (!firmwareInfo.isHeaderValid()) {
|
if (!firmwareInfo.isHeaderValid()) {
|
||||||
throw new IllegalArgumentException("Not a an Amazifit T-Rex firmware");
|
throw new IllegalArgumentException("Not a an Amazfit T-Rex firmware");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,11 @@ package nodomain.freeyourgadget.gadgetbridge.devices.jyou;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport.BASE_UUID;
|
|
||||||
|
|
||||||
public final class BFH16Constants {
|
public final class BFH16Constants {
|
||||||
|
|
||||||
//Known Services
|
//Known Services
|
||||||
public static final UUID BFH16_GENERIC_ACCESS_SERVICE = UUID.fromString("00001800-0000-1000-8000-00805f9b34fb");
|
public static final UUID BFH16_GENERIC_ACCESS_SERVICE = UUID.fromString("00001800-0000-1000-8000-00805f9b34fb");
|
||||||
public static final UUID BFH16_GENERIC_ARTTRIBUTE_SERVICE = UUID.fromString("00001801-0000-1000-8000-00805f9b34fb");
|
public static final UUID BFH16_GENERIC_ATTRIBUTE_SERVICE = UUID.fromString("00001801-0000-1000-8000-00805f9b34fb");
|
||||||
|
|
||||||
public static final UUID BFH16_IDENTIFICATION_SERVICE1 = UUID.fromString("0000fef5-0000-1000-8000-00805f9b34fb");
|
public static final UUID BFH16_IDENTIFICATION_SERVICE1 = UUID.fromString("0000fef5-0000-1000-8000-00805f9b34fb");
|
||||||
public static final UUID BFH16_IDENTIFICATION_SERVICE2 = UUID.fromString("0000fee7-0000-1000-8000-00805f9b34fb");
|
public static final UUID BFH16_IDENTIFICATION_SERVICE2 = UUID.fromString("0000fee7-0000-1000-8000-00805f9b34fb");
|
||||||
|
@ -139,7 +139,7 @@ public class CalendarReceiver extends BroadcastReceiver {
|
|||||||
for (CalendarSyncState CalendarSyncState : CalendarSyncStateList) {
|
for (CalendarSyncState CalendarSyncState : CalendarSyncStateList) {
|
||||||
if (!eventState.containsKey(CalendarSyncState.getCalendarEntryId())) {
|
if (!eventState.containsKey(CalendarSyncState.getCalendarEntryId())) {
|
||||||
eventState.put(CalendarSyncState.getCalendarEntryId(), new EventSyncState(null, EventState.NEEDS_DELETE));
|
eventState.put(CalendarSyncState.getCalendarEntryId(), new EventSyncState(null, EventState.NEEDS_DELETE));
|
||||||
LOG.info("insert null event for orphanded calendar id=" + CalendarSyncState.getCalendarEntryId() + " for device=" + mGBDevice.getName());
|
LOG.info("insert null event for orphaned calendar id=" + CalendarSyncState.getCalendarEntryId() + " for device=" + mGBDevice.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
public interface Alarm extends Serializable {
|
public interface Alarm extends Serializable {
|
||||||
/**
|
/**
|
||||||
* The {@link android.os.Bundle} name for transferring pacreled alarms.
|
* The {@link android.os.Bundle} name for transferring parceled alarms.
|
||||||
*/
|
*/
|
||||||
String EXTRA_ALARM = "alarm";
|
String EXTRA_ALARM = "alarm";
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class CalendarEvents {
|
|||||||
//further: primaryColor, secondaryColor, backgroundColor, headings, paragraphs, lastUpdated
|
//further: primaryColor, secondaryColor, backgroundColor, headings, paragraphs, lastUpdated
|
||||||
// taken from: https://developer.getpebble.com/guides/timeline/pin-structure/
|
// taken from: https://developer.getpebble.com/guides/timeline/pin-structure/
|
||||||
|
|
||||||
// needed for miband:
|
// needed for MiBand:
|
||||||
// time
|
// time
|
||||||
|
|
||||||
private static final String[] EVENT_INSTANCE_PROJECTION = new String[]{
|
private static final String[] EVENT_INSTANCE_PROJECTION = new String[]{
|
||||||
|
@ -22,6 +22,8 @@ import android.bluetooth.BluetoothSocket;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.ParcelUuid;
|
import android.os.ParcelUuid;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -31,7 +33,6 @@ import java.io.OutputStream;
|
|||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport;
|
import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport;
|
||||||
@ -45,7 +46,6 @@ public abstract class BtClassicIoThread extends GBDeviceIoThread {
|
|||||||
private final GBDeviceProtocol mProtocol;
|
private final GBDeviceProtocol mProtocol;
|
||||||
private final AbstractSerialDeviceSupport mDeviceSupport;
|
private final AbstractSerialDeviceSupport mDeviceSupport;
|
||||||
|
|
||||||
|
|
||||||
private BluetoothAdapter mBtAdapter = null;
|
private BluetoothAdapter mBtAdapter = null;
|
||||||
private BluetoothSocket mBtSocket = null;
|
private BluetoothSocket mBtSocket = null;
|
||||||
private InputStream mInStream = null;
|
private InputStream mInStream = null;
|
||||||
|
@ -33,6 +33,8 @@ import android.content.Context;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -44,13 +46,11 @@ import java.util.concurrent.BlockingQueue;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.Logging;
|
import nodomain.freeyourgadget.gadgetbridge.Logging;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.receivers.AutoConnectIntervalReceiver;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One queue/thread per connectable device.
|
* One queue/thread per connectable device.
|
||||||
|
@ -60,7 +60,7 @@ public class AmazfitBipLiteFirmwareInfo extends HuamiFirmwareInfo {
|
|||||||
@Override
|
@Override
|
||||||
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
||||||
if (ArrayUtils.startsWith(bytes, NEWRES_HEADER)) {
|
if (ArrayUtils.startsWith(bytes, NEWRES_HEADER)) {
|
||||||
if ((bytes.length <= 100000) || (bytes.length > 700000)) { // dont know how to distinguish from Cor/Mi Band 3 .res
|
if ((bytes.length <= 100000) || (bytes.length > 700000)) { // don't know how to distinguish from Cor/Mi Band 3 .res
|
||||||
return HuamiFirmwareType.INVALID;
|
return HuamiFirmwareType.INVALID;
|
||||||
}
|
}
|
||||||
return HuamiFirmwareType.RES;
|
return HuamiFirmwareType.RES;
|
||||||
|
@ -485,7 +485,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set only digytal time
|
// set only digital time
|
||||||
private void setTime(Calendar calendar) {
|
private void setTime(Calendar calendar) {
|
||||||
try {
|
try {
|
||||||
TransactionBuilder builder = performInitialized("setTime");
|
TransactionBuilder builder = performInitialized("setTime");
|
||||||
@ -634,7 +634,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
case CallSpec.CALL_INCOMING:
|
case CallSpec.CALL_INCOMING:
|
||||||
isRinging = true;
|
isRinging = true;
|
||||||
remainingRepeats = repeatCount;
|
remainingRepeats = repeatCount;
|
||||||
LOG.info(" Incomming call ");
|
LOG.info(" Incoming call ");
|
||||||
if (("Phone".equals(callSpec.name)) || (callSpec.name.contains("ropusn")) || (callSpec.name.contains("issed"))) {
|
if (("Phone".equals(callSpec.name)) || (callSpec.name.contains("ropusn")) || (callSpec.name.contains("issed"))) {
|
||||||
// do nothing for notifications without caller name, e.g. system call event
|
// do nothing for notifications without caller name, e.g. system call event
|
||||||
} else {
|
} else {
|
||||||
@ -1168,14 +1168,14 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
buildCommand(WatchXPlusConstants.CMD_SET_UNITS,
|
buildCommand(WatchXPlusConstants.CMD_SET_UNITS,
|
||||||
WatchXPlusConstants.READ_VALUE));
|
WatchXPlusConstants.READ_VALUE));
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.warn(" Unable to get units ", e);
|
LOG.warn(" Unable to get units ", e);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** set watch units
|
/**
|
||||||
*
|
* Set watch units
|
||||||
*/
|
*/
|
||||||
private void setUnitsSettings() {
|
private void setUnitsSettings() {
|
||||||
int units = 0;
|
int units = 0;
|
||||||
@ -1190,7 +1190,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
byte[] bArr = new byte[3];
|
byte[] bArr = new byte[3];
|
||||||
bArr[0] = (byte) units; // metric - 0/imperial - 1
|
bArr[0] = (byte) units; // metric - 0/imperial - 1
|
||||||
bArr[1] = (byte) 0x00; //time unit 12/24h (there are separate command for this)
|
bArr[1] = (byte) 0x00; // time unit 12/24h (there is a separate command for this)
|
||||||
bArr[2] = (byte) 0x00; // temperature unit (do nothing)
|
bArr[2] = (byte) 0x00; // temperature unit (do nothing)
|
||||||
try {
|
try {
|
||||||
TransactionBuilder builder = performInitialized("setUnits");
|
TransactionBuilder builder = performInitialized("setUnits");
|
||||||
|
@ -251,8 +251,10 @@ public class QHybridSupport extends QHybridBaseSupport {
|
|||||||
globalCommandReceiver = new BroadcastReceiver() {
|
globalCommandReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if(watchAdapter == null) return;
|
if (watchAdapter == null) {
|
||||||
//noinspection SwitchStatementWithTooFewBranches
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (intent.getAction()) {
|
switch (intent.getAction()) {
|
||||||
case QHYBRID_ACTION_SET_ACTIVITY_HAND: {
|
case QHYBRID_ACTION_SET_ACTIVITY_HAND: {
|
||||||
try {
|
try {
|
||||||
|
@ -32,7 +32,7 @@ public class Alarm {
|
|||||||
private final boolean repeat;
|
private final boolean repeat;
|
||||||
private String title, message;
|
private String title, message;
|
||||||
|
|
||||||
public Alarm(byte minute, byte hour, String title, String message){
|
public Alarm(byte minute, byte hour, String title, String message) {
|
||||||
this.minute = minute;
|
this.minute = minute;
|
||||||
this.hour = hour;
|
this.hour = hour;
|
||||||
this.repeat = false;
|
this.repeat = false;
|
||||||
|
@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
|
|||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileGetRequest;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileLookupAndGetRequest;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileLookupAndGetRequest;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
|
|
||||||
@ -61,6 +60,7 @@ public class AlarmsGetRequest extends FileLookupAndGetRequest {
|
|||||||
for(int i = 0; i < alarms.length; i++){
|
for(int i = 0; i < alarms.length; i++){
|
||||||
alarms2[i] = Alarm.fromBytes(alarms[i].getData());
|
alarms2[i] = Alarm.fromBytes(alarms[i].getData());
|
||||||
}
|
}
|
||||||
|
// TODO: This does nothing currently!
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,21 +73,21 @@ public class AlarmsSetRequest extends FilePutRequest {
|
|||||||
String message = alarm.getMessage();
|
String message = alarm.getMessage();
|
||||||
int alarmSize = 17 + label.length() + message.length();
|
int alarmSize = 17 + label.length() + message.length();
|
||||||
|
|
||||||
buffer.put((byte) 0x00); // dunno why
|
buffer.put((byte) 0x00); // No information why
|
||||||
buffer.putShort((short) (alarmSize - 3)); // alarm size, 0 above and this does not count
|
buffer.putShort((short) (alarmSize - 3)); // Alarm size, 0 above and this does not count
|
||||||
buffer.put((byte) 0x00); // prolly entry id time data
|
buffer.put((byte) 0x00); // Probably entry id time data
|
||||||
buffer.putShort((short) 3); // prolly entry length
|
buffer.putShort((short) 3); // Probably entry length
|
||||||
buffer.put(alarm.getData());
|
buffer.put(alarm.getData());
|
||||||
|
|
||||||
buffer.put((byte) 0x01); // another entry id label
|
buffer.put((byte) 0x01); // Another entry id label
|
||||||
buffer.putShort((short) (label.length() + 1)); // entry length
|
buffer.putShort((short) (label.length() + 1)); // Entry length
|
||||||
buffer.put(label.getBytes());
|
buffer.put(label.getBytes());
|
||||||
buffer.put((byte) 0x00); // null terminator
|
buffer.put((byte) 0x00); // Null terminator
|
||||||
|
|
||||||
buffer.put((byte) 0x02); // entry id subtext
|
buffer.put((byte) 0x02); // Entry ID subtext
|
||||||
buffer.putShort((short) (message.length() + 1)); // entry length
|
buffer.putShort((short) (message.length() + 1)); // Entry length
|
||||||
buffer.put(message.getBytes());
|
buffer.put(message.getBytes());
|
||||||
buffer.put((byte) 0x00); // null terminator
|
buffer.put((byte) 0x00); // Null terminator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ public class ConfigurationPutRequest extends FilePutRequest {
|
|||||||
GB.log("error", GB.ERROR, e);
|
GB.log("error", GB.ERROR, e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.parseData(payload);
|
item.parseData(payload);
|
||||||
|
|
||||||
configItems.add(item);
|
configItems.add(item);
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.util;
|
package nodomain.freeyourgadget.gadgetbridge.util;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -25,7 +27,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
|
@ -35,15 +35,16 @@ import android.provider.MediaStore;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.content.FileProvider;
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
|
||||||
@ -148,10 +149,11 @@ public class AndroidUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As seen on stackoverflow https://stackoverflow.com/a/36714242/1207186
|
* As seen on StackOverflow https://stackoverflow.com/a/36714242/1207186
|
||||||
* Try to find the file path of a document uri
|
* Try to find the file path of a document uri
|
||||||
|
*
|
||||||
* @param context the application context
|
* @param context the application context
|
||||||
* @param uri the Uri for which the path should be resolved
|
* @param uri the Uri for which the path should be resolved
|
||||||
* @return the path corresponding to the Uri as a String
|
* @return the path corresponding to the Uri as a String
|
||||||
* @throws IllegalArgumentException on any problem decoding the uri to a path
|
* @throws IllegalArgumentException on any problem decoding the uri to a path
|
||||||
*/
|
*/
|
||||||
@ -170,7 +172,7 @@ public class AndroidUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As seen on stackoverflow https://stackoverflow.com/a/36714242/1207186
|
* As seen on StackOverflow https://stackoverflow.com/a/36714242/1207186
|
||||||
* Try to find the file path of a document uri
|
* Try to find the file path of a document uri
|
||||||
* @param context the application context
|
* @param context the application context
|
||||||
* @param uri the Uri for which the path should be resolved
|
* @param uri the Uri for which the path should be resolved
|
||||||
|
@ -36,6 +36,8 @@ import android.webkit.WebResourceResponse;
|
|||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -46,7 +48,6 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.GBChromeClient;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.GBChromeClient;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.GBWebClient;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.GBWebClient;
|
||||||
@ -55,7 +56,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.JSInt
|
|||||||
public class WebViewSingleton {
|
public class WebViewSingleton {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(WebViewSingleton.class);
|
private static final Logger LOG = LoggerFactory.getLogger(WebViewSingleton.class);
|
||||||
private static WebViewSingleton instance = new WebViewSingleton();
|
private static final WebViewSingleton instance = new WebViewSingleton();
|
||||||
|
|
||||||
private WebView webView = null;
|
private WebView webView = null;
|
||||||
private MutableContextWrapper contextWrapper;
|
private MutableContextWrapper contextWrapper;
|
||||||
@ -71,6 +72,21 @@ public class WebViewSingleton {
|
|||||||
private WebViewSingleton() {
|
private WebViewSingleton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Internet helper outgoing connection
|
||||||
|
private final ServiceConnection internetHelperConnection = new ServiceConnection() {
|
||||||
|
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||||
|
LOG.info("internet helper service bound");
|
||||||
|
internetHelperBound = true;
|
||||||
|
internetHelper = new Messenger(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onServiceDisconnected(ComponentName className) {
|
||||||
|
LOG.info("internet helper service unbound");
|
||||||
|
internetHelper = null;
|
||||||
|
internetHelperBound = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static synchronized void ensureCreated(Activity context) {
|
public static synchronized void ensureCreated(Activity context) {
|
||||||
if (instance.webView == null) {
|
if (instance.webView == null) {
|
||||||
instance.contextWrapper = new MutableContextWrapper(context);
|
instance.contextWrapper = new MutableContextWrapper(context);
|
||||||
@ -91,21 +107,6 @@ public class WebViewSingleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Internet helper outgoing connection
|
|
||||||
private ServiceConnection internetHelperConnection = new ServiceConnection() {
|
|
||||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
|
||||||
LOG.info("internet helper service bound");
|
|
||||||
internetHelperBound = true;
|
|
||||||
internetHelper = new Messenger(service);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServiceDisconnected(ComponentName className) {
|
|
||||||
LOG.info("internet helper service unbound");
|
|
||||||
internetHelper = null;
|
|
||||||
internetHelperBound = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static WebViewSingleton getInstance() {
|
public static WebViewSingleton getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user