mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
As suggested by @Jean-BaptisteC, reformatting code with Android Studio
This commit is contained in:
parent
feb95329be
commit
9bb5e62c48
33 changed files with 561 additions and 569 deletions
|
@ -2,11 +2,10 @@ package net.foucry.pilldroid;
|
|||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.webkit.WebView;
|
||||
|
||||
/**
|
||||
* Created by jacques on 12/06/16.
|
||||
*/
|
||||
|
|
|
@ -31,103 +31,6 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
|
||||
NotificationManager notificationManager;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
// Show the toast like in above screen shot
|
||||
Log.d(TAG, "onReceive");
|
||||
|
||||
// If BOOT_COMPLETED is received we launch an alarm in 10 second in order to
|
||||
// start the alarmschedule process.
|
||||
|
||||
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||
Log.d(TAG, "StartUpBootReceiver BOOT_COMPLETED");
|
||||
scheduleAlarm(context);
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) { Toast.makeText(context, "New stock calculated", Toast.LENGTH_LONG).show(); }
|
||||
createNotificationChannel(context);
|
||||
PrescriptionDatabase prescriptions = PrescriptionDatabase.getInstanceDatabase(context.getApplicationContext());
|
||||
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
||||
List<Prescription> prescriptionList = prescriptionsDAO.getAllMedics();
|
||||
Prescription firstPrescription = null;
|
||||
Prescription currentPrescription;
|
||||
|
||||
for (int i=0 ; i < prescriptionList.size(); i++ ) {
|
||||
currentPrescription = prescriptionList.get(i);
|
||||
currentPrescription.newStock();
|
||||
prescriptionsDAO.update(currentPrescription);
|
||||
}
|
||||
// Sorting list by dateEndOfStock
|
||||
prescriptionList = prescriptionsDAO.getAllMedics(); // Reread the database
|
||||
Utils.sortPrescriptionList(prescriptionList);
|
||||
try {
|
||||
firstPrescription = prescriptionList.get(0);
|
||||
}
|
||||
catch (Exception e){
|
||||
Log.e(TAG, e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (firstPrescription != null) {
|
||||
if (firstPrescription.getTake() != 0) {
|
||||
if(firstPrescription.getStock() <= firstPrescription.getAlertThreshold()) {
|
||||
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
Intent notificationIntent = new Intent(context, DrugListActivity.class);
|
||||
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "PillDroid")
|
||||
.setSmallIcon(R.drawable.ic_pill_alarm)
|
||||
.setContentTitle(context.getString(R.string.app_name))
|
||||
.setContentText(context.getString(R.string.notification_text))
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setColorized(true)
|
||||
.setAutoCancel(true);
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
int notificationId = 666;
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
} else
|
||||
{
|
||||
double dummy = (firstPrescription.getStock() - firstPrescription.getAlertThreshold());
|
||||
Log.d(TAG, "no notification scheduled " + dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createNotificationChannel(Context context) {
|
||||
|
||||
Log.d(TAG, "start create notification channel");
|
||||
CharSequence name = context.getString(R.string.channel_name);
|
||||
String description = context.getString(R.string.channel_description);
|
||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||
String CHANNEL_ID = "PillDroid";
|
||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
||||
channel.setDescription(description);
|
||||
channel.enableLights(true);
|
||||
channel.setLightColor(R.color.led);
|
||||
channel.enableVibration(true);
|
||||
channel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
|
||||
// Register the channel with the system; you can't change the importance
|
||||
// or other notification behaviors after this
|
||||
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
|
||||
try {
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
} catch (Exception e) {
|
||||
// This will catch any exception, because they are all descended from Exception
|
||||
Log.e(TAG, e.toString());
|
||||
//At the level Exception Class handle the error in Exception Table
|
||||
// Exception Create That Error Object and throw it
|
||||
//E.g: FileNotFoundException ,etc
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void scheduleAlarm(Context context) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Date today;
|
||||
|
@ -166,11 +69,110 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
//}
|
||||
|
||||
Log.d(TAG, "Alarm scheduled for " + UtilDate.convertDate(calendar.getTimeInMillis()));
|
||||
if (BuildConfig.DEBUG) { Toast.makeText(context, "Alarm scheduled for " + UtilDate.convertDate(calendar.getTimeInMillis()), Toast.LENGTH_SHORT).show(); }
|
||||
if (BuildConfig.DEBUG) {
|
||||
Toast.makeText(context, "Alarm scheduled for " + UtilDate.convertDate(calendar.getTimeInMillis()), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean isAlarmScheduled(Context context) {
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
return alarmManager.getNextAlarmClock() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// Show the toast like in above screen shot
|
||||
Log.d(TAG, "onReceive");
|
||||
|
||||
// If BOOT_COMPLETED is received we launch an alarm in 10 second in order to
|
||||
// start the alarmschedule process.
|
||||
|
||||
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||
Log.d(TAG, "StartUpBootReceiver BOOT_COMPLETED");
|
||||
scheduleAlarm(context);
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
Toast.makeText(context, "New stock calculated", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
createNotificationChannel(context);
|
||||
PrescriptionDatabase prescriptions = PrescriptionDatabase.getInstanceDatabase(context.getApplicationContext());
|
||||
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
||||
List<Prescription> prescriptionList = prescriptionsDAO.getAllMedics();
|
||||
Prescription firstPrescription = null;
|
||||
Prescription currentPrescription;
|
||||
|
||||
for (int i = 0; i < prescriptionList.size(); i++) {
|
||||
currentPrescription = prescriptionList.get(i);
|
||||
currentPrescription.newStock();
|
||||
prescriptionsDAO.update(currentPrescription);
|
||||
}
|
||||
// Sorting list by dateEndOfStock
|
||||
prescriptionList = prescriptionsDAO.getAllMedics(); // Reread the database
|
||||
Utils.sortPrescriptionList(prescriptionList);
|
||||
try {
|
||||
firstPrescription = prescriptionList.get(0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (firstPrescription != null) {
|
||||
if (firstPrescription.getTake() != 0) {
|
||||
if (firstPrescription.getStock() <= firstPrescription.getAlertThreshold()) {
|
||||
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
Intent notificationIntent = new Intent(context, DrugListActivity.class);
|
||||
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "PillDroid")
|
||||
.setSmallIcon(R.drawable.ic_pill_alarm)
|
||||
.setContentTitle(context.getString(R.string.app_name))
|
||||
.setContentText(context.getString(R.string.notification_text))
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setColorized(true)
|
||||
.setAutoCancel(true);
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
int notificationId = 666;
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
} else {
|
||||
double dummy = (firstPrescription.getStock() - firstPrescription.getAlertThreshold());
|
||||
Log.d(TAG, "no notification scheduled " + dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createNotificationChannel(Context context) {
|
||||
|
||||
Log.d(TAG, "start create notification channel");
|
||||
CharSequence name = context.getString(R.string.channel_name);
|
||||
String description = context.getString(R.string.channel_description);
|
||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||
String CHANNEL_ID = "PillDroid";
|
||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
||||
channel.setDescription(description);
|
||||
channel.enableLights(true);
|
||||
channel.setLightColor(R.color.led);
|
||||
channel.enableVibration(true);
|
||||
channel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
|
||||
// Register the channel with the system; you can't change the importance
|
||||
// or other notification behaviors after this
|
||||
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
|
||||
try {
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
} catch (Exception e) {
|
||||
// This will catch any exception, because they are all descended from Exception
|
||||
Log.e(TAG, e.toString());
|
||||
//At the level Exception Class handle the error in Exception Table
|
||||
// Exception Create That Error Object and throw it
|
||||
//E.g: FileNotFoundException ,etc
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,14 +23,12 @@ import com.journeyapps.barcodescanner.ViewfinderView;
|
|||
public class CustomScannerActivity extends Activity implements DecoratedBarcodeView.TorchListener {
|
||||
|
||||
private static final String TAG = CustomScannerActivity.class.getName();
|
||||
|
||||
final Bundle captureIntentBundle = new Bundle();
|
||||
private CaptureManager capture;
|
||||
private DecoratedBarcodeView barcodeScannerView;
|
||||
private ImageButton switchFlashlightButton;
|
||||
private ViewfinderView viewfinderView;
|
||||
|
||||
final Bundle captureIntentBundle = new Bundle();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
@ -22,9 +22,6 @@ class DBDrugs extends SQLiteOpenHelper {
|
|||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
private static final String dbName = "drugs.db";
|
||||
private final Context myContext;
|
||||
private final SQLiteDatabase myDataBase = null;
|
||||
|
||||
private static final String TABLE_NAME = "drugs";
|
||||
private static final String DRUG_CIS = "cis";
|
||||
private static final String DRUG_CIP13 = "cip13";
|
||||
|
@ -32,11 +29,10 @@ class DBDrugs extends SQLiteOpenHelper {
|
|||
private static final String DRUG_ADMIN = "administration_mode";
|
||||
private static final String DRUG_NAME = "name";
|
||||
private static final String DRUG_PRES = "presentation";
|
||||
|
||||
private static final String[] COLUMNS_NAMES = {DRUG_CIS, DRUG_CIP13, DRUG_CIP7, DRUG_ADMIN, DRUG_NAME, DRUG_PRES};
|
||||
|
||||
private static final String TAG = DBDrugs.class.getName();
|
||||
|
||||
private final Context myContext;
|
||||
private final SQLiteDatabase myDataBase = null;
|
||||
|
||||
|
||||
DBDrugs(Context context) {
|
||||
|
@ -44,12 +40,10 @@ class DBDrugs extends SQLiteOpenHelper {
|
|||
this.myContext = context;
|
||||
}
|
||||
|
||||
public boolean isDBFileExist(File database)
|
||||
{
|
||||
public boolean isDBFileExist(File database) {
|
||||
try {
|
||||
myContext.getDatabasePath(String.valueOf(database));
|
||||
}
|
||||
catch (final Exception e){
|
||||
} catch (final Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -175,13 +169,11 @@ class DBDrugs extends SQLiteOpenHelper {
|
|||
|
||||
c.moveToFirst();
|
||||
|
||||
if(c.getCount()>0)
|
||||
{
|
||||
if (c.getCount() > 0) {
|
||||
cip13 = c.getString(0);
|
||||
}
|
||||
c.close();
|
||||
} catch(Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return cip13;
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
|
||||
|
||||
class DBHelper extends SQLiteOpenHelper {
|
||||
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
@ -36,13 +35,10 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
private static final String KEY_THRESHOLD_WARN = "warning";
|
||||
private static final String KEY_THRESHOLD_ALERT = "alert";
|
||||
private static final String KEY_LAST_UPDATE = "last_update";
|
||||
|
||||
final List<Drug> drugs = new ArrayList<>();
|
||||
|
||||
private static final String TAG = DBHelper.class.getName();
|
||||
|
||||
private static final String[] COLUMNS = {KEY_ID, KEY_CIS, KEY_CIP13, KEY_NAME, KEY_ADMIN, KEY_PRES, KEY_STOCK, KEY_TAKE,
|
||||
KEY_THRESHOLD_WARN, KEY_THRESHOLD_ALERT, KEY_LAST_UPDATE};
|
||||
final List<Drug> drugs = new ArrayList<>();
|
||||
|
||||
DBHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
|
@ -88,6 +84,7 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
/**
|
||||
* Split drug values into database record and record it to the DB
|
||||
*
|
||||
* @param drug the drug object to be saved
|
||||
*/
|
||||
void addDrug(Drug drug) {
|
||||
|
@ -123,6 +120,7 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
/**
|
||||
* return a drug from the DB with is id
|
||||
*
|
||||
* @param id of the drug we looking for (not used)
|
||||
* @return return the found drug of null
|
||||
*/
|
||||
|
@ -172,7 +170,6 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cip13 drug id in French nomenclature
|
||||
* @return the drug object found in DB or null
|
||||
*/
|
||||
|
@ -218,7 +215,6 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return a Sorted and updated by dateEndOfStock List of All drugs presents in database
|
||||
*/
|
||||
|
||||
|
@ -265,15 +261,13 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
for (int position = 0; position < getCount(); position++) {
|
||||
currentDrug = getItem(position);
|
||||
|
||||
if (!DateUtils.isToday(currentDrug.getDateLastUpdate()))
|
||||
{
|
||||
if (!DateUtils.isToday(currentDrug.getDateLastUpdate())) {
|
||||
currentDrug.newStock();
|
||||
updateDrug(currentDrug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Log.d(TAG, "Before sort == " + drugs);
|
||||
|
||||
drugs.sort(new Comparator<Drug>() {
|
||||
|
@ -293,12 +287,10 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
for (int nbOps = 0; nbOps < getCount(); nbOps++) {
|
||||
currentDrug = getItem(position);
|
||||
double currentTake = currentDrug.getTake();
|
||||
if (currentTake == 0)
|
||||
{
|
||||
if (currentTake == 0) {
|
||||
drug = drugs.remove(position);
|
||||
drugs.add(drug);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +298,6 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param drug object to be updated in DB
|
||||
*/
|
||||
public void updateDrug(Drug drug) {
|
||||
|
@ -345,6 +336,7 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
/**
|
||||
* Delete a drug object in database
|
||||
*
|
||||
* @param drug object to be delete in the DB
|
||||
*/
|
||||
public void deleteDrug(Drug drug) {
|
||||
|
@ -365,6 +357,7 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
/**
|
||||
* Get count of all drug present in database
|
||||
*
|
||||
* @return number of drug in DB
|
||||
*/
|
||||
int getCount() {
|
||||
|
@ -391,13 +384,11 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
try {
|
||||
Cursor c = this.getReadableDatabase().rawQuery("SELECT * FROM " + TABLE_DRUG + " where cip13 = " + cip13, null);
|
||||
|
||||
if(c.getCount()>0)
|
||||
{
|
||||
if (c.getCount() > 0) {
|
||||
value = true;
|
||||
}
|
||||
c.close();
|
||||
} catch(Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.foucry.pilldroid;
|
||||
|
||||
import static net.foucry.pilldroid.UtilDate.dateAtNoon;
|
||||
import static net.foucry.pilldroid.UtilDate.nbOfDaysBetweenDateAndToday;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -7,9 +10,6 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import static net.foucry.pilldroid.UtilDate.dateAtNoon;
|
||||
import static net.foucry.pilldroid.UtilDate.nbOfDaysBetweenDateAndToday;
|
||||
|
||||
/**
|
||||
* Created by jacques on 26/11/15.
|
||||
*/
|
||||
|
@ -56,86 +56,68 @@ public class Drug implements Serializable {
|
|||
return id;
|
||||
}
|
||||
|
||||
String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
String getCip13() {
|
||||
return cip13;
|
||||
}
|
||||
|
||||
String getCis() {
|
||||
return cis;
|
||||
}
|
||||
|
||||
String getAdministration_mode() {
|
||||
return administration_mode;
|
||||
}
|
||||
|
||||
String getPresentation() {
|
||||
return presentation;
|
||||
}
|
||||
|
||||
double getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
double getTake() {
|
||||
return take;
|
||||
}
|
||||
|
||||
int getAlertThreshold() {
|
||||
return alertThreshold;
|
||||
}
|
||||
|
||||
int getWarnThreshold() {
|
||||
return warnThreshold;
|
||||
}
|
||||
|
||||
long getDateLastUpdate() {
|
||||
return dateLastUpdate;
|
||||
}
|
||||
|
||||
Date getDateEndOfStock() {
|
||||
return dateEndOfStock;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
String getCip13() {
|
||||
return cip13;
|
||||
}
|
||||
|
||||
void setCip13(String cip13) {
|
||||
this.cip13 = cip13;
|
||||
}
|
||||
|
||||
String getCis() {
|
||||
return cis;
|
||||
}
|
||||
|
||||
void setCis(String cis) {
|
||||
this.cis = cis;
|
||||
}
|
||||
|
||||
String getAdministration_mode() {
|
||||
return administration_mode;
|
||||
}
|
||||
|
||||
void setAdministration_mode(String administration_mode) {
|
||||
this.administration_mode = administration_mode;
|
||||
}
|
||||
|
||||
String getPresentation() {
|
||||
return presentation;
|
||||
}
|
||||
|
||||
void setPresentation(String presentation) {
|
||||
this.presentation = presentation;
|
||||
}
|
||||
|
||||
double getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
void setStock(double stock) {
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
double getTake() {
|
||||
return take;
|
||||
}
|
||||
|
||||
void setTake(double take) {
|
||||
this.take = take;
|
||||
}
|
||||
|
||||
void setWarnThreshold(int warn) {
|
||||
if (warn == 0)
|
||||
warn = 14;
|
||||
this.warnThreshold = warn;
|
||||
int getAlertThreshold() {
|
||||
return alertThreshold;
|
||||
}
|
||||
|
||||
void setAlertThreshold(int alert) {
|
||||
|
@ -144,10 +126,28 @@ public class Drug implements Serializable {
|
|||
this.alertThreshold = alert;
|
||||
}
|
||||
|
||||
int getWarnThreshold() {
|
||||
return warnThreshold;
|
||||
}
|
||||
|
||||
void setWarnThreshold(int warn) {
|
||||
if (warn == 0)
|
||||
warn = 14;
|
||||
this.warnThreshold = warn;
|
||||
}
|
||||
|
||||
long getDateLastUpdate() {
|
||||
return dateLastUpdate;
|
||||
}
|
||||
|
||||
void setDateLastUpdate(long l) {
|
||||
this.dateLastUpdate = l;
|
||||
}
|
||||
|
||||
Date getDateEndOfStock() {
|
||||
return dateEndOfStock;
|
||||
}
|
||||
|
||||
void setDateEndOfStock() {
|
||||
int numberDayOfTake;
|
||||
if (this.take > 0) {
|
||||
|
@ -176,6 +176,7 @@ public class Drug implements Serializable {
|
|||
setDateLastUpdate(new Date().getTime());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -26,6 +26,7 @@ public class DrugDetailContract extends ActivityResultContract<Intent, Integer>
|
|||
|
||||
/**
|
||||
* Convert result obtained from to O
|
||||
*
|
||||
* @param resultCode Integer
|
||||
* @param intent Intent
|
||||
* @return Integer
|
||||
|
|
|
@ -39,6 +39,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import androidx.room.Room;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.zxing.client.android.BuildConfig;
|
||||
import com.google.zxing.client.android.Intents;
|
||||
import com.journeyapps.barcodescanner.ScanOptions;
|
||||
|
||||
|
@ -54,8 +55,6 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.google.zxing.client.android.BuildConfig;
|
||||
|
||||
/**
|
||||
* An activity representing a list of Drugs is activity
|
||||
* has different presentations for handset and tablet-size devices. On
|
||||
|
@ -65,19 +64,15 @@ import com.google.zxing.client.android.BuildConfig;
|
|||
* item details side-by-side using two vertical panes.
|
||||
*/
|
||||
public class DrugListActivity extends AppCompatActivity {
|
||||
// Used for dev and debug
|
||||
final Boolean DEMO = false;
|
||||
|
||||
private static final String TAG = DrugListActivity.class.getName();
|
||||
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<ScanOptions> mBarcodeScannerLauncher;
|
||||
private static final String TAG = DrugListActivity.class.getName();
|
||||
|
||||
// Used for dev and debug
|
||||
final Boolean DEMO = false;
|
||||
public PrescriptionDatabase prescriptions;
|
||||
public MedicineDatabase medicines;
|
||||
|
||||
private ActivityResultLauncher<ScanOptions> mBarcodeScannerLauncher;
|
||||
private List<Prescription> prescriptionList; // used for prescriptions
|
||||
|
||||
private RecyclerViewAdapter mAdapter;
|
||||
|
@ -127,8 +122,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
prescription.setLast_update(drug.getDateLastUpdate());
|
||||
|
||||
prescriptionsDAO.insert(prescription);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Log.i(TAG, "Already in the database");
|
||||
}
|
||||
}
|
||||
|
@ -170,6 +164,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -369,10 +364,12 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) { }
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
@ -460,6 +457,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
||||
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
||||
}
|
||||
|
||||
/**
|
||||
* setupRecyclerView (list of drugs)
|
||||
*
|
||||
|
@ -561,6 +559,16 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
|
||||
}
|
||||
|
||||
private String getAppName() {
|
||||
PackageManager packageManager = getApplicationContext().getPackageManager();
|
||||
ApplicationInfo applicationInfo = null;
|
||||
try {
|
||||
applicationInfo = packageManager.getApplicationInfo(this.getPackageName(), 0);
|
||||
} catch (final PackageManager.NameNotFoundException ignored) {
|
||||
}
|
||||
return (String) ((applicationInfo != null) ? packageManager.getApplicationLabel(applicationInfo) : "???");
|
||||
}
|
||||
|
||||
/**
|
||||
* SimpleItemRecyclerViewAdapter
|
||||
*/
|
||||
|
@ -687,14 +695,4 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getAppName() {
|
||||
PackageManager packageManager = getApplicationContext().getPackageManager();
|
||||
ApplicationInfo applicationInfo = null;
|
||||
try {
|
||||
applicationInfo = packageManager.getApplicationInfo(this.getPackageName(), 0);
|
||||
} catch (final PackageManager.NameNotFoundException ignored) {
|
||||
}
|
||||
return (String) ((applicationInfo != null) ? packageManager.getApplicationLabel(applicationInfo) : "???");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.journeyapps.barcodescanner.ScanOptions;
|
|||
|
||||
public class PilldroidScanContract extends ActivityResultContract<ScanOptions, ScanIntentResult> {
|
||||
private static final String TAG = PilldroidScanContract.class.getName();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Intent createIntent(@NonNull Context context, ScanOptions input) {
|
||||
|
|
|
@ -8,45 +8,47 @@ import android.content.SharedPreferences;
|
|||
* Created by Lincoln on 05/05/16.
|
||||
*/
|
||||
public class PrefManager {
|
||||
final SharedPreferences pref;
|
||||
SharedPreferences.Editor editor;
|
||||
|
||||
// shared pref mode
|
||||
final int PRIVATE_MODE = 0;
|
||||
|
||||
// Shared preferences file name
|
||||
private static final String PREF_NAME = "Pildroid-Prefs";
|
||||
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
|
||||
private static final String DATABASE_VERSION = "DatabaseVersion";
|
||||
private static final String IS_UNDERSTOOD = "IsUnderStood";
|
||||
final SharedPreferences pref;
|
||||
// shared pref mode
|
||||
final int PRIVATE_MODE = 0;
|
||||
SharedPreferences.Editor editor;
|
||||
|
||||
public PrefManager(Context context) {
|
||||
pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
|
||||
}
|
||||
|
||||
public boolean isFirstTimeLaunch() {
|
||||
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
|
||||
}
|
||||
|
||||
public void setFirstTimeLaunch(boolean isFirstTime) {
|
||||
editor = pref.edit();
|
||||
editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public int getDatabaseVersion() {
|
||||
return pref.getInt(DATABASE_VERSION, 0);
|
||||
}
|
||||
|
||||
public void setDatabaseVersion(int version) {
|
||||
editor = pref.edit();
|
||||
editor.putInt(DATABASE_VERSION, version);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public boolean isUnderstood() {
|
||||
return pref.getBoolean(IS_UNDERSTOOD, false);
|
||||
}
|
||||
|
||||
public void setUnderstood(boolean isUnderstood) {
|
||||
editor = pref.edit();
|
||||
editor.putBoolean(IS_UNDERSTOOD, isUnderstood);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public boolean isFirstTimeLaunch() {
|
||||
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
|
||||
}
|
||||
public int getDatabaseVersion() {
|
||||
return pref.getInt(DATABASE_VERSION, 0);
|
||||
}
|
||||
public boolean isUnderstood() {return pref.getBoolean(IS_UNDERSTOOD, false); }
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ public class UtilDate {
|
|||
|
||||
/**
|
||||
* Convert dateInMilliseconds into string formatted date
|
||||
*
|
||||
* @param dateInMilliseconds long
|
||||
* @return formatted Date String
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,7 @@ public class Utils {
|
|||
|
||||
/**
|
||||
* 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
|
||||
|
@ -23,8 +24,7 @@ public class Utils {
|
|||
return r.nextInt(max - min) + max;
|
||||
}
|
||||
|
||||
public static String fmt(double d)
|
||||
{
|
||||
public static String fmt(double d) {
|
||||
if (d == (long) d)
|
||||
return String.format(Locale.getDefault(), "%d", (long) d);
|
||||
else
|
||||
|
|
|
@ -27,6 +27,35 @@ public class WelcomeActivity extends AppCompatActivity {
|
|||
private LinearLayout dotsLayout;
|
||||
private int[] layouts;
|
||||
private Button btnSkip, btnNext;
|
||||
// viewpager change listener
|
||||
final ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
addBottomDots(position);
|
||||
|
||||
// changing the next button text 'NEXT' / 'GOT IT'
|
||||
if (position == layouts.length - 1) {
|
||||
// last page. make button text to GOT IT
|
||||
btnNext.setText(getString(R.string.start));
|
||||
btnSkip.setVisibility(View.GONE);
|
||||
} else {
|
||||
// still pages are left
|
||||
btnNext.setText(getString(R.string.next));
|
||||
btnSkip.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int arg0) {
|
||||
|
||||
}
|
||||
};
|
||||
private PrefManager prefManager;
|
||||
|
||||
@Override
|
||||
|
@ -131,36 +160,6 @@ public class WelcomeActivity extends AppCompatActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
// viewpager change listener
|
||||
final ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
addBottomDots(position);
|
||||
|
||||
// changing the next button text 'NEXT' / 'GOT IT'
|
||||
if (position == layouts.length - 1) {
|
||||
// last page. make button text to GOT IT
|
||||
btnNext.setText(getString(R.string.start));
|
||||
btnSkip.setVisibility(View.GONE);
|
||||
} else {
|
||||
// still pages are left
|
||||
btnNext.setText(getString(R.string.next));
|
||||
btnSkip.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int arg0) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Making notification bar transparent
|
||||
*/
|
||||
|
@ -178,8 +177,7 @@ public class WelcomeActivity extends AppCompatActivity {
|
|||
controller.hide(WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars());
|
||||
controller.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//noinspection
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.foucry.pilldroid.models.Medicine;
|
|||
|
||||
public abstract class MedicineDatabase extends RoomDatabase {
|
||||
private static MedicineDatabase INSTANCE;
|
||||
public abstract MedicinesDAO getMedicinesDAO();
|
||||
|
||||
public static MedicineDatabase getInstanceDatabase(Context context) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE =
|
||||
|
@ -32,4 +32,6 @@ public abstract class MedicineDatabase extends RoomDatabase {
|
|||
public static void destroyInstance() {
|
||||
INSTANCE = null;
|
||||
}
|
||||
|
||||
public abstract MedicinesDAO getMedicinesDAO();
|
||||
}
|
|
@ -28,11 +28,6 @@ import net.foucry.pilldroid.models.Prescription;
|
|||
public abstract class PrescriptionDatabase extends RoomDatabase {
|
||||
private static PrescriptionDatabase INSTANCE;
|
||||
|
||||
public abstract PrescriptionsDAO getPrescriptionsDAO();
|
||||
|
||||
@RenameColumn(tableName = "prescriptions", fromColumnName = "genetic_type", toColumnName = "generic_type")
|
||||
static class generic_typeMigration implements AutoMigrationSpec { }
|
||||
|
||||
public static PrescriptionDatabase getInstanceDatabase(Context context) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE =
|
||||
|
@ -44,7 +39,14 @@ public abstract class PrescriptionDatabase extends RoomDatabase {
|
|||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static void destroyInstance() {
|
||||
INSTANCE = null;
|
||||
}
|
||||
|
||||
public abstract PrescriptionsDAO getPrescriptionsDAO();
|
||||
|
||||
@RenameColumn(tableName = "prescriptions", fromColumnName = "genetic_type", toColumnName = "generic_type")
|
||||
static class generic_typeMigration implements AutoMigrationSpec {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ import androidx.room.PrimaryKey;
|
|||
@Entity(tableName = "drugs")
|
||||
public class Medicine {
|
||||
@PrimaryKey
|
||||
@NonNull private Integer _id;
|
||||
@NonNull
|
||||
private Integer _id;
|
||||
private String cis;
|
||||
private String cip13;
|
||||
private String cip7;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package net.foucry.pilldroid.models;
|
||||
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
@ -15,7 +12,7 @@ import java.util.Date;
|
|||
|
||||
@Entity(tableName = "prescriptions")
|
||||
public class Prescription implements Serializable {
|
||||
private static final String TAG = Prescription.class.getName();;
|
||||
private static final String TAG = Prescription.class.getName();
|
||||
@PrimaryKey
|
||||
@NonNull
|
||||
private String cis;
|
||||
|
@ -31,87 +28,87 @@ public class Prescription implements Serializable {
|
|||
private String label_group;
|
||||
private Integer generic_type;
|
||||
|
||||
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 void setCis(@NonNull String cis) {
|
||||
this.cis = cis;
|
||||
}
|
||||
|
||||
public Integer getWarning() {
|
||||
return warning;
|
||||
}
|
||||
|
||||
public void setWarning(Integer warning) {
|
||||
this.warning = warning;
|
||||
}
|
||||
|
||||
public String getCip13() {
|
||||
return cip13;
|
||||
}
|
||||
|
||||
public void setCip13(String cip13) {
|
||||
this.cip13 = cip13;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAdministration_mode() {
|
||||
return administration_mode;
|
||||
}
|
||||
|
||||
public void setAdministration_mode(String administration_mode) {
|
||||
this.administration_mode = administration_mode;
|
||||
}
|
||||
|
||||
public String getPresentation() {
|
||||
return presentation;
|
||||
}
|
||||
|
||||
public void setPresentation(String presentation) {
|
||||
this.presentation = presentation;
|
||||
}
|
||||
|
||||
public Float getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
public void setStock(Float stock) {
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
public Float getTake() {
|
||||
return take;
|
||||
}
|
||||
|
||||
public void setTake(Float take) {
|
||||
this.take = take;
|
||||
}
|
||||
|
||||
public Integer getAlert() {
|
||||
return alert;
|
||||
}
|
||||
|
||||
public void setAlert(Integer alert) {
|
||||
this.alert = alert;
|
||||
}
|
||||
|
||||
public Long getLast_update() {
|
||||
return last_update;
|
||||
}
|
||||
|
||||
public void setLast_update(Long last_update) {
|
||||
this.last_update = last_update;
|
||||
}
|
||||
|
||||
public int getAlertThreshold() {
|
||||
return this.alert;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="-100%p" android:toXDelta="0"
|
||||
<translate
|
||||
android:duration="@integer/slide_animation_duration"
|
||||
android:fromXDelta="-100%p"
|
||||
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
|
||||
android:duration="@integer/slide_animation_duration"/>
|
||||
android:toXDelta="0" />
|
||||
</set>
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="100%p" android:toXDelta="0"
|
||||
<translate
|
||||
android:duration="@integer/slide_animation_duration"
|
||||
android:fromXDelta="100%p"
|
||||
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
|
||||
android:duration="@integer/slide_animation_duration"/>
|
||||
android:toXDelta="0" />
|
||||
</set>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0" android:toXDelta="-100%p"
|
||||
<translate android:duration="@integer/slide_animation_duration" android:fromXDelta="0"
|
||||
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
|
||||
android:duration="@integer/slide_animation_duration"/>
|
||||
android:toXDelta="-100%p"/>
|
||||
</set>
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0" android:toXDelta="100%p"
|
||||
<translate
|
||||
android:duration="@integer/slide_animation_duration"
|
||||
android:fromXDelta="0"
|
||||
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
|
||||
android:duration="@integer/slide_animation_duration"/>
|
||||
android:toXDelta="100%p" />
|
||||
</set>
|
|
@ -1,9 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="Overdraw">
|
||||
|
||||
<WebView
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<com.journeyapps.barcodescanner.BarcodeView
|
||||
android:id="@+id/zxing_barcode_surface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/zxing_barcode_surface"
|
||||
app:zxing_framing_rect_width="300dp"
|
||||
app:zxing_framing_rect_height="150dp">
|
||||
</com.journeyapps.barcodescanner.BarcodeView>
|
||||
app:zxing_framing_rect_height="150dp"
|
||||
app:zxing_framing_rect_width="300dp"></com.journeyapps.barcodescanner.BarcodeView>
|
||||
|
||||
<com.journeyapps.barcodescanner.ViewfinderView
|
||||
android:id="@+id/zxing_viewfinder_view"
|
||||
|
@ -30,10 +29,10 @@
|
|||
android:layout_marginTop="@dimen/app_bar_height"
|
||||
android:background="@color/zxing_transparent"
|
||||
android:fontFamily="sans-serif-black"
|
||||
android:textSize="32sp"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/zxing_msg_default_status"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="32sp"
|
||||
tools:ignore="PrivateResource" />
|
||||
|
||||
<ImageButton
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="net.foucry.pilldroid.CustomScannerActivity">
|
||||
|
|
|
@ -8,29 +8,29 @@
|
|||
|
||||
<include
|
||||
android:id="@+id/name_cell"
|
||||
layout="@layout/info_cell"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
layout="@layout/info_cell" />
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/presentation_cell"
|
||||
layout="@layout/info_cell"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
layout="@layout/info_cell"/>
|
||||
android:layout_height="match_parent" />
|
||||
<!-- android:layout_marginTop="5sp" />-->
|
||||
|
||||
<include
|
||||
android:id="@+id/administration_cell"
|
||||
layout="@layout/info_cell"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
layout="@layout/info_cell"/>
|
||||
android:layout_height="match_parent" />
|
||||
<!-- android:layout_marginTop="5sp" />-->
|
||||
|
||||
<include
|
||||
android:id="@+id/stock_cell"
|
||||
layout="@layout/value_input"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/value_input"/>
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- android:layout_marginTop="30sp" />-->
|
||||
|
||||
<include
|
||||
|
@ -41,9 +41,9 @@
|
|||
|
||||
<include
|
||||
android:id="@+id/warning_cell"
|
||||
layout="@layout/value_input"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/value_input"/>
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- android:layout_marginTop="15sp" />-->
|
||||
|
||||
<include
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
android:layout_height="@dimen/fab_height"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:layout_marginBottom="?attr/actionBarSize"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="?attr/actionBarSize"
|
||||
android:contentDescription="@string/save_button"
|
||||
android:src="@drawable/ic_save_black_24dp"
|
||||
app:backgroundTint="@android:color/transparent" />
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:name="net.foucry.pilldroid.MedicamentListFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
android:background="@drawable/list_selector"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
tools:context="net.foucry.pilldroid.DrugListActivity"
|
||||
tools:listitem="@layout/drug_list_content" />
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
|
||||
<include
|
||||
layout="@layout/drug_list"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"/>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
@ -45,11 +45,11 @@
|
|||
android:backgroundTint="@android:color/transparent"
|
||||
android:baselineAlignBottom="false"
|
||||
android:clickable="false"
|
||||
android:contentDescription="@string/add_button"
|
||||
android:onClick="onButtonClick"
|
||||
android:src="@drawable/ic_add_circle_black_24dp"
|
||||
app:backgroundTint="@android:color/darker_gray"
|
||||
app:fabCustomSize="60dp"
|
||||
app:maxImageSize="60dp"
|
||||
android:contentDescription="@string/add_button"
|
||||
tools:ignore="OnClick" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -13,24 +13,24 @@
|
|||
android:id="@+id/list_image"
|
||||
android:layout_width="50sp"
|
||||
android:layout_height="50sp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:src="@drawable/ok_stock_vect"
|
||||
android:contentDescription="@string/stockIcon"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
android:layout_marginStart="5dp"
|
||||
android:contentDescription="@string/stockIcon"
|
||||
android:src="@drawable/ok_stock_vect" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/list_image"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@+id/list_image"
|
||||
android:text="@string/drugName"
|
||||
android:textColor="#040404"
|
||||
android:typeface="sans"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_alignTop="@+id/list_image"
|
||||
android:layout_toEndOf="@+id/list_image"
|
||||
android:layout_marginStart="5dp" />
|
||||
android:typeface="sans" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/endOfStock"
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_selector">
|
||||
android:background="@drawable/list_selector"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10sp"
|
||||
android:paddingEnd="10sp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="10sp"
|
||||
android:text="@string/Value"
|
||||
android:textColor="#040404"
|
||||
android:textSize="16sp"
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_selector"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp"
|
||||
android:background="@drawable/list_selector"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -31,14 +32,14 @@
|
|||
android:layout_alignParentEnd="true"
|
||||
android:ems="10"
|
||||
android:gravity="end|fill_vertical"
|
||||
android:hint="@string/zero"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="numberDecimal"
|
||||
android:labelFor="@id/value"
|
||||
android:paddingEnd="25dp"
|
||||
android:paddingStart="5dp"
|
||||
android:hint="@string/zero"
|
||||
android:textColorHint="@color/grey"
|
||||
android:paddingEnd="25dp"
|
||||
android:textAlignment="gravity"
|
||||
android:importantForAutofill="no"
|
||||
android:textColorHint="@color/grey"
|
||||
tools:ignore="LabelFor" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -19,18 +19,17 @@
|
|||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dots_margin_bottom"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
</LinearLayout>
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dots_margin_bottom"
|
||||
android:background="@null"
|
||||
android:text="@string/next"
|
||||
android:layout_marginBottom="@dimen/dots_margin_bottom"
|
||||
android:textColor="@android:color/white"
|
||||
tools:ignore="RelativeOverlap,RtlSymmetry" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue