From f800d695fff99c57ffe256e3ba7c0a98813f8367 Mon Sep 17 00:00:00 2001 From: Roumen Georgiev Date: Tue, 3 Apr 2018 09:15:28 +0300 Subject: [PATCH] SAGE, CAGE ... change color if old - second try requested in #811 --- .../nightscout/androidaps/db/CareportalEvent.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java b/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java index e2e4e6d639..9cd013a1c4 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java +++ b/app/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java @@ -98,6 +98,20 @@ public class CareportalEvent implements DataPointWithLabelInterface { return diff.get(TimeUnit.DAYS) + " " + MainApp.sResources.getString(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.sResources.getString(R.string.hours); } + public String age(int threshold) { + Map diff = computeDiff(date, System.currentTimeMillis()); + if (OverviewFragment.shorttextmode) + if(diff.get(TimeUnit.DAYS) > threshold) + return "isOLD"+diff.get(TimeUnit.DAYS) +"d" + diff.get(TimeUnit.HOURS) + "h"; + else + return diff.get(TimeUnit.DAYS) +"d" + diff.get(TimeUnit.HOURS) + "h"; + else + if(diff.get(TimeUnit.DAYS) > threshold) + return "isOLD"+diff.get(TimeUnit.DAYS) + " " + MainApp.sResources.getString(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.sResources.getString(R.string.hours); + else + return diff.get(TimeUnit.DAYS) + " " + MainApp.sResources.getString(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.sResources.getString(R.string.hours); + } + public String log() { return "CareportalEvent{" + "date= " + date + @@ -259,4 +273,5 @@ public class CareportalEvent implements DataPointWithLabelInterface { public int getSecondColor() { return 0; } + }