diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java index ed34f3bef..45e2dc850 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java @@ -54,31 +54,27 @@ import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.json.JSONArray; import org.json.JSONException; -import org.json.JSONObject; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; import nodomain.freeyourgadget.gadgetbridge.GBApplication; -import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.AbstractGBActivity; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.GenericItem; import nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails; -import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.DeviceInfo; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.buttonconfig.ConfigPayload; -import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.FossilRequest; import nodomain.freeyourgadget.gadgetbridge.util.GB; public class ConfigActivity extends AbstractGBActivity { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/profiles/AbstractBleProfile.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/profiles/AbstractBleProfile.java index 93c47b2e6..0382ae6c3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/profiles/AbstractBleProfile.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/profiles/AbstractBleProfile.java @@ -33,9 +33,9 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEQueue; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; /** - * Base class for all BLE profiles, with things that all impplementations are + * Base class for all BLE profiles, with things that all implementations are * expected to use. - * + *
* Instances are used in the context of a concrete AbstractBTLEDeviceSupport instance,
* i.e. a concrete device.
*
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioHandlerThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioHandlerThread.java
index 379db068b..8dd09757d 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioHandlerThread.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioHandlerThread.java
@@ -31,9 +31,9 @@ import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceIoThread;
public class CasioHandlerThread extends GBDeviceIoThread {
private static final Logger LOG = LoggerFactory.getLogger(CasioHandlerThread.class);
private static final int TX_PERIOD = 60;
- private boolean mQuit = false;
- private CasioGB6900DeviceSupport mDeviceSupport;
private final Object waitObject = new Object();
+ private boolean mQuit;
+ private final CasioGB6900DeviceSupport mDeviceSupport;
private Calendar mTxTime = GregorianCalendar.getInstance();
@@ -88,9 +88,7 @@ public class CasioHandlerThread extends GBDeviceIoThread {
public void requestTxPowerLevel() {
try {
mDeviceSupport.readTxPowerLevel();
-
- } catch(Exception e) {
-
+ } catch (Exception ignored) {
}
mTxTime = GregorianCalendar.getInstance();
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java
index 3dcc55c01..b938f4da4 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java
@@ -116,7 +116,7 @@ public class QHybridSupport extends QHybridBaseSupport {
private final BroadcastReceiver commandReceiver;
private final BroadcastReceiver globalCommandReceiver;
- private PackageConfigHelper helper;
+ private final PackageConfigHelper helper;
public volatile boolean searchDevice = false;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/Alarm.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/Alarm.java
index 750c64ed0..7ca8477fb 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/Alarm.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/Alarm.java
@@ -104,7 +104,7 @@ public class Alarm {
@NonNull
@Override
public String toString() {
- String description = this.hour + ":" + this.minute + " ";
+ StringBuilder description = new StringBuilder(this.hour + ":" + this.minute + " ");
if(repeat){
String[] dayNames = new String[]{"sunday", "monday", "tuesday", "thursday", "wednesday", "friday", "saturday"};
for(int i = WEEKDAY_SUNDAY; i <= WEEKDAY_SATURDAY; i++){
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/AlarmsSetRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/AlarmsSetRequest.java
index 01cf23109..f71eee218 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/AlarmsSetRequest.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/alarm/AlarmsSetRequest.java
@@ -38,12 +38,13 @@ public class AlarmsSetRequest extends FilePutRequest {
Version newFormatVersion = new Version("1.0.2.17");
Pattern versionPattern = Pattern.compile("([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)");
Matcher matcher = versionPattern.matcher(firmware);
- matcher.find();
- String thisVersion = matcher.group(0);
- int result = newFormatVersion.compareTo(new Version(thisVersion));
-
- return result != 1;
+ if (matcher.find()) {
+ String thisVersion = matcher.group(0);
+ return newFormatVersion.compareTo(new Version(thisVersion)) != 1;
+ } else {
+ return false;
+ }
}
static public byte[] createFileFromAlarms(Alarm[] alarms, boolean newFormat) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java
index f5fd7a276..323b9c865 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/configuration/ConfigurationPutRequest.java
@@ -16,21 +16,17 @@
along with this program. If not, see