mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-09 23:41:08 +01:00
Remove grab new values from onStop method
This commit is contained in:
parent
1b99aee35b
commit
97e6cbf409
2 changed files with 2 additions and 43 deletions
|
@ -121,47 +121,6 @@ public class MedicamentDetailFragment extends Fragment {
|
|||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
Context context = getContext();
|
||||
dbHelper = new DBHelper(context);
|
||||
View currentView = getView();
|
||||
|
||||
View stockView;
|
||||
View priseView;
|
||||
View warningView;
|
||||
View alertView;
|
||||
|
||||
assert currentView != null;
|
||||
stockView = currentView.findViewById(R.id.stock_cell);
|
||||
TextView stockTextView = stockView.findViewById(R.id.valeur);
|
||||
String stockValue = stockTextView.getText().toString();
|
||||
|
||||
priseView = currentView.findViewById(R.id.prise_cell);
|
||||
TextView priseTextView = priseView.findViewById(R.id.valeur);
|
||||
String priseValue = priseTextView.getText().toString();
|
||||
|
||||
alertView = currentView.findViewById(R.id.alert_cell);
|
||||
TextView alertTextView = alertView.findViewById(R.id.valeur);
|
||||
String alertValue = alertTextView.getText().toString();
|
||||
|
||||
warningView = currentView.findViewById(R.id.warning_cell);
|
||||
TextView warningTextView = warningView.findViewById(R.id.valeur);
|
||||
String warningValue = warningTextView.getText().toString();
|
||||
|
||||
Log.d(TAG, "StockValue == "+ stockValue);
|
||||
Log.d(TAG, "PriseValue == "+ priseValue);
|
||||
Log.d(TAG, "AlertValue == "+ alertValue);
|
||||
Log.d(TAG, "WarningValue == "+ warningValue);
|
||||
Log.d(TAG, "medicamentID == "+ medicament.getId());
|
||||
Log.d(TAG, "medicament == "+ medicament.toString());
|
||||
|
||||
medicament.setStock(Double.parseDouble(stockValue));
|
||||
medicament.setPrise(Double.parseDouble(priseValue));
|
||||
medicament.setWarnThreshold(Integer.parseInt(warningValue));
|
||||
medicament.setAlertThreshold(Integer.parseInt(alertValue));
|
||||
medicament.setDateLastUpdate();
|
||||
medicament.setDateEndOfStock();
|
||||
|
||||
dbHelper.updateDrug(medicament);
|
||||
super.onStop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
|
||||
if (dateAlert.getTime() < now.getTime())
|
||||
{
|
||||
dateSchedule = now.getTime() + 50000; // If dateAlert < now we schedule an alert for now + 5 seconds (3600000 pour 1 heure)
|
||||
dateSchedule = now.getTime() + 50000; // If dateAlert < now we schedule an alert for now + 5 seconds (3600000 pour 1 heure)[in prod define delay]
|
||||
} else {
|
||||
dateSchedule = dateAlert.getTime(); // If dateAlert > now we use dateAlert as scheduleDate
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
// Handle cancel
|
||||
Toast.makeText(context, "Scan annulé", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else if (requestCode == 1 ){
|
||||
else {
|
||||
Toast.makeText(context, "back from detail", Toast.LENGTH_SHORT).show();
|
||||
// TODO : Si requestCode=1 -> Sauvegarde du medoc dans la base et
|
||||
// TODO : raffraichissement de la base.[Call updateDrug(medicament)]
|
||||
|
|
Loading…
Reference in a new issue