Some more lint warnings fixed

master
cpfeiffer 2015-11-23 23:04:46 +01:00
parent 95dc67c98d
commit bd0716ba58
41 changed files with 71 additions and 72 deletions

View File

@ -8,7 +8,7 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
public abstract class AbstractFragmentPagerAdapter extends FragmentStatePagerAdapter { public abstract class AbstractFragmentPagerAdapter extends FragmentStatePagerAdapter {
private Set<AbstractGBFragment> fragments = new HashSet<>(); private final Set<AbstractGBFragment> fragments = new HashSet<>();
private Object primaryFragment; private Object primaryFragment;
public AbstractFragmentPagerAdapter(FragmentManager fm) { public AbstractFragmentPagerAdapter(FragmentManager fm) {

View File

@ -56,7 +56,7 @@ public abstract class AbstractSettingsActivity extends PreferenceActivity {
} }
private static class ExtraSetSummaryOnChangeListener extends SimpleSetSummaryOnChangeListener { private static class ExtraSetSummaryOnChangeListener extends SimpleSetSummaryOnChangeListener {
private Preference.OnPreferenceChangeListener delegate; private final Preference.OnPreferenceChangeListener delegate;
public ExtraSetSummaryOnChangeListener(Preference.OnPreferenceChangeListener delegate) { public ExtraSetSummaryOnChangeListener(Preference.OnPreferenceChangeListener delegate) {
this.delegate = delegate; this.delegate = delegate;
@ -72,7 +72,7 @@ public abstract class AbstractSettingsActivity extends PreferenceActivity {
} }
} }
private static SimpleSetSummaryOnChangeListener sBindPreferenceSummaryToValueListener = new SimpleSetSummaryOnChangeListener(); private static final SimpleSetSummaryOnChangeListener sBindPreferenceSummaryToValueListener = new SimpleSetSummaryOnChangeListener();
@Override @Override
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {

View File

@ -35,7 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.R;
public class AppBlacklistActivity extends Activity { public class AppBlacklistActivity extends Activity {
private static final Logger LOG = LoggerFactory.getLogger(AppBlacklistActivity.class); private static final Logger LOG = LoggerFactory.getLogger(AppBlacklistActivity.class);
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();

View File

@ -37,7 +37,7 @@ public class AppManagerActivity extends Activity {
= "nodomain.freeyourgadget.gadgetbridge.appmanager.action.refresh_applist"; = "nodomain.freeyourgadget.gadgetbridge.appmanager.action.refresh_applist";
private static final Logger LOG = LoggerFactory.getLogger(AppManagerActivity.class); private static final Logger LOG = LoggerFactory.getLogger(AppManagerActivity.class);
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();

View File

@ -50,7 +50,7 @@ public class DebugActivity extends Activity {
private Button importDBButton; private Button importDBButton;
private EditText editContent; private EditText editContent;
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ControlCenter.ACTION_QUIT)) { if (intent.getAction().equals(ControlCenter.ACTION_QUIT)) {

View File

@ -36,9 +36,9 @@ public class DiscoveryActivity extends Activity implements AdapterView.OnItemCli
private static final Logger LOG = LoggerFactory.getLogger(DiscoveryActivity.class); private static final Logger LOG = LoggerFactory.getLogger(DiscoveryActivity.class);
private static final long SCAN_DURATION = 60000; // 60s private static final long SCAN_DURATION = 60000; // 60s
private Handler handler = new Handler(); private final Handler handler = new Handler();
private BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() { private final BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) { switch (intent.getAction()) {
@ -78,14 +78,14 @@ public class DiscoveryActivity extends Activity implements AdapterView.OnItemCli
} }
}; };
private BluetoothAdapter.LeScanCallback leScanCallback = new BluetoothAdapter.LeScanCallback() { private final BluetoothAdapter.LeScanCallback leScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override @Override
public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) { public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
handleDeviceFound(device, (short) rssi); handleDeviceFound(device, (short) rssi);
} }
}; };
private Runnable stopRunnable = new Runnable() { private final Runnable stopRunnable = new Runnable() {
@Override @Override
public void run() { public void run() {
stopDiscovery(); stopDiscovery();
@ -94,7 +94,7 @@ public class DiscoveryActivity extends Activity implements AdapterView.OnItemCli
private ProgressBar progressView; private ProgressBar progressView;
private BluetoothAdapter adapter; private BluetoothAdapter adapter;
private ArrayList<GBDeviceCandidate> deviceCandidates = new ArrayList<>(); private final ArrayList<GBDeviceCandidate> deviceCandidates = new ArrayList<>();
private DeviceCandidateAdapter cadidateListAdapter; private DeviceCandidateAdapter cadidateListAdapter;
private Button startButton; private Button startButton;
private Scanning isScanning = Scanning.SCANNING_OFF; private Scanning isScanning = Scanning.SCANNING_OFF;

View File

@ -45,7 +45,7 @@ public class FwAppInstallerActivity extends Activity implements InstallActivity
private InstallHandler installHandler; private InstallHandler installHandler;
private boolean mayConnect; private boolean mayConnect;
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();
@ -72,7 +72,7 @@ public class FwAppInstallerActivity extends Activity implements InstallActivity
}; };
private ProgressBar mProgressBar; private ProgressBar mProgressBar;
private ListView itemListView; private ListView itemListView;
private List<ItemWithDetails> mItems = new ArrayList<>(); private final List<ItemWithDetails> mItems = new ArrayList<>();
private ItemWithDetailsAdapter mItemAdapter; private ItemWithDetailsAdapter mItemAdapter;
private void refreshBusyState(GBDevice dev) { private void refreshBusyState(GBDevice dev) {

View File

@ -60,12 +60,12 @@ import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
* shift the date by one day. * shift the date by one day.
*/ */
public abstract class AbstractChartFragment extends AbstractGBFragment { public abstract class AbstractChartFragment extends AbstractGBFragment {
protected int ANIM_TIME = 350; protected final int ANIM_TIME = 350;
private static final Logger LOG = LoggerFactory.getLogger(AbstractChartFragment.class); private static final Logger LOG = LoggerFactory.getLogger(AbstractChartFragment.class);
private final Set<String> mIntentFilterActions; private final Set<String> mIntentFilterActions;
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
AbstractChartFragment.this.onReceive(context, intent); AbstractChartFragment.this.onReceive(context, intent);
@ -82,7 +82,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
protected static final class ActivityConfig { protected static final class ActivityConfig {
public final int type; public final int type;
public final String label; public final String label;
public Integer color; public final Integer color;
public ActivityConfig(int kind, String label, Integer color) { public ActivityConfig(int kind, String label, Integer color) {
this.type = kind; this.type = kind;

View File

@ -80,7 +80,7 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
} }
} }
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();

View File

@ -60,7 +60,7 @@ public class LiveActivityFragment extends AbstractChartFragment {
private CustomBarChart mStepsPerMinuteCurrentChart; private CustomBarChart mStepsPerMinuteCurrentChart;
private CustomBarChart mTotalStepsChart; private CustomBarChart mTotalStepsChart;
private Steps mSteps = new Steps(); private final Steps mSteps = new Steps();
private ScheduledExecutorService pulseScheduler; private ScheduledExecutorService pulseScheduler;
private int maxStepsResetCounter; private int maxStepsResetCounter;
@ -140,7 +140,7 @@ public class LiveActivityFragment extends AbstractChartFragment {
} }
} }
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();

View File

@ -26,7 +26,7 @@ public class MiBandPairingActivity extends Activity {
private TextView message; private TextView message;
private boolean isPairing; private boolean isPairing;
private String macAddress; private String macAddress;
private BroadcastReceiver mPairingReceiver = new BroadcastReceiver() { private final BroadcastReceiver mPairingReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (GBDevice.ACTION_DEVICE_CHANGED.equals(intent.getAction())) { if (GBDevice.ACTION_DEVICE_CHANGED.equals(intent.getAction())) {

View File

@ -20,7 +20,7 @@ public class MiBandSampleProvider implements SampleProvider {
// public static final byte TYPE_WALKING = 1; // public static final byte TYPE_WALKING = 1;
// maybe this should be configurable 256 seems way off, though. // maybe this should be configurable 256 seems way off, though.
private float movementDivisor = 180.0f; //256.0f; private final float movementDivisor = 180.0f; //256.0f;
@Override @Override
public int normalizeType(byte rawType) { public int normalizeType(byte rawType) {

View File

@ -207,7 +207,7 @@ public class MiBandService {
*/ */
private static Map<UUID, String> MIBAND_DEBUG; private static final Map<UUID, String> MIBAND_DEBUG;
static { static {
MIBAND_DEBUG = new HashMap<>(); MIBAND_DEBUG = new HashMap<>();

View File

@ -10,13 +10,13 @@ import java.util.Arrays;
*/ */
public class UserInfo { public class UserInfo {
private String btAddress; private final String btAddress;
private String alias; private final String alias;
private int gender; private final int gender;
private int age; private final int age;
private int height; private final int height;
private int weight; private final int weight;
private int type; private final int type;
private byte[] data = new byte[20]; private byte[] data = new byte[20];

View File

@ -40,8 +40,8 @@ public class VibrationProfile {
private final String id; private final String id;
private int[] onOffSequence; private final int[] onOffSequence;
private short repeat; private final short repeat;
/** /**
* Creates a new profile instance. * Creates a new profile instance.

View File

@ -4,7 +4,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
public class MisfitSampleProvider implements SampleProvider { public class MisfitSampleProvider implements SampleProvider {
protected float movementDivisor = 300f; protected final float movementDivisor = 300f;
@Override @Override
public int normalizeType(byte rawType) { public int normalizeType(byte rawType) {

View File

@ -14,7 +14,7 @@ import java.nio.ByteOrder;
public class STM32CRC { public class STM32CRC {
private int crc; private int crc;
private byte rem; private byte rem;
private byte buffer[] = {0, 0, 0, 0}; private final byte[] buffer = {0, 0, 0, 0};
private static final int[] crc_table = { private static final int[] crc_table = {
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,

View File

@ -1,7 +1,6 @@
package nodomain.freeyourgadget.gadgetbridge.externalevents; package nodomain.freeyourgadget.gadgetbridge.externalevents;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.Notification; import android.app.Notification;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -12,7 +11,6 @@ import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.PowerManager; import android.os.PowerManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
@ -41,7 +39,7 @@ public class NotificationListener extends NotificationListenerService {
public static final String ACTION_MUTE public static final String ACTION_MUTE
= "nodomain.freeyourgadget.gadgetbridge.notificationlistener.action.mute"; = "nodomain.freeyourgadget.gadgetbridge.notificationlistener.action.mute";
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {

View File

@ -18,7 +18,7 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PR
public class GBAlarm implements Alarm { public class GBAlarm implements Alarm {
private int index; private final int index;
private boolean enabled; private boolean enabled;
private boolean smartWakeup; private boolean smartWakeup;
private int repetition; private int repetition;

View File

@ -14,8 +14,8 @@ import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
* support this candidate, will the candidate be promoted to a GBDevice. * support this candidate, will the candidate be promoted to a GBDevice.
*/ */
public class GBDeviceCandidate implements Parcelable { public class GBDeviceCandidate implements Parcelable {
private BluetoothDevice device; private final BluetoothDevice device;
private short rssi; private final short rssi;
private DeviceType deviceType = DeviceType.UNKNOWN; private DeviceType deviceType = DeviceType.UNKNOWN;
public GBDeviceCandidate(BluetoothDevice device, short rssi) { public GBDeviceCandidate(BluetoothDevice device, short rssi) {

View File

@ -5,7 +5,7 @@ import android.content.Context;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
public class ActivityAmount { public class ActivityAmount {
private int activityKind; private final int activityKind;
private short percent; private short percent;
private long totalSeconds; private long totalSeconds;

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ActivityAmounts { public class ActivityAmounts {
private List<ActivityAmount> amounts = new ArrayList<>(4); private final List<ActivityAmount> amounts = new ArrayList<>(4);
private long totalSeconds; private long totalSeconds;
public void addAmount(ActivityAmount amount) { public void addAmount(ActivityAmount amount) {

View File

@ -93,7 +93,7 @@ public class DeviceCommunicationService extends Service {
private MusicPlaybackReceiver mMusicPlaybackReceiver = null; private MusicPlaybackReceiver mMusicPlaybackReceiver = null;
private TimeChangeReceiver mTimeChangeReceiver = null; private TimeChangeReceiver mTimeChangeReceiver = null;
private BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String action = intent.getAction(); String action = intent.getAction();

View File

@ -18,7 +18,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class DeviceSupportFactory { public class DeviceSupportFactory {
private final BluetoothAdapter mBtAdapter; private final BluetoothAdapter mBtAdapter;
private Context mContext; private final Context mContext;
public DeviceSupportFactory(Context context) { public DeviceSupportFactory(Context context) {
mContext = context; mContext = context;

View File

@ -33,7 +33,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im
private BtLEQueue mQueue; private BtLEQueue mQueue;
private HashMap<UUID, BluetoothGattCharacteristic> mAvailableCharacteristics; private HashMap<UUID, BluetoothGattCharacteristic> mAvailableCharacteristics;
private Set<UUID> mSupportedServices = new HashSet<>(4); private final Set<UUID> mSupportedServices = new HashSet<>(4);
public static final String BASE_UUID = "0000%s-0000-1000-8000-00805f9b34fb"; //this is common for all BTLE devices. see http://stackoverflow.com/questions/18699251/finding-out-android-bluetooth-le-gatt-profiles public static final String BASE_UUID = "0000%s-0000-1000-8000-00805f9b34fb"; //this is common for all BTLE devices. see http://stackoverflow.com/questions/18699251/finding-out-android-bluetooth-le-gatt-profiles

View File

@ -31,8 +31,8 @@ public final class BtLEQueue {
private static final Logger LOG = LoggerFactory.getLogger(BtLEQueue.class); private static final Logger LOG = LoggerFactory.getLogger(BtLEQueue.class);
private final Object mGattMonitor = new Object(); private final Object mGattMonitor = new Object();
private GBDevice mGbDevice; private final GBDevice mGbDevice;
private BluetoothAdapter mBluetoothAdapter; private final BluetoothAdapter mBluetoothAdapter;
private BluetoothGatt mBluetoothGatt; private BluetoothGatt mBluetoothGatt;
/** /**
* When an automatic reconnect was attempted after a connection breakdown (error) * When an automatic reconnect was attempted after a connection breakdown (error)
@ -41,12 +41,12 @@ public final class BtLEQueue {
private static final long MIN_MILLIS_BEFORE_RECONNECT = 1000 * 60 * 5; // 5 minutes private static final long MIN_MILLIS_BEFORE_RECONNECT = 1000 * 60 * 5; // 5 minutes
private volatile BlockingQueue<Transaction> mTransactions = new LinkedBlockingQueue<>(); private final BlockingQueue<Transaction> mTransactions = new LinkedBlockingQueue<>();
private volatile boolean mDisposed; private volatile boolean mDisposed;
private volatile boolean mCrashed; private volatile boolean mCrashed;
private volatile boolean mAbortTransaction; private volatile boolean mAbortTransaction;
private Context mContext; private final Context mContext;
private CountDownLatch mWaitForActionResultLatch; private CountDownLatch mWaitForActionResultLatch;
private CountDownLatch mConnectionLatch; private CountDownLatch mConnectionLatch;
private BluetoothGattCharacteristic mWaitCharacteristic; private BluetoothGattCharacteristic mWaitCharacteristic;
@ -284,7 +284,7 @@ public final class BtLEQueue {
private private
@Nullable @Nullable
GattCallback mTransactionGattCallback; GattCallback mTransactionGattCallback;
private GattCallback mExternalGattCallback; private final GattCallback mExternalGattCallback;
public InternalGattCallback(GattCallback externalGattCallback) { public InternalGattCallback(GattCallback externalGattCallback) {
mExternalGattCallback = externalGattCallback; mExternalGattCallback = externalGattCallback;

View File

@ -178,7 +178,7 @@ public class GattCharacteristic {
//do we need this? //do we need this?
private static Map<UUID, String> GATTCHARACTERISTIC_DEBUG; private static final Map<UUID, String> GATTCHARACTERISTIC_DEBUG;
static { static {
GATTCHARACTERISTIC_DEBUG = new HashMap<>(); GATTCHARACTERISTIC_DEBUG = new HashMap<>();

View File

@ -43,7 +43,7 @@ public class GattService {
//do we need this? //do we need this?
private static Map<UUID, String> GATTSERVICE_DEBUG; private static final Map<UUID, String> GATTSERVICE_DEBUG;
static { static {
GATTSERVICE_DEBUG = new HashMap<>(); GATTSERVICE_DEBUG = new HashMap<>();

View File

@ -16,9 +16,9 @@ import java.util.Locale;
* @author TREND * @author TREND
*/ */
public class Transaction { public class Transaction {
private String mName; private final String mName;
private List<BtLEAction> mActions = new ArrayList<>(4); private final List<BtLEAction> mActions = new ArrayList<>(4);
private long creationTimestamp = System.currentTimeMillis(); private final long creationTimestamp = System.currentTimeMillis();
private private
@Nullable @Nullable
GattCallback gattCallback; GattCallback gattCallback;

View File

@ -14,7 +14,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.WriteAction;
public class TransactionBuilder { public class TransactionBuilder {
private static final Logger LOG = LoggerFactory.getLogger(TransactionBuilder.class); private static final Logger LOG = LoggerFactory.getLogger(TransactionBuilder.class);
private Transaction mTransaction; private final Transaction mTransaction;
private boolean mQueued; private boolean mQueued;
public TransactionBuilder(String taskName) { public TransactionBuilder(String taskName) {

View File

@ -7,9 +7,9 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class SetProgressAction extends PlainAction { public class SetProgressAction extends PlainAction {
private String text; private final String text;
private boolean ongoing; private final boolean ongoing;
private int percentage; private final int percentage;
private final Context context; private final Context context;
/** /**

View File

@ -4,7 +4,7 @@ import android.bluetooth.BluetoothGatt;
public class WaitAction extends PlainAction { public class WaitAction extends PlainAction {
private int mMillis; private final int mMillis;
public WaitAction(int millis) { public WaitAction(int millis) {
mMillis = millis; mMillis = millis;

View File

@ -13,7 +13,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEAction;
*/ */
public class WriteAction extends BtLEAction { public class WriteAction extends BtLEAction {
private byte[] value; private final byte[] value;
public WriteAction(BluetoothGattCharacteristic characteristic, byte[] value) { public WriteAction(BluetoothGattCharacteristic characteristic, byte[] value) {
super(characteristic); super(characteristic);

View File

@ -1,7 +1,7 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.miband; package nodomain.freeyourgadget.gadgetbridge.service.devices.miband;
public class AbstractInfo { public class AbstractInfo {
protected byte[] mData; protected final byte[] mData;
public AbstractInfo(byte[] data) { public AbstractInfo(byte[] data) {
mData = new byte[data.length]; mData = new byte[data.length];

View File

@ -78,8 +78,8 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
private DeviceInfo mDeviceInfo; private DeviceInfo mDeviceInfo;
GBDeviceEventVersionInfo versionCmd = new GBDeviceEventVersionInfo(); private final GBDeviceEventVersionInfo versionCmd = new GBDeviceEventVersionInfo();
GBDeviceEventBatteryInfo batteryCmd = new GBDeviceEventBatteryInfo(); private final GBDeviceEventBatteryInfo batteryCmd = new GBDeviceEventBatteryInfo();
public MiBandSupport() { public MiBandSupport() {
addSupportedService(GattService.UUID_SERVICE_GENERIC_ACCESS); addSupportedService(GattService.UUID_SERVICE_GENERIC_ACCESS);

View File

@ -50,13 +50,13 @@ public class FetchActivityOperation extends AbstractBTLEOperation<MiBandSupport>
//private ScheduledExecutorService scheduleTaskExecutor; //private ScheduledExecutorService scheduleTaskExecutor;
//private ScheduledFuture scheduledTask; //private ScheduledFuture scheduledTask;
private int activityMetadataLength = 11; private final int activityMetadataLength = 11;
//temporary buffer, size is a multiple of 60 because we want to store complete minutes (1 minute = 3 bytes) //temporary buffer, size is a multiple of 60 because we want to store complete minutes (1 minute = 3 bytes)
private static final int activityDataHolderSize = 3 * 60 * 4; // 4h private static final int activityDataHolderSize = 3 * 60 * 4; // 4h
private static class ActivityStruct { private static class ActivityStruct {
private byte[] activityDataHolder = new byte[activityDataHolderSize]; private final byte[] activityDataHolder = new byte[activityDataHolderSize];
//index of the buffer above //index of the buffer above
private int activityDataHolderProgress = 0; private int activityDataHolderProgress = 0;
//number of bytes we will get in a single data transfer, used as counter //number of bytes we will get in a single data transfer, used as counter

View File

@ -56,7 +56,7 @@ public class PebbleIoThread extends GBDeviceIoThread {
public static final String PEBBLEKIT_ACTION_APP_START = "com.getpebble.action.app.START"; public static final String PEBBLEKIT_ACTION_APP_START = "com.getpebble.action.app.START";
public static final String PEBBLEKIT_ACTION_APP_STOP = "com.getpebble.action.app.STOP"; public static final String PEBBLEKIT_ACTION_APP_STOP = "com.getpebble.action.app.STOP";
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext()); final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
private final PebbleProtocol mPebbleProtocol; private final PebbleProtocol mPebbleProtocol;
private final PebbleSupport mPebbleSupport; private final PebbleSupport mPebbleSupport;
@ -419,6 +419,7 @@ public class PebbleIoThread extends GBDeviceIoThread {
mOutStream.flush(); mOutStream.flush();
} }
} catch (IOException e) { } catch (IOException e) {
LOG.error("Error writing.", e);
} }
} }

View File

@ -228,7 +228,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
"snowy_evt2", "snowy_dvt", "spalding_dvt", "snowy_s3", "spalding" "snowy_evt2", "snowy_dvt", "spalding_dvt", "snowy_s3", "spalding"
}; };
private static Random mRandom = new Random(); private static final Random mRandom = new Random();
boolean isFw3x = false; boolean isFw3x = false;
boolean mForceProtocol = false; boolean mForceProtocol = false;
@ -327,14 +327,14 @@ public class PebbleProtocol extends GBDeviceProtocol {
byte last_id = -1; byte last_id = -1;
private ArrayList<UUID> tmpUUIDS = new ArrayList<>(); private final ArrayList<UUID> tmpUUIDS = new ArrayList<>();
private static final UUID UUID_GBPEBBLE = UUID.fromString("61476764-7465-7262-6469-656775527a6c"); private static final UUID UUID_GBPEBBLE = UUID.fromString("61476764-7465-7262-6469-656775527a6c");
private static final UUID UUID_MORPHEUZ = UUID.fromString("5be44f1d-d262-4ea6-aa30-ddbec1e3cab2"); private static final UUID UUID_MORPHEUZ = UUID.fromString("5be44f1d-d262-4ea6-aa30-ddbec1e3cab2");
private static final UUID UUID_WHETHERNEAT = UUID.fromString("3684003b-a685-45f9-a713-abc6364ba051"); private static final UUID UUID_WHETHERNEAT = UUID.fromString("3684003b-a685-45f9-a713-abc6364ba051");
private static final UUID UUID_MISFIT = UUID.fromString("0b73b76a-cd65-4dc2-9585-aaa213320858"); private static final UUID UUID_MISFIT = UUID.fromString("0b73b76a-cd65-4dc2-9585-aaa213320858");
private static Map<UUID, AppMessageHandler> mAppMessageHandlers = new HashMap<>(); private static final Map<UUID, AppMessageHandler> mAppMessageHandlers = new HashMap<>();
{ {
mAppMessageHandlers.put(UUID_GBPEBBLE, new AppMessageHandlerGBPebble(UUID_GBPEBBLE, PebbleProtocol.this)); mAppMessageHandlers.put(UUID_GBPEBBLE, new AppMessageHandlerGBPebble(UUID_GBPEBBLE, PebbleProtocol.this));

View File

@ -13,7 +13,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
public class DeviceHelper { public class DeviceHelper {
private static DeviceHelper instance = new DeviceHelper(); private static final DeviceHelper instance = new DeviceHelper();
public static DeviceHelper getInstance() { public static DeviceHelper getInstance() {
return instance; return instance;

View File

@ -19,7 +19,7 @@ import nodomain.freeyourgadget.gadgetbridge.test.MockHelper;
public abstract class AbstractServiceTestCase<T extends Service> { public abstract class AbstractServiceTestCase<T extends Service> {
private static final int ID = -1; // currently not supported private static final int ID = -1; // currently not supported
private Class<T> mServiceClass; private final Class<T> mServiceClass;
private T mServiceInstance; private T mServiceInstance;
private Context mContext; private Context mContext;
private Application mApplication; private Application mApplication;

View File

@ -12,7 +12,7 @@ import java.util.Map;
public class GBMockIntent extends Intent { public class GBMockIntent extends Intent {
private String mAction; private String mAction;
private Map<String,Object> extras = new HashMap<>(); private final Map<String,Object> extras = new HashMap<>();
@NonNull @NonNull
@Override @Override