Merge branch 'feature/saveDrugs' of ssh://git.exodus-privacy.eu.org:2225/foucry.net/PillDroid into feature/saveDrugs

This commit is contained in:
jacques 2020-04-25 14:32:49 +02:00
commit 1998c587ad
3 changed files with 10 additions and 5 deletions

View file

@ -32,6 +32,7 @@ public class MedicamentDetailFragment extends Fragment {
* The dummy content this fragment is presenting.
*/
private Medicament medicament;
private DBHelper dbHelper = new DBHelper();
/**
* Mandatory empty constructor for the fragment manager to instantiate the
@ -123,6 +124,7 @@ public class MedicamentDetailFragment extends Fragment {
{
Context context = getContext();
View currentView = getView();
// View nameView;
// View adminModeView;
// View presentationView;
@ -153,8 +155,9 @@ public class MedicamentDetailFragment extends Fragment {
Log.d(TAG, "AlertValue == "+ alertValue);
Log.d(TAG, "WarningValue == "+ warningValue);
Log.d(TAG, "medicamentID == "+ medicament.getId());
Log.d(TAG, "medicament == "+ medicament);
Log.d(TAG, "medicament == "+ medicament.toString());
dbHelper.updateDrug(medicament);
super.onStop();
}
}

View file

@ -62,8 +62,8 @@ public class MedicamentListActivity extends AppCompatActivity {
// TODO: Change DEMO/DBDEMO form statci to non-static. In order to create fake data at only at launchtime
private boolean mTwoPane;
final static Boolean DEMO = true;
final static Boolean DBDEMO = true;
final Boolean DEMO = false;
final Boolean DBDEMO = false;
final static Random random = new Random();
@Override
@ -232,12 +232,14 @@ public class MedicamentListActivity extends AppCompatActivity {
public void newStockCalculation() {
Medicament currentMedicament;
DBHelper dbHelper = new DBHelper();
for (int position = 0 ; position < this. getCount() ; position++ ) {
currentMedicament = this.getItem(position);
currentMedicament.newStock(currentMedicament.getStock());
dbHelper.updateDrug(currentMedicament);
}
// TODO: Must record new stock in DB
// TODO: si un des médicaments est en rouge, on déclanche une notification visuelle pour dans 5 secondes
Calendar calendar = Calendar.getInstance();