Project update to gradle 6.3;

Remove most of warnings;
This commit is contained in:
jacques 2020-04-24 19:19:32 +00:00
parent bd97001c9e
commit bdbce4715f
9 changed files with 19 additions and 31 deletions

View file

@ -2,7 +2,7 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 27 compileSdkVersion 29
defaultConfig { defaultConfig {
applicationId "net.foucry.pilldroid" applicationId "net.foucry.pilldroid"
minSdkVersion 25 minSdkVersion 25

View file

@ -48,6 +48,7 @@ public class About extends AppCompatActivity{
// Drawable d = getResources().getDrawable(id); // Drawable d = getResources().getDrawable(id);
//Drawable d = ResourcesCompatApi21.getDrawable(getResources(),id, null); //Drawable d = ResourcesCompatApi21.getDrawable(getResources(),id, null);
Drawable d = ContextCompat.getDrawable(getApplicationContext(),id); Drawable d = ContextCompat.getDrawable(getApplicationContext(),id);
assert d != null;
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d; return d;
} }

View file

@ -24,7 +24,7 @@ class DBMedoc extends SQLiteOpenHelper{
private static String dbName = "medicaments.db"; private static String dbName = "medicaments.db";
private SQLiteDatabase myDataBase; private SQLiteDatabase myDataBase;
private final Context myContext; 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 TABLE_NAME = "medicaments";
private static final String MEDOC_CIS = "cis"; private static final String MEDOC_CIS = "cis";
@ -54,10 +54,9 @@ class DBMedoc extends SQLiteOpenHelper{
@Override @Override
public synchronized SQLiteDatabase getReadableDatabase() { public synchronized SQLiteDatabase getReadableDatabase() {
if (!dbFile.exists()) { if (dbFile.exists()) return super.getReadableDatabase();
SQLiteDatabase db = super.getReadableDatabase(); SQLiteDatabase db = super.getReadableDatabase();
copyDatabase(db.getPath()); copyDatabase(db.getPath());
}
return super.getReadableDatabase(); return super.getReadableDatabase();
} }

View file

@ -1,5 +1,6 @@
package net.foucry.pilldroid; package net.foucry.pilldroid;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CollapsingToolbarLayout;
@ -50,13 +51,14 @@ public class MedicamentDetailFragment extends Fragment {
medicament = (Medicament) getArguments().getSerializable(ARG_ITEM_ID); medicament = (Medicament) getArguments().getSerializable(ARG_ITEM_ID);
Activity activity = this.getActivity(); Activity activity = this.getActivity();
CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout); CollapsingToolbarLayout appBarLayout = activity.findViewById(R.id.toolbar_layout);
if (appBarLayout != null) { if (appBarLayout != null) {
appBarLayout.setTitle(medicament.getNom()); appBarLayout.setTitle(medicament.getNom());
} }
} }
} }
@SuppressLint("SetTextI18n")
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View detailView = inflater.inflate(R.layout.medicament_detail, container, false); 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())); priseValue.setText(Double.toString(medicament.getPrise()));
warningView = detailView.findViewById(R.id.warning_cell); warningView = detailView.findViewById(R.id.warning_cell);
TextView warningLibelle = (TextView) warningView.findViewById(R.id.libelle); TextView warningLibelle = warningView.findViewById(R.id.libelle);
TextView warningValue = (TextView) warningView.findViewById(R.id.valeur); TextView warningValue = warningView.findViewById(R.id.valeur);
warningLibelle.setText("Seuil d'alerte"); warningLibelle.setText("Seuil d'alerte");
warningValue.setText(Integer.toString(medicament.getWarnThreshold())); warningValue.setText(Integer.toString(medicament.getWarnThreshold()));
@ -129,6 +131,7 @@ public class MedicamentDetailFragment extends Fragment {
View warningView; View warningView;
View alertView; View alertView;
assert currentView != null;
stockView = currentView.findViewById(R.id.stock_cell); stockView = currentView.findViewById(R.id.stock_cell);
TextView stockTextView = stockView.findViewById(R.id.valeur); TextView stockTextView = stockView.findViewById(R.id.valeur);
String stockValue = stockTextView.getText().toString(); String stockValue = stockTextView.getText().toString();

View file

@ -276,9 +276,11 @@ public class MedicamentListActivity extends AppCompatActivity {
dlg.setTitle(context.getString(R.string.app_name)); dlg.setTitle(context.getString(R.string.app_name));
// Handle successful scan // Handle successful scan
assert format != null;
if (format.equals("CODE_128")) { //CODE_128 if (format.equals("CODE_128")) { //CODE_128
cip13 = contents; cip13 = contents;
} else { } else {
assert contents != null;
cip13 = contents.substring(4, 17); cip13 = contents.substring(4, 17);
} }
@ -475,6 +477,7 @@ public class MedicamentListActivity extends AppCompatActivity {
mIconView = view.findViewById(R.id.list_image); mIconView = view.findViewById(R.id.list_image);
} }
@NonNull
@Override @Override
public String toString() { public String toString() {
return super.toString() + " '" + mContentView.getText() + "'"; return super.toString() + " '" + mContentView.getText() + "'";

View file

@ -12,8 +12,8 @@ import android.view.View;
public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration { public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration {
private Drawable mDivider; private Drawable mDivider;
public SimpleDividerItemDecoration(Context context) { SimpleDividerItemDecoration(Context context) {
mDivider = context.getResources().getDrawable(R.drawable.line_divider); mDivider = context.getDrawable(R.drawable.line_divider);
} }
@Override @Override

View file

@ -94,22 +94,6 @@ class UtilDate {
return (int) (todayDate.getTime() - oldDate.getTime()); 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) { static String convertDate(long dateInMilliseconds) {
DateFormat formatter = new SimpleDateFormat("dd/MM/yy HH:mm:ss", Locale.FRANCE); DateFormat formatter = new SimpleDateFormat("dd/MM/yy HH:mm:ss", Locale.FRANCE);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();

View file

@ -3,9 +3,7 @@ package net.foucry.pilldroid;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Date;
import java.util.Random; import java.util.Random;
import java.lang.Math;
public class Utils { public class Utils {
public static void CopyStream(InputStream is, OutputStream os) public static void CopyStream(InputStream is, OutputStream os)

View file

@ -1,6 +1,6 @@
#Sun Apr 12 14:00:20 UTC 2020 #Fri Apr 24 16:50:40 UTC 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip