Add iterator in contructList to change list order (not yet tested)

This commit is contained in:
jacques 2022-06-23 11:03:42 +02:00
parent c659146d67
commit 80daeb0923

View file

@ -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<Prescription> 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);