diff --git a/app/build.gradle b/app/build.gradle index bb14fa9..8fc1f5e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,6 +39,11 @@ android { versionCode 100 versionName "v0.100-beta" multiDexEnabled true + javaCompileOptions { + annotationProcessorOptions { + arguments += ["room.schemaLocation": "$projectDir/schemas".toString()] + } + } } buildTypes { @@ -102,6 +107,12 @@ sourceSets { } } dependencies { + implementation "androidx.room:room-common:2.4.2" + annotationProcessor "androidx.room:room-compiler:2.4.2" + implementation "androidx.room:room-testing:2.4.2" + implementation "androidx.room:room-rxjava3:2.4.2" + implementation "androidx.room:room-runtime:2.4.2" + implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.13.2' @@ -109,7 +120,6 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.journeyapps:zxing-android-embedded:4.3.0' implementation 'androidx.core:core:1.7.0' diff --git a/app/schemas/net.foucry.pilldroid.PilldroidDatabase/1.json b/app/schemas/net.foucry.pilldroid.PilldroidDatabase/1.json new file mode 100644 index 0000000..d4fe768 --- /dev/null +++ b/app/schemas/net.foucry.pilldroid.PilldroidDatabase/1.json @@ -0,0 +1,88 @@ +{ + "formatVersion": 1, + "database": { + "version": 1, + "identityHash": "5ac4c79044120e5fa2716c6a89eff9bf", + "entities": [ + { + "tableName": "medics", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cis` TEXT NOT NULL, `cip13` TEXT, `name` TEXT, `administration_mode` TEXT, `presentation` TEXT, `stock` INTEGER, `take` INTEGER, `warning` INTEGER, `alert` INTEGER, `last_update` INTEGER, PRIMARY KEY(`cis`))", + "fields": [ + { + "fieldPath": "cis", + "columnName": "cis", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cip13", + "columnName": "cip13", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "administration_mode", + "columnName": "administration_mode", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "presentation", + "columnName": "presentation", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "stock", + "columnName": "stock", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "take", + "columnName": "take", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "warning", + "columnName": "warning", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "alert", + "columnName": "alert", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "last_update", + "columnName": "last_update", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "cis" + ], + "autoGenerate": false + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5ac4c79044120e5fa2716c6a89eff9bf')" + ] + } +} \ No newline at end of file diff --git a/app/schemas/net.foucry.pilldroid.PilldroidDatabase/2.json b/app/schemas/net.foucry.pilldroid.PilldroidDatabase/2.json new file mode 100644 index 0000000..b18c00f --- /dev/null +++ b/app/schemas/net.foucry.pilldroid.PilldroidDatabase/2.json @@ -0,0 +1,88 @@ +{ + "formatVersion": 1, + "database": { + "version": 2, + "identityHash": "ed6d0a13273d73ba9fcec1f374251efa", + "entities": [ + { + "tableName": "medics", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cis` TEXT NOT NULL, `cip13` TEXT, `name` TEXT, `administration_mode` TEXT, `presentation` TEXT, `stock` REAL, `take` REAL, `warning` INTEGER, `alert` INTEGER, `last_update` INTEGER, PRIMARY KEY(`cis`))", + "fields": [ + { + "fieldPath": "cis", + "columnName": "cis", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cip13", + "columnName": "cip13", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "administration_mode", + "columnName": "administration_mode", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "presentation", + "columnName": "presentation", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "stock", + "columnName": "stock", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "take", + "columnName": "take", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "warning", + "columnName": "warning", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "alert", + "columnName": "alert", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "last_update", + "columnName": "last_update", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "cis" + ], + "autoGenerate": false + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ed6d0a13273d73ba9fcec1f374251efa')" + ] + } +} \ No newline at end of file diff --git a/app/schemas/net.foucry.pilldroid.PilldroidDatabase/3.json b/app/schemas/net.foucry.pilldroid.PilldroidDatabase/3.json new file mode 100644 index 0000000..1483f81 --- /dev/null +++ b/app/schemas/net.foucry.pilldroid.PilldroidDatabase/3.json @@ -0,0 +1,88 @@ +{ + "formatVersion": 1, + "database": { + "version": 3, + "identityHash": "ed6d0a13273d73ba9fcec1f374251efa", + "entities": [ + { + "tableName": "medics", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cis` TEXT NOT NULL, `cip13` TEXT, `name` TEXT, `administration_mode` TEXT, `presentation` TEXT, `stock` REAL, `take` REAL, `warning` INTEGER, `alert` INTEGER, `last_update` INTEGER, PRIMARY KEY(`cis`))", + "fields": [ + { + "fieldPath": "cis", + "columnName": "cis", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cip13", + "columnName": "cip13", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "administration_mode", + "columnName": "administration_mode", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "presentation", + "columnName": "presentation", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "stock", + "columnName": "stock", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "take", + "columnName": "take", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "warning", + "columnName": "warning", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "alert", + "columnName": "alert", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "last_update", + "columnName": "last_update", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "cis" + ], + "autoGenerate": false + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ed6d0a13273d73ba9fcec1f374251efa')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a70a432..dca5e89 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,7 +18,6 @@ android:allowBackup="true"> diff --git a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java index b3ff7c1..5d08003 100644 --- a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java @@ -38,7 +38,7 @@ public class CustomScannerActivity extends Activity implements DecoratedBarcodeV public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_custom_scanner); + setContentView(R.layout.custom_scanner_activty); //barcodeScannerView.setTorchListener(this); diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java index 21061a6..d5315ef 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java @@ -1,5 +1,7 @@ package net.foucry.pilldroid; +import static net.foucry.pilldroid.R.id.detail_toolbar; + import android.content.Intent; import android.os.Bundle; import android.util.Log; @@ -13,9 +15,10 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; -import java.util.Date; +import net.foucry.pilldroid.dao.MedicDAO; +import net.foucry.pilldroid.models.Medic; -import static net.foucry.pilldroid.R.id.detail_toolbar; +import java.util.Date; /** * An activity representing a single Drug detail screen. This @@ -27,25 +30,18 @@ public class DrugDetailActivity extends AppCompatActivity { private static final String TAG = DrugDetailActivity.class.getName(); - Drug drug; + Medic aMedic; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getIntent().getExtras(); - - /* fetching the string passed with intent using ‘extras’*/ - assert bundle != null; - drug = (Drug) bundle.getSerializable("drug"); + aMedic = (Medic) bundle.get("medic"); + Log.d(TAG, "aMedic == " + aMedic); - assert drug != null; - Log.d(TAG, "drug == " + drug); - - /* fetching the string passed with intent using ‘bundle’*/ - - setContentView(R.layout.activity_drug_detail); + setContentView(R.layout.drug_detail_activity); Toolbar toolbar = findViewById(detail_toolbar); if (toolbar != null) { @@ -69,7 +65,7 @@ public class DrugDetailActivity extends AppCompatActivity { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(false); - actionBar.setTitle(drug.getName()); + actionBar.setTitle(aMedic.getName()); } // savedInstanceState is non-null when there is fragment state @@ -85,8 +81,7 @@ public class DrugDetailActivity extends AppCompatActivity { // Create the detail fragment and add it to the activity // using a fragment transaction. Bundle arguments = new Bundle(); - arguments.putSerializable("drug", - getIntent().getSerializableExtra("drug")); + arguments.putSerializable("medic", aMedic); DrugDetailFragment fragment = new DrugDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction() @@ -114,9 +109,11 @@ public class DrugDetailActivity extends AppCompatActivity { private void getMDrugChanges() { Log.d(TAG, "Time to save new values"); - DBHelper dbHelper = new DBHelper(this); + PilldroidDatabase prescriptions = null; + assert false; + MedicDAO medicDAO = prescriptions.getMedicDAO(); - Drug newDrug = dbHelper.getDrugByCIP13(drug.getCip13()); + Medic newMedic = medicDAO.getMedicByCIP13(aMedic.getCip13()); View stockView; View takeView; @@ -139,18 +136,19 @@ public class DrugDetailActivity extends AppCompatActivity { TextView warningTextView = warningView.findViewById(R.id.value); String warningValue = warningTextView.getText().toString(); - newDrug.setStock(Double.parseDouble(stockValue)); - newDrug.setTake(Double.parseDouble(takeValue)); - newDrug.setWarnThreshold(Integer.parseInt(warningValue)); - newDrug.setAlertThreshold(Integer.parseInt(alertValue)); - newDrug.setDateEndOfStock(); + newMedic.setStock(Float.parseFloat(stockValue)); + newMedic.setTake(Float.parseFloat(takeValue)); + newMedic.setWarning(Integer.parseInt(warningValue)); + newMedic.setAlert(Integer.parseInt(alertValue)); + newMedic.getDateEndOfStock(); - if (drug.equals(newDrug)) { - Log.d(TAG, "drug and newDrug are Equals"); + if (aMedic.equals(newMedic)) { + Log.d(TAG, "medic and newMedic are Equals"); } else { - Log.d(TAG, "drug and newDrug are NOT Equals"); - newDrug.setDateLastUpdate(new Date().getTime()); - dbHelper.updateDrug(newDrug); + Log.d(TAG, "medic and newMedic are NOT Equals"); + newMedic.setLast_update(new Date().getTime()); + medicDAO.update(newMedic); + //dbHelper.updateDrug(newDrug); } } } diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailContract.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailContract.java index 7059816..1dcef08 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugDetailContract.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailContract.java @@ -3,7 +3,6 @@ package net.foucry.pilldroid; import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.os.Bundle; import androidx.activity.result.contract.ActivityResultContract; import androidx.annotation.NonNull; diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java index 04a74e1..52169da 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java @@ -11,6 +11,8 @@ import androidx.fragment.app.Fragment; import com.google.android.material.appbar.CollapsingToolbarLayout; +import net.foucry.pilldroid.models.Medic; + /** * A fragment representing a single Drug detail screen. * This fragment is either contained in a {@link DrugListActivity} @@ -23,12 +25,12 @@ public class DrugDetailFragment extends Fragment { * The fragment argument representing the item ID that this fragment * represents. */ - public static final String ARG_ITEM_ID = "drug"; + public static final String ARG_ITEM_ID = "medic"; /** * The dummy content this fragment is presenting. */ - private Drug drug; + private Medic medic; /** * Mandatory empty constructor for the fragment manager to instantiate the @@ -46,13 +48,13 @@ public class DrugDetailFragment extends Fragment { // Load the dummy content specified by the fragment // arguments. In a real-world scenario, use a Loader // to load content from a content provider. - drug = (Drug) getArguments().getSerializable(ARG_ITEM_ID); + medic = (Medic) getArguments().getSerializable(ARG_ITEM_ID); Activity activity = this.getActivity(); assert activity != null; CollapsingToolbarLayout appBarLayout = activity.findViewById(R.id.toolbar_layout); if (appBarLayout != null) { - appBarLayout.setTitle(drug.getName()); + appBarLayout.setTitle(medic.getName()); } } } @@ -69,47 +71,49 @@ public class DrugDetailFragment extends Fragment { View alertView; // Show the dummy content as text in a TextView. - if (drug != null) { + if (medic != null) { // Find each component of rootView nameView = detailView.findViewById(R.id.name_cell); TextView nameLabel = nameView.findViewById(R.id.label); TextView nameValue = nameView.findViewById(R.id.value); nameLabel.setText(R.string.drug_name_label); - nameValue.setText(drug.getName()); + nameValue.setText(medic.getName()); presentationView = detailView.findViewById(R.id.presentation_cell); TextView presentationLabel = presentationView.findViewById(R.id.label); TextView presentationValue = presentationView.findViewById(R.id.value); presentationLabel.setText(R.string.drug_presentation_label); - presentationValue.setText(drug.getPresentation()); + presentationValue.setText(medic.getPresentation()); adminModeView = detailView.findViewById(R.id.administration_cell); TextView adminModeLabel = adminModeView.findViewById(R.id.label); TextView adminModeValue = adminModeView.findViewById(R.id.value); adminModeLabel.setText(R.string.drug_administrationMode_label); - adminModeValue.setText(drug.getAdministration_mode()); + adminModeValue.setText(medic.getAdministration_mode()); stockView = detailView.findViewById(R.id.stock_cell); TextView stockLibelle = (stockView.findViewById(R.id.label)); TextView stockValue = stockView.findViewById(R.id.value); stockLibelle.setText(R.string.drug_current_stock_label); - stockValue.setText(Double.toString(drug.getStock())); + stockValue.setText(Utils.fmt(medic.getStock())); stockValue.setHint(R.string.drug_current_stock_label); stockValue.setSelectAllOnFocus(true); takeView = detailView.findViewById(R.id.take_cell); - TextView priseLabel = takeView.findViewById(R.id.label); - TextView priseValue = (takeView.findViewById(R.id.value)); - priseLabel.setText(R.string.drug_take_label); - priseValue.setText(Double.toString(drug.getTake())); - priseValue.setHint(R.string.drug_take_label); - priseValue.setSelectAllOnFocus(true); + TextView takeLabel = takeView.findViewById(R.id.label); + TextView takeValue = (takeView.findViewById(R.id.value)); + takeLabel.setText(R.string.drug_take_label); + //takeValue.setText(Double.toString(medic.getTake())); + takeValue.setText(Utils.fmt(medic.getTake())); + takeValue.setHint(R.string.drug_take_label); + takeValue.setSelectAllOnFocus(true); warningView = detailView.findViewById(R.id.warning_cell); TextView warningLibelle = warningView.findViewById(R.id.label); TextView warningValue = warningView.findViewById(R.id.value); warningLibelle.setText(R.string.drug_warningThreshold_label); - warningValue.setText(Integer.toString(drug.getWarnThreshold())); + //warningValue.setText(Integer.toString(medic.getWarnThreshold())); + warningValue.setText(Utils.fmt(medic.getWarning())); warningValue.setHint(R.string.drug_warningThreshold_label); warningValue.setSelectAllOnFocus(true); @@ -117,7 +121,8 @@ public class DrugDetailFragment extends Fragment { TextView alertLibelle = alertView.findViewById(R.id.label); TextView alertValue = alertView.findViewById(R.id.value); alertLibelle.setText(R.string.drug_alertThreshold_label); - alertValue.setText(Integer.toString(drug.getAlertThreshold())); + //alertValue.setText(Integer.toString(medic.getAlertThreshold())); + alertValue.setText(Utils.fmt(medic.getAlert())); alertValue.setHint(R.string.drug_alertThreshold_label); alertValue.setSelectAllOnFocus(true); } diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java index 31ad512..9bc3bed 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java @@ -10,6 +10,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Bundle; +import android.os.Parcelable; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; @@ -30,11 +31,15 @@ import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.RecyclerView; +import androidx.room.Room; import com.google.zxing.client.android.Intents; import com.journeyapps.barcodescanner.ScanContract; import com.journeyapps.barcodescanner.ScanOptions; +import net.foucry.pilldroid.dao.MedicDAO; +import net.foucry.pilldroid.models.Medic; + import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -49,38 +54,69 @@ import java.util.Locale; * item details side-by-side using two vertical panes. */ public class DrugListActivity extends AppCompatActivity { - /** - * Whether or not the activity is in two-pane mode, i.e. running on a tablet - * device. - */ - - // TODO: Change DEMO/DBDEMO form static to non-static. In order to create fake data at only at launch time + // Used for dev and debug final Boolean DEMO = false; - final Boolean DBDEMO = false; public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff; public final String BARCODE_FORMAT_NAME = "Barcode Format name"; public final String BARCODE_CONTENT = "Barcode Content"; private ActivityResultLauncher mBarcodeScannerLauncher; + private static final String TAG = DrugListActivity.class.getName(); + public PilldroidDatabase prescriptions; + public PilldroidDatabase medications; - /** - * Start tutorial - */ + private List medics; // used for prescriptions + private SimpleItemRecyclerViewAdapter mAdapter; @Override public void onStart() { super.onStart(); + medications = Room + .databaseBuilder(getApplicationContext(), PilldroidDatabase.class, "medications") + .createFromAsset("drugs.db") + .build(); + + // Manually migrate old database to room + MedicDAO medicDAO = prescriptions.getMedicDAO(); + DBHelper dbHelper = new DBHelper(this); + if (dbHelper.getCount() !=0) { + List drugs=dbHelper.getAllDrugs(); + for (int count=0; count < dbHelper.getCount(); count++) { + Drug drug = drugs.get(count); + Medic medic = new Medic(); + + if(medicDAO.getMedicByCIP13(drug.getCip13()) == null) { + medic.setName(drug.getName()); + medic.setCip13(drug.getCip13()); + medic.setCis(drug.getCis()); + medic.setPresentation(drug.getPresentation()); + medic.setAdministration_mode(drug.getAdministration_mode()); + medic.setStock((float) drug.getStock()); + medic.setTake((float) drug.getTake()); + medic.setWarning(drug.getWarnThreshold()); + medic.setAlert(drug.getAlertThreshold()); + medic.setLast_update(drug.getDateLastUpdate()); + + medicDAO.insert(medic); + } + else { + Log.i(TAG, "Already in the database"); + } + } + dbHelper.dropDrug(); + } + // remove old notification Log.d(TAG, "Remove old notification and old job"); NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); if (nm != null) { nm.cancelAll(); } - // tutorial + // start tutorial Log.i(TAG, "Launch tutorial"); startActivity(new Intent(this, WelcomeActivity.class)); } @@ -90,39 +126,19 @@ public class DrugListActivity extends AppCompatActivity { super.onStop(); } - private static final String TAG = DrugListActivity.class.getName(); - - private DBHelper dbHelper; - private DBDrugs dbDrug; - - private List drugs; - - private SimpleItemRecyclerViewAdapter mAdapter; - - public void constructDrugsList() { - dbHelper = new DBHelper(getApplicationContext()); - - if (!(drugs == null)) { - if (!drugs.isEmpty()) { - drugs.clear(); - } - } - drugs = dbHelper.getAllDrugs(); - - View mRecyclerView = findViewById(R.id.drug_list); - assert mRecyclerView != null; - setupRecyclerView((RecyclerView) mRecyclerView); - } - @SuppressLint("NotifyDataSetChanged") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_drug_list); + // Create Room database + prescriptions = Room + .databaseBuilder(getApplicationContext(), PilldroidDatabase.class, "prescriptions") + .allowMainThreadQueries() + .build(); - dbHelper = new DBHelper(this); - dbDrug = new DBDrugs(this); + // Set view content + setContentView(R.layout.drug_list_activity); Toolbar toolbar = findViewById(R.id.toolbar); @@ -131,54 +147,34 @@ public class DrugListActivity extends AppCompatActivity { toolbar.setTitle(getTitle()); } - // Added to drop database each the app is launch. - if (DBDEMO) { - dbHelper.dropDrug(); - } - if (DEMO) { - if (dbHelper.getCount() == 0) { + MedicDAO medicDAO = prescriptions.getMedicDAO(); - // String cis, String cip13, String nom, String mode_administration, - // String presentation,double stock, double prise, int warn, int alert + if (medicDAO.getMedicCount() == 0) { + final int min_stock = 5; + final int max_stock = 50; + final int min_take = 0; + final int max_take = 3; - // Limit for randoms generator - final int min_stock = 5; - final int max_stock = 50; - final int min_prise = 0; - final int max_prise = 3; + for (int i = 1; i < 9; i++) { + Medic medic = new Medic(); + medic.setName("Medicament test " + i); + medic.setCip13("340093000001" + i); + medic.setCis("6000001" + i); + medic.setAdministration_mode("oral"); + medic.setPresentation("plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)"); + medic.setStock((float) intRandomExclusive(min_stock, max_stock)); + medic.setTake((float) intRandomExclusive(min_take, max_take)); + medic.setWarning(14); + medic.setAlert(7); + medic.setLast_update(UtilDate.dateAtNoon(new Date()).getTime()); - dbHelper.addDrug(new Drug("60000011", "3400930000011", "Médicament test 01", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000012", "3400930000012", "Médicament test 02", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000013", "3400930000013", "Médicament test 03", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000014", "3400930000014", "Médicament test 04", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000015", "3400930000015", "Médicament test 05", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000016", "3400930000016", "Médicament test 06", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000017", "3400930000017", "Médicament test 07", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000018", "3400930000018", "Médicament test 08", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000019", "3400930000019", "Médicament test 09", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - dbHelper.addDrug(new Drug("60000010", "3400930000010", "Médicament test 10", "orale", - "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)", - intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime())); - } + medicDAO.insert(medic); + } + List prescriptions = medicDAO.getAllMedics(); + System.out.println(prescriptions); + Log.d(TAG, "prescriptions ==" + prescriptions); + } } mBarcodeScannerLauncher = registerForActivityResult(new PilldroidScanContract(), @@ -214,7 +210,6 @@ public class DrugListActivity extends AppCompatActivity { String cip13; // Handle successful scan - Log.d(TAG, "formatName = " + bundle.getString(BARCODE_FORMAT_NAME)); switch (bundle.getString(BARCODE_FORMAT_NAME)) { @@ -222,9 +217,6 @@ public class DrugListActivity extends AppCompatActivity { case "EAN_13": //CODE_128 || EAN 13 cip13 = bundle.getString(BARCODE_CONTENT); break; - case "CODE_39": - cip13 = dbDrug.getCIP13FromCIP7(bundle.getString(BARCODE_CONTENT)); - break; case "DATA_MATRIX": cip13 = bundle.getString(BARCODE_CONTENT).substring(4, 17); break; @@ -234,10 +226,11 @@ public class DrugListActivity extends AppCompatActivity { } // Get Drug from database - final Drug scannedDrug = dbDrug.getDrugByCIP13(cip13); + MedicDAO medicationDAO = medications.getMedicDAO(); + final Medic scannedMedication = medicationDAO.getMedicByCIP13(cip13); // add Drug to prescription database - askToAddInDB(scannedDrug); + askToAddInDB(scannedMedication); } } } @@ -246,6 +239,15 @@ public class DrugListActivity extends AppCompatActivity { constructDrugsList(); } + public void constructDrugsList() { + + MedicDAO medicDAO = prescriptions.getMedicDAO(); + medics = medicDAO.getAllMedics(); + + View mRecyclerView = findViewById(R.id.drug_list); + assert mRecyclerView != null; + setupRecyclerView((RecyclerView) mRecyclerView); + } public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); @@ -254,16 +256,16 @@ public class DrugListActivity extends AppCompatActivity { } public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.about: - startActivity(new Intent(this, About.class)); - return true; - case R.id.help: - PrefManager prefManager = new PrefManager(this); - prefManager.setFirstTimeLaunch(true); + int id = item.getItemId(); + if (id == R.id.about) { + startActivity(new Intent(this, About.class)); + return true; + } else if (id == R.id.help) { + PrefManager prefManager = new PrefManager(this); + prefManager.setFirstTimeLaunch(true); - startActivity(new Intent(this, WelcomeActivity.class)); - return true; + startActivity(new Intent(this, WelcomeActivity.class)); + return true; } return super.onOptionsItemSelected(item); } @@ -271,19 +273,7 @@ public class DrugListActivity extends AppCompatActivity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - /*if (requestCode != CUSTOMIZED_REQUEST_CODE && requestCode != IntentIntegrator.REQUEST_CODE) { - // This is important, otherwise the result will not be passed to the fragment - super.onActivityResult(requestCode, resultCode, data); - return; - }*/ - if (requestCode == CUSTOMIZED_REQUEST_CODE) { - 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(); - } + constructDrugsList(); } public void onPause() { @@ -327,8 +317,7 @@ public class DrugListActivity extends AppCompatActivity { public void onButtonClick(View v) { Log.d(TAG, "add medication"); ScanOptions options = new ScanOptions(); - options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_39, - ScanOptions.CODE_128); + options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_128); options.setCameraId(0); // Use a specific camera of the device options.setBeepEnabled(true); options.setBarcodeImageEnabled(true); @@ -360,8 +349,10 @@ public class DrugListActivity extends AppCompatActivity { .setPositiveButton("OK", (dialog, id) -> { String cip13 = editText.getText().toString(); - Drug aDrug = dbDrug.getDrugByCIP13(cip13); - askToAddInDB(aDrug); + MedicDAO medicationsDAO = medications.getMedicDAO(); + Medic aMedic = medicationsDAO.getMedicByCIP13(cip13); + //Medic aMedic = medications.getDrugByCIP13(cip13); + askToAddInDB(aMedic); }) .setNegativeButton("Cancel", (dialog, id) -> dialog.cancel()); @@ -392,14 +383,14 @@ public class DrugListActivity extends AppCompatActivity { * Ask if the drug found in the database should be include in the * user database * - * @param aDrug Drug- drug to be added + * @param aMedic Medic- medication to be added */ - private void askToAddInDB(Drug aDrug) { + private void askToAddInDB(Medic aMedic) { AlertDialog.Builder dlg = new AlertDialog.Builder(this); dlg.setTitle(getString(R.string.app_name)); - if (aDrug != null) { - String msg = aDrug.getName() + " " + getString(R.string.msgFound); + if (aMedic != null) { + String msg = aMedic.getName() + " " + getString(R.string.msgFound); dlg.setMessage(msg); dlg.setNegativeButton(getString(R.string.button_cancel), (dialog, which) -> { @@ -407,7 +398,7 @@ public class DrugListActivity extends AppCompatActivity { }); dlg.setPositiveButton(getString(R.string.button_ok), (dialog, which) -> { // Add Drug to DB then try to show it - addDrugToList(aDrug); + addDrugToList(aMedic); }); } else { dlg.setMessage(getString(R.string.msgNotFound)); @@ -435,18 +426,18 @@ public class DrugListActivity extends AppCompatActivity { /** * Add New drug to the user database * - * @param aDrug Drug - drug to be added + * @param aMedic Medic - medication to be added */ @SuppressWarnings("deprecation") - private void addDrugToList(Drug aDrug) { - aDrug.setDateEndOfStock(); - mAdapter.addItem(aDrug); + private void addDrugToList(Medic aMedic) { + aMedic.getDateEndOfStock(); + mAdapter.addItem(aMedic); Log.d(TAG, "Call DrugDetailActivity"); Context context = this; Intent intent = new Intent(context, DrugDetailActivity.class); - intent.putExtra("drug", aDrug); + intent.putExtra("medic", (Parcelable) aMedic); startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); @@ -469,27 +460,29 @@ public class DrugListActivity extends AppCompatActivity { */ private void setupRecyclerView(@NonNull RecyclerView recyclerView) { recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext())); - mAdapter = new SimpleItemRecyclerViewAdapter(drugs); + mAdapter = new SimpleItemRecyclerViewAdapter(medics); recyclerView.setAdapter(mAdapter); } /** * SimpleItemRecyclerViewAdapter */ - public class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter { + public class SimpleItemRecyclerViewAdapter extends + RecyclerView.Adapter { - private final List mValues; + private final List mValues; - SimpleItemRecyclerViewAdapter(List items) { + SimpleItemRecyclerViewAdapter(List items) { mValues = items; } - void addItem(Drug scannedDrug) { - if (!dbHelper.isDrugExist(scannedDrug.getCip13())) { - mValues.add(scannedDrug); + void addItem(Medic scannedMedic) { + MedicDAO medicDAO = prescriptions.getMedicDAO(); + if (medicDAO.getMedicByCIP13(scannedMedic.getCip13()) == null) { + mValues.add(scannedMedic); //notifyDataSetChanged(); notifyItemInserted(mValues.size()); - dbHelper.addDrug(scannedDrug); + medicDAO.insert(scannedMedic); } else { Toast.makeText(getApplicationContext(), "already in the database", Toast.LENGTH_LONG).show(); } @@ -530,10 +523,10 @@ public class DrugListActivity extends AppCompatActivity { holder.mView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - Drug drug = mValues.get(position); + Medic aMedic = mValues.get(position); Context context = v.getContext(); Intent intent = new Intent(context, DrugDetailActivity.class); - intent.putExtra("drug", drug); + intent.putExtra("medic", (Parcelable) aMedic); startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); @@ -556,10 +549,10 @@ public class DrugListActivity extends AppCompatActivity { holder.mView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - Drug drug = mValues.get(position); + Medic medic = mValues.get(position); Context context = v.getContext(); Intent intent = new Intent(context, DrugDetailActivity.class); - intent.putExtra("drug", drug); + intent.putExtra("medic", medic); startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); @@ -579,7 +572,7 @@ public class DrugListActivity extends AppCompatActivity { final TextView mContentView; final TextView mEndOfStock; final ImageView mIconView; - public Drug mItem; + public Medic mItem; ViewHolder(View view) { super(view); diff --git a/app/src/main/java/net/foucry/pilldroid/PilldroidDatabase.java b/app/src/main/java/net/foucry/pilldroid/PilldroidDatabase.java new file mode 100644 index 0000000..359f731 --- /dev/null +++ b/app/src/main/java/net/foucry/pilldroid/PilldroidDatabase.java @@ -0,0 +1,21 @@ +package net.foucry.pilldroid; + +import androidx.room.AutoMigration; +import androidx.room.Database; +import androidx.room.RoomDatabase; + +import net.foucry.pilldroid.dao.MedicDAO; +import net.foucry.pilldroid.models.Medic; + +@Database( + version = 3, + entities = {Medic.class}, + autoMigrations = { + @AutoMigration(from = 1, to = 2), + @AutoMigration(from = 2, to = 3), + } +) + +public abstract class PilldroidDatabase extends RoomDatabase { + public abstract MedicDAO getMedicDAO(); +} diff --git a/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java b/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java index ea424b5..e6fa4c4 100644 --- a/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java +++ b/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java @@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable; import android.view.View; import androidx.annotation.NonNull; +import androidx.appcompat.content.res.AppCompatResources; import androidx.recyclerview.widget.RecyclerView; /** @@ -15,7 +16,8 @@ public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration { private final Drawable mDivider; SimpleDividerItemDecoration(Context context) { - mDivider = context.getDrawable(R.drawable.line_divider); + //mDivider = context.getDrawable(R.drawable.line_divider); + mDivider = AppCompatResources.getDrawable(context, R.drawable.line_divider); } @Override diff --git a/app/src/main/java/net/foucry/pilldroid/UtilDate.java b/app/src/main/java/net/foucry/pilldroid/UtilDate.java index bafb822..fe7075a 100644 --- a/app/src/main/java/net/foucry/pilldroid/UtilDate.java +++ b/app/src/main/java/net/foucry/pilldroid/UtilDate.java @@ -12,7 +12,7 @@ import java.util.Locale; /** * Created by jacques on 05/05/16. */ -class UtilDate { +public class UtilDate { private static final String TAG = UtilDate.class.getName(); @@ -21,7 +21,7 @@ class UtilDate { * @return date the same date as input but at noon (12:00:00 PM) * set date time at Noon */ - static Date dateAtNoon(Date aDate) { + public static Date dateAtNoon(Date aDate) { Log.d(TAG, "dateAtNoon " + aDate); @@ -41,7 +41,7 @@ class UtilDate { * @param days number of days to remove to the ate * @param date date before day removing * @return date - * Substract days to date and return a new date + * Subtract days to date and return a new date */ static Date removeDaysToDate(int days, Date date) { Calendar calendar = Calendar.getInstance(); @@ -90,7 +90,7 @@ class UtilDate { } /** - * Convert dateInMilliseconds into string formated date + * Convert dateInMilliseconds into string formatted date * @param dateInMilliseconds long * @return formatted Date String */ diff --git a/app/src/main/java/net/foucry/pilldroid/Utils.java b/app/src/main/java/net/foucry/pilldroid/Utils.java index 0db4c80..647d793 100644 --- a/app/src/main/java/net/foucry/pilldroid/Utils.java +++ b/app/src/main/java/net/foucry/pilldroid/Utils.java @@ -1,42 +1,13 @@ package net.foucry.pilldroid; -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.util.Locale; import java.util.Random; public class Utils { private static final String TAG = Utils.class.getName(); - public static final int SELECT_BARCODE_REQUEST = 2; - public static final int BARCODE_SCAN = 3; - - public static void CopyStream(InputStream is, OutputStream os) - { - final int buffer_size=1024; - try - { - byte[] bytes=new byte[buffer_size]; - for(;;) - { - int count=is.read(bytes, 0, buffer_size); - if(count==-1) - break; - os.write(bytes, 0, count); - } - } catch (IOException e) { - e.printStackTrace(); - } - - } - /** - * Return a random number between twovalues - use to gənerate a false demo DB + * Return a random number between two values - use to generate a false demo DB * @param min minimal value accepted * @param max maximum value accepted * @return int random number @@ -45,4 +16,12 @@ public class Utils { Random r = new Random(); return r.nextInt(max - min) +max; } + + public static String fmt(double d) + { + if(d == (long) d) + return String.format(Locale.getDefault(),"%d",(long)d); + else + return String.format("%s",d); + } } diff --git a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java index fe0946a..1816f83 100644 --- a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java @@ -45,7 +45,7 @@ public class WelcomeActivity extends AppCompatActivity { } prefManager.setFirstTimeLaunch(false); - setContentView(R.layout.activity_welcome); + setContentView(R.layout.welcome_activity); setFullScreen(); diff --git a/app/src/main/java/net/foucry/pilldroid/dao/MedicDAO.java b/app/src/main/java/net/foucry/pilldroid/dao/MedicDAO.java new file mode 100644 index 0000000..6b1fb0a --- /dev/null +++ b/app/src/main/java/net/foucry/pilldroid/dao/MedicDAO.java @@ -0,0 +1,34 @@ +package net.foucry.pilldroid.dao; + +import androidx.room.Dao; +import androidx.room.Delete; +import androidx.room.Insert; +import androidx.room.Query; +import androidx.room.Update; + +import net.foucry.pilldroid.models.Medic; + +import java.util.List; + +@Dao +public interface MedicDAO { + @Insert + void insert(Medic... medics); + + @Update + void update(Medic... medics); + + @Delete + void delete(Medic medic); + + @Query("SELECT * FROM medics") + List getAllMedics(); + + @Query("SELECT * FROM medics WHERE cip13 = :cip13") + Medic getMedicByCIP13(String cip13); + + @Query("SELECT count(*) FROM medics") + int getMedicCount(); +} + + diff --git a/app/src/main/java/net/foucry/pilldroid/models/Medic.java b/app/src/main/java/net/foucry/pilldroid/models/Medic.java new file mode 100644 index 0000000..cb66220 --- /dev/null +++ b/app/src/main/java/net/foucry/pilldroid/models/Medic.java @@ -0,0 +1,136 @@ +package net.foucry.pilldroid.models; + +import androidx.annotation.NonNull; +import androidx.room.Entity; +import androidx.room.PrimaryKey; + +import net.foucry.pilldroid.UtilDate; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.Date; + +@Entity(tableName = "medics") +public class Medic implements Serializable { + @PrimaryKey + @NonNull private String cis; + private String cip13; + private String name; + private String administration_mode; + private String presentation; + private Float stock; + private Float take; + private Integer warning; + private Integer alert; + private Long last_update; + + + public void setCis(@NonNull String cis) +{ + this.cis = cis; +} + + public void setCip13(String cip13) { + this.cip13 = cip13; + } + + public void setName(String name) { + this.name = name; + } + + public void setAdministration_mode(String administration_mode) { + this.administration_mode = administration_mode; + } + + public void setPresentation(String presentation) { + this.presentation = presentation; +} + public void setStock(Float stock) { + this.stock = stock; +} + + public void setTake(Float take) { + this.take = take; +} + + public void setWarning(Integer warning) { + this.warning = warning; +} + + public void setAlert(Integer alert) { + this.alert = alert; +} + + public void setLast_update(Long last_update) { + this.last_update = last_update; +} + + @NonNull + public String getCis() { + return this.cis; +} + + public Integer getWarning() { + return warning; + } + + public String getCip13() { + return cip13; + } + + public String getName() { + return name; + } + + public String getAdministration_mode() { + return administration_mode; + } + + public String getPresentation() { + return presentation; + } + + public Float getStock() { + return stock; + } + + public Float getTake() { + return take; + } + + public Integer getAlert() { + return alert; + } + + public Long getLast_update() { + return last_update; + } + + public int getAlertThreshold() { + return this.alert; + } + + public int getWarnThreshold() { + return this.warning; + } + + public Date getDateEndOfStock() { + int numberDayOfTake; + if (this.getTake() > 0) { + numberDayOfTake = (int) Math.floor(this.getStock() / this.getTake()); + } else { + numberDayOfTake = 0; + } + + Date aDate = UtilDate.dateAtNoon(new Date()); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(aDate); + calendar.add(Calendar.DAY_OF_YEAR, numberDayOfTake); + + return calendar.getTime(); + } +} + + + + diff --git a/app/src/main/res/layout/activity_custom_scanner.xml b/app/src/main/res/layout/custom_scanner_activty.xml similarity index 100% rename from app/src/main/res/layout/activity_custom_scanner.xml rename to app/src/main/res/layout/custom_scanner_activty.xml diff --git a/app/src/main/res/layout/activity_drug_detail.xml b/app/src/main/res/layout/drug_detail_activity.xml similarity index 100% rename from app/src/main/res/layout/activity_drug_detail.xml rename to app/src/main/res/layout/drug_detail_activity.xml diff --git a/app/src/main/res/layout/activity_drug_list.xml b/app/src/main/res/layout/drug_list_activity.xml similarity index 95% rename from app/src/main/res/layout/activity_drug_list.xml rename to app/src/main/res/layout/drug_list_activity.xml index 6ded56d..0664590 100644 --- a/app/src/main/res/layout/activity_drug_list.xml +++ b/app/src/main/res/layout/drug_list_activity.xml @@ -50,5 +50,6 @@ app:backgroundTint="@android:color/darker_gray" app:fabCustomSize="60dp" app:maxImageSize="60dp" - android:contentDescription="@string/add_button" /> + android:contentDescription="@string/add_button" + tools:ignore="OnClick" /> diff --git a/app/src/main/res/layout/activity_welcome.xml b/app/src/main/res/layout/welcome_activity.xml similarity index 97% rename from app/src/main/res/layout/activity_welcome.xml rename to app/src/main/res/layout/welcome_activity.xml index 9819b77..2004232 100644 --- a/app/src/main/res/layout/activity_welcome.xml +++ b/app/src/main/res/layout/welcome_activity.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:showIn="@layout/activity_welcome"> + tools:showIn="@layout/welcome_activity"> - \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index ef3fa4b..8c5bcde 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -1,9 +1,9 @@ <<<<<<< HEAD -Pilldroid is a theorical medics manager. It for French people +Pilldroid is a theoretical medics manager. It for French people only. Why for french people only? -

Pilldroid use a medics databases that come from French governement website, with +

Pilldroid use a medics databases that come from French government website, with Pilldroid is a theoretical medics manager. It for French people only.