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;