mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Call Utils.sortPrescriptionList
This commit is contained in:
parent
156ff07fc5
commit
589dc41709
2 changed files with 6 additions and 5 deletions
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
public class AlarmReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = AlarmManager.class.getName();
|
||||
|
||||
NotificationManager notificationManager;
|
||||
|
||||
@Override
|
||||
|
@ -48,6 +47,8 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
PrescriptionDatabase prescriptions = PrescriptionDatabase.getInstanceDatabase(context.getApplicationContext());
|
||||
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
||||
List<Prescription> prescriptionList = prescriptionsDAO.getAllMedics();
|
||||
|
||||
prescriptionList = Utils.sortPrescriptionList(prescriptionList);
|
||||
Prescription firstPrescription = null ;
|
||||
|
||||
try {
|
||||
|
@ -88,7 +89,6 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createNotificationChannel(Context context) {
|
||||
|
|
|
@ -286,7 +286,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
Prescription currentPrescription;
|
||||
|
||||
// Sorting list by dateEndOfStock
|
||||
prescriptionList.sort(new Comparator<>() {
|
||||
/*prescriptionList.sort(new Comparator<>() {
|
||||
@Override
|
||||
public int compare(Prescription lhs, Prescription rhs) {
|
||||
if (lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock()) != 0)
|
||||
|
@ -294,11 +294,12 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
}
|
||||
});
|
||||
});*/
|
||||
prescriptionList = Utils.sortPrescriptionList(prescriptionList);
|
||||
|
||||
// Move Prescription with take==0 to the end of the list
|
||||
for (int i=0 ; i < prescriptionList.size(); i++ ){
|
||||
currentPrescription = prescriptionList.get(i);
|
||||
currentPrescription = (Prescription) prescriptionList.get(i);
|
||||
if (currentPrescription.getTake() == 0) {
|
||||
prescriptionList.remove(currentPrescription);
|
||||
prescriptionList.add(prescriptionList.size(), currentPrescription);
|
||||
|
|
Loading…
Reference in a new issue