mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
Squashing some build warnings. Fix for potential corruption in bitmaps that weren't exactly n*8 bits long
This commit is contained in:
parent
c425cff759
commit
55cbac5f8f
@ -106,7 +106,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.AlarmUtils;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.EmojiConverter;
|
import nodomain.freeyourgadget.gadgetbridge.util.EmojiConverter;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
@ -193,7 +192,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
case GBDevice.ACTION_DEVICE_CHANGED: {
|
case GBDevice.ACTION_DEVICE_CHANGED: {
|
||||||
LOG.info("ACTION_DEVICE_CHANGED " + (gbDevice!=null ? gbDevice.getStateString():""));
|
LOG.info("ACTION_DEVICE_CHANGED " + (gbDevice!=null ? gbDevice.getStateString():""));
|
||||||
addReceiveHistory("\n================================================\nACTION_DEVICE_CHANGED "+gbDevice.getStateString()+" "+(new SimpleDateFormat("yyyy-mm-dd hh:mm:ss")).format(Calendar.getInstance().getTime())+"\n================================================\n");
|
addReceiveHistory("\n================================================\nACTION_DEVICE_CHANGED "+gbDevice.getStateString()+" "+(new SimpleDateFormat("yyyy-mm-dd hh:mm:ss", Locale.US)).format(Calendar.getInstance().getTime())+"\n================================================\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,13 +382,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write JSON object of the form {t:taskName, err:message}
|
private void uartTxJSONError(String taskName, String message, String id) {
|
||||||
|
|
||||||
private void uartTxJSONError(String taskName, String message) {
|
|
||||||
uartTxJSONError(taskName,message,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void uartTxJSONError(String taskName, String message,String id) {
|
|
||||||
JSONObject o = new JSONObject();
|
JSONObject o = new JSONObject();
|
||||||
try {
|
try {
|
||||||
o.put("t", taskName);
|
o.put("t", taskName);
|
||||||
@ -607,7 +600,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
XPath xPath = XPathFactory.newInstance().newXPath();
|
XPath xPath = XPathFactory.newInstance().newXPath();
|
||||||
response = xPath.evaluate(xmlPath, inputXML);
|
response = xPath.evaluate(xmlPath, inputXML);
|
||||||
} catch (Exception error) {
|
} catch (Exception error) {
|
||||||
uartTxJSONError("http", error.toString(),id);
|
uartTxJSONError("http", error.toString(), id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -624,8 +617,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}, new Response.ErrorListener() {
|
}, new Response.ErrorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onErrorResponse(VolleyError error) {
|
public void onErrorResponse(VolleyError error) {
|
||||||
JSONObject o = new JSONObject();
|
uartTxJSONError("http", error.toString(), id);
|
||||||
uartTxJSONError("http", error.toString(),id);
|
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
@Override
|
@Override
|
||||||
@ -718,7 +710,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
GB.toast(getContext(), "Targeting '"+target+"' isn't implemented or it doesn't exist.", Toast.LENGTH_LONG, GB.INFO);
|
GB.toast(getContext(), "Targeting '"+target+"' isn't implemented or it doesn't exist.", Toast.LENGTH_LONG, GB.INFO);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uartTxJSONError("intent", "Android Intents not enabled, check Gadgetbridge Device Settings");
|
uartTxJSONError("intent", "Android Intents not enabled, check Gadgetbridge Device Settings", null);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
case "force_calendar_sync": {
|
case "force_calendar_sync": {
|
||||||
@ -932,7 +924,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
transmitTime(builder);
|
transmitTime(builder);
|
||||||
//TODO: once we have a common strategy for sending events (e.g. EventHandler), remove this call from here. Meanwhile it does no harm.
|
//TODO: once we have a common strategy for sending events (e.g. EventHandler), remove this call from here. Meanwhile it does no harm.
|
||||||
// = we should genaralize the pebble calender code
|
// = we should genaralize the pebble calender code
|
||||||
//sendCalendarEvents(builder);
|
//sendCalendarEvents();
|
||||||
forceCalendarSync();
|
forceCalendarSync();
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -952,9 +944,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
if (!alarm.getEnabled()) continue;
|
if (!alarm.getEnabled()) continue;
|
||||||
JSONObject jsonalarm = new JSONObject();
|
JSONObject jsonalarm = new JSONObject();
|
||||||
jsonalarms.put(jsonalarm);
|
jsonalarms.put(jsonalarm);
|
||||||
|
//Calendar calendar = AlarmUtils.toCalendar(alarm);
|
||||||
Calendar calendar = AlarmUtils.toCalendar(alarm);
|
|
||||||
|
|
||||||
jsonalarm.put("h", alarm.getHour());
|
jsonalarm.put("h", alarm.getHour());
|
||||||
jsonalarm.put("m", alarm.getMinute());
|
jsonalarm.put("m", alarm.getMinute());
|
||||||
jsonalarm.put("rep", alarm.getRepetition());
|
jsonalarm.put("rep", alarm.getRepetition());
|
||||||
@ -1250,7 +1240,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
/** Used for writing single bits to an array */
|
/** Used for writing single bits to an array */
|
||||||
public static class BitWriter {
|
public static class BitWriter {
|
||||||
int n;
|
int n;
|
||||||
byte[] bits;
|
final byte[] bits;
|
||||||
int currentByte, bitIdx;
|
int currentByte, bitIdx;
|
||||||
|
|
||||||
public BitWriter(byte[] array, int offset) {
|
public BitWriter(byte[] array, int offset) {
|
||||||
@ -1356,6 +1346,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
bits.push(((pixel>>b)&1) != 0);
|
bits.push(((pixel>>b)&1) != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bits.finish();
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1424,8 +1415,8 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
/*
|
/*
|
||||||
* Sending all events together, not used for now, keep for future reference
|
* Sending all events together, not used for now, keep for future reference
|
||||||
*/
|
*/
|
||||||
private void sendCalendarEvents(TransactionBuilder builder) {
|
private void sendCalendarEvents() {
|
||||||
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
|
//Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
|
||||||
//TODO set a limit as number in the preferences?
|
//TODO set a limit as number in the preferences?
|
||||||
//int availableSlots = prefs.getInt(PREF_CALENDAR_EVENTS_MAX, 0);
|
//int availableSlots = prefs.getInt(PREF_CALENDAR_EVENTS_MAX, 0);
|
||||||
int availableSlots = 6;
|
int availableSlots = 6;
|
||||||
|
Loading…
Reference in New Issue
Block a user