mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-09 23:41:08 +01:00
Add iterator in contructList to change list order (not yet tested)
This commit is contained in:
parent
c659146d67
commit
80daeb0923
1 changed files with 13 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue