mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Merge branch 'feature/Fix_zxing_calling' into develop
This commit is contained in:
commit
c0b0759466
36 changed files with 520 additions and 333 deletions
25
LICENSE
Normal file
25
LICENSE
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
The BSD 3-Clause License The following is a BSD 3-Clause ("BSD New" or "BSD Simplified") license template. To generate your own license, change the values of OWNER, ORGANIZATION and YEAR from their original values as given here, and substitute your own.
|
||||||
|
|
||||||
|
Note: You may omit clause 3 and still be OSD-conformant. Despite its colloquial name "BSD New", this is not the newest version of the BSD license; it was followed by the even newer BSD-2-Clause version, sometimes known as the "Simplified BSD License". On January 9th, 2008 the OSI Board approved BSD-2-Clause, which is used by FreeBSD and others. It omits the final "no-endorsement" clause and is thus roughly equivalent to the MIT License.
|
||||||
|
|
||||||
|
Historical Background: The original license used on BSD Unix had four clauses. The advertising clause (the third of four clauses) required you to acknowledge use of U.C. Berkeley code in your advertising of any product using that code. It was officially rescinded by the Director of the Office of Technology Licensing of the University of California on July 22nd, 1999. He states that clause 3 is "hereby deleted in its entirety." The four clause license has not been approved by OSI. The license below does not contain the advertising clause.
|
||||||
|
|
||||||
|
This prelude is not part of the license.
|
||||||
|
|
||||||
|
OWNER = Regents of the University of California
|
||||||
|
|
||||||
|
ORGANIZATION = University of California, Berkeley
|
||||||
|
|
||||||
|
YEAR = 1998
|
||||||
|
|
||||||
|
In the original BSD license, both occurrences of the phrase "COPYRIGHT HOLDERS AND CONTRIBUTORS" in the disclaimer read "REGENTS AND CONTRIBUTORS".
|
||||||
|
|
||||||
|
Copyright (c) $2022 Jacques Foucry, All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
11
README.md
11
README.md
|
@ -3,10 +3,6 @@
|
||||||
Pilldroid est une application de gestion de stock **théorique** de médicament à
|
Pilldroid est une application de gestion de stock **théorique** de médicament à
|
||||||
destinations des personnes résidant en France.
|
destinations des personnes résidant en France.
|
||||||
|
|
||||||
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
|
||||||
alt="Get it on F-Droid"
|
|
||||||
height="80">](https://f-droid.org/packages/net.foucry.pilldroid/)
|
|
||||||
|
|
||||||
## Ce que n'est pas Pilldroid
|
## Ce que n'est pas Pilldroid
|
||||||
|
|
||||||
- Pilldroid n'est pas un pilulier. Pilldroid ne vous rappellera pas de prendre
|
- Pilldroid n'est pas un pilulier. Pilldroid ne vous rappellera pas de prendre
|
||||||
|
@ -31,7 +27,7 @@ lancer son cycle de réveil journalier ;
|
||||||
scanner le code barre des boites de médicaments ;
|
scanner le code barre des boites de médicaments ;
|
||||||
- Pilldroid a besoin de pouvoir vous envoyer des alarmes ;
|
- Pilldroid a besoin de pouvoir vous envoyer des alarmes ;
|
||||||
- Pilldroid a besoin de faire vibrer le téléphone pour les alarmes ;
|
- Pilldroid a besoin de faire vibrer le téléphone pour les alarmes ;
|
||||||
- Pilldroid utilise un accès Internet pour les remontée de crash *via* la bibliothèque [sentry.io](https://sentry.io).
|
|
||||||
|
|
||||||
## L'application Pilldroid embarque-t-elle des bibliothèques tierce ?
|
## L'application Pilldroid embarque-t-elle des bibliothèques tierce ?
|
||||||
|
|
||||||
|
@ -39,11 +35,6 @@ Oui. Pour la lecture de code barre, Pilldroid utilise le projet
|
||||||
[zxing](https://github.com/journeyapps/zxing-android-embedded) lui-même libre et
|
[zxing](https://github.com/journeyapps/zxing-android-embedded) lui-même libre et
|
||||||
ouvert.
|
ouvert.
|
||||||
|
|
||||||
A terme Pilldroid utilisera la bibliothèque
|
|
||||||
[sentry.io](https://sentry.io/for/android/) quand j'aurais compris comment cela
|
|
||||||
fonctionne. Le but est d'avoir des remontées les crashs de l'application sans
|
|
||||||
collecter de données à caractère personnel.
|
|
||||||
Déjà embarquée mais non fonctionnelle, `sentry.io` à besoin de l'accès Internet.
|
|
||||||
|
|
||||||
## L'application Pilldroid contient-elle des pisteurs ?
|
## L'application Pilldroid contient-elle des pisteurs ?
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
//noinspection GradleCompatible
|
//noinspection GradleCompatible
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
ext.versionMajor = 0
|
|
||||||
ext.versionMinor = 65
|
|
||||||
ext.versionPatch = new Date().format("yyyyMMdd")
|
|
||||||
ext.versionClassifier = null
|
|
||||||
ext.isSnapshot = false
|
|
||||||
ext.minimumSdkVersion = defaultMinSdkVersion
|
|
||||||
ext.git_version= ("git rev-parse --short HEAD".execute().text.trim())
|
|
||||||
|
|
||||||
// Try reading secrets from file
|
// Try reading secrets from file
|
||||||
def secretsPropertiesFile = rootProject.file("secrets.properties")
|
def secretsPropertiesFile = rootProject.file("secrets.properties")
|
||||||
def secretProperties = new Properties()
|
def secretProperties = new Properties()
|
||||||
|
@ -26,22 +18,26 @@ else {
|
||||||
android {
|
android {
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
|
storeFile rootProject.file("android-signing-keystore.jks")
|
||||||
|
storePassword secretProperties['signing_keystore_password']
|
||||||
|
keyAlias secretProperties['signing_release_alias_key']
|
||||||
|
keyPassword secretProperties['signing_release_key_password']
|
||||||
}
|
}
|
||||||
prerelease {
|
prerelease {
|
||||||
storeFile file("../android-signing-keystore.jks")
|
storeFile rootProject.file("android-signing-keystore.jks")
|
||||||
storePassword secretProperties['signing_keystore_password']
|
storePassword secretProperties['signing_keystore_password']
|
||||||
keyAlias secretProperties['signing_key_alias']
|
keyAlias secretProperties['signing_pre-release_key_alias']
|
||||||
keyPassword secretProperties['signing_key_password']
|
keyPassword secretProperties['signing_pre-release_key_password']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileSdkVersion 29
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "net.foucry.pilldroid"
|
applicationId "net.foucry.pilldroid"
|
||||||
minSdkVersion defaultMinSdkVersion
|
minSdkVersion defaultMinSdkVersion
|
||||||
targetSdkVersion defaultTargetSdkVersion
|
targetSdkVersion defaultTargetSdkVersion
|
||||||
versionCode generateVersionCode() // 190010203
|
versionCode 100
|
||||||
versionName generateVersionName() // 1.2.3-SNAPSHOT
|
versionName "v0.100-beta"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +51,7 @@ android {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
debuggable false
|
debuggable false
|
||||||
|
signingConfig signingConfigs.release
|
||||||
}
|
}
|
||||||
prerelease {
|
prerelease {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
|
@ -81,15 +78,11 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
coreLibraryDesugaringEnabled true
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
buildToolsVersion '32.0.0'
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
dexOptions {
|
|
||||||
incremental false
|
|
||||||
javaMaxHeapSize "4g"
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
|
@ -112,40 +105,13 @@ dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
implementation 'com.google.android.material:material:1.4.0'
|
implementation 'com.google.android.material:material:1.5.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||||
implementation 'androidx.core:core:1.6.0'
|
implementation 'androidx.core:core:1.7.0'
|
||||||
|
|
||||||
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
|
|
||||||
|
|
||||||
implementation 'io.sentry:sentry-android:5.4.0'
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer generateVersionCode() {
|
|
||||||
Integer versionCode = ext.minimumSdkVersion * 1000 + ext.versionMajor * 100 + ext.versionMinor
|
|
||||||
print "versionCode = " + versionCode +"\n"
|
|
||||||
return versionCode
|
|
||||||
}
|
|
||||||
|
|
||||||
private String generateVersionName() {
|
|
||||||
String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
|
|
||||||
if (ext.versionClassifier == null && ext.isSnapshot) {
|
|
||||||
ext.versionClassifier = "SNAPSHOT"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ext.versionClassifier != null) {
|
|
||||||
versionName += "-" + ext.versionClassifier
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ext.git_version != null) {
|
|
||||||
versionName += "-" + ext.git_version
|
|
||||||
}
|
|
||||||
|
|
||||||
print "versionName = " + versionName
|
|
||||||
return versionName
|
|
||||||
}
|
|
|
@ -59,7 +59,5 @@
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<meta-data android:name="io.sentry.dsn" android:value="https://ba17f240b58144e398c862bb953256ef@o755123.ingest.sentry.io/5792286" />
|
|
||||||
</application>
|
</application>
|
||||||
|
</manifest>
|
||||||
</manifest>
|
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
}</style>
|
}</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<center><img src="file:///android_asset/ic_launcher-web.png" width="64"/></center>
|
<center><img src="file:///android_asset/icon_pilldroid.png" width="64"/></center>
|
||||||
<!--<div class="build">[[[about_string]]]</div>-->
|
<!--<div class="build">[[[about_string]]]</div>-->
|
||||||
<h5>PillDroid © 2021 Jacques Foucry </h5>
|
<h5>Pilldroid © 2022 Jacques Foucry </h5>
|
||||||
<p>PillDroid est une gestion théorique de votre stock de médicaments.</p>
|
<p>Pilldroid est une gestion théorique de votre stock de médicaments.</p>
|
||||||
<p>PillDroid n'a aucune connaissance des interactions des médicaments entre eux.</p>
|
<p>Pilldroid n'a aucune connaissance des interactions des médicaments entre eux.</p>
|
||||||
<p class="red">EN CAS DE DOUTE, CONSULTEZ VOTRE MÉDECIN OU VOTRE PHARMACIEN.</p>
|
<p class="red">EN CAS DE DOUTE, CONSULTEZ VOTRE MÉDECIN OU VOTRE PHARMACIEN.</p>
|
||||||
<p>PillDroid ne vous rappelle pas de prendre vos médicaments.</p>
|
<p>PillDroid ne vous rappelle pas de prendre vos médicaments.</p>
|
||||||
<p class="red">LA RESPONSABILITÉ DE L'AUTEUR NE SAURAIT ÊTRE ENGAGÉE EN CAS DE SURDOSAGE OU D'OUBLI DE PRISE.</p>
|
<p class="red">LA RESPONSABILITÉ DE L'AUTEUR NE SAURAIT ÊTRE ENGAGÉE EN CAS DE SURDOSAGE OU D'OUBLI DE PRISE.</p>
|
||||||
|
@ -28,9 +28,9 @@
|
||||||
<hr width=45%/>
|
<hr width=45%/>
|
||||||
<p>Les conseils et aides de <a href="https://mob-dev.fr">mob-dev.fr</a>.</p>
|
<p>Les conseils et aides de <a href="https://mob-dev.fr">mob-dev.fr</a>.</p>
|
||||||
<p>Le soutien actif et les conseils du Dr Kauffmann me permettent de faire
|
<p>Le soutien actif et les conseils du Dr Kauffmann me permettent de faire
|
||||||
évoluer PillDroid.</p>
|
évoluer Pilldroid.</p>
|
||||||
<p>Vous pouvez me contacter à l'adresse suivante : <a
|
<p>Vous pouvez me contacter à l'adresse suivante : <a
|
||||||
href="mailto:jacques+PillDroid@foucry.net?subject=À propos de
|
href="mailto:pilldroidd@foucry.net?subject=À propos de
|
||||||
PillDroid">jacques+pilldroid@foucry.net</a></p>.
|
PillDroid">jacques+pilldroid@foucry.net</a></p>.
|
||||||
<p>Le site web de l'<a href="https://pilldroid.foucry.net">application</a>.
|
<p>Le site web de l'<a href="https://pilldroid.foucry.net">application</a>.
|
||||||
</body>
|
</body>
|
||||||
|
|
BIN
app/src/main/assets/icon_pilldroid.png
Normal file
BIN
app/src/main/assets/icon_pilldroid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -96,26 +96,24 @@ public class AlarmReceiver extends BroadcastReceiver {
|
||||||
String description = context.getString(R.string.channel_description);
|
String description = context.getString(R.string.channel_description);
|
||||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
String CHANNEL_ID = "PillDroid";
|
String CHANNEL_ID = "PillDroid";
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
||||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
channel.setDescription(description);
|
||||||
channel.setDescription(description);
|
channel.enableLights(true);
|
||||||
channel.enableLights(true);
|
channel.setLightColor(R.color.led);
|
||||||
channel.setLightColor(R.color.led);
|
channel.enableVibration(true);
|
||||||
channel.enableVibration(true);
|
channel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
|
||||||
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
|
||||||
// Register the channel with the system; you can't change the importance
|
// or other notification behaviors after this
|
||||||
// or other notification behaviors after this
|
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
|
||||||
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
|
try {
|
||||||
try {
|
notificationManager.createNotificationChannel(channel);
|
||||||
notificationManager.createNotificationChannel(channel);
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
// This will catch any exception, because they are all descended from Exception
|
||||||
// This will catch any exception, because they are all descended from Exception
|
Log.e(TAG, e.toString());
|
||||||
Log.e(TAG, e.toString());
|
//At the level Exception Class handle the error in Exception Table
|
||||||
//At the level Exception Class handle the error in Exception Table
|
// Exception Create That Error Object and throw it
|
||||||
// Exception Create That Error Object and throw it
|
//E.g: FileNotFoundException ,etc
|
||||||
//E.g: FileNotFoundException ,etc
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void scheduleAlarm(Context context) {
|
public static void scheduleAlarm(Context context) {
|
||||||
|
@ -150,4 +148,4 @@ public class AlarmReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
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(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
23
app/src/main/java/net/foucry/pilldroid/BarcodeValues.java
Normal file
23
app/src/main/java/net/foucry/pilldroid/BarcodeValues.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package net.foucry.pilldroid;
|
||||||
|
|
||||||
|
public class BarcodeValues {
|
||||||
|
private final String mFormat;
|
||||||
|
private final String mContent;
|
||||||
|
|
||||||
|
public BarcodeValues(String format, String content) {
|
||||||
|
mFormat = format;
|
||||||
|
mContent = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String format() {
|
||||||
|
return mFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String content() {
|
||||||
|
return mContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return mFormat == null && mContent == null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,19 @@
|
||||||
package net.foucry.pilldroid;
|
package net.foucry.pilldroid;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.journeyapps.barcodescanner.BarcodeCallback;
|
||||||
|
import com.journeyapps.barcodescanner.BarcodeResult;
|
||||||
import com.journeyapps.barcodescanner.CaptureManager;
|
import com.journeyapps.barcodescanner.CaptureManager;
|
||||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||||
import com.journeyapps.barcodescanner.ViewfinderView;
|
import com.journeyapps.barcodescanner.ViewfinderView;
|
||||||
|
@ -19,39 +23,59 @@ import java.util.Random;
|
||||||
/**
|
/**
|
||||||
* Custom Scanner Activity extending from Activity to display a custom layout form scanner view.
|
* Custom Scanner Activity extending from Activity to display a custom layout form scanner view.
|
||||||
*/
|
*/
|
||||||
public class CustomScannerActivity extends Activity implements
|
public class CustomScannerActivity extends Activity implements DecoratedBarcodeView.TorchListener {
|
||||||
DecoratedBarcodeView.TorchListener {
|
|
||||||
|
private static final String TAG = CustomScannerActivity.class.getName();
|
||||||
|
|
||||||
private CaptureManager capture;
|
private CaptureManager capture;
|
||||||
private DecoratedBarcodeView barcodeScannerView;
|
private DecoratedBarcodeView barcodeScannerView;
|
||||||
private ImageButton switchFlashlightButton;
|
private ImageButton switchFlashlightButton;
|
||||||
private ViewfinderView viewfinderView;
|
private ViewfinderView viewfinderView;
|
||||||
|
|
||||||
|
final Bundle captureIntentBundle = new Bundle();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_custom_scanner);
|
setContentView(R.layout.activity_custom_scanner);
|
||||||
|
|
||||||
barcodeScannerView = findViewById(R.id.zxing_barcode_scanner);
|
//barcodeScannerView.setTorchListener(this);
|
||||||
barcodeScannerView.setTorchListener(this);
|
|
||||||
|
|
||||||
|
findViewById(R.id.keyboard_button).setOnClickListener(this::onKeyboard);
|
||||||
|
findViewById(R.id.cancel_button).setOnClickListener(this::onCancel);
|
||||||
|
findViewById(R.id.switch_flashlight).setOnClickListener(this::switchFlashlight);
|
||||||
switchFlashlightButton = findViewById(R.id.switch_flashlight);
|
switchFlashlightButton = findViewById(R.id.switch_flashlight);
|
||||||
|
|
||||||
viewfinderView = findViewById(R.id.zxing_viewfinder_view);
|
viewfinderView = findViewById(R.id.zxing_viewfinder_view);
|
||||||
|
|
||||||
|
barcodeScannerView = findViewById(R.id.zxing_barcode_scanner);
|
||||||
|
|
||||||
// if the device does not have flashlight in its camera,
|
// if the device does not have flashlight in its camera,
|
||||||
// then remove the switch flashlight button...
|
// then remove the switch flashlight button...
|
||||||
if (!hasFlash()) {
|
if (!hasFlash()) {
|
||||||
switchFlashlightButton.setVisibility(View.GONE);
|
findViewById(R.id.switch_flashlight).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
capture = new CaptureManager(this, barcodeScannerView);
|
capture = new CaptureManager(this, barcodeScannerView);
|
||||||
capture.initializeFromIntent(getIntent(), savedInstanceState);
|
capture.initializeFromIntent(getIntent(), savedInstanceState);
|
||||||
capture.setShowMissingCameraPermissionDialog(false);
|
capture.setShowMissingCameraPermissionDialog(false);
|
||||||
capture.decode();
|
|
||||||
|
|
||||||
changeMaskColor(null);
|
//changeMaskColor(null);
|
||||||
changeLaserVisibility(true);
|
changeLaserVisibility(true);
|
||||||
|
barcodeScannerView.decodeSingle(new BarcodeCallback() {
|
||||||
|
@Override
|
||||||
|
public void barcodeResult(BarcodeResult result) {
|
||||||
|
Intent scanResult = new Intent();
|
||||||
|
//Bundle scanResultBundle = new Bundle();
|
||||||
|
scanResult.putExtra("Barcode Content", result.getText());
|
||||||
|
scanResult.putExtra("Barcode Format name", result.getBarcodeFormat().name());
|
||||||
|
scanResult.putExtra("returnCode", captureIntentBundle.getInt("returnCode"));
|
||||||
|
scanResult.putExtra("resultCode", 1);
|
||||||
|
CustomScannerActivity.this.setResult(RESULT_OK, scanResult);
|
||||||
|
Log.d(TAG, "scanResult == " + scanResult);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,6 +109,7 @@ public class CustomScannerActivity extends Activity implements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the device's camera has a Flashlight.
|
* Check if the device's camera has a Flashlight.
|
||||||
|
*
|
||||||
* @return true if there is Flashlight, otherwise false.
|
* @return true if there is Flashlight, otherwise false.
|
||||||
*/
|
*/
|
||||||
private boolean hasFlash() {
|
private boolean hasFlash() {
|
||||||
|
@ -93,10 +118,13 @@ public class CustomScannerActivity extends Activity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void switchFlashlight(View view) {
|
public void switchFlashlight(View view) {
|
||||||
|
Log.d(TAG, "Switch torch");
|
||||||
if (switchFlashlightButton.isActivated()) {
|
if (switchFlashlightButton.isActivated()) {
|
||||||
barcodeScannerView.setTorchOff();
|
barcodeScannerView.setTorchOff();
|
||||||
|
switchFlashlightButton.setActivated(false);
|
||||||
} else {
|
} else {
|
||||||
barcodeScannerView.setTorchOn();
|
barcodeScannerView.setTorchOn();
|
||||||
|
switchFlashlightButton.setActivated(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,13 +138,13 @@ public class CustomScannerActivity extends Activity implements
|
||||||
viewfinderView.setLaserVisibility(visible);
|
viewfinderView.setLaserVisibility(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTorchOn() {
|
public void onTorchOn() {
|
||||||
|
Log.d(TAG, "TorchON");
|
||||||
switchFlashlightButton.setActivated(true);
|
switchFlashlightButton.setActivated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTorchOff() {
|
public void onTorchOff() {
|
||||||
|
Log.d(TAG, "TorchOFF");
|
||||||
switchFlashlightButton.setActivated(false);
|
switchFlashlightButton.setActivated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,14 +153,20 @@ public class CustomScannerActivity extends Activity implements
|
||||||
capture.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
capture.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onKeyboard(View view) {
|
public void onKeyboard(View view) {
|
||||||
setResult(3);
|
Log.d(TAG, "onkeyboard");
|
||||||
|
Intent resultIntent = new Intent();
|
||||||
|
resultIntent.putExtra("returnCode",3);
|
||||||
|
CustomScannerActivity.this.setResult(RESULT_OK, resultIntent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCancel(View view) {
|
public void onCancel(View view) {
|
||||||
setResult(2);
|
Log.d(TAG, "onCancel");
|
||||||
|
Intent resultIntent = new Intent();
|
||||||
|
resultIntent.putExtra("returnCode", 2);
|
||||||
|
CustomScannerActivity.this.setResult(RESULT_OK, resultIntent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,10 @@ class DBDrugs extends SQLiteOpenHelper {
|
||||||
|
|
||||||
public boolean isDBFileExist(File database)
|
public boolean isDBFileExist(File database)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
myContext.getDatabasePath(String.valueOf(database));
|
myContext.getDatabasePath(String.valueOf(database));
|
||||||
} catch (final Exception exception) {
|
}
|
||||||
|
catch (final Exception e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -108,9 +109,8 @@ class DBDrugs extends SQLiteOpenHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() {
|
public synchronized void close() {
|
||||||
if (myDataBase != null) {
|
assert false;
|
||||||
myDataBase.close();
|
myDataBase.close();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,7 +154,7 @@ class DBDrugs extends SQLiteOpenHelper {
|
||||||
drug.setAlertThreshold(7);
|
drug.setAlertThreshold(7);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
Log.d(TAG, "getDrug(" + cip13 + ")" + drug.toString());
|
Log.d(TAG, "getDrug(" + cip13 + ")" + drug);
|
||||||
|
|
||||||
// Return drug
|
// Return drug
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ class DBDrugs extends SQLiteOpenHelper {
|
||||||
drug.setAlertThreshold(7);
|
drug.setAlertThreshold(7);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
Log.d(TAG, "getDrug(" + cip7 + ")" + drug.toString());
|
Log.d(TAG, "getDrug(" + cip7 + ")" + drug);
|
||||||
|
|
||||||
// Return drug
|
// Return drug
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
drug.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
|
drug.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
|
||||||
}
|
}
|
||||||
// Log
|
// Log
|
||||||
Log.d(TAG, "getDrug("+id+")" + drug.toString());
|
Log.d(TAG, "getDrug("+id+")" + drug);
|
||||||
|
|
||||||
assert cursor != null;
|
assert cursor != null;
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
@ -212,7 +212,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
assert cursor != null;
|
assert cursor != null;
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
||||||
Log.d(TAG, "getDrug(" + cip13 + ")" + drug.toString());
|
Log.d(TAG, "getDrug(" + cip13 + ")" + drug);
|
||||||
|
|
||||||
return drug;
|
return drug;
|
||||||
}
|
}
|
||||||
|
@ -274,10 +274,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log.d(TAG, "Before sort == " + drugs.toString());
|
Log.d(TAG, "Before sort == " + drugs);
|
||||||
|
|
||||||
/*drugs.sort(Comparator.comparing(Drug::getDateEndOfStock)
|
|
||||||
.thenComparing(Drug::getStock));*/
|
|
||||||
|
|
||||||
drugs.sort(new Comparator<Drug>() {
|
drugs.sort(new Comparator<Drug>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -288,7 +285,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
return (int) (lhs.getStock() - rhs.getStock());
|
return (int) (lhs.getStock() - rhs.getStock());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Log.d(TAG, "After sort " + drugs.toString());
|
Log.d(TAG, "After sort " + drugs);
|
||||||
|
|
||||||
// Move drug with prise = 0 at the end of the list
|
// Move drug with prise = 0 at the end of the list
|
||||||
// todo: If some drug moved, must redo all the loop
|
// todo: If some drug moved, must redo all the loop
|
||||||
|
@ -320,7 +317,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
// Get reference to writable DB
|
// Get reference to writable DB
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
|
|
||||||
// Create ContentValues to add columnm/value
|
// Create ContentValues to add column/value
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(KEY_ID, drug.getId());
|
values.put(KEY_ID, drug.getId());
|
||||||
values.put(KEY_CIS, drug.getCis());
|
values.put(KEY_CIS, drug.getCis());
|
||||||
|
@ -336,14 +333,14 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
String[] selectionArgs = { String.valueOf(drug.getId()) };
|
String[] selectionArgs = { String.valueOf(drug.getId()) };
|
||||||
|
|
||||||
db.update(TABLE_DRUG, // table
|
db.update(TABLE_DRUG, // table
|
||||||
values, // column/value
|
values, // column/value
|
||||||
KEY_ID + " = ?", // selections
|
KEY_ID + " = ?", // selections
|
||||||
selectionArgs);
|
selectionArgs);
|
||||||
|
|
||||||
// Close DB
|
// Close DB
|
||||||
db.close();
|
db.close();
|
||||||
Log.d(TAG, "values == " + values.toString());
|
Log.d(TAG, "values == " + values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class Drug implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
void newStock() {
|
void newStock() {
|
||||||
Log.d(TAG, "current drug = " + this.toString());
|
Log.d(TAG, "current drug = " + this);
|
||||||
|
|
||||||
Date lastUpdate = new Date(getDateLastUpdate());
|
Date lastUpdate = new Date(getDateLastUpdate());
|
||||||
|
|
||||||
|
|
|
@ -29,25 +29,25 @@ public class DrugDetailActivity extends AppCompatActivity {
|
||||||
|
|
||||||
Drug drug;
|
Drug drug;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
|
||||||
/* fetching the string passed with intent using ‘extras’*/
|
/* fetching the string passed with intent using ‘extras’*/
|
||||||
|
|
||||||
assert extras != null;
|
assert bundle != null;
|
||||||
drug = (Drug) extras.getSerializable("drug");
|
drug = (Drug) bundle.getSerializable("drug");
|
||||||
|
|
||||||
assert drug != null;
|
assert drug != null;
|
||||||
Log.d(TAG, "drug == " + drug.toString());
|
Log.d(TAG, "drug == " + drug);
|
||||||
|
|
||||||
|
/* fetching the string passed with intent using ‘bundle’*/
|
||||||
|
|
||||||
setContentView(R.layout.activity_drug_detail);
|
setContentView(R.layout.activity_drug_detail);
|
||||||
Toolbar toolbar = findViewById(detail_toolbar);
|
Toolbar toolbar = findViewById(detail_toolbar);
|
||||||
|
|
||||||
|
|
||||||
if (toolbar != null) {
|
if (toolbar != null) {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package net.foucry.pilldroid;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.activity.result.contract.ActivityResultContract;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
public class DrugDetailContract extends ActivityResultContract<Intent, Integer> {
|
||||||
|
/**
|
||||||
|
* Create an intent that can be used for {@link Activity#startActivityForResult}
|
||||||
|
*
|
||||||
|
* @param context Context
|
||||||
|
* @param input Drug
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Intent createIntent(@NonNull Context context, Intent input) {
|
||||||
|
Intent intent = new Intent(context, DrugDetailActivity.class);
|
||||||
|
|
||||||
|
intent.putExtra("Drug", input.getExtras());
|
||||||
|
return (intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert result obtained from to O
|
||||||
|
* @param resultCode Integer
|
||||||
|
* @param intent Intent
|
||||||
|
* @return Integer
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer parseResult(int resultCode, @Nullable Intent intent) {
|
||||||
|
|
||||||
|
return resultCode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,13 +80,13 @@ public class DrugDetailFragment extends Fragment {
|
||||||
presentationView = detailView.findViewById(R.id.presentation_cell);
|
presentationView = detailView.findViewById(R.id.presentation_cell);
|
||||||
TextView presentationLabel = presentationView.findViewById(R.id.label);
|
TextView presentationLabel = presentationView.findViewById(R.id.label);
|
||||||
TextView presentationValue = presentationView.findViewById(R.id.value);
|
TextView presentationValue = presentationView.findViewById(R.id.value);
|
||||||
presentationLabel.setText(R.string.drug_presention_labal);
|
presentationLabel.setText(R.string.drug_presentation_label);
|
||||||
presentationValue.setText(drug.getPresentation());
|
presentationValue.setText(drug.getPresentation());
|
||||||
|
|
||||||
adminModeView = detailView.findViewById(R.id.administration_cell);
|
adminModeView = detailView.findViewById(R.id.administration_cell);
|
||||||
TextView adminModeLabel = adminModeView.findViewById(R.id.label);
|
TextView adminModeLabel = adminModeView.findViewById(R.id.label);
|
||||||
TextView adminModeValue = adminModeView.findViewById(R.id.value);
|
TextView adminModeValue = adminModeView.findViewById(R.id.value);
|
||||||
adminModeLabel.setText(R.string.drug_administationMode_label);
|
adminModeLabel.setText(R.string.drug_administrationMode_label);
|
||||||
adminModeValue.setText(drug.getAdministration_mode());
|
adminModeValue.setText(drug.getAdministration_mode());
|
||||||
|
|
||||||
stockView = detailView.findViewById(R.id.stock_cell);
|
stockView = detailView.findViewById(R.id.stock_cell);
|
||||||
|
@ -108,17 +108,17 @@ public class DrugDetailFragment extends Fragment {
|
||||||
warningView = detailView.findViewById(R.id.warning_cell);
|
warningView = detailView.findViewById(R.id.warning_cell);
|
||||||
TextView warningLibelle = warningView.findViewById(R.id.label);
|
TextView warningLibelle = warningView.findViewById(R.id.label);
|
||||||
TextView warningValue = warningView.findViewById(R.id.value);
|
TextView warningValue = warningView.findViewById(R.id.value);
|
||||||
warningLibelle.setText(R.string.drug_warningTherehold_label);
|
warningLibelle.setText(R.string.drug_warningThreshold_label);
|
||||||
warningValue.setText(Integer.toString(drug.getWarnThreshold()));
|
warningValue.setText(Integer.toString(drug.getWarnThreshold()));
|
||||||
warningValue.setHint(R.string.drug_warningTherehold_label);
|
warningValue.setHint(R.string.drug_warningThreshold_label);
|
||||||
warningValue.setSelectAllOnFocus(true);
|
warningValue.setSelectAllOnFocus(true);
|
||||||
|
|
||||||
alertView = detailView.findViewById(R.id.alert_cell);
|
alertView = detailView.findViewById(R.id.alert_cell);
|
||||||
TextView alertLibelle = alertView.findViewById(R.id.label);
|
TextView alertLibelle = alertView.findViewById(R.id.label);
|
||||||
TextView alertValue = alertView.findViewById(R.id.value);
|
TextView alertValue = alertView.findViewById(R.id.value);
|
||||||
alertLibelle.setText(R.string.drug_alertTherehold_label);
|
alertLibelle.setText(R.string.drug_alertThreshold_label);
|
||||||
alertValue.setText(Integer.toString(drug.getAlertThreshold()));
|
alertValue.setText(Integer.toString(drug.getAlertThreshold()));
|
||||||
alertValue.setHint(R.string.drug_alertTherehold_label);
|
alertValue.setHint(R.string.drug_alertThreshold_label);
|
||||||
alertValue.setSelectAllOnFocus(true);
|
alertValue.setSelectAllOnFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package net.foucry.pilldroid;
|
package net.foucry.pilldroid;
|
||||||
|
|
||||||
|
import static net.foucry.pilldroid.UtilDate.date2String;
|
||||||
|
import static net.foucry.pilldroid.Utils.intRandomExclusive;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
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.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -21,6 +24,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
@ -28,17 +32,13 @@ import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.zxing.client.android.Intents;
|
import com.google.zxing.client.android.Intents;
|
||||||
import com.google.zxing.integration.android.IntentIntegrator;
|
import com.journeyapps.barcodescanner.ScanOptions;
|
||||||
import com.google.zxing.integration.android.IntentResult;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static net.foucry.pilldroid.UtilDate.date2String;
|
|
||||||
import static net.foucry.pilldroid.Utils.intRandomExclusive;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An activity representing a list of Drugs is activity
|
* An activity representing a list of Drugs is activity
|
||||||
* has different presentations for handset and tablet-size devices. On
|
* has different presentations for handset and tablet-size devices. On
|
||||||
|
@ -53,11 +53,16 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
* device.
|
* device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: Change DEMO/DBDEMO form static to non-static. In order to create fake data at only at launchtime
|
// TODO: Change DEMO/DBDEMO form static to non-static. In order to create fake data at only at launch time
|
||||||
final Boolean DEMO = false;
|
final Boolean DEMO = false;
|
||||||
final Boolean DBDEMO = false;
|
final Boolean DBDEMO = false;
|
||||||
|
|
||||||
public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;
|
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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start tutorial
|
* Start tutorial
|
||||||
|
@ -74,8 +79,8 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
nm.cancelAll();
|
nm.cancelAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
// tuto
|
// tutorial
|
||||||
Log.i(TAG, "Launch tuto");
|
Log.i(TAG, "Launch tutorial");
|
||||||
startActivity(new Intent(this, WelcomeActivity.class));
|
startActivity(new Intent(this, WelcomeActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +98,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private SimpleItemRecyclerViewAdapter mAdapter;
|
private SimpleItemRecyclerViewAdapter mAdapter;
|
||||||
|
|
||||||
public void constructDrugsList()
|
public void constructDrugsList() {
|
||||||
{
|
|
||||||
dbHelper = new DBHelper(getApplicationContext());
|
dbHelper = new DBHelper(getApplicationContext());
|
||||||
|
|
||||||
if (!(drugs == null)) {
|
if (!(drugs == null)) {
|
||||||
|
@ -109,15 +113,14 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
setupRecyclerView((RecyclerView) mRecyclerView);
|
setupRecyclerView((RecyclerView) mRecyclerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_drug_list);
|
setContentView(R.layout.activity_drug_list);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
dbHelper = new DBHelper(this);
|
||||||
dbHelper = new DBHelper(this);
|
|
||||||
}
|
|
||||||
dbDrug = new DBDrugs(this);
|
dbDrug = new DBDrugs(this);
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
@ -139,10 +142,10 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
// String presentation,double stock, double prise, int warn, int alert
|
// String presentation,double stock, double prise, int warn, int alert
|
||||||
|
|
||||||
// Limit for randoms generator
|
// Limit for randoms generator
|
||||||
final int min_stock=5;
|
final int min_stock = 5;
|
||||||
final int max_stock=50;
|
final int max_stock = 50;
|
||||||
final int min_prise=0;
|
final int min_prise = 0;
|
||||||
final int max_prise=3;
|
final int max_prise = 3;
|
||||||
|
|
||||||
dbHelper.addDrug(new Drug("60000011", "3400930000011", "Médicament test 01", "orale",
|
dbHelper.addDrug(new Drug("60000011", "3400930000011", "Médicament test 01", "orale",
|
||||||
"plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
|
"plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
|
||||||
|
@ -177,6 +180,68 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mBarcodeScannerLauncher = registerForActivityResult(new PilldroidScanContract(),
|
||||||
|
result -> {
|
||||||
|
if (result.getContents() == null) {
|
||||||
|
Intent originalIntent = result.getOriginalIntent();
|
||||||
|
Bundle bundle = originalIntent.getExtras();
|
||||||
|
if (originalIntent.hasExtra(Intents.Scan.MISSING_CAMERA_PERMISSION)) {
|
||||||
|
Log.d(TAG, "Missing camera permission");
|
||||||
|
Toast.makeText(this, R.string.missing_camera_permission, Toast.LENGTH_LONG).show();
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "bundle == " + bundle.getInt("returnCode"));
|
||||||
|
int returnCode = bundle.getInt("returnCode");
|
||||||
|
int resultCode = bundle.getInt("resultCode");
|
||||||
|
|
||||||
|
if (resultCode != 1) {
|
||||||
|
if (returnCode == 3) {
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Toast.makeText(this, "Keyboard input",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
Log.d(TAG, "Keyboard Input");
|
||||||
|
showInputDialog();
|
||||||
|
} else if (returnCode == 2) {
|
||||||
|
Toast.makeText(this, R.string.cancelled_scan, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "Scanned");
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Toast.makeText(this, "Scanned: " + bundle.getString(BARCODE_FORMAT_NAME),
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
String cip13;
|
||||||
|
|
||||||
|
// Handle successful scan
|
||||||
|
|
||||||
|
Log.d(TAG, "formatName = " + bundle.getString(BARCODE_FORMAT_NAME));
|
||||||
|
|
||||||
|
switch (bundle.getString(BARCODE_FORMAT_NAME)) {
|
||||||
|
case "CODE_128":
|
||||||
|
case "EAN_13": //CODE_128 || EAN 13
|
||||||
|
cip13 = bundle.getString(BARCODE_CONTENT);
|
||||||
|
break;
|
||||||
|
case "CODE_39":
|
||||||
|
cip13 = dbDrug.getCIP13FromCIP7(bundle.getString(BARCODE_CONTENT));
|
||||||
|
break;
|
||||||
|
case "DATA_MATRIX":
|
||||||
|
cip13 = bundle.getString(BARCODE_CONTENT).substring(4, 17);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
scanNotOK();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Drug from database
|
||||||
|
final Drug scannedDrug = dbDrug.getDrugByCIP13(cip13);
|
||||||
|
|
||||||
|
// add Drug to prescription database
|
||||||
|
askToAddInDB(scannedDrug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
constructDrugsList();
|
constructDrugsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,9 +267,27 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
/*if (requestCode != CUSTOMIZED_REQUEST_CODE && requestCode != IntentIntegrator.REQUEST_CODE) {
|
||||||
|
// This is important, otherwise the result will not be passed to the fragment
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
if (requestCode == CUSTOMIZED_REQUEST_CODE) {
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Toast.makeText(this, "REQUEST_CODE = " + requestCode +
|
||||||
|
"RESULT_CODE = " + resultCode, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
||||||
|
constructDrugsList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
Log.d(TAG, "onPause really!");
|
Log.d(TAG, "onPause");
|
||||||
AlarmReceiver.scheduleAlarm(this);
|
AlarmReceiver.scheduleAlarm(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,89 +295,24 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** scanNow
|
|
||||||
*
|
|
||||||
* @param view
|
|
||||||
* call ZXing Library to scan a new QR/EAN code
|
|
||||||
*/
|
|
||||||
public void scanNow(View view) {
|
|
||||||
new IntentIntegrator(this).setOrientationLocked(false).setCaptureActivity(CustomScannerActivity.class).initiateScan();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// Launch scan
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onButtonClick() {
|
||||||
if (requestCode != CUSTOMIZED_REQUEST_CODE && requestCode != IntentIntegrator.REQUEST_CODE) {
|
Log.d(TAG, "add medication");
|
||||||
// This is important, otherwise the result will not be passed to the fragment
|
ScanOptions options = new ScanOptions();
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_39,
|
||||||
return;
|
ScanOptions.CODE_128);
|
||||||
}
|
options.setCameraId(0); // Use a specific camera of the device
|
||||||
if (requestCode == CUSTOMIZED_REQUEST_CODE) {
|
options.setBeepEnabled(true);
|
||||||
if (BuildConfig.DEBUG) { Toast.makeText(this, "REQUEST_CODE = " + requestCode +
|
options.setBarcodeImageEnabled(true);
|
||||||
"RESULT_CODE = " + resultCode, Toast.LENGTH_LONG).show(); }
|
//options.setTimeout(3600);
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
options.setCaptureActivity(CustomScannerActivity.class);
|
||||||
constructDrugsList();
|
options.setBeepEnabled(true);
|
||||||
} else {
|
options.addExtra(Intents.Scan.SCAN_TYPE, Intents.Scan.MIXED_SCAN);
|
||||||
IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);
|
options.addExtra(Intents.Scan.SCAN_TYPE, Intents.Scan.INVERTED_SCAN);
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) { Toast.makeText(this, "REQUEST_CODE = " + requestCode,
|
Log.d(TAG, "scanOptions == " + options);
|
||||||
Toast.LENGTH_LONG).show(); }
|
mBarcodeScannerLauncher.launch(options);
|
||||||
|
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + "resultCode = " + resultCode);
|
|
||||||
if (result.getContents() == null) {
|
|
||||||
Intent originalIntent = result.getOriginalIntent();
|
|
||||||
if (originalIntent == null) {
|
|
||||||
if (resultCode == 3) {
|
|
||||||
if(BuildConfig.DEBUG) { Toast.makeText(this, "Keyboard input",
|
|
||||||
Toast.LENGTH_SHORT).show(); }
|
|
||||||
Log.d(TAG, "Keyboard Input");
|
|
||||||
showInputDialog();
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Cancelled scan");
|
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
|
||||||
}
|
|
||||||
if(BuildConfig.DEBUG) { Toast.makeText(this, "Cancelled",
|
|
||||||
Toast.LENGTH_LONG).show(); }
|
|
||||||
} else if (originalIntent.hasExtra(Intents.Scan.MISSING_CAMERA_PERMISSION)) {
|
|
||||||
Log.d(TAG, "Cancelled scan due to missing camera permission");
|
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
|
||||||
Toast.makeText(this, "Cancelled due to missing camera permission", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Scanned");
|
|
||||||
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
|
|
||||||
Log.d(TAG, "result.getContents = " + result.getContents());
|
|
||||||
Log.d(TAG, "format = " + result.getFormatName());
|
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) { Toast.makeText(this, "Scanned: " +
|
|
||||||
result.getContents(), Toast.LENGTH_LONG).show(); }
|
|
||||||
|
|
||||||
String cip13;
|
|
||||||
|
|
||||||
// Handle successful scan
|
|
||||||
|
|
||||||
Log.d(TAG, "formatName = " + result.getFormatName());
|
|
||||||
|
|
||||||
switch (result.getFormatName()) {
|
|
||||||
case "CODE_128":
|
|
||||||
case "EAN_13": //CODE_128 || EAN 13
|
|
||||||
cip13 = result.getContents();
|
|
||||||
break;
|
|
||||||
case "CODE_39":
|
|
||||||
cip13 = dbDrug.getCIP13FromCIP7(result.getContents());
|
|
||||||
break;
|
|
||||||
case "DATA_MATRIX":
|
|
||||||
cip13 = result.getContents().substring(4, 17);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
scanNotOK();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Drug from database
|
|
||||||
final Drug scannedDrug = dbDrug.getDrugByCIP13(cip13);
|
|
||||||
askToAddInDB(scannedDrug);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -316,7 +334,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
String cip13 = editText.getText().toString();
|
String cip13 = editText.getText().toString();
|
||||||
|
|
||||||
Drug aDrug = dbDrug.getDrugByCIP13(cip13);
|
Drug aDrug = dbDrug.getDrugByCIP13(cip13);
|
||||||
askToAddInDB(aDrug);
|
askToAddInDB(aDrug);
|
||||||
})
|
})
|
||||||
.setNegativeButton("Cancel",
|
.setNegativeButton("Cancel",
|
||||||
(dialog, id) -> dialog.cancel());
|
(dialog, id) -> dialog.cancel());
|
||||||
|
@ -346,6 +364,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
/**
|
/**
|
||||||
* Ask if the drug found in the database should be include in the
|
* Ask if the drug found in the database should be include in the
|
||||||
* user database
|
* user database
|
||||||
|
*
|
||||||
* @param aDrug Drug- drug to be added
|
* @param aDrug Drug- drug to be added
|
||||||
*/
|
*/
|
||||||
private void askToAddInDB(Drug aDrug) {
|
private void askToAddInDB(Drug aDrug) {
|
||||||
|
@ -375,8 +394,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
/**
|
/**
|
||||||
* Tell user that the barre code cannot be interpreted
|
* Tell user that the barre code cannot be interpreted
|
||||||
*/
|
*/
|
||||||
private void scanNotOK()
|
private void scanNotOK() {
|
||||||
{
|
|
||||||
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
|
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
|
||||||
dlg.setTitle(getString(R.string.app_name));
|
dlg.setTitle(getString(R.string.app_name));
|
||||||
|
|
||||||
|
@ -389,10 +407,12 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add New drug to the user database
|
* Add New drug to the user database
|
||||||
|
*
|
||||||
* @param aDrug Drug - drug to be added
|
* @param aDrug Drug - drug to be added
|
||||||
*/
|
*/
|
||||||
private void addDrugToList(Drug aDrug)
|
|
||||||
{
|
@SuppressWarnings("deprecation")
|
||||||
|
private void addDrugToList(Drug aDrug) {
|
||||||
aDrug.setDateEndOfStock();
|
aDrug.setDateEndOfStock();
|
||||||
mAdapter.addItem(aDrug);
|
mAdapter.addItem(aDrug);
|
||||||
|
|
||||||
|
@ -400,11 +420,24 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
Context context = this;
|
Context context = this;
|
||||||
Intent intent = new Intent(context, DrugDetailActivity.class);
|
Intent intent = new Intent(context, DrugDetailActivity.class);
|
||||||
intent.putExtra("drug", aDrug);
|
intent.putExtra("drug", aDrug);
|
||||||
|
|
||||||
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
||||||
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* setupRecyclerView (list of drugs
|
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) : "???");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setupRecyclerView (list of drugs)
|
||||||
|
*
|
||||||
* @param recyclerView RecyclerView
|
* @param recyclerView RecyclerView
|
||||||
*/
|
*/
|
||||||
private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
|
private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||||
|
@ -413,21 +446,13 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
recyclerView.setAdapter(mAdapter);
|
recyclerView.setAdapter(mAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
* SimpleItemRecyclerViewAdapter
|
||||||
*/
|
*/
|
||||||
public class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> {
|
public class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> {
|
||||||
|
|
||||||
private final List<Drug> mValues;
|
private final List<Drug> mValues;
|
||||||
|
|
||||||
SimpleItemRecyclerViewAdapter(List<Drug> items) {
|
SimpleItemRecyclerViewAdapter(List<Drug> items) {
|
||||||
mValues = items;
|
mValues = items;
|
||||||
}
|
}
|
||||||
|
@ -452,6 +477,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void onBindViewHolder(final ViewHolder holder, int dummy) {
|
public void onBindViewHolder(final ViewHolder holder, int dummy) {
|
||||||
final int position = holder.getBindingAdapterPosition();
|
final int position = holder.getBindingAdapterPosition();
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE d MMMM yyyy", Locale.getDefault());
|
SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE d MMMM yyyy", Locale.getDefault());
|
||||||
|
@ -473,6 +499,19 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
if (mValues.get(position).getTake() == 0) {
|
if (mValues.get(position).getTake() == 0) {
|
||||||
holder.mView.setBackgroundResource(R.drawable.gradient_bg);
|
holder.mView.setBackgroundResource(R.drawable.gradient_bg);
|
||||||
holder.mIconView.setImageResource(R.drawable.ic_suspended_pill);
|
holder.mIconView.setImageResource(R.drawable.ic_suspended_pill);
|
||||||
|
|
||||||
|
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Drug drug = mValues.get(position);
|
||||||
|
Context context = v.getContext();
|
||||||
|
Intent intent = new Intent(context, DrugDetailActivity.class);
|
||||||
|
intent.putExtra("drug", drug);
|
||||||
|
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
||||||
|
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
int remainingStock = (int) Math.floor(mValues.get(position).getStock() / mValues.get(position).getTake());
|
int remainingStock = (int) Math.floor(mValues.get(position).getStock() / mValues.get(position).getTake());
|
||||||
if (remainingStock <= mValues.get(position).getAlertThreshold()) {
|
if (remainingStock <= mValues.get(position).getAlertThreshold()) {
|
||||||
|
@ -486,19 +525,21 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
holder.mView.setBackgroundResource(R.drawable.gradient_bg_ok);
|
holder.mView.setBackgroundResource(R.drawable.gradient_bg_ok);
|
||||||
holder.mIconView.setImageResource(R.drawable.ok_stock_vect);
|
holder.mIconView.setImageResource(R.drawable.ok_stock_vect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.mView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Drug drug = mValues.get(position);
|
||||||
|
Context context = v.getContext();
|
||||||
|
Intent intent = new Intent(context, DrugDetailActivity.class);
|
||||||
|
intent.putExtra("drug", drug);
|
||||||
|
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
||||||
|
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.mView.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Drug drugCourant = mValues.get(position);
|
|
||||||
Context context = v.getContext();
|
|
||||||
Intent intent = new Intent(context, DrugDetailActivity.class);
|
|
||||||
intent.putExtra("drug", drugCourant);
|
|
||||||
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
|
|
||||||
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -511,8 +552,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
final TextView mContentView;
|
final TextView mContentView;
|
||||||
final TextView mEndOfStock;
|
final TextView mEndOfStock;
|
||||||
final ImageView mIconView;
|
final ImageView mIconView;
|
||||||
|
public Drug mItem;
|
||||||
Drug mItem;
|
|
||||||
|
|
||||||
ViewHolder(View view) {
|
ViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
|
@ -529,4 +569,4 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import androidx.core.app.NotificationManagerCompat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by jacques on 17/09/16.
|
* Created by jacques on 17/09/16.
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +88,7 @@ public class PillDroidJobService extends JobService {
|
||||||
Log.d(TAG, "schedule notification");
|
Log.d(TAG, "schedule notification");
|
||||||
createNotificationChannel();
|
createNotificationChannel();
|
||||||
Intent intent = new Intent(this, DrugListActivity.class);
|
Intent intent = new Intent(this, DrugListActivity.class);
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,0);
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,PendingIntent.FLAG_MUTABLE);
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "PillDroid")
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "PillDroid")
|
||||||
.setSmallIcon(R.drawable.ic_pill_alarm)
|
.setSmallIcon(R.drawable.ic_pill_alarm)
|
||||||
.setContentTitle(getString(R.string.app_name))
|
.setContentTitle(getString(R.string.app_name))
|
||||||
|
@ -114,23 +113,21 @@ public class PillDroidJobService extends JobService {
|
||||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
String CHANNEL_ID = "PillDroid";
|
String CHANNEL_ID = "PillDroid";
|
||||||
NotificationChannel channel;
|
NotificationChannel channel;
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
||||||
channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
|
||||||
|
|
||||||
channel.setDescription(description);
|
channel.setDescription(description);
|
||||||
// Register the channel with the system; you can't change the importance
|
// Register the channel with the system; you can't change the importance
|
||||||
// or other notification behaviors after this
|
// or other notification behaviors after this
|
||||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||||
try {
|
try {
|
||||||
notificationManager.createNotificationChannel(channel);
|
notificationManager.createNotificationChannel(channel);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// This will catch any exception, because they are all descended from Exception
|
// This will catch any exception, because they are all descended from Exception
|
||||||
Log.e(TAG, e.toString());
|
Log.e(TAG, e.toString());
|
||||||
//At the level Exception Class handle the error in Exception Table
|
//At the level Exception Class handle the error in Exception Table
|
||||||
// Exception Create That Error Object and throw it
|
// Exception Create That Error Object and throw it
|
||||||
//E.g: FileNotFoundException ,etc
|
//E.g: FileNotFoundException ,etc
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package net.foucry.pilldroid;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.activity.result.contract.ActivityResultContract;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.zxing.client.android.Intents;
|
||||||
|
import com.journeyapps.barcodescanner.ScanIntentResult;
|
||||||
|
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) {
|
||||||
|
Log.d(TAG, "create Intent");
|
||||||
|
|
||||||
|
Intent intent = new Intent(context, CustomScannerActivity.class);
|
||||||
|
|
||||||
|
intent.setAction(Intents.Scan.ACTION);
|
||||||
|
|
||||||
|
Log.d(TAG, "intent ==" + intent);
|
||||||
|
return(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScanIntentResult parseResult(int resultCode, @Nullable Intent intent) {
|
||||||
|
return ScanIntentResult.parseActivityResult(resultCode, intent);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,11 +8,11 @@ import android.content.SharedPreferences;
|
||||||
* Created by Lincoln on 05/05/16.
|
* Created by Lincoln on 05/05/16.
|
||||||
*/
|
*/
|
||||||
public class PrefManager {
|
public class PrefManager {
|
||||||
SharedPreferences pref;
|
final SharedPreferences pref;
|
||||||
SharedPreferences.Editor editor;
|
SharedPreferences.Editor editor;
|
||||||
|
|
||||||
// shared pref mode
|
// shared pref mode
|
||||||
int PRIVATE_MODE = 0;
|
final int PRIVATE_MODE = 0;
|
||||||
|
|
||||||
// Shared preferences file name
|
// Shared preferences file name
|
||||||
private static final String PREF_NAME = "Pildroid-Prefs";
|
private static final String PREF_NAME = "Pildroid-Prefs";
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.util.Log;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParsePosition;
|
import java.text.ParsePosition;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
package net.foucry.pilldroid;
|
package net.foucry.pilldroid;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
private static final String TAG = UtilDate.class.getName();
|
private static final String TAG = Utils.class.getName();
|
||||||
|
|
||||||
|
public static final int SELECT_BARCODE_REQUEST = 2;
|
||||||
|
public static final int BARCODE_SCAN = 3;
|
||||||
|
|
||||||
public static void CopyStream(InputStream is, OutputStream os)
|
public static void CopyStream(InputStream is, OutputStream os)
|
||||||
{
|
{
|
||||||
|
@ -20,8 +29,10 @@ public class Utils {
|
||||||
break;
|
break;
|
||||||
os.write(bytes, 0, count);
|
os.write(bytes, 0, count);
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
catch(Exception ignored){}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,5 +45,4 @@ public class Utils {
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
return r.nextInt(max - min) +max;
|
return r.nextInt(max - min) +max;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -2,16 +2,20 @@ package net.foucry.pilldroid;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import android.view.WindowInsets;
|
||||||
|
import android.view.WindowInsetsController;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.viewpager.widget.PagerAdapter;
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
|
@ -41,11 +45,10 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
prefManager.setFirstTimeLaunch(false);
|
prefManager.setFirstTimeLaunch(false);
|
||||||
// Making notification bar transparent
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_welcome);
|
setContentView(R.layout.activity_welcome);
|
||||||
|
|
||||||
|
setFullScreen();
|
||||||
|
|
||||||
viewPager = findViewById(R.id.view_pager);
|
viewPager = findViewById(R.id.view_pager);
|
||||||
dotsLayout = findViewById(R.id.layoutDots);
|
dotsLayout = findViewById(R.id.layoutDots);
|
||||||
btnSkip = findViewById(R.id.btn_skip);
|
btnSkip = findViewById(R.id.btn_skip);
|
||||||
|
@ -90,7 +93,7 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// checking for last page
|
// checking for last page
|
||||||
// if last page home screen will be launched
|
// if last page home screen will be launched
|
||||||
int current = getItem(+1);
|
int current = getItem();
|
||||||
if (current < layouts.length) {
|
if (current < layouts.length) {
|
||||||
// move to next screen
|
// move to next screen
|
||||||
viewPager.setCurrentItem(current);
|
viewPager.setCurrentItem(current);
|
||||||
|
@ -118,8 +121,8 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
dots[currentPage].setTextColor(ContextCompat.getColor(this, R.color.dot_light));
|
dots[currentPage].setTextColor(ContextCompat.getColor(this, R.color.dot_light));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getItem(int i) {
|
private int getItem() {
|
||||||
return viewPager.getCurrentItem() + i;
|
return viewPager.getCurrentItem() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void launchHomeScreen() {
|
void launchHomeScreen() {
|
||||||
|
@ -129,7 +132,7 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
// viewpager change listener
|
// viewpager change listener
|
||||||
ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
|
final ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
|
@ -167,6 +170,28 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
window.setStatusBarColor(Color.TRANSPARENT);
|
window.setStatusBarColor(Color.TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private void setFullScreen(){
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
getWindow().setDecorFitsSystemWindows(false);
|
||||||
|
WindowInsetsController controller = getWindow().getInsetsController();
|
||||||
|
if(controller != null) {
|
||||||
|
controller.hide(WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars());
|
||||||
|
controller.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//noinspection
|
||||||
|
getWindow().getDecorView().setSystemUiVisibility(
|
||||||
|
View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View pager adapter
|
* View pager adapter
|
||||||
*/
|
*/
|
||||||
|
@ -175,8 +200,9 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
public MyViewPagerAdapter() {
|
public MyViewPagerAdapter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Object instantiateItem(ViewGroup container, int position) {
|
public Object instantiateItem(@NonNull ViewGroup container, int position) {
|
||||||
LayoutInflater layoutInflater = getLayoutInflater();
|
LayoutInflater layoutInflater = getLayoutInflater();
|
||||||
|
|
||||||
View view = layoutInflater.inflate(layouts[position], container, false);
|
View view = layoutInflater.inflate(layouts[position], container, false);
|
||||||
|
@ -191,13 +217,13 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isViewFromObject(View view, Object obj) {
|
public boolean isViewFromObject(@NonNull View view, @NonNull Object obj) {
|
||||||
return view == obj;
|
return view == obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
public void destroyItem(ViewGroup container, int position, @NonNull Object object) {
|
||||||
View view = (View) object;
|
View view = (View) object;
|
||||||
container.removeView(view);
|
container.removeView(view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/drug_list"
|
android:id="@+id/drug_list"
|
||||||
android:name="net.foucry.pilldroid.MedicamentListFragment"
|
android:name="net.foucry.pilldroid.MedicamentListFragment"
|
||||||
android:layout_width="@dimen/item_width"
|
android:layout_width="@dimen/item_width"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="example.zxing.CustomScannerActivity">
|
tools:context="net.foucry.pilldroid.CustomScannerActivity">
|
||||||
|
|
||||||
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||||
android:id="@+id/zxing_barcode_scanner"
|
android:id="@+id/zxing_barcode_scanner"
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
android:layout_marginEnd="@dimen/fab_margin"
|
android:layout_marginEnd="@dimen/fab_margin"
|
||||||
android:layout_marginBottom="@dimen/fab_margin"
|
android:layout_marginBottom="@dimen/fab_margin"
|
||||||
android:backgroundTint="@android:color/transparent"
|
android:backgroundTint="@android:color/transparent"
|
||||||
android:contentDescription="@string/flashlighButton"
|
android:contentDescription="@string/flashlightButton"
|
||||||
android:onClick="switchFlashlight"
|
android:onClick="switchFlashlight"
|
||||||
android:src="@drawable/ic_baseline_highlight_24" />
|
android:src="@drawable/ic_baseline_highlight_24" />
|
||||||
</com.journeyapps.barcodescanner.DecoratedBarcodeView>
|
</com.journeyapps.barcodescanner.DecoratedBarcodeView>
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
android:backgroundTint="@android:color/transparent"
|
android:backgroundTint="@android:color/transparent"
|
||||||
android:baselineAlignBottom="false"
|
android:baselineAlignBottom="false"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:onClick="scanNow"
|
android:onClick="onButtonClick"
|
||||||
android:src="@drawable/ic_add_circle_black_24dp"
|
android:src="@drawable/ic_add_circle_black_24dp"
|
||||||
app:backgroundTint="@android:color/darker_gray"
|
app:backgroundTint="@android:color/darker_gray"
|
||||||
app:fabCustomSize="60dp"
|
app:fabCustomSize="60dp"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
app:zxing_result_view="@color/zxing_custom_result_view"
|
app:zxing_result_view="@color/zxing_custom_result_view"
|
||||||
app:zxing_viewfinder_laser="@color/zxing_custom_viewfinder_laser"
|
app:zxing_viewfinder_laser="@color/zxing_custom_viewfinder_laser"
|
||||||
app:zxing_viewfinder_laser_visibility="true"
|
app:zxing_viewfinder_laser_visibility="true"
|
||||||
app:zxing_viewfinder_mask="@color/zxing_custom_viewfinder_mask" />
|
app:zxing_viewfinder_mask="@color/grey"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/zxing_status_view"
|
android:id="@+id/zxing_status_view"
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
android:textSize="32sp"
|
android:textSize="32sp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="@string/zxing_msg_default_status"
|
android:text="@string/zxing_msg_default_status"
|
||||||
android:textColor="@color/design_default_color_primary_dark"
|
android:textColor="@color/white"
|
||||||
tools:ignore="PrivateResource" />
|
tools:ignore="PrivateResource" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
android:backgroundTint="@android:color/transparent"
|
android:backgroundTint="@android:color/transparent"
|
||||||
android:contentDescription="@string/button_keyboard"
|
android:contentDescription="@string/button_keyboard"
|
||||||
android:onClick="onKeyboard"
|
android:onClick="onKeyboard"
|
||||||
android:src="@drawable/ic_keyboard_black_24dp" />
|
android:src="@drawable/ic_keyboard_black_24dp"
|
||||||
|
tools:ignore="PrivateResource" />
|
||||||
|
|
||||||
</merge>
|
</merge>
|
|
@ -10,7 +10,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="@dimen/img_width_height"
|
android:layout_width="@dimen/img_width_height"
|
||||||
android:layout_height="@dimen/img_width_height"
|
android:layout_height="@dimen/img_width_height"
|
||||||
android:contentDescription="@string/barre_code_icone"
|
android:contentDescription="@string/barcode_icon"
|
||||||
android:src="@drawable/ic_barcode" />
|
android:src="@drawable/ic_barcode" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="@dimen/screen_shot_height"
|
android:layout_width="@dimen/screen_shot_height"
|
||||||
android:layout_height="@dimen/screen_shot_height"
|
android:layout_height="@dimen/screen_shot_height"
|
||||||
android:contentDescription="@string/tunables"
|
android:contentDescription="@string/tunable"
|
||||||
android:src="@drawable/tunable" />
|
android:src="@drawable/tunable" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
0
app/src/main/res/mipmap-anydpi
Normal file
0
app/src/main/res/mipmap-anydpi
Normal file
|
@ -3,22 +3,22 @@
|
||||||
<string name="title_drug_detail">Détail Médicament</string>
|
<string name="title_drug_detail">Détail Médicament</string>
|
||||||
<string name="button_cancel">Annuler</string>
|
<string name="button_cancel">Annuler</string>
|
||||||
<string name="button_ok">OK</string>
|
<string name="button_ok">OK</string>
|
||||||
<string name="drug_presention_labal">Présentation</string>
|
<string name="drug_presentation_label">Présentation</string>
|
||||||
<string name="drug_name_label">Nom</string>
|
<string name="drug_name_label">Nom</string>
|
||||||
<string name="drug_administationMode_label">Mode d\'adminitration</string>
|
<string name="drug_administrationMode_label">Mode d\'adminitration</string>
|
||||||
<string name="msgNotFound">Médicament introuvable dans la base de données</string>
|
<string name="msgNotFound">Médicament introuvable dans la base de données</string>
|
||||||
<string name="about">À propos</string>
|
<string name="about">À propos</string>
|
||||||
<string name="help">Aide</string>
|
<string name="help">Aide</string>
|
||||||
<string name="drug_take_label">Prise</string>
|
<string name="drug_take_label">Prise</string>
|
||||||
<string name="drug_alertTherehold_label">Seuil critique</string>
|
<string name="drug_alertThreshold_label">Seuil critique</string>
|
||||||
<string name="drug_warningTherehold_label">Seuil d\'alerte</string>
|
<string name="drug_warningThreshold_label">Seuil d\'alerte</string>
|
||||||
<string name="msgFound">Médicament trouvé dans la base de données</string>
|
<string name="msgFound">Médicament trouvé dans la base de données</string>
|
||||||
<string name="drug_current_stock_label">Stock courant</string>
|
<string name="drug_current_stock_label">Stock courant</string>
|
||||||
<string name="notification_text">Vous devez passer à la pharmacie</string>
|
<string name="notification_text">Vous devez passer à la pharmacie</string>
|
||||||
<string name="button_keyboard">Utilisez le clavier</string>
|
<string name="button_keyboard">Utilisez le clavier</string>
|
||||||
<string name="detail_view">Vue de détail</string>
|
<string name="detail_view">Vue de détail</string>
|
||||||
<string name="save_button">Enrefistrez</string>
|
<string name="save_button">Enrefistrez</string>
|
||||||
<string name="flashlighButton">Allumez/Éteignez le Flash</string>
|
<string name="flashlightButton">Allumez/Éteignez le Flash</string>
|
||||||
<string name="enter_cip_13_here">Enter cip 13 here..</string>
|
<string name="enter_cip_13_here">Enter cip 13 here..</string>
|
||||||
<string name="enter_cip_13">Enter CIP 13</string>
|
<string name="enter_cip_13">Enter CIP 13</string>
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@
|
||||||
<string name="the_plus_icon">L\'icône Plus</string>
|
<string name="the_plus_icon">L\'icône Plus</string>
|
||||||
<string name="slide4_desc">Pour trouver le CIP13</string>
|
<string name="slide4_desc">Pour trouver le CIP13</string>
|
||||||
<string name="happy_face">Visage souriant</string>
|
<string name="happy_face">Visage souriant</string>
|
||||||
<string name="barre_code_icone">Icône de code barre</string>
|
<string name="barcode_icon">Icône de code barre</string>
|
||||||
<string name="qr_code_icon">icône de QR-Code</string>
|
<string name="qr_code_icon">icône de QR-Code</string>
|
||||||
<string name="neutral_face">Visage neutre</string>
|
<string name="neutral_face">Visage neutre</string>
|
||||||
<string name="unhappy_face">Visage grincheux</string>
|
<string name="unhappy_face">Visage grincheux</string>
|
||||||
<string name="drug_info">Capture d\'écran sur la partie information du médicament</string>
|
<string name="drug_info">Capture d\'écran sur la partie information du médicament</string>
|
||||||
<string name="tunables">Réglages</string>
|
<string name="tunable">Réglages</string>
|
||||||
<string name="slide10_desc">Mettre la prise à zéro suspend le traitement et les calculs de stock</string>
|
<string name="slide10_desc">Mettre la prise à zéro suspend le traitement et les calculs de stock</string>
|
||||||
<string name="suspended_treatment_icon">Icône de traitemernt suspendu</string>
|
<string name="suspended_treatment_icon">Icône de traitemernt suspendu</string>
|
||||||
<string name="slide11_desc">Pour enregistrer les changements, utilisez l\'icône de sauvegarde</string>
|
<string name="slide11_desc">Pour enregistrer les changements, utilisez l\'icône de sauvegarde</string>
|
||||||
|
@ -64,4 +64,6 @@
|
||||||
<string name="label">Libellé</string>
|
<string name="label">Libellé</string>
|
||||||
<string name="drug_list">Attributs d\'un médicament</string>
|
<string name="drug_list">Attributs d\'un médicament</string>
|
||||||
<string name="notInterpreted">Le code barre ne peut pas être interprété</string>
|
<string name="notInterpreted">Le code barre ne peut pas être interprété</string>
|
||||||
|
<string name="cancelled_scan">Scan annulé</string>
|
||||||
|
<string name="missing_camera_permission">Permission appareil photo manquante</string>
|
||||||
</resources>
|
</resources>
|
|
@ -3,6 +3,7 @@
|
||||||
<color name="colorPrimary">#3F51B5</color>
|
<color name="colorPrimary">#3F51B5</color>
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
<color name="colorPrimaryDark">#303F9F</color>
|
||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#FF4081</color>
|
||||||
|
<color name="white">#FFFFFF</color>
|
||||||
|
|
||||||
<!-- slide bg -->
|
<!-- slide bg -->
|
||||||
<color name="bg_screen1">#4f91ff</color>
|
<color name="bg_screen1">#4f91ff</color>
|
||||||
|
|
|
@ -8,16 +8,16 @@
|
||||||
<string name="help">Help</string>
|
<string name="help">Help</string>
|
||||||
<string name="notification_text">You have to go to the pharmacy</string>
|
<string name="notification_text">You have to go to the pharmacy</string>
|
||||||
<string name="drug_name_label">Name</string>
|
<string name="drug_name_label">Name</string>
|
||||||
<string name="drug_presention_labal">Presentation</string>
|
<string name="drug_presentation_label">Presentation</string>
|
||||||
<string name="drug_administationMode_label">Administration mode</string>
|
<string name="drug_administrationMode_label">Administration mode</string>
|
||||||
<string name="drug_current_stock_label">Current stock</string>
|
<string name="drug_current_stock_label">Current stock</string>
|
||||||
<string name="drug_take_label">Take</string>
|
<string name="drug_take_label">Take</string>
|
||||||
<string name="drug_warningTherehold_label">Alert therehold</string>
|
<string name="drug_warningThreshold_label">Alert threshold</string>
|
||||||
<string name="drug_alertTherehold_label">Critical therehold</string>
|
<string name="drug_alertThreshold_label">Critical threshold</string>
|
||||||
<string name="button_keyboard">"Use the keyboard"</string>
|
<string name="button_keyboard">"Use the keyboard"</string>
|
||||||
<string name="detail_view">Detail view</string>
|
<string name="detail_view">Detail view</string>
|
||||||
<string name="save_button">Save</string>
|
<string name="save_button">Save</string>
|
||||||
<string name="flashlighButton">Toggle Flash</string>
|
<string name="flashlightButton">Toggle Flash</string>
|
||||||
<string name="enter_cip_13_here">Enter cip 13 here..</string>
|
<string name="enter_cip_13_here">Enter cip 13 here..</string>
|
||||||
<string name="enter_cip_13">Enter CIP 13</string>
|
<string name="enter_cip_13">Enter CIP 13</string>
|
||||||
<string name="channel_description" translatable="false">PillDroid_NotificationChannel</string>
|
<string name="channel_description" translatable="false">PillDroid_NotificationChannel</string>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
<!-- slides strings -->
|
<!-- slides strings -->
|
||||||
<string name="slide1_Pilldroid">Welcome on Pilldroid</string>
|
<string name="slide1_Pilldroid">Welcome on Pilldroid</string>
|
||||||
<string name="slide1_desc">The theorical Pill Stock Manager</string>
|
<string name="slide1_desc">The theoretical Pill Stock Manager</string>
|
||||||
<string name="slide2_Pilldroid">To add a med, tap on the "Plus" button</string>
|
<string name="slide2_Pilldroid">To add a med, tap on the "Plus" button</string>
|
||||||
<string name="slide2_desc">You\'ll add a drug to the database</string>
|
<string name="slide2_desc">You\'ll add a drug to the database</string>
|
||||||
<string name="slide3_Pilldroid">You can scan classic barcode</string>
|
<string name="slide3_Pilldroid">You can scan classic barcode</string>
|
||||||
|
@ -43,12 +43,12 @@
|
||||||
<string name="the_plus_icon">The plus icon</string>
|
<string name="the_plus_icon">The plus icon</string>
|
||||||
<string name="slide4_desc">In order to find the CIP13</string>
|
<string name="slide4_desc">In order to find the CIP13</string>
|
||||||
<string name="happy_face">Happy face</string>
|
<string name="happy_face">Happy face</string>
|
||||||
<string name="barre_code_icone">Barre code icon</string>
|
<string name="barcode_icon">Barre code icon</string>
|
||||||
<string name="qr_code_icon">qr-code icon</string>
|
<string name="qr_code_icon">qr-code icon</string>
|
||||||
<string name="neutral_face">neutral face</string>
|
<string name="neutral_face">neutral face</string>
|
||||||
<string name="unhappy_face">unhappy face</string>
|
<string name="unhappy_face">unhappy face</string>
|
||||||
<string name="drug_info">Drug info screenshot</string>
|
<string name="drug_info">Drug info screenshot</string>
|
||||||
<string name="tunables">Tunables</string>
|
<string name="tunable">Tunable</string>
|
||||||
<string name="slide10_desc">Take to 0 to suspend treatment</string>
|
<string name="slide10_desc">Take to 0 to suspend treatment</string>
|
||||||
<string name="suspended_treatment_icon">Treatment suspended icon</string>
|
<string name="suspended_treatment_icon">Treatment suspended icon</string>
|
||||||
<string name="slide11_desc">To save changes</string>
|
<string name="slide11_desc">To save changes</string>
|
||||||
|
@ -65,5 +65,7 @@
|
||||||
<string name="Value">Value</string>
|
<string name="Value">Value</string>
|
||||||
<string name="label">Label</string>
|
<string name="label">Label</string>
|
||||||
<string name="drug_list">Drug\'s attributes</string>
|
<string name="drug_list">Drug\'s attributes</string>
|
||||||
<string name="notInterpreted">Barre code cannot be intrepreted</string>
|
<string name="notInterpreted">Barre code cannot be interpreted</string>
|
||||||
|
<string name="cancelled_scan">Scan canceled</string>
|
||||||
|
<string name="missing_camera_permission">Missing camera permission</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -9,7 +9,7 @@ buildscript {
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
@ -20,10 +20,11 @@ ext {
|
||||||
buildToolsVersion = '28.0.1'
|
buildToolsVersion = '28.0.1'
|
||||||
var = '3.4.2'
|
var = '3.4.2'
|
||||||
//buildToolsVersion1 = '29.0.3'
|
//buildToolsVersion1 = '29.0.3'
|
||||||
defaultMinSdkVersion = 24
|
defaultMinSdkVersion = 26
|
||||||
defaultTargetSdkVersion = 30
|
defaultTargetSdkVersion = 30
|
||||||
defaultVersionCode = 1
|
defaultVersionCode = 1
|
||||||
defaultVersionCode1 = defaultVersionCode
|
defaultVersionCode1 = defaultVersionCode
|
||||||
|
defaultVersionName = 'beta-0.+$versioncode'
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
|
@ -23,4 +23,4 @@ do not stress me it will be unproductive.
|
||||||
|
|
||||||
Pilldroid will available only from [f-droid](https://f-droid.org)
|
Pilldroid will available only from [f-droid](https://f-droid.org)
|
||||||
|
|
||||||
You can reach me and discuss on [Pildroid](mailto://jacques+pilldroid@foucry.net).
|
You can reach me and discuss on [Pilldroid](mailto://jacques+pilldroid@foucry.net).
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
<<<<<<< HEAD
|
||||||
<strong>Pilldroid</strong> is a theorical medics manager. It for French people
|
<strong>Pilldroid</strong> is a theorical medics manager. It for French people
|
||||||
only.
|
only.
|
||||||
|
|
||||||
<strong>Why for french people only?</strong>
|
<strong>Why for french people only?</strong>
|
||||||
<p>Pilldroid use a medics databases that come from French governement website, with
|
<p>Pilldroid use a medics databases that come from French governement website, with
|
||||||
|
<strong>Pilldroid</strong> is a theoretical medics manager. It for French people
|
||||||
|
only.
|
||||||
|
|
||||||
medics which are refund by french health care national insurance (Sécurité
|
medics which are refund by french health care national insurance (Sécurité
|
||||||
Sociale).</p>
|
Sociale).</p>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue