mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 19:06:53 +01:00
Some lint fixes
This commit is contained in:
parent
a7a061e298
commit
81c2f657bd
@ -43,7 +43,7 @@ public abstract class AbstractGBFragment extends Fragment {
|
||||
}
|
||||
|
||||
protected void updateActivityTitle() {
|
||||
FragmentActivity activity = (FragmentActivity) getActivity();
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||
if (getTitle() != null) {
|
||||
activity.setTitle(getTitle());
|
||||
|
@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory;
|
||||
* to set that listener in #onCreate, *not* in #onPostCreate, otherwise the value will
|
||||
* not be displayed.
|
||||
*/
|
||||
public class AbstractSettingsActivity extends PreferenceActivity {
|
||||
public abstract class AbstractSettingsActivity extends PreferenceActivity {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractSettingsActivity.class);
|
||||
|
||||
|
@ -27,7 +27,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -569,7 +569,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
|
||||
@Override
|
||||
protected void onPostExecute(Object o) {
|
||||
super.onPostExecute(o);
|
||||
FragmentActivity activity = (FragmentActivity) getActivity();
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
|
||||
renderCharts();
|
||||
} else {
|
||||
|
@ -10,9 +10,7 @@ import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.PagerTabStrip;
|
||||
import android.support.v4.view.PagerTitleStrip;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.view.Menu;
|
||||
@ -27,7 +25,6 @@ import android.widget.Toast;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -7,9 +7,9 @@ import java.util.Date;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
|
||||
public interface ChartsHost {
|
||||
static final String DATE_PREV = ChartsActivity.class.getName().concat(".date_prev");
|
||||
static final String DATE_NEXT = ChartsActivity.class.getName().concat(".date_next");
|
||||
static final String REFRESH = ChartsActivity.class.getName().concat(".refresh");
|
||||
String DATE_PREV = ChartsActivity.class.getName().concat(".date_prev");
|
||||
String DATE_NEXT = ChartsActivity.class.getName().concat(".date_next");
|
||||
String REFRESH = ChartsActivity.class.getName().concat(".refresh");
|
||||
|
||||
GBDevice getDevice();
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities.charts;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
|
||||
|
@ -6,7 +6,7 @@ public class SleepUtils {
|
||||
public static final float Y_VALUE_DEEP_SLEEP = 0.01f;
|
||||
public static final float Y_VALUE_LIGHT_SLEEP = 0.016f;
|
||||
|
||||
public static final boolean isSleep(byte type) {
|
||||
public static boolean isSleep(byte type) {
|
||||
return type == ActivityKind.TYPE_DEEP_SLEEP || type == ActivityKind.TYPE_LIGHT_SLEEP;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class GBAlarmListAdapter extends ArrayAdapter<GBAlarm> {
|
||||
super(context, 0, new ArrayList<GBAlarm>());
|
||||
|
||||
this.mContext = context;
|
||||
alarmList = new ArrayList<GBAlarm>();
|
||||
alarmList = new ArrayList<>();
|
||||
|
||||
for (String alarmString : preferencesAlarmListSet) {
|
||||
alarmList.add(new GBAlarm(alarmString));
|
||||
@ -50,7 +50,7 @@ public class GBAlarmListAdapter extends ArrayAdapter<GBAlarm> {
|
||||
}
|
||||
|
||||
public void setAlarmList(Set<String> preferencesAlarmListSet) {
|
||||
alarmList = new ArrayList<GBAlarm>();
|
||||
alarmList = new ArrayList<>();
|
||||
|
||||
for (String alarmString : preferencesAlarmListSet) {
|
||||
alarmList.add(new GBAlarm(alarmString));
|
||||
|
@ -202,7 +202,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
|
||||
if (timestamp_from < 0) {
|
||||
throw new IllegalArgumentException("negative timestamp_from");
|
||||
}
|
||||
ArrayList<ActivitySample> samples = new ArrayList<ActivitySample>();
|
||||
ArrayList<ActivitySample> samples = new ArrayList<>();
|
||||
final String where = "(provider=" + provider.getID() + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + getWhereClauseFor(activityTypes, provider) + ")";
|
||||
LOG.info("Activity query where: " + where);
|
||||
final String order = "timestamp";
|
||||
|
@ -1,7 +1,6 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||
|
||||
public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
|
||||
public boolean allowFetchActivityData(GBDevice device) {
|
||||
|
@ -13,7 +13,7 @@ public interface InstallHandler {
|
||||
* Returns true if this handler is able to install the element.
|
||||
* #validateInstallation may only be called if this method returned true.
|
||||
*/
|
||||
public boolean isValid();
|
||||
boolean isValid();
|
||||
|
||||
/**
|
||||
* Checks whether the installation of the 'element' on the device is possible
|
||||
|
@ -14,7 +14,6 @@ import java.util.Calendar;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
|
@ -45,6 +45,9 @@ public class MiBandFWHelper {
|
||||
public MiBandFWHelper(Uri uri, Context context) throws IOException {
|
||||
this.uri = uri;
|
||||
cr = context.getContentResolver();
|
||||
if (cr == null) {
|
||||
throw new IOException("No content resolver");
|
||||
}
|
||||
|
||||
String pebblePattern = ".*\\.(pbw|pbz|pbl)";
|
||||
|
||||
|
@ -4,9 +4,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattCharacteristic;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport.BASE_UUID;
|
||||
|
||||
public class MiBandService {
|
||||
|
@ -32,7 +32,7 @@ public class PBWReader {
|
||||
private static final HashMap<String, Byte> appFileTypesMap;
|
||||
|
||||
static {
|
||||
appFileTypesMap = new HashMap<String, Byte>();
|
||||
appFileTypesMap = new HashMap<>();
|
||||
appFileTypesMap.put("application", PebbleProtocol.PUTBYTES_TYPE_BINARY);
|
||||
appFileTypesMap.put("resources", PebbleProtocol.PUTBYTES_TYPE_RESOURCES);
|
||||
appFileTypesMap.put("worker", PebbleProtocol.PUTBYTES_TYPE_WORKER);
|
||||
@ -41,7 +41,7 @@ public class PBWReader {
|
||||
private static final HashMap<String, Byte> fwFileTypesMap;
|
||||
|
||||
static {
|
||||
fwFileTypesMap = new HashMap<String, Byte>();
|
||||
fwFileTypesMap = new HashMap<>();
|
||||
fwFileTypesMap.put("firmware", PebbleProtocol.PUTBYTES_TYPE_FIRMWARE);
|
||||
fwFileTypesMap.put("resources", PebbleProtocol.PUTBYTES_TYPE_SYSRESOURCES);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import android.preference.PreferenceManager;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.AppManagerActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
|
@ -55,17 +55,24 @@ public class K9Receiver extends BroadcastReceiver {
|
||||
* It should be the first one returned by the query in most cases,
|
||||
*/
|
||||
Cursor c = context.getContentResolver().query(k9Uri, messagesProjection, null, null, null);
|
||||
c.moveToFirst();
|
||||
do {
|
||||
String uri = c.getString(c.getColumnIndex("uri"));
|
||||
if (uri.equals(uriWanted)) {
|
||||
notificationSpec.sender = c.getString(c.getColumnIndex("senderAddress"));
|
||||
notificationSpec.subject = c.getString(c.getColumnIndex("subject"));
|
||||
notificationSpec.body = c.getString(c.getColumnIndex("preview"));
|
||||
break;
|
||||
try {
|
||||
if (c != null) {
|
||||
c.moveToFirst();
|
||||
do {
|
||||
String uri = c.getString(c.getColumnIndex("uri"));
|
||||
if (uri.equals(uriWanted)) {
|
||||
notificationSpec.sender = c.getString(c.getColumnIndex("senderAddress"));
|
||||
notificationSpec.subject = c.getString(c.getColumnIndex("subject"));
|
||||
notificationSpec.body = c.getString(c.getColumnIndex("preview"));
|
||||
break;
|
||||
}
|
||||
} while (c.moveToNext());
|
||||
}
|
||||
} while (c.moveToNext());
|
||||
c.close();
|
||||
} finally {
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
|
||||
GBApplication.deviceService().onNotification(notificationSpec);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class GBAlarm implements Alarm {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(GBApplication.getContext());
|
||||
Set<String> preferencesAlarmListSet = sharedPrefs.getStringSet(PREF_MIBAND_ALARMS, new HashSet<String>());
|
||||
//the old Set cannot be updated in place see http://developer.android.com/reference/android/content/SharedPreferences.html#getStringSet%28java.lang.String,%20java.util.Set%3Cjava.lang.String%3E%29
|
||||
Set<String> newPrefs = new HashSet<String>(preferencesAlarmListSet);
|
||||
Set<String> newPrefs = new HashSet<>(preferencesAlarmListSet);
|
||||
|
||||
Iterator<String> iterator = newPrefs.iterator();
|
||||
|
||||
|
@ -5,14 +5,14 @@ import android.os.Parcelable;
|
||||
import java.util.Calendar;
|
||||
|
||||
public interface Alarm extends Parcelable, Comparable<Alarm> {
|
||||
public static final byte ALARM_ONCE = 0;
|
||||
public static final byte ALARM_MON = 1;
|
||||
public static final byte ALARM_TUE = 2;
|
||||
public static final byte ALARM_WED = 4;
|
||||
public static final byte ALARM_THU = 8;
|
||||
public static final byte ALARM_FRI = 16;
|
||||
public static final byte ALARM_SAT = 32;
|
||||
public static final byte ALARM_SUN = 64;
|
||||
byte ALARM_ONCE = 0;
|
||||
byte ALARM_MON = 1;
|
||||
byte ALARM_TUE = 2;
|
||||
byte ALARM_WED = 4;
|
||||
byte ALARM_THU = 8;
|
||||
byte ALARM_FRI = 16;
|
||||
byte ALARM_SAT = 32;
|
||||
byte ALARM_SUN = 64;
|
||||
|
||||
int getIndex();
|
||||
|
||||
|
@ -9,52 +9,52 @@ import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
|
||||
*
|
||||
*/
|
||||
public interface DeviceService extends EventHandler {
|
||||
static final String PREFIX = "nodomain.freeyourgadget.gadgetbridge.devices";
|
||||
String PREFIX = "nodomain.freeyourgadget.gadgetbridge.devices";
|
||||
|
||||
static final String ACTION_START = PREFIX + ".action.start";
|
||||
static final String ACTION_CONNECT = PREFIX + ".action.connect";
|
||||
static final String ACTION_NOTIFICATION = PREFIX + ".action.notification";
|
||||
static final String ACTION_NOTIFICATION_SMS = PREFIX + ".action.notification_sms";
|
||||
static final String ACTION_CALLSTATE = PREFIX + ".action.callstate";
|
||||
static final String ACTION_SETTIME = PREFIX + ".action.settime";
|
||||
static final String ACTION_SETMUSICINFO = PREFIX + ".action.setmusicinfo";
|
||||
static final String ACTION_REQUEST_DEVICEINFO = PREFIX + ".action.request_deviceinfo";
|
||||
static final String ACTION_REQUEST_APPINFO = PREFIX + ".action.request_appinfo";
|
||||
static final String ACTION_REQUEST_SCREENSHOT = PREFIX + ".action.request_screenshot";
|
||||
static final String ACTION_STARTAPP = PREFIX + ".action.startapp";
|
||||
static final String ACTION_DELETEAPP = PREFIX + ".action.deleteapp";
|
||||
static final String ACTION_INSTALL = PREFIX + ".action.install";
|
||||
static final String ACTION_REBOOT = PREFIX + ".action.reboot";
|
||||
static final String ACTION_FETCH_ACTIVITY_DATA = PREFIX + ".action.fetch_activity_data";
|
||||
static final String ACTION_DISCONNECT = PREFIX + ".action.disconnect";
|
||||
static final String ACTION_FIND_DEVICE = PREFIX + ".action.find_device";
|
||||
static final String ACTION_SET_ALARMS = PREFIX + ".action.set_alarms";
|
||||
static final String ACTION_ENABLE_REALTIME_STEPS = PREFIX + ".action.enable_realtime_steps";
|
||||
static final String ACTION_REALTIME_STEPS = PREFIX + ".action.realtime_steps";
|
||||
String ACTION_START = PREFIX + ".action.start";
|
||||
String ACTION_CONNECT = PREFIX + ".action.connect";
|
||||
String ACTION_NOTIFICATION = PREFIX + ".action.notification";
|
||||
String ACTION_NOTIFICATION_SMS = PREFIX + ".action.notification_sms";
|
||||
String ACTION_CALLSTATE = PREFIX + ".action.callstate";
|
||||
String ACTION_SETTIME = PREFIX + ".action.settime";
|
||||
String ACTION_SETMUSICINFO = PREFIX + ".action.setmusicinfo";
|
||||
String ACTION_REQUEST_DEVICEINFO = PREFIX + ".action.request_deviceinfo";
|
||||
String ACTION_REQUEST_APPINFO = PREFIX + ".action.request_appinfo";
|
||||
String ACTION_REQUEST_SCREENSHOT = PREFIX + ".action.request_screenshot";
|
||||
String ACTION_STARTAPP = PREFIX + ".action.startapp";
|
||||
String ACTION_DELETEAPP = PREFIX + ".action.deleteapp";
|
||||
String ACTION_INSTALL = PREFIX + ".action.install";
|
||||
String ACTION_REBOOT = PREFIX + ".action.reboot";
|
||||
String ACTION_FETCH_ACTIVITY_DATA = PREFIX + ".action.fetch_activity_data";
|
||||
String ACTION_DISCONNECT = PREFIX + ".action.disconnect";
|
||||
String ACTION_FIND_DEVICE = PREFIX + ".action.find_device";
|
||||
String ACTION_SET_ALARMS = PREFIX + ".action.set_alarms";
|
||||
String ACTION_ENABLE_REALTIME_STEPS = PREFIX + ".action.enable_realtime_steps";
|
||||
String ACTION_REALTIME_STEPS = PREFIX + ".action.realtime_steps";
|
||||
|
||||
static final String EXTRA_DEVICE_ADDRESS = "device_address";
|
||||
static final String EXTRA_NOTIFICATION_BODY = "notification_body";
|
||||
static final String EXTRA_NOTIFICATION_ID = "notification_id";
|
||||
static final String EXTRA_NOTIFICATION_PHONENUMBER = "notification_phonenumber";
|
||||
static final String EXTRA_NOTIFICATION_SENDER = "notification_sender";
|
||||
static final String EXTRA_NOTIFICATION_SOURCENAME = "notification_sourcename";
|
||||
static final String EXTRA_NOTIFICATION_SUBJECT = "notification_subject";
|
||||
static final String EXTRA_NOTIFICATION_TITLE = "notification_title";
|
||||
static final String EXTRA_NOTIFICATION_TYPE = "notification_type";
|
||||
static final String EXTRA_FIND_START = "find_start";
|
||||
static final String EXTRA_CALL_COMMAND = "call_command";
|
||||
static final String EXTRA_CALL_PHONENUMBER = "call_phonenumber";
|
||||
static final String EXTRA_MUSIC_ARTIST = "music_artist";
|
||||
static final String EXTRA_MUSIC_ALBUM = "music_album";
|
||||
static final String EXTRA_MUSIC_TRACK = "music_track";
|
||||
static final String EXTRA_APP_UUID = "app_uuid";
|
||||
static final String EXTRA_APP_START = "app_start";
|
||||
static final String EXTRA_URI = "uri";
|
||||
static final String EXTRA_ALARMS = "alarms";
|
||||
static final String EXTRA_PERFORM_PAIR = "perform_pair";
|
||||
static final String EXTRA_ENABLE_REALTIME_STEPS = "enable_realtime_steps";
|
||||
static final String EXTRA_REALTIME_STEPS = "realtime_steps";
|
||||
static final String EXTRA_TIMESTAMP = "timestamp";
|
||||
String EXTRA_DEVICE_ADDRESS = "device_address";
|
||||
String EXTRA_NOTIFICATION_BODY = "notification_body";
|
||||
String EXTRA_NOTIFICATION_ID = "notification_id";
|
||||
String EXTRA_NOTIFICATION_PHONENUMBER = "notification_phonenumber";
|
||||
String EXTRA_NOTIFICATION_SENDER = "notification_sender";
|
||||
String EXTRA_NOTIFICATION_SOURCENAME = "notification_sourcename";
|
||||
String EXTRA_NOTIFICATION_SUBJECT = "notification_subject";
|
||||
String EXTRA_NOTIFICATION_TITLE = "notification_title";
|
||||
String EXTRA_NOTIFICATION_TYPE = "notification_type";
|
||||
String EXTRA_FIND_START = "find_start";
|
||||
String EXTRA_CALL_COMMAND = "call_command";
|
||||
String EXTRA_CALL_PHONENUMBER = "call_phonenumber";
|
||||
String EXTRA_MUSIC_ARTIST = "music_artist";
|
||||
String EXTRA_MUSIC_ALBUM = "music_album";
|
||||
String EXTRA_MUSIC_TRACK = "music_track";
|
||||
String EXTRA_APP_UUID = "app_uuid";
|
||||
String EXTRA_APP_START = "app_start";
|
||||
String EXTRA_URI = "uri";
|
||||
String EXTRA_ALARMS = "alarms";
|
||||
String EXTRA_PERFORM_PAIR = "perform_pair";
|
||||
String EXTRA_ENABLE_REALTIME_STEPS = "enable_realtime_steps";
|
||||
String EXTRA_REALTIME_STEPS = "realtime_steps";
|
||||
String EXTRA_TIMESTAMP = "timestamp";
|
||||
|
||||
void start();
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.model;
|
||||
|
||||
public interface SummaryOfDay {
|
||||
public byte getProvider();
|
||||
byte getProvider();
|
||||
|
||||
public int getSteps();
|
||||
int getSteps();
|
||||
|
||||
public int getDayStartWakeupTime();
|
||||
int getDayStartWakeupTime();
|
||||
|
||||
public int getDayEndFallAsleepTime();
|
||||
int getDayEndFallAsleepTime();
|
||||
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
|
||||
GB.updateBatteryNotification(context.getString(R.string.notif_battery_low_percent, gbDevice.getName(), deviceEvent.level),
|
||||
deviceEvent.extendedInfoAvailable() ?
|
||||
context.getString(R.string.notif_battery_low_percent, gbDevice.getName(), deviceEvent.level) + "\n" +
|
||||
context.getString(R.string.notif_battery_low_bigtext_last_charge_time, DateFormat.getDateTimeInstance().format(deviceEvent.lastChargeTime.getTime()).toString()) +
|
||||
context.getString(R.string.notif_battery_low_bigtext_last_charge_time, DateFormat.getDateTimeInstance().format(deviceEvent.lastChargeTime.getTime())) +
|
||||
context.getString(R.string.notif_battery_low_bigtext_number_of_charges, deviceEvent.numCharges)
|
||||
: ""
|
||||
, context);
|
||||
|
@ -21,7 +21,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.ServiceCommand;
|
||||
*/
|
||||
public class ServiceDeviceSupport implements DeviceSupport {
|
||||
|
||||
static enum Flags {
|
||||
enum Flags {
|
||||
THROTTLING,
|
||||
BUSY_CHECKING,
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ package nodomain.freeyourgadget.gadgetbridge.service.btle;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface BTLEOperation {
|
||||
public void perform() throws IOException;
|
||||
void perform() throws IOException;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
||||
public final class BtLEQueue {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BtLEQueue.class);
|
||||
|
||||
private Object mGattMonitor = new Object();
|
||||
private final Object mGattMonitor = new Object();
|
||||
private GBDevice mGbDevice;
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
private BluetoothGatt mBluetoothGatt;
|
||||
@ -41,7 +41,7 @@ public final class BtLEQueue {
|
||||
|
||||
private static final long MIN_MILLIS_BEFORE_RECONNECT = 1000 * 60 * 5; // 5 minutes
|
||||
|
||||
private volatile BlockingQueue<Transaction> mTransactions = new LinkedBlockingQueue<Transaction>();
|
||||
private volatile BlockingQueue<Transaction> mTransactions = new LinkedBlockingQueue<>();
|
||||
private volatile boolean mDisposed;
|
||||
private volatile boolean mCrashed;
|
||||
private volatile boolean mAbortTransaction;
|
||||
@ -460,7 +460,7 @@ public final class BtLEQueue {
|
||||
}
|
||||
} else {
|
||||
if (BtLEQueue.this.mWaitCharacteristic != null) {
|
||||
LOG.error("checkWaitingCharacteristic: mismatched characteristic received: " + characteristic != null ? characteristic.getUuid().toString() : "(null)");
|
||||
LOG.error("checkWaitingCharacteristic: mismatched characteristic received: " + ((characteristic != null && characteristic.getUuid() != null) ? characteristic.getUuid().toString() : "(null)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public interface GattCallback {
|
||||
* @param status
|
||||
* @see BluetoothGattCallback#onDescriptorRead(BluetoothGatt, BluetoothGattDescriptor, int)
|
||||
*/
|
||||
public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
|
||||
void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
|
||||
int status);
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ public interface GattCallback {
|
||||
* @param status
|
||||
* @see BluetoothGattCallback#onDescriptorWrite(BluetoothGatt, BluetoothGattDescriptor, int)
|
||||
*/
|
||||
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
|
||||
void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
|
||||
int status);
|
||||
//
|
||||
// /**
|
||||
|
@ -4,7 +4,6 @@ import android.bluetooth.BluetoothGatt;
|
||||
import android.bluetooth.BluetoothGattCallback;
|
||||
import android.bluetooth.BluetoothGattCharacteristic;
|
||||
import android.bluetooth.BluetoothGattDescriptor;
|
||||
import android.bluetooth.BluetoothGattService;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -4,8 +4,6 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.CheckSums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class DeviceInfo extends AbstractInfo {
|
||||
public final String deviceId;
|
||||
public final int profileVersion;
|
||||
|
@ -9,8 +9,6 @@ import android.preference.PreferenceManager;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.WriteAction;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -28,6 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInf
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandDateConverter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandService;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State;
|
||||
@ -35,7 +34,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ServiceCommand;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEAction;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattCharacteristic;
|
||||
@ -43,6 +41,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.AbortTransactionAction;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.WriteAction;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.operations.FetchActivityOperation;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.operations.UpdateFirmwareOperation;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils;
|
||||
@ -712,7 +711,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
byte[] alarmCalBytes = MiBandDateConverter.calendarToRawBytes(alarm.getAlarmCal());
|
||||
|
||||
byte[] alarmMessage = new byte[]{
|
||||
(byte) MiBandService.COMMAND_SET_TIMER,
|
||||
MiBandService.COMMAND_SET_TIMER,
|
||||
(byte) alarm.getIndex(),
|
||||
(byte) (alarm.isEnabled() ? 1 : 0),
|
||||
alarmCalBytes[0],
|
||||
|
@ -1,15 +1,11 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.miband;
|
||||
|
||||
import android.bluetooth.BluetoothGattCharacteristic;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandService;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEAction;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattCharacteristic;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
|
||||
public interface NotificationStrategy {
|
||||
public void sendDefaultNotification(TransactionBuilder builder, BtLEAction extraAction);
|
||||
void sendDefaultNotification(TransactionBuilder builder, BtLEAction extraAction);
|
||||
|
||||
/**
|
||||
* Adds a custom notification to the given transaction builder
|
||||
@ -22,5 +18,5 @@ public interface NotificationStrategy {
|
||||
* @param extraAction an extra action to be executed after every vibration and flash sequence. Allows to abort the repetition, for example.
|
||||
* @param builder
|
||||
*/
|
||||
public void sendCustomNotification(VibrationProfile vibrationProfile, int flashTimes, int flashColour, int originalColour, long flashDuration, BtLEAction extraAction, TransactionBuilder builder);
|
||||
void sendCustomNotification(VibrationProfile vibrationProfile, int flashTimes, int flashColour, int originalColour, long flashDuration, BtLEAction extraAction, TransactionBuilder builder);
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
}
|
||||
|
||||
private ArrayList<Pair<Integer, Object>> decodeDict(ByteBuffer buf) {
|
||||
ArrayList<Pair<Integer, Object>> dict = new ArrayList<Pair<Integer, Object>>();
|
||||
ArrayList<Pair<Integer, Object>> dict = new ArrayList<>();
|
||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
byte dictSize = buf.get();
|
||||
while (dictSize-- > 0) {
|
||||
|
@ -69,9 +69,7 @@ public class GBMusicControlReceiver extends BroadcastReceiver {
|
||||
Intent upIntent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
|
||||
KeyEvent upEvent = new KeyEvent(eventtime, eventtime, KeyEvent.ACTION_UP, keyCode, 0);
|
||||
upIntent.putExtra(Intent.EXTRA_KEY_EVENT, upEvent);
|
||||
if (audioPlayer != null) {
|
||||
upIntent.setPackage(audioPlayer);
|
||||
}
|
||||
upIntent.setPackage(audioPlayer);
|
||||
context.sendOrderedBroadcast(upIntent, null);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.service;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InOrder;
|
||||
|
@ -11,10 +11,8 @@ import java.util.UUID;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ServiceCommand;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.AbstractDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ServiceCommand;
|
||||
|
||||
public class TestDeviceSupport extends AbstractDeviceSupport {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user