mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
refactoring and use Utils.sortPrescriptionList
This commit is contained in:
parent
5110e6b9b8
commit
8a218e7467
1 changed files with 1 additions and 10 deletions
|
@ -51,7 +51,6 @@ import net.foucry.pilldroid.models.Medicine;
|
|||
import net.foucry.pilldroid.models.Prescription;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -286,15 +285,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
Prescription currentPrescription;
|
||||
|
||||
// Sorting list by dateEndOfStock
|
||||
prescriptionList.sort(new Comparator<>() {
|
||||
@Override
|
||||
public int compare(Prescription lhs, Prescription rhs) {
|
||||
if (lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock()) != 0)
|
||||
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
|
||||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
}
|
||||
});
|
||||
Utils.sortPrescriptionList(prescriptionList);
|
||||
|
||||
// Move Prescription with take==0 to the end of the list
|
||||
for (int i=0 ; i < prescriptionList.size(); i++ ){
|
||||
|
|
Loading…
Reference in a new issue