mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-18 02:51:38 +01:00
Merge branch 'feature/saveDrugs' of ssh://git.exodus-privacy.eu.org:2225/foucry.net/PillDroid into feature/saveDrugs
This commit is contained in:
commit
1998c587ad
3 changed files with 10 additions and 5 deletions
|
@ -277,7 +277,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
// Update row
|
// Update row
|
||||||
int i = db.update(TABLE_DRUG, // table
|
int i = db.update(TABLE_DRUG, // table
|
||||||
values, // column/value
|
values, // column/value
|
||||||
KEY_ID+" = ?", // selections
|
KEY_ID+" = ?", // selections
|
||||||
new String[] {String.valueOf(medicament.getId()) } ); // selections args
|
new String[] {String.valueOf(medicament.getId()) } ); // selections args
|
||||||
|
|
||||||
// Close DB
|
// Close DB
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class MedicamentDetailFragment extends Fragment {
|
||||||
* The dummy content this fragment is presenting.
|
* The dummy content this fragment is presenting.
|
||||||
*/
|
*/
|
||||||
private Medicament medicament;
|
private Medicament medicament;
|
||||||
|
private DBHelper dbHelper = new DBHelper();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||||
|
@ -123,6 +124,7 @@ public class MedicamentDetailFragment extends Fragment {
|
||||||
{
|
{
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
View currentView = getView();
|
View currentView = getView();
|
||||||
|
|
||||||
// View nameView;
|
// View nameView;
|
||||||
// View adminModeView;
|
// View adminModeView;
|
||||||
// View presentationView;
|
// View presentationView;
|
||||||
|
@ -153,8 +155,9 @@ public class MedicamentDetailFragment extends Fragment {
|
||||||
Log.d(TAG, "AlertValue == "+ alertValue);
|
Log.d(TAG, "AlertValue == "+ alertValue);
|
||||||
Log.d(TAG, "WarningValue == "+ warningValue);
|
Log.d(TAG, "WarningValue == "+ warningValue);
|
||||||
Log.d(TAG, "medicamentID == "+ medicament.getId());
|
Log.d(TAG, "medicamentID == "+ medicament.getId());
|
||||||
Log.d(TAG, "medicament == "+ medicament);
|
Log.d(TAG, "medicament == "+ medicament.toString());
|
||||||
|
|
||||||
|
dbHelper.updateDrug(medicament);
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// TODO: Change DEMO/DBDEMO form statci to non-static. In order to create fake data at only at launchtime
|
||||||
private boolean mTwoPane;
|
private boolean mTwoPane;
|
||||||
final static Boolean DEMO = true;
|
final Boolean DEMO = false;
|
||||||
final static Boolean DBDEMO = true;
|
final Boolean DBDEMO = false;
|
||||||
final static Random random = new Random();
|
final static Random random = new Random();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -232,12 +232,14 @@ public class MedicamentListActivity extends AppCompatActivity {
|
||||||
public void newStockCalculation() {
|
public void newStockCalculation() {
|
||||||
|
|
||||||
Medicament currentMedicament;
|
Medicament currentMedicament;
|
||||||
|
DBHelper dbHelper = new DBHelper();
|
||||||
|
|
||||||
for (int position = 0 ; position < this. getCount() ; position++ ) {
|
for (int position = 0 ; position < this. getCount() ; position++ ) {
|
||||||
currentMedicament = this.getItem(position);
|
currentMedicament = this.getItem(position);
|
||||||
currentMedicament.newStock(currentMedicament.getStock());
|
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
|
// TODO: si un des médicaments est en rouge, on déclanche une notification visuelle pour dans 5 secondes
|
||||||
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
|
Loading…
Reference in a new issue