Change resource name

This commit is contained in:
jacques 2022-03-13 12:49:06 +01:00
parent da79ff480e
commit 24ec947239
4 changed files with 5 additions and 29 deletions

View file

@ -38,7 +38,7 @@ public class CustomScannerActivity extends Activity implements DecoratedBarcodeV
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_scanner); setContentView(R.layout.CustomScannerActivty);
//barcodeScannerView.setTorchListener(this); //barcodeScannerView.setTorchListener(this);

View file

@ -41,7 +41,7 @@ public class DrugDetailActivity extends AppCompatActivity {
aMedic = (Medic) bundle.get("medic"); aMedic = (Medic) bundle.get("medic");
Log.d(TAG, "aMedic == " + aMedic); Log.d(TAG, "aMedic == " + aMedic);
setContentView(R.layout.activity_drug_detail); setContentView(R.layout.DrugDetailActivity);
Toolbar toolbar = findViewById(detail_toolbar); Toolbar toolbar = findViewById(detail_toolbar);
if (toolbar != null) { if (toolbar != null) {

View file

@ -3,7 +3,6 @@ package net.foucry.pilldroid;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle;
import androidx.activity.result.contract.ActivityResultContract; import androidx.activity.result.contract.ActivityResultContract;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;

View file

@ -55,7 +55,6 @@ import java.util.Locale;
public class DrugListActivity extends AppCompatActivity { public class DrugListActivity extends AppCompatActivity {
// Used for dev and debug // Used for dev and debug
final Boolean DEMO = true; final Boolean DEMO = true;
final Boolean DBDEMO = false;
public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff; public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;
public final String BARCODE_FORMAT_NAME = "Barcode Format name"; public final String BARCODE_FORMAT_NAME = "Barcode Format name";
@ -64,7 +63,6 @@ public class DrugListActivity extends AppCompatActivity {
private ActivityResultLauncher<ScanOptions> mBarcodeScannerLauncher; private ActivityResultLauncher<ScanOptions> mBarcodeScannerLauncher;
private static final String TAG = DrugListActivity.class.getName(); private static final String TAG = DrugListActivity.class.getName();
private DBDrugs dbDrug;
public PilldroidDatabase prescriptions; public PilldroidDatabase prescriptions;
public PilldroidDatabase medications; public PilldroidDatabase medications;
@ -110,10 +108,7 @@ public class DrugListActivity extends AppCompatActivity {
.build(); .build();
// Set view content // Set view content
setContentView(R.layout.activity_drug_list); setContentView(R.layout.DrugListActivity);
DBHelper dbHelper = new DBHelper(this);
dbDrug = new DBDrugs(this);
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
@ -122,11 +117,6 @@ public class DrugListActivity extends AppCompatActivity {
toolbar.setTitle(getTitle()); toolbar.setTitle(getTitle());
} }
// Added to drop database each the app is launch.
if (DBDEMO) {
dbHelper.dropDrug();
}
if (DEMO) { if (DEMO) {
MedicDAO medicDAO = prescriptions.getMedicDAO(); MedicDAO medicDAO = prescriptions.getMedicDAO();
@ -190,7 +180,6 @@ public class DrugListActivity extends AppCompatActivity {
String cip13; String cip13;
// Handle successful scan // Handle successful scan
Log.d(TAG, "formatName = " + bundle.getString(BARCODE_FORMAT_NAME)); Log.d(TAG, "formatName = " + bundle.getString(BARCODE_FORMAT_NAME));
switch (bundle.getString(BARCODE_FORMAT_NAME)) { switch (bundle.getString(BARCODE_FORMAT_NAME)) {
@ -198,9 +187,6 @@ public class DrugListActivity extends AppCompatActivity {
case "EAN_13": //CODE_128 || EAN 13 case "EAN_13": //CODE_128 || EAN 13
cip13 = bundle.getString(BARCODE_CONTENT); cip13 = bundle.getString(BARCODE_CONTENT);
break; break;
case "CODE_39":
cip13 = dbDrug.getCIP13FromCIP7(bundle.getString(BARCODE_CONTENT));
break;
case "DATA_MATRIX": case "DATA_MATRIX":
cip13 = bundle.getString(BARCODE_CONTENT).substring(4, 17); cip13 = bundle.getString(BARCODE_CONTENT).substring(4, 17);
break; break;
@ -210,7 +196,6 @@ public class DrugListActivity extends AppCompatActivity {
} }
// Get Drug from database // Get Drug from database
//final Drug scannedDrug = dbDrug.getDrugByCIP13(cip13);
MedicDAO medicationDAO = medications.getMedicDAO(); MedicDAO medicationDAO = medications.getMedicDAO();
final Medic scannedMedication = medicationDAO.getMedicByCIP13(cip13); final Medic scannedMedication = medicationDAO.getMedicByCIP13(cip13);
@ -258,14 +243,7 @@ public class DrugListActivity extends AppCompatActivity {
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CUSTOMIZED_REQUEST_CODE) { constructDrugsList();
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);
constructDrugsList();
}
} }
public void onPause() { public void onPause() {
@ -283,8 +261,7 @@ public class DrugListActivity extends AppCompatActivity {
public void onButtonClick() { public void onButtonClick() {
Log.d(TAG, "add medication"); Log.d(TAG, "add medication");
ScanOptions options = new ScanOptions(); ScanOptions options = new ScanOptions();
options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_39, options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_128);
ScanOptions.CODE_128);
options.setCameraId(0); // Use a specific camera of the device options.setCameraId(0); // Use a specific camera of the device
options.setBeepEnabled(true); options.setBeepEnabled(true);
options.setBarcodeImageEnabled(true); options.setBarcodeImageEnabled(true);