Merge branch 'bugfix/list_order' into develop

This commit is contained in:
jacques 2021-07-04 22:28:16 +02:00
commit 56d3796e54
4 changed files with 19 additions and 14 deletions

View file

@ -142,7 +142,7 @@ class DBDrugs extends SQLiteOpenHelper {
drug.setCis(cursor.getString(0));
drug.setCip13(cursor.getString(1));
drug.setAdministration_mode(cursor.getString(2));
drug.setNama(cursor.getString(3));
drug.setName(cursor.getString(3));
drug.setPresentation(cursor.getString(4));
// Set default values

View file

@ -151,7 +151,7 @@ class DBHelper extends SQLiteOpenHelper {
drug.setId(Integer.parseInt(cursor.getString(0)));
drug.setCis(cursor.getString(1));
drug.setCip13(cursor.getString(2));
drug.setNama(cursor.getString(3));
drug.setName(cursor.getString(3));
drug.setAdministration_mode(cursor.getString(4));
drug.setPresentation(cursor.getString(5));
drug.setStock(Double.parseDouble(cursor.getString(6)));
@ -199,7 +199,7 @@ class DBHelper extends SQLiteOpenHelper {
drug.setId(Integer.parseInt(cursor.getString(0)));
drug.setCis(cursor.getString(1));
drug.setCip13(cursor.getString(2));
drug.setNama(cursor.getString(3));
drug.setName(cursor.getString(3));
drug.setAdministration_mode(cursor.getString(4));
drug.setPresentation(cursor.getString(5));
drug.setStock(Double.parseDouble(cursor.getString(6)));
@ -241,7 +241,7 @@ class DBHelper extends SQLiteOpenHelper {
drug.setId(Integer.parseInt(cursor.getString(0)));
drug.setCis(cursor.getString(1));
drug.setCip13(cursor.getString(2));
drug.setNama(cursor.getString(3));
drug.setName(cursor.getString(3));
drug.setAdministration_mode(cursor.getString(4));
drug.setPresentation(cursor.getString(5));
drug.setStock(Double.parseDouble(cursor.getString(6)));
@ -291,13 +291,18 @@ class DBHelper extends SQLiteOpenHelper {
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++ ) {
// todo: If some drug moved, must redo all the loop
int position = 0 ;
for ( int nbOps = 0; nbOps < getCount() ; nbOps ++ ) {
currentDrug = getItem(position);
double currentTake = currentDrug.getTake();
if (currentTake == 0)
{
drug = drugs.remove(position);
drugs.add(drugs.size(), drug);
drugs.add(drug);
} else
{
position++;
}
}
return drugs;

View file

@ -17,7 +17,7 @@ public class Drug implements Serializable {
private static final String TAG = Drug.class.getName();
/* part read form database */
private int id;
private String nama;
private String name;
private String cip13;
private String cis;
private String administration_mode;
@ -34,13 +34,13 @@ public class Drug implements Serializable {
Drug() {
}
Drug(final String cis, final String cip13, final String nama, final String administration_mode, final String presentation,
Drug(final String cis, final String cip13, final String name, final String administration_mode, final String presentation,
double stock, double take, int warn, int alert, long dateLastUpdate) {
super();
this.cis = cis;
this.cip13 = cip13;
this.nama = nama;
this.name = name;
this.administration_mode = administration_mode;
this.presentation = presentation;
this.stock = stock;
@ -56,7 +56,7 @@ public class Drug implements Serializable {
}
String getName() {
return nama;
return name;
}
String getCip13() {
@ -103,8 +103,8 @@ public class Drug implements Serializable {
this.id = id;
}
void setNama(String nama) {
this.nama = nama;
void setName(String name) {
this.name = name;
}
void setCip13(String cip13) {

View file

@ -376,7 +376,7 @@ public class DrugListActivity extends AppCompatActivity {
Context context = this;
Intent intent = new Intent(context, DrugDetailActivity.class);
intent.putExtra("drug", aDrug);
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); // todo deprecated
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
}
@ -473,7 +473,7 @@ public class DrugListActivity extends AppCompatActivity {
Context context = v.getContext();
Intent intent = new Intent(context, DrugDetailActivity.class);
intent.putExtra("drug", drugCourant);
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); // todo: deprecated
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
}
});