mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Add drug comparaison between the original drug and the saved one.
This commit is contained in:
parent
592079bd01
commit
b6d0322acd
1 changed files with 10 additions and 4 deletions
|
@ -28,6 +28,8 @@ public class DrugDetailActivity extends AppCompatActivity {
|
||||||
private static final String TAG = DrugDetailActivity.class.getName();
|
private static final String TAG = DrugDetailActivity.class.getName();
|
||||||
|
|
||||||
Drug drug;
|
Drug drug;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -109,8 +111,7 @@ public class DrugDetailActivity extends AppCompatActivity {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getMDrugChanges()
|
private void getMDrugChanges() {
|
||||||
{
|
|
||||||
Log.d(TAG, "Time to save new values");
|
Log.d(TAG, "Time to save new values");
|
||||||
|
|
||||||
DBHelper dbHelper = new DBHelper(this);
|
DBHelper dbHelper = new DBHelper(this);
|
||||||
|
@ -142,9 +143,14 @@ public class DrugDetailActivity extends AppCompatActivity {
|
||||||
newDrug.setTake(Double.parseDouble(takeValue));
|
newDrug.setTake(Double.parseDouble(takeValue));
|
||||||
newDrug.setWarnThreshold(Integer.parseInt(warningValue));
|
newDrug.setWarnThreshold(Integer.parseInt(warningValue));
|
||||||
newDrug.setAlertThreshold(Integer.parseInt(alertValue));
|
newDrug.setAlertThreshold(Integer.parseInt(alertValue));
|
||||||
newDrug.setDateLastUpdate(new Date().getTime());
|
|
||||||
newDrug.setDateEndOfStock();
|
newDrug.setDateEndOfStock();
|
||||||
|
|
||||||
dbHelper.updateDrug(newDrug);
|
if (drug.equals(newDrug)) {
|
||||||
|
Log.d(TAG, "drug and newDrug are Equals");
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "drug and newDrug are NOT Equals");
|
||||||
|
newDrug.setDateLastUpdate(new Date().getTime());
|
||||||
|
dbHelper.updateDrug(newDrug);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue