mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Cosmetic change in the code
This commit is contained in:
parent
be9fc0a358
commit
ed6052ba1b
1 changed files with 35 additions and 26 deletions
|
@ -272,12 +272,23 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Log.d(TAG, "Before sort == " + drugs.toString());
|
||||
|
||||
/*drugs.sort(Comparator.comparing(Drug::getDateEndOfStock)
|
||||
.thenComparing(Drug::getStock));*/
|
||||
|
||||
drugs.sort(new Comparator<Drug>() {
|
||||
@Override
|
||||
public int compare(Drug lhs, Drug rhs) {
|
||||
if (lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock()) != 0)
|
||||
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
|
||||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
}
|
||||
});
|
||||
Log.d(TAG, "After sort " + drugs.toString());
|
||||
|
||||
// Move drug with prise = 0 at the end of the list
|
||||
for (int position = 0 ; position < getCount() ; position++ ) {
|
||||
|
@ -289,9 +300,6 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
drugs.add(drugs.size(), drug);
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "getAllDrugs " + drugs.toString());
|
||||
|
||||
return drugs;
|
||||
}
|
||||
|
||||
|
@ -301,7 +309,7 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
*/
|
||||
public void updateDrug(Drug drug) {
|
||||
|
||||
Log.d(TAG, "Update Drug == " + drug);
|
||||
Log.d(TAG, "Update Drug == " + drug.toString());
|
||||
|
||||
// Get reference to writable DB
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
@ -329,6 +337,7 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
// Close DB
|
||||
db.close();
|
||||
Log.d(TAG, "values == " + values.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue