Amisc
|
@ -21,7 +21,6 @@ import java.util.List;
|
|||
class DBHelper extends SQLiteOpenHelper {
|
||||
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
private static final ThreadLocal<String> DATABASE_NAME = ThreadLocal.withInitial(() -> "ordonnance.db");
|
||||
|
||||
private static final String TABLE_DRUG = "drug";
|
||||
|
@ -264,11 +263,15 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
Medicament currentMedicament;
|
||||
for (int position = 0 ; position < getCount() ; position++ ) {
|
||||
currentMedicament = getItem(position);
|
||||
currentMedicament.newStock(currentMedicament.getStock());
|
||||
|
||||
// if (!DateUtils.isToday(currentMedicament.getDateLastUpdate()))
|
||||
// {
|
||||
currentMedicament.newStock();
|
||||
updateDrug(currentMedicament);
|
||||
//}
|
||||
}
|
||||
|
||||
Collections.sort(medicaments, new Comparator<Medicament>() {
|
||||
medicaments.sort(new Comparator<Medicament>() {
|
||||
@Override
|
||||
public int compare(Medicament lhs, Medicament rhs) {
|
||||
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
|
||||
|
|
|
@ -160,11 +160,11 @@ public class Medicament implements Serializable {
|
|||
this.dateEndOfStock = calendar.getTime();
|
||||
}
|
||||
|
||||
double newStock(double currentStock) {
|
||||
Date lastUpdate = string2Date(this.dateLastUpdate);
|
||||
void newStock() {
|
||||
Date lastUpdate = new Date(getDateLastUpdate());
|
||||
int numberOfDays = nbOfDaysBetweenDateAndToday(lastUpdate);
|
||||
double takeDuringPeriod = this.prise * numberOfDays;
|
||||
|
||||
return currentStock - takeDuringPeriod;
|
||||
setStock(getStock() - takeDuringPeriod);
|
||||
setDateLastUpdate(dateAtNoon(new Date()).getTime());
|
||||
}
|
||||
}
|
|
@ -500,14 +500,14 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
int remainingStock = (int) Math.floor(mValues.get(position).getStock() / mValues.get(position).getPrise());
|
||||
if (remainingStock <= mValues.get(position).getAlertThreshold()) {
|
||||
holder.mView.setBackgroundResource(R.drawable.gradient_bg_alert);
|
||||
holder.mIconView.setImageResource(R.drawable.lower_stock);
|
||||
holder.mIconView.setImageResource(R.drawable.lower_stock_vect);
|
||||
} else if ((remainingStock > mValues.get(position).getAlertThreshold()) &&
|
||||
(remainingStock <= (mValues.get(position).getWarnThreshold()))) {
|
||||
holder.mView.setBackgroundResource(R.drawable.gradient_bg_warning);
|
||||
holder.mIconView.setImageResource(R.drawable.warning_stock);
|
||||
holder.mIconView.setImageResource(R.drawable.warning_stock_vect);
|
||||
} else {
|
||||
holder.mView.setBackgroundResource(R.drawable.gradient_bg_ok);
|
||||
holder.mIconView.setImageResource(R.drawable.ok_stock);
|
||||
holder.mIconView.setImageResource(R.drawable.ok_stock_vect);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,15 +596,15 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
|
||||
TutorialItem tutorialItem5 = new TutorialItem(context.getString(R.string.slide5_Pilldroid),
|
||||
context.getString(R.string.slide5_Pilldroid),
|
||||
R.color.slide_3, R.drawable.emoticon_happy_outline);
|
||||
R.color.slide_3, R.drawable.ok_stock_bitmap);
|
||||
|
||||
TutorialItem tutorialItem6 = new TutorialItem(context.getString(R.string.slide6_Pilldroid),
|
||||
context.getString(R.string.slide6_Pilldroid),
|
||||
R.color.slide_2, R.drawable.emoticon_neutral_outline);
|
||||
R.color.slide_2, R.drawable.lower_stock_bitmap);
|
||||
|
||||
TutorialItem tutorialItem7 = new TutorialItem(context.getString(R.string.slide7_Pilldroid),
|
||||
context.getString(R.string.slide7_Pilldroid),
|
||||
R.color.slide_4, R.drawable.emoticon_angry_outline);
|
||||
R.color.slide_4, R.drawable.warning_stock_bitmap);
|
||||
|
||||
TutorialItem tutorialItem8 = new TutorialItem(context.getString(R.string.slide8_Pilldroid),
|
||||
context.getString(R.string.slide8_Pilldroid),
|
||||
|
|
|
@ -4,8 +4,8 @@ import android.app.NotificationChannel;
|
|||
import android.app.NotificationManager;
|
||||
import android.app.job.JobParameters;
|
||||
import android.app.job.JobService;
|
||||
import android.content.Intent;
|
||||
import android.icu.util.Calendar;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
@ -20,8 +20,7 @@ import java.util.List;
|
|||
public class PillDroidJobService extends JobService {
|
||||
private static final String TAG = JobService.class.getName();
|
||||
private boolean jobCancelled = false;
|
||||
private String CHANNEL_ID = "PillDroid";
|
||||
private DBHelper dbHelper = new DBHelper(this);
|
||||
private final DBHelper dbHelper = new DBHelper(this);
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -84,7 +83,7 @@ public class PillDroidJobService extends JobService {
|
|||
Intent intent = new Intent(this, MedicamentListActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,0);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
|
||||
.setSmallIcon(R.drawable.ic_pill)
|
||||
.setSmallIcon(R.drawable.ic_pill_alarm)
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
.setContentText(getString(R.string.notification_text))
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4.22,11.29L11.29,4.22C13.64,1.88 17.43,1.88 19.78,4.22C22.12,6.56 22.12,10.36 19.78,12.71L12.71,19.78C10.36,22.12 6.56,22.12 4.22,19.78C1.88,17.43 1.88,13.64 4.22,11.29M5.64,12.71C4.59,13.75 4.24,15.24 4.6,16.57L10.59,10.59L14.83,14.83L18.36,11.29C19.93,9.73 19.93,7.2 18.36,5.64C16.8,4.07 14.27,4.07 12.71,5.64L5.64,12.71Z"/>
|
||||
</vector>
|
|
@ -1,15 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24">
|
||||
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M15.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M8.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12,14c-2.33,0 -4.32,1.45 -5.12,3.5h1.67c0.69,-1.19 1.97,-2 3.45,-2s2.75,0.81 3.45,2h1.67c-0.8,-2.05 -2.79,-3.5 -5.12,-3.5z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -1,14 +0,0 @@
|
|||
<svg mlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24">
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M15.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M8.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12,16c-1.48,0 -2.75,-0.81 -3.45,-2L6.88,14c0.8,2.05 2.79,3.5 5.12,3.5s4.32,-1.45 5.12,-3.5h-1.67c-0.7,1.19 -1.97,2 -3.45,2z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -1,18 +0,0 @@
|
|||
<svg xmlns:="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24">
|
||||
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M9,14h6v1.5H9z"/>
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M15.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M8.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
|
||||
<path
|
||||
fill="#FF000000"
|
||||
d="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 595 B |
Before Width: | Height: | Size: 971 B After Width: | Height: | Size: 971 B |
|
@ -14,7 +14,7 @@
|
|||
android:layout_width="50sp"
|
||||
android:layout_height="50sp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:src="@drawable/ok_stock"
|
||||
android:src="@drawable/ok_stock_vect"
|
||||
android:contentDescription="Icone de stock"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
|
|
@ -16,8 +16,8 @@ buildscript {
|
|||
}
|
||||
}
|
||||
ext {
|
||||
compileSdkVersion = '27'
|
||||
buildToolsVersion = '27.0.1'
|
||||
compileSdkVersion = '28'
|
||||
buildToolsVersion = '28.0.1'
|
||||
var = '3.4.2'
|
||||
buildToolsVersion1 = '29.0.3'
|
||||
defaultMinSdkVersion = 28
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Fri Apr 24 16:50:40 UTC 2020
|
||||
#Tue Nov 03 18:11:12 CET 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
|
|