optimize nsclient logging

This commit is contained in:
Milos Kozak 2017-06-13 12:17:54 +02:00
parent afca896f23
commit 2a1fe205ee
3 changed files with 12 additions and 7 deletions

View file

@ -189,11 +189,11 @@ public class NSClientInternalPlugin implements PluginBase {
private void updateLog() {
try {
Spanned newTextLog = Html.fromHtml("");
String newTextLog = "";
for (EventNSClientNewLog log : listLog) {
newTextLog = (Spanned) TextUtils.concat(newTextLog, log.toHtml());
newTextLog = newTextLog + log.toPreparedHtml();
}
textLog = newTextLog;
textLog = Html.fromHtml(newTextLog);
MainApp.bus().post(new EventNSClientUpdateGUI());
} catch (OutOfMemoryError e) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), "Out of memory!\nStop using this phone !!!", R.raw.error);

View file

@ -27,4 +27,9 @@ public class EventNSClientNewLog {
Spanned line = Html.fromHtml(timeFormat.format(date) + " <b>" + action + "</b> " + logText + "<br>");
return line;
}
public String toPreparedHtml() {
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
return timeFormat.format(date) + " <b>" + action + "</b> " + logText + "<br>";
}
}

View file

@ -1155,7 +1155,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
// ****** GRAPH *******
log.debug("updateGUI checkpoint 1");
//log.debug("updateGUI checkpoint 1");
// allign to hours
Calendar calendar = Calendar.getInstance();
@ -1286,7 +1286,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
absoluteBasalsLineSeries.setCustomPaint(absolutePaint);
}
log.debug("updateGUI checkpoint 2");
//log.debug("updateGUI checkpoint 2");
// **** IOB COB DEV graph ****
class DeviationDataPoint extends DataPoint {
@ -1404,12 +1404,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} else {
iobGraph.setVisibility(View.GONE);
}
log.debug("updateGUI checkpoint 3");
//log.debug("updateGUI checkpoint 3");
// remove old data from graph
bgGraph.getSecondScale().getSeries().clear();
bgGraph.getSeries().clear();
log.debug("updateGUI checkpoint 4");
//log.debug("updateGUI checkpoint 4");
// **** Area ****
DoubleDataPoint[] areaDataPoints = new DoubleDataPoint[]{