diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java index a6cd73c..159ae73 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java @@ -53,6 +53,7 @@ import net.foucry.pilldroid.models.Prescription; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.ListIterator; import java.util.Locale; /** @@ -283,6 +284,18 @@ public class DrugListActivity extends AppCompatActivity { PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO(); prescriptionList = prescriptionsDAO.getAllMedics(); + ListIterator listIterator = prescriptionList.listIterator(); + Prescription currentPrescription; + + while (listIterator.hasNext()) { + currentPrescription = listIterator.next(); + + if (currentPrescription.getTake() == 0) { + prescriptionList.remove(currentPrescription); + prescriptionList.add(prescriptionList.size(), currentPrescription); + } + } + View mRecyclerView = findViewById(R.id.drug_list); assert mRecyclerView != null; setupRecyclerView((RecyclerView) mRecyclerView);