- fixed problem with filtering in #69
This commit is contained in:
parent
3e12a7df5a
commit
e7e8cac81b
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
|
@ -73,29 +74,24 @@ public class PodHistoryActivity extends NoSplashActivity {
|
||||||
|
|
||||||
this.filteredHistoryList.clear();
|
this.filteredHistoryList.clear();
|
||||||
|
|
||||||
|
LOG.debug("Items on full list: {}", fullHistoryList.size());
|
||||||
|
|
||||||
//LOG.debug("Items on full list: {}", list.size());
|
if (group == PumpHistoryEntryGroup.All) {
|
||||||
|
|
||||||
this.filteredHistoryList.addAll(fullHistoryList);
|
this.filteredHistoryList.addAll(fullHistoryList);
|
||||||
|
} else {
|
||||||
// TODO grouping
|
for (PodHistory pumpHistoryEntry : fullHistoryList) {
|
||||||
|
if (pumpHistoryEntry.getPodDbEntryType().getGroup() == group) {
|
||||||
// if (group == PumpHistoryEntryGroup.All) {
|
this.filteredHistoryList.add(pumpHistoryEntry);
|
||||||
// this.filteredHistoryList.addAll(list);
|
}
|
||||||
// } else {
|
}
|
||||||
// for (PumpHistoryEntry pumpHistoryEntry : list) {
|
}
|
||||||
// if (pumpHistoryEntry.getEntryType().getGroup() == group) {
|
|
||||||
// this.filteredHistoryList.add(pumpHistoryEntry);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.recyclerViewAdapter != null) {
|
if (this.recyclerViewAdapter != null) {
|
||||||
this.recyclerViewAdapter.setHistoryList(this.filteredHistoryList);
|
this.recyclerViewAdapter.setHistoryList(this.filteredHistoryList);
|
||||||
this.recyclerViewAdapter.notifyDataSetChanged();
|
this.recyclerViewAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
//LOG.debug("Items on filtered list: {}", filteredHistoryList.size());
|
LOG.debug("Items on filtered list: {}", filteredHistoryList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,35 +7,36 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 24.11.2019
|
* Created by andy on 24.11.2019
|
||||||
*/
|
*/
|
||||||
public enum PodHistoryEntryType {
|
public enum PodHistoryEntryType {
|
||||||
|
|
||||||
PairAndPrime(1, R.string.omnipod_init_pod_wizard_step2_title),
|
PairAndPrime(1, R.string.omnipod_init_pod_wizard_step2_title, PumpHistoryEntryGroup.Prime),
|
||||||
FillCannulaSetBasalProfile(2, R.string.omnipod_init_pod_wizard_step4_title),
|
FillCannulaSetBasalProfile(2, R.string.omnipod_init_pod_wizard_step4_title, PumpHistoryEntryGroup.Prime),
|
||||||
DeactivatePod(3, R.string.omnipod_cmd_deactivate_pod),
|
DeactivatePod(3, R.string.omnipod_cmd_deactivate_pod, PumpHistoryEntryGroup.Prime),
|
||||||
ResetPodState(4, R.string.omnipod_cmd_reset_pod),
|
ResetPodState(4, R.string.omnipod_cmd_reset_pod, PumpHistoryEntryGroup.Prime),
|
||||||
|
|
||||||
SetTemporaryBasal(10, R.string.omnipod_cmd_set_tbr),
|
SetTemporaryBasal(10, R.string.omnipod_cmd_set_tbr, PumpHistoryEntryGroup.Basal),
|
||||||
CancelTemporaryBasal(11, R.string.omnipod_cmd_cancel_tbr),
|
CancelTemporaryBasal(11, R.string.omnipod_cmd_cancel_tbr, PumpHistoryEntryGroup.Basal),
|
||||||
CancelTemporaryBasalForce(12, R.string.omnipod_cmd_cancel_tbr_forced),
|
CancelTemporaryBasalForce(12, R.string.omnipod_cmd_cancel_tbr_forced, PumpHistoryEntryGroup.Basal),
|
||||||
|
|
||||||
SetBasalSchedule(20, R.string.omnipod_cmd_set_basal_schedule),
|
SetBasalSchedule(20, R.string.omnipod_cmd_set_basal_schedule, PumpHistoryEntryGroup.Basal),
|
||||||
|
|
||||||
GetPodStatus(30, R.string.omnipod_cmd_get_pod_status),
|
GetPodStatus(30, R.string.omnipod_cmd_get_pod_status, PumpHistoryEntryGroup.Configuration),
|
||||||
GetPodInfo(31, R.string.omnipod_cmd_get_pod_info),
|
GetPodInfo(31, R.string.omnipod_cmd_get_pod_info, PumpHistoryEntryGroup.Configuration),
|
||||||
SetTime(32, R.string.omnipod_cmd_set_time),
|
SetTime(32, R.string.omnipod_cmd_set_time, PumpHistoryEntryGroup.Configuration),
|
||||||
|
|
||||||
SetBolus(40, R.string.omnipod_cmd_set_bolus),
|
SetBolus(40, R.string.omnipod_cmd_set_bolus, PumpHistoryEntryGroup.Bolus),
|
||||||
CancelBolus(41, R.string.omnipod_cmd_cancel_bolus),
|
CancelBolus(41, R.string.omnipod_cmd_cancel_bolus, PumpHistoryEntryGroup.Bolus),
|
||||||
|
|
||||||
ConfigureAlerts(50, R.string.omnipod_cmd_configure_alerts),
|
ConfigureAlerts(50, R.string.omnipod_cmd_configure_alerts, PumpHistoryEntryGroup.Alarm),
|
||||||
AcknowledgeAlerts(51, R.string.omnipod_cmd_acknowledge_alerts),
|
AcknowledgeAlerts(51, R.string.omnipod_cmd_acknowledge_alerts, PumpHistoryEntryGroup.Alarm),
|
||||||
|
|
||||||
SuspendDelivery(60, R.string.omnipod_cmd_suspend_delivery),
|
SuspendDelivery(60, R.string.omnipod_cmd_suspend_delivery, PumpHistoryEntryGroup.Basal),
|
||||||
ResumeDelivery(61, R.string.omnipod_cmd_resume_delivery),
|
ResumeDelivery(61, R.string.omnipod_cmd_resume_delivery, PumpHistoryEntryGroup.Basal),
|
||||||
|
|
||||||
UnknownEntryType(99, R.string.omnipod_cmd_unknown_entry)
|
UnknownEntryType(99, R.string.omnipod_cmd_unknown_entry)
|
||||||
;
|
;
|
||||||
|
@ -46,6 +47,8 @@ public enum PodHistoryEntryType {
|
||||||
@StringRes
|
@StringRes
|
||||||
private int resourceId;
|
private int resourceId;
|
||||||
|
|
||||||
|
private PumpHistoryEntryGroup group;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
instanceMap = new HashMap<>();
|
instanceMap = new HashMap<>();
|
||||||
|
@ -61,10 +64,20 @@ public enum PodHistoryEntryType {
|
||||||
this.resourceId = resourceId;
|
this.resourceId = resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PodHistoryEntryType(int code, @StringRes int resourceId, PumpHistoryEntryGroup group) {
|
||||||
|
this.code = code;
|
||||||
|
this.resourceId = resourceId;
|
||||||
|
this.group = group;
|
||||||
|
}
|
||||||
|
|
||||||
public int getCode() {
|
public int getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PumpHistoryEntryGroup getGroup() {
|
||||||
|
return this.group;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static PodHistoryEntryType getByCode(int code) {
|
public static PodHistoryEntryType getByCode(int code) {
|
||||||
if (instanceMap.containsKey(code)) {
|
if (instanceMap.containsKey(code)) {
|
||||||
|
|
Loading…
Reference in a new issue