Merge branch 'release/v0.300-beta'

This commit is contained in:
jacques 2022-06-11 10:07:55 +02:00
commit f39152873a
11 changed files with 226 additions and 17 deletions

View file

@ -26,14 +26,14 @@ android {
keyPassword secretProperties['signing_key_password'] keyPassword secretProperties['signing_key_password']
} }
} }
compileSdkVersion 29 compileSdk 31
defaultConfig { defaultConfig {
applicationId "net.foucry.pilldroid" applicationId "net.foucry.pilldroid"
minSdkVersion defaultMinSdkVersion minSdkVersion defaultMinSdkVersion
targetSdkVersion defaultTargetSdkVersion targetSdkVersion defaultTargetSdkVersion
versionCode 201 versionCode 300
versionName "v0.201-beta" versionName "v0.300-beta"
multiDexEnabled true multiDexEnabled true
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {

View file

@ -50,7 +50,6 @@ public class AlarmReceiver extends BroadcastReceiver {
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO(); PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
List<Prescription> prescriptionList = prescriptionsDAO.getAllMedics(); List<Prescription> prescriptionList = prescriptionsDAO.getAllMedics();
Prescription firstPrescription = null ; Prescription firstPrescription = null ;
//List<Drug> drugs = dbHelper.getAllDrugs();
try { try {
firstPrescription = prescriptionList.get(1); firstPrescription = prescriptionList.get(1);

View file

@ -9,6 +9,9 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
@ -30,9 +33,12 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.room.Room; import androidx.room.Room;
import com.google.android.material.snackbar.Snackbar;
import com.google.zxing.client.android.BuildConfig; import com.google.zxing.client.android.BuildConfig;
import com.google.zxing.client.android.Intents; import com.google.zxing.client.android.Intents;
import com.journeyapps.barcodescanner.ScanOptions; import com.journeyapps.barcodescanner.ScanOptions;
@ -73,7 +79,7 @@ public class DrugListActivity extends AppCompatActivity {
private List<Prescription> prescriptionList; // used for prescriptions private List<Prescription> prescriptionList; // used for prescriptions
private SimpleItemRecyclerViewAdapter mAdapter; private RecyclerViewAdapter mAdapter;
@Override @Override
public void onStart() { public void onStart() {
@ -463,19 +469,110 @@ public class DrugListActivity extends AppCompatActivity {
*/ */
private void setupRecyclerView(@NonNull RecyclerView recyclerView) { private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext())); recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext()));
mAdapter = new SimpleItemRecyclerViewAdapter(prescriptionList); mAdapter = new RecyclerViewAdapter(prescriptionList);
recyclerView.setAdapter(mAdapter); recyclerView.setAdapter(mAdapter);
}
new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, (ItemTouchHelper.RIGHT|ItemTouchHelper.LEFT)) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
int position = viewHolder.getBindingAdapterPosition();
Prescription prescription = prescriptionList.get(position);
if (direction == ItemTouchHelper.LEFT) {
prescriptionList.remove(position);
mAdapter.notifyItemRemoved(position);
// Remove item form database
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
prescriptionsDAO.delete(prescription);
} else {
// Call DetailView
Intent intent = new Intent(getApplicationContext(), DrugDetailActivity.class);
intent.putExtra("prescription", prescription);
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
}
Snackbar.make(recyclerView, prescription.getName(),
Snackbar.LENGTH_LONG).setAction(R.string.Undo, new View.OnClickListener() {
@Override
public void onClick(View v) {
prescriptionList.add(position, prescription);
mAdapter.notifyItemInserted(position);
}
}).show();
}
@Override
public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
// Get RecyclerView item from the ViewHolder
View itemView = viewHolder.itemView;
Paint p = new Paint();
Drawable icon;
icon = ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_trash_can_outline);
int xMarkMargin = (int) getApplicationContext().getResources().getDimension(R.dimen.fab_margin);
assert icon != null;
int intrinsicWidth = icon.getIntrinsicWidth();
int intrinsicHeight = icon.getIntrinsicHeight();
int itemHeight = itemView.getBottom() - itemView.getTop();
if (dX > 0) {
p.setColor(getColor(R.color.bg_screen3));
icon = ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_edit_black_48dp);
// Draw Rect with varying right side, equal to displacement dX
c.drawRect((float) itemView.getLeft(), (float) itemView.getTop(), dX,
(float) itemView.getBottom(), p);
int xMarkLeft = itemView.getLeft() + xMarkMargin;
int xMarkRight = itemView.getLeft() + xMarkMargin + intrinsicWidth;
int xMarkTop = itemView.getTop() + (itemHeight - intrinsicHeight) / 2;
int xMarkBottom = xMarkTop + intrinsicHeight;// +xMarkTop;
assert icon != null;
icon.setBounds(xMarkLeft, xMarkTop, xMarkRight, xMarkBottom);
} else {
p.setColor(getColor(R.color.bg_screen4));
// Draw Rect with varying left side, equal to the item's right side plus negative displacement dX
c.drawRect((float) itemView.getRight() + dX, (float) itemView.getTop(),
(float) itemView.getRight(), (float) itemView.getBottom(), p);
int xMarkLeft = itemView.getRight() - xMarkMargin - intrinsicWidth;
int xMarkRight = itemView.getRight() - xMarkMargin;
int xMarkTop = itemView.getTop() + (itemHeight - intrinsicHeight) / 2;
int xMarkBottom = xMarkTop + intrinsicHeight;
icon.setBounds(xMarkLeft, xMarkTop, xMarkRight, xMarkBottom);
}
icon.draw(c);
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
}
}
}).attachToRecyclerView(recyclerView);
}
/** /**
* SimpleItemRecyclerViewAdapter * SimpleItemRecyclerViewAdapter
*/ */
public class SimpleItemRecyclerViewAdapter extends public class RecyclerViewAdapter extends
RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> { RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> {
private final List<Prescription> mValues; private final List<Prescription> mValues;
SimpleItemRecyclerViewAdapter(List<Prescription> items) { RecyclerViewAdapter(List<Prescription> items) {
mValues = items; mValues = items;
} }

View file

@ -0,0 +1,4 @@
<vector android:height="48dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
</vector>

View file

@ -0,0 +1,4 @@
<vector android:height="48dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M9,3V4H4V6H5V19A2,2 0,0 0,7 21H17A2,2 0,0 0,19 19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z"/>
</vector>

View file

@ -6,7 +6,6 @@
android:name="net.foucry.pilldroid.MedicamentListFragment" android:name="net.foucry.pilldroid.MedicamentListFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
android:background="@drawable/list_selector" android:background="@drawable/list_selector"
tools:context="net.foucry.pilldroid.DrugListActivity" tools:context="net.foucry.pilldroid.DrugListActivity"

View file

@ -36,15 +36,15 @@
android:id="@+id/endOfStock" android:id="@+id/endOfStock"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="30dp"
android:layout_marginBottom="5dp"
android:gravity="end" android:gravity="end"
android:text="@string/Date" android:text="@string/Date"
android:textSize="14sp"
android:textColor="#212121" android:textColor="#212121"
android:textStyle="bold" android:textSize="14sp"
android:layout_alignParentBottom="true" android:textStyle="bold" />
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:layout_marginBottom="5dp" />
</RelativeLayout> </RelativeLayout>
<!-- CIP 13 (should change) --> <!-- CIP 13 (should change) -->

View file

@ -68,4 +68,6 @@
<string name="missing_camera_permission">Autorisation appareil photo manquante</string> <string name="missing_camera_permission">Autorisation appareil photo manquante</string>
<string name="Yes">Oui, j\'ai compris</string> <string name="Yes">Oui, j\'ai compris</string>
<string name="understood">Je comprends que le développeur de app_name n\'est pas responsable de la gestion de vos médicaments. CELA RELÈVE DE VOTRE SEULE RESPONSABILITË.</string> <string name="understood">Je comprends que le développeur de app_name n\'est pas responsable de la gestion de vos médicaments. CELA RELÈVE DE VOTRE SEULE RESPONSABILITË.</string>
<string name="Undo">Annuler</string>
<string name="trash_icon">Icone de poubelle</string>
</resources> </resources>

View file

@ -70,4 +70,6 @@
<string name="missing_camera_permission">Missing camera permission</string> <string name="missing_camera_permission">Missing camera permission</string>
<string name="Yes">Yes, I understood</string> <string name="Yes">Yes, I understood</string>
<string name="understood">I understood that de developer of app_name cannot be responsible ot your medication management. IT\'S YOU OWN RESPONSIBILITY.</string> <string name="understood">I understood that de developer of app_name cannot be responsible ot your medication management. IT\'S YOU OWN RESPONSIBILITY.</string>
<string name="Undo">Undo</string>
<string name="trash_icon">Trash icon</string>
</resources> </resources>

View file

@ -0,0 +1,51 @@
# v0.300-beta - New features
- The prescription list management have been revamp (the medics your taken);
- a swipe from right to left remove a medic from the list AND from the database;
- a swipe from left to right allow you to change the detail of the medic, exactly has taping
ont the right arrow.
Those change allow you to remove medics with a take to zero (0) for a to long time and you'll never
take again.
They allow me to go to the next step of Pilldroid advancement. Instead of displaying the medic named,
Pilldroid will display the molecule (doliprane, efferalgant, daflagant will be displyed has paracétamol).
I will sais more soon.
Thanks to make return of those new features, [Pilldroid](mailto:jacques+pilldroid@foucry.net)
or [Pilldroid](mailto:pilldroid@foucry.net).
# v0.201-beta - fix bug in `alarmReceiver`
The `alarmReceiver` was still using the old database that *should* be empty. I use `room` database
management now.
# v0.200-beta New semantic version number (VRelease.MajorMinorPatch)
**REMEMBER** Pilldroid is a French people user only.
I made a lot a tests but there must stay some bugs.
## What's new
A lot of things under the surface :
- Add an alert about non responsibility of the author in case of trouble;
- Using `Room` to manage databases;
- Migration of the old database to the new one, you should not see anything;
- Code cleaning.
## What should work.
- QR-code scan on a dark background. The library have an option for that.
**WARNING**, Pilldroid does not manage creams, liquids
(like insulin).
Thanks to use [github](https://github/jfoucry/pilldroid) for bugs
reports and new features.
> I made Pilldroid on my free time which is not expandable. Please
do not stress me it will be unproductive.
Pilldroid will available only from [f-droid](https://f-droid.org)
You can reach me and discuss on [Pilldroid](mailto:jacques+pilldroid@foucry.net).

View file

@ -0,0 +1,51 @@
# v0.300-beta - Nouvelles fonctionnalités
- La gestion de la liste des prescriptions (les médicaments que vous permet) à été revue ;
- un glissement de la droite vers la gauche supprime le médicament de la liste ET de
la base données ;
- un glissement de la gauche vers la droite permet de modifier les détails du médicament,
tout comme le tapotage sur la flèche à la droite de la ligne.
Ces changements vont vous permettre de supprimer les médicaments dont la prise est à zéro (0)
depuis longtemps et que vous ne prendrez plus.
Ils vont également me permettre d'avancer sur la prochaine étape qui est de plus présenter les noms
des médicaments, mais la molécule (doliprane, efferalgant, daflagant deviendront paracétamol).
Je vous en dirais plus prochainement.
Merci de me faire des retours sur ces nouveautés, [Pilldroid](mailto:jacques+pilldroid@foucry.net)
[Pilldroid](mailto:pilldroid@foucry.net)ou pilldroid@foucry.net.
# v0.201-beta - déverminage dans `alarmReceiver`
L'`alarmReceiver` utilisait encore l'anciennt base de données qui devait être vide. J'utilise désormais la gestion`room`
pour la base données.
# v0.200 Nouvelle numérotation sémantique (VMajor.Minor.Patch)
Malgré de nombreux tests et une utilisation quotidienne,
tout est à tester.
## Nouveautés
Pas grand-chose de visible pour les personnes utilisatrices :
- Ajout d'une demande explicite de non-responsabilité de l'auteur en cas de problème ;
- Utilisation de `Room` pour gérer les bases de données ;
- Migration de l'ancienne base de données à la nouvelle, vous ne devriez rien voir ;
- Nettoyage du code.
## Ce qui devrait fonctionner
- le scan de QR-code sur un fond foncé. La bibliothèque utilisée a un paramètre pour cela.
**ATTENTION**, Pilldroid ne sait pas gérer les crèmes, les liquides
(l'insuline par exemple).
Merci d'utiliser [github](https://github/jfoucry/pilldroid) pour
rapporter des bogues et demander des fonctionnalités.
> Je fais Pilldroid sur mon temps libre et accessible. Il est inutile
et contre-productif de me « mettre la pression ».
Pilldroid ne sera diffusé que par [f-droid](https://f-droid.org) (pour l'instant)
Vous pouvez m'écrire pour discuter de [Pilldroid](mailto:jacques+pilldroid@foucry.net).