- fixed bug #113 inconsistencies between pod and RL history...

This commit is contained in:
Andy Rozman 2020-03-25 09:39:56 +00:00
parent 33bdaa1768
commit ac9f684424
3 changed files with 16 additions and 1 deletions

View file

@ -125,4 +125,12 @@ public class RLHistoryItem {
} }
} }
public static class Comparator implements java.util.Comparator<RLHistoryItem> {
@Override
public int compare(RLHistoryItem o1, RLHistoryItem o2) {
return o2.dateTime.compareTo(o1.dateTime);
}
}
} }

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import android.os.Bundle; import android.os.Bundle;
@ -12,11 +14,14 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface; 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.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem; 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.common.utils.StringUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState; import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
/** /**
@ -83,6 +88,8 @@ public class RileyLinkStatusHistory extends Fragment implements RefreshableInter
public void addItemsAndClean(List<RLHistoryItem> items) { public void addItemsAndClean(List<RLHistoryItem> items) {
this.historyList.clear(); this.historyList.clear();
Collections.sort(items, new RLHistoryItem.Comparator());
for (RLHistoryItem item : items) { for (RLHistoryItem item : items) {
if (!historyList.contains(item) && isValidItem(item)) { if (!historyList.contains(item) && isValidItem(item)) {
@ -110,6 +117,7 @@ public class RileyLinkStatusHistory extends Fragment implements RefreshableInter
} }
@NotNull
@Override @Override
public RecyclerViewAdapter.HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { public RecyclerViewAdapter.HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.rileylink_status_history_item, // View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.rileylink_status_history_item, //

View file

@ -13,7 +13,6 @@ import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; 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.defs.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity; import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType; import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType;