mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
logical start (not tested)
This commit is contained in:
parent
3fc7ef41c2
commit
458fd8ab17
3 changed files with 7 additions and 10 deletions
|
@ -35,6 +35,7 @@ public class MedicamentDetailActivity extends AppCompatActivity {
|
|||
|
||||
/* fetching the string passed with intent using ‘extras’*/
|
||||
|
||||
assert extras != null;
|
||||
medicament = (Medicament) extras.getSerializable("medicament");
|
||||
|
||||
assert medicament != null;
|
||||
|
@ -150,6 +151,5 @@ public class MedicamentDetailActivity extends AppCompatActivity {
|
|||
medicament.setDateEndOfStock();
|
||||
|
||||
dbHelper.updateDrug(medicament);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public class MedicamentDetailFragment extends Fragment {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
assert getArguments() != null;
|
||||
if (getArguments().containsKey(ARG_ITEM_ID)) {
|
||||
// Load the dummy content specified by the fragment
|
||||
// arguments. In a real-world scenario, use a Loader
|
||||
|
|
|
@ -66,7 +66,6 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
final Boolean DBDEMO = false;
|
||||
final static Random random = new Random();
|
||||
public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;
|
||||
public final int SAVE_REQUEST_CODE = 0x000000ff;
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
@ -277,11 +276,9 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
switch (requestCode) {
|
||||
case CUSTOMIZED_REQUEST_CODE: {
|
||||
Toast.makeText(this, "REQUEST_CODE = " + requestCode +"RESULT_CODE = " + resultCode, Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
case SAVE_REQUEST_CODE: {
|
||||
Toast.makeText(this, "REQUEST_CODE = " + requestCode +"RESULT_CODE = " + resultCode, Toast.LENGTH_LONG).show();
|
||||
updateDrug();
|
||||
if (resultCode == 1) {
|
||||
constructMedsList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
@ -428,7 +425,7 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
holder.mContentView.setText(mValues.get(position).getNom());
|
||||
holder.mEndOfStock.setText(dateEndOfStock);
|
||||
|
||||
// Test to change background programmaticaly
|
||||
// Test to change background programmatically
|
||||
if (mValues.get(position).getPrise() == 0) {
|
||||
holder.mView.setBackgroundResource(R.drawable.gradient_bg);
|
||||
} else {
|
||||
|
@ -462,8 +459,7 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
Context context = v.getContext();
|
||||
Intent intent = new Intent(context, MedicamentDetailActivity.class);
|
||||
intent.putExtra("medicament", medicamentCourant);
|
||||
int requestCode = SAVE_REQUEST_CODE;
|
||||
startActivityForResult(intent, requestCode);
|
||||
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue