1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Bangle.js: handle if time was given with decimals

This commit is contained in:
Ganblejs 2023-12-06 22:58:34 +01:00 committed by José Rebelo
parent e39e67100e
commit acdde68fab

View File

@ -733,7 +733,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
private void handleTrksList(JSONObject json) throws JSONException { private void handleTrksList(JSONObject json) throws JSONException {
LOG.info("trksList says hi!"); LOG.info("trksList says hi!");
GB.toast(getContext(), "trksList says hi!", Toast.LENGTH_LONG, GB.INFO); //GB.toast(getContext(), "trksList says hi!", Toast.LENGTH_LONG, GB.INFO);
JSONArray tracksList = json.getJSONArray("list"); JSONArray tracksList = json.getJSONArray("list");
LOG.info("New recorder logs since last fetch: " + String.valueOf(tracksList)); LOG.info("New recorder logs since last fetch: " + String.valueOf(tracksList));
for (int i = 0; i < tracksList.length(); i ++) { for (int i = 0; i < tracksList.length(); i ++) {
@ -955,8 +955,8 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
BaseActivitySummary summary = null; BaseActivitySummary summary = null;
Date startTime = new Date(Long.parseLong(storedLogArray2[1][0])*1000L); Date startTime = new Date(Long.parseLong(storedLogArray2[1][0].split("\\.\\d")[0])*1000L);
Date endTime = new Date(Long.parseLong(storedLogArray2[storedLogArray2.length-1][0])*1000L); Date endTime = new Date(Long.parseLong(storedLogArray2[storedLogArray2.length-1][0].split("\\.\\d")[0])*1000L);
summary = new BaseActivitySummary(); summary = new BaseActivitySummary();
summary.setName(log); summary.setName(log);
summary.setStartTime(startTime); summary.setStartTime(startTime);
@ -1188,12 +1188,12 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile, true)); BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile, true));
writer.write(line); writer.write(line);
writer.close(); writer.close();
GB.toast(getContext(), "Log written to " + filename, Toast.LENGTH_LONG, GB.INFO); //GB.toast(getContext(), "Log written to " + filename, Toast.LENGTH_LONG, GB.INFO);
BufferedWriter writerLogID = new BufferedWriter(new FileWriter(outputFileLogID)); BufferedWriter writerLogID = new BufferedWriter(new FileWriter(outputFileLogID));
writerLogID.write(log); writerLogID.write(log);
writerLogID.close(); writerLogID.close();
GB.toast(getContext(), "Log ID " + log + " written to " + filenameLogID, Toast.LENGTH_LONG, GB.INFO); //GB.toast(getContext(), "Log ID " + log + " written to " + filenameLogID, Toast.LENGTH_LONG, GB.INFO);
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Could not write to file", e); LOG.warn("Could not write to file", e);
} }