From ac9f684424bea55d7d09df6378ce77e2edf99f9e Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Wed, 25 Mar 2020 09:39:56 +0000 Subject: [PATCH] - fixed bug #113 inconsistencies between pod and RL history... --- .../pump/common/hw/rileylink/data/RLHistoryItem.java | 8 ++++++++ .../hw/rileylink/dialog/RileyLinkStatusHistory.java | 8 ++++++++ .../dialogs/wizard/pages/InitPodRefreshAction.java | 1 - 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java index 80cad6fa9a..ad860cd670 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java @@ -125,4 +125,12 @@ public class RLHistoryItem { } } + public static class Comparator implements java.util.Comparator { + + @Override + public int compare(RLHistoryItem o1, RLHistoryItem o2) { + return o2.dateTime.compareTo(o1.dateTime); + } + } + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistory.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistory.java index d6af799550..afdcafa99e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistory.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistory.java @@ -1,6 +1,8 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import android.os.Bundle; @@ -12,11 +14,14 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import org.jetbrains.annotations.NotNull; + import info.nightscout.androidaps.R; import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem; import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil; +import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry; import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState; /** @@ -83,6 +88,8 @@ public class RileyLinkStatusHistory extends Fragment implements RefreshableInter public void addItemsAndClean(List items) { this.historyList.clear(); + Collections.sort(items, new RLHistoryItem.Comparator()); + for (RLHistoryItem item : items) { if (!historyList.contains(item) && isValidItem(item)) { @@ -110,6 +117,7 @@ public class RileyLinkStatusHistory extends Fragment implements RefreshableInter } + @NotNull @Override public RecyclerViewAdapter.HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.rileylink_status_history_item, // diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java index ab4e8d030a..8ea3d1faf2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java @@ -13,7 +13,6 @@ import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; -import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil; import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress; import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity; import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType;