mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 09:31:59 +01:00
Fixed a few more warnings
This commit is contained in:
parent
7db3b68047
commit
010785113b
@ -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 {
|
||||
|
@ -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.
|
||||
*
|
||||
* <p>
|
||||
* Instances are used in the context of a concrete AbstractBTLEDeviceSupport instance,
|
||||
* i.e. a concrete device.
|
||||
*
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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++){
|
||||
|
@ -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();
|
||||
|
||||
if (matcher.find()) {
|
||||
String thisVersion = matcher.group(0);
|
||||
|
||||
int result = newFormatVersion.compareTo(new Version(thisVersion));
|
||||
|
||||
return result != 1;
|
||||
return newFormatVersion.compareTo(new Version(thisVersion)) != 1;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static public byte[] createFileFromAlarms(Alarm[] alarms, boolean newFormat) {
|
||||
|
@ -16,21 +16,17 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.configuration;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileCloseAndPutRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FilePutRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
public class ConfigurationPutRequest extends FilePutRequest {
|
||||
private static HashMap<Short, Class<? extends ConfigItem>> itemsById = new HashMap<>();
|
||||
private static final HashMap<Short, Class<? extends ConfigItem>> itemsById = new HashMap<>();
|
||||
|
||||
static {
|
||||
itemsById.put((short)0x02, CurrentStepCountConfigItem.class);
|
||||
@ -60,7 +56,8 @@ public class ConfigurationPutRequest extends FilePutRequest {
|
||||
if (configClass == null) {
|
||||
continue;
|
||||
}
|
||||
ConfigItem item = null;
|
||||
|
||||
ConfigItem item;
|
||||
try {
|
||||
item = configClass.newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
@ -112,7 +109,7 @@ public class ConfigurationPutRequest extends FilePutRequest {
|
||||
|
||||
static public class GenericConfigItem<T> extends ConfigItem {
|
||||
private T value;
|
||||
private short configId;
|
||||
private final short configId;
|
||||
|
||||
public GenericConfigItem(short configId, T value) {
|
||||
this.value = value;
|
||||
|
@ -106,12 +106,12 @@ public class DownloadFileRequest extends FileRequest {
|
||||
}
|
||||
|
||||
private String bytesToString(byte[] bytes){
|
||||
String s = "";
|
||||
StringBuilder s = new StringBuilder();
|
||||
String chars = "0123456789ABCDEF";
|
||||
for (byte b : bytes) {
|
||||
s += chars.charAt((b >> 4) & 0xF);
|
||||
s += chars.charAt((b >> 0) & 0xF);
|
||||
s.append(chars.charAt((b >> 4) & 0xF));
|
||||
s.append(chars.charAt((b >> 0) & 0xF));
|
||||
}
|
||||
return s;
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user