mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-10 07:51:20 +01:00
Merge branch 'feature/saveDrugs' of ssh://git.exodus-privacy.eu.org:2225/foucry.net/PillDroid into feature/saveDrugs
Conflicts: gradle/wrapper/gradle-wrapper.properties
This commit is contained in:
commit
1ab5ef950d
9 changed files with 18 additions and 30 deletions
|
@ -2,7 +2,7 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
compileSdkVersion 29
|
||||
defaultConfig {
|
||||
applicationId "net.foucry.pilldroid"
|
||||
minSdkVersion 25
|
||||
|
|
|
@ -48,6 +48,7 @@ public class About extends AppCompatActivity{
|
|||
// Drawable d = getResources().getDrawable(id);
|
||||
//Drawable d = ResourcesCompatApi21.getDrawable(getResources(),id, null);
|
||||
Drawable d = ContextCompat.getDrawable(getApplicationContext(),id);
|
||||
assert d != null;
|
||||
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class DBMedoc extends SQLiteOpenHelper{
|
|||
private static String dbName = "medicaments.db";
|
||||
private SQLiteDatabase myDataBase;
|
||||
private final Context myContext;
|
||||
File dbFile = new File(DATABASE_PATH + dbName);
|
||||
private File dbFile = new File(DATABASE_PATH + dbName);
|
||||
|
||||
private static final String TABLE_NAME = "medicaments";
|
||||
private static final String MEDOC_CIS = "cis";
|
||||
|
@ -54,10 +54,9 @@ class DBMedoc extends SQLiteOpenHelper{
|
|||
|
||||
@Override
|
||||
public synchronized SQLiteDatabase getReadableDatabase() {
|
||||
if (!dbFile.exists()) {
|
||||
if (dbFile.exists()) return super.getReadableDatabase();
|
||||
SQLiteDatabase db = super.getReadableDatabase();
|
||||
copyDatabase(db.getPath());
|
||||
}
|
||||
return super.getReadableDatabase();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.foucry.pilldroid;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.support.design.widget.CollapsingToolbarLayout;
|
||||
|
@ -50,13 +51,14 @@ public class MedicamentDetailFragment extends Fragment {
|
|||
medicament = (Medicament) getArguments().getSerializable(ARG_ITEM_ID);
|
||||
|
||||
Activity activity = this.getActivity();
|
||||
CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
|
||||
CollapsingToolbarLayout appBarLayout = activity.findViewById(R.id.toolbar_layout);
|
||||
if (appBarLayout != null) {
|
||||
appBarLayout.setTitle(medicament.getNom());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View detailView = inflater.inflate(R.layout.medicament_detail, container, false);
|
||||
|
@ -102,8 +104,8 @@ public class MedicamentDetailFragment extends Fragment {
|
|||
priseValue.setText(Double.toString(medicament.getPrise()));
|
||||
|
||||
warningView = detailView.findViewById(R.id.warning_cell);
|
||||
TextView warningLibelle = (TextView) warningView.findViewById(R.id.libelle);
|
||||
TextView warningValue = (TextView) warningView.findViewById(R.id.valeur);
|
||||
TextView warningLibelle = warningView.findViewById(R.id.libelle);
|
||||
TextView warningValue = warningView.findViewById(R.id.valeur);
|
||||
warningLibelle.setText("Seuil d'alerte");
|
||||
warningValue.setText(Integer.toString(medicament.getWarnThreshold()));
|
||||
|
||||
|
@ -129,6 +131,7 @@ public class MedicamentDetailFragment extends Fragment {
|
|||
View warningView;
|
||||
View alertView;
|
||||
|
||||
assert currentView != null;
|
||||
stockView = currentView.findViewById(R.id.stock_cell);
|
||||
TextView stockTextView = stockView.findViewById(R.id.valeur);
|
||||
String stockValue = stockTextView.getText().toString();
|
||||
|
|
|
@ -276,9 +276,11 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
dlg.setTitle(context.getString(R.string.app_name));
|
||||
|
||||
// Handle successful scan
|
||||
assert format != null;
|
||||
if (format.equals("CODE_128")) { //CODE_128
|
||||
cip13 = contents;
|
||||
} else {
|
||||
assert contents != null;
|
||||
cip13 = contents.substring(4, 17);
|
||||
}
|
||||
|
||||
|
@ -475,6 +477,7 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
mIconView = view.findViewById(R.id.list_image);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " '" + mContentView.getText() + "'";
|
||||
|
|
|
@ -12,8 +12,8 @@ import android.view.View;
|
|||
public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private Drawable mDivider;
|
||||
|
||||
public SimpleDividerItemDecoration(Context context) {
|
||||
mDivider = context.getResources().getDrawable(R.drawable.line_divider);
|
||||
SimpleDividerItemDecoration(Context context) {
|
||||
mDivider = context.getDrawable(R.drawable.line_divider);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -94,22 +94,6 @@ class UtilDate {
|
|||
return (int) (todayDate.getTime() - oldDate.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param: none
|
||||
* return int
|
||||
*/
|
||||
|
||||
static long tomorrowAtNoonInMillis() {
|
||||
Date now = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(now);
|
||||
calendar.add(Calendar.DAY_OF_YEAR,1);
|
||||
|
||||
Date tomorrowAtNoon = dateAtNoon(calendar.getTime());
|
||||
|
||||
return (tomorrowAtNoon.getTime() - now.getTime());
|
||||
}
|
||||
|
||||
static String convertDate(long dateInMilliseconds) {
|
||||
DateFormat formatter = new SimpleDateFormat("dd/MM/yy HH:mm:ss", Locale.FRANCE);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
|
|
@ -3,9 +3,7 @@ package net.foucry.pilldroid;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.lang.Math;
|
||||
|
||||
public class Utils {
|
||||
public static void CopyStream(InputStream is, OutputStream os)
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,4 +1,4 @@
|
|||
#Fri Apr 24 21:29:18 CEST 2020
|
||||
#Fri Apr 24 16:50:40 UTC 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
Loading…
Reference in a new issue