From 9a8521b8094b4143abeb7d4f1563dde31c486c93 Mon Sep 17 00:00:00 2001 From: Jamorham Date: Sun, 28 Jan 2018 21:52:58 +0000 Subject: [PATCH] Insight Live History --- .../PumpInsight/history/LiveHistory.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/LiveHistory.java diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/LiveHistory.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/LiveHistory.java new file mode 100644 index 0000000000..5a37865bd5 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/LiveHistory.java @@ -0,0 +1,32 @@ +package info.nightscout.androidaps.plugins.PumpInsight.history; + +import info.nightscout.androidaps.plugins.PumpInsight.utils.Helpers; + +/** + * Created by jamorham on 27/01/2018. + * + * In memory status storage class + */ + +public class LiveHistory { + + private static String status = ""; + private static long status_time = -1; + + public static String getStatus() { + if (status.equals("")) return status; + return status + " " + Helpers.niceTimeScalar(Helpers.msSince(status_time)) + " ago"; + } + + public static long getStatusTime() { + return status_time; + } + + static void setStatus(String mystatus, long eventtime) { + if (eventtime > status_time) { + status_time = eventtime; + status = mystatus; + } + } + +}