mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Add BuildConfig.DEBUG if statement on debug toast
This commit is contained in:
parent
f364890d02
commit
49352fadd1
1 changed files with 14 additions and 32 deletions
|
@ -237,26 +237,31 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (requestCode == CUSTOMIZED_REQUEST_CODE) {
|
if (requestCode == CUSTOMIZED_REQUEST_CODE) {
|
||||||
Toast.makeText(this, "REQUEST_CODE = " + requestCode + "RESULT_CODE = " + resultCode, Toast.LENGTH_LONG).show();
|
if (BuildConfig.DEBUG) { Toast.makeText(this, "REQUEST_CODE = " + requestCode +
|
||||||
|
"RESULT_CODE = " + resultCode, Toast.LENGTH_LONG).show(); }
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
||||||
constructDrugsList();
|
constructDrugsList();
|
||||||
} else {
|
} else {
|
||||||
IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);
|
IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);
|
||||||
|
|
||||||
Toast.makeText(this, "REQUEST_CODE = " + requestCode, Toast.LENGTH_LONG).show();
|
if (BuildConfig.DEBUG) { Toast.makeText(this, "REQUEST_CODE = " + requestCode,
|
||||||
|
Toast.LENGTH_LONG).show(); }
|
||||||
|
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + "resultCode = " + resultCode);
|
Log.d(TAG, "REQUEST_CODE = " + requestCode + "resultCode = " + resultCode);
|
||||||
if (result.getContents() == null) {
|
if (result.getContents() == null) {
|
||||||
Intent originalIntent = result.getOriginalIntent();
|
Intent originalIntent = result.getOriginalIntent();
|
||||||
if (originalIntent == null) {
|
if (originalIntent == null) {
|
||||||
if (resultCode == 3) {
|
if (resultCode == 3) {
|
||||||
Toast.makeText(this, "Keyboard input", Toast.LENGTH_SHORT).show();
|
if(BuildConfig.DEBUG) { Toast.makeText(this, "Keyboard input",
|
||||||
|
Toast.LENGTH_SHORT).show(); }
|
||||||
Log.d(TAG, "Keyboard Input");
|
Log.d(TAG, "Keyboard Input");
|
||||||
showInputDialog();
|
showInputDialog();
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Cancelled scan");
|
Log.d(TAG, "Cancelled scan");
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
||||||
}
|
}
|
||||||
Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
|
if(BuildConfig.DEBUG) { Toast.makeText(this, "Cancelled",
|
||||||
|
Toast.LENGTH_LONG).show(); }
|
||||||
} else if (originalIntent.hasExtra(Intents.Scan.MISSING_CAMERA_PERMISSION)) {
|
} else if (originalIntent.hasExtra(Intents.Scan.MISSING_CAMERA_PERMISSION)) {
|
||||||
Log.d(TAG, "Cancelled scan due to missing camera permission");
|
Log.d(TAG, "Cancelled scan due to missing camera permission");
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
||||||
|
@ -268,7 +273,8 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
Log.d(TAG, "result.getContents = " + result.getContents());
|
Log.d(TAG, "result.getContents = " + result.getContents());
|
||||||
Log.d(TAG, "format = " + result.getFormatName());
|
Log.d(TAG, "format = " + result.getFormatName());
|
||||||
|
|
||||||
Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
|
if (BuildConfig.DEBUG) { Toast.makeText(this, "Scanned: " +
|
||||||
|
result.getContents(), Toast.LENGTH_LONG).show(); }
|
||||||
|
|
||||||
String cip13;
|
String cip13;
|
||||||
|
|
||||||
|
@ -377,33 +383,11 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
Context context = this;
|
Context context = this;
|
||||||
Intent intent = new Intent(context, DrugDetailActivity.class);
|
Intent intent = new Intent(context, DrugDetailActivity.class);
|
||||||
intent.putExtra("drug", aDrug);
|
intent.putExtra("drug", aDrug);
|
||||||
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); // todo deprecated
|
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
||||||
//openActivityForResult(intent);
|
|
||||||
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void openActivityForResult(Intent intent) {
|
/**
|
||||||
// Intent intent = new Intent(this,DrugDetailActivity.class);
|
|
||||||
DrugDetailActivityLaucher.launch(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityResultLauncher<Intent> DrugDetailActivityLaucher = registerForActivityResult(
|
|
||||||
new ActivityResultContracts.StartActivityForResult(),
|
|
||||||
new ActivityResultCallback<ActivityResult>() {
|
|
||||||
@Override
|
|
||||||
public void onActivityResult(ActivityResult result) {
|
|
||||||
if (result.getResultCode() == Activity.RESULT_OK) {
|
|
||||||
// Here, no request code
|
|
||||||
try {
|
|
||||||
result.getData();
|
|
||||||
Intent data = result.getData();
|
|
||||||
Log.d(TAG, "Result data = " +data.getDataString());
|
|
||||||
}
|
|
||||||
catch (Exception ignored){};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
/**
|
|
||||||
* setupRecyclerView (list of drugs
|
* setupRecyclerView (list of drugs
|
||||||
* @param recyclerView RecyclerView
|
* @param recyclerView RecyclerView
|
||||||
*/
|
*/
|
||||||
|
@ -467,7 +451,6 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
Log.d(TAG, "alert == " + mValues.get(position).getAlertThreshold());
|
Log.d(TAG, "alert == " + mValues.get(position).getAlertThreshold());
|
||||||
|
|
||||||
holder.mItem = mValues.get(position);
|
holder.mItem = mValues.get(position);
|
||||||
// holder.mIDView.setText(mValues.get(position).getCip13());
|
|
||||||
holder.mContentView.setText(mValues.get(position).getName());
|
holder.mContentView.setText(mValues.get(position).getName());
|
||||||
holder.mEndOfStock.setText(dateEndOfStock);
|
holder.mEndOfStock.setText(dateEndOfStock);
|
||||||
|
|
||||||
|
@ -498,8 +481,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
Context context = v.getContext();
|
Context context = v.getContext();
|
||||||
Intent intent = new Intent(context, DrugDetailActivity.class);
|
Intent intent = new Intent(context, DrugDetailActivity.class);
|
||||||
intent.putExtra("drug", drugCourant);
|
intent.putExtra("drug", drugCourant);
|
||||||
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); // todo: deprecated
|
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
||||||
//openActivityForResult(intent);
|
|
||||||
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue