diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..081feb7
--- /dev/null
+++ b/LICENSE
@@ -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.
diff --git a/README.md b/README.md
index 62b49a3..d5f42de 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Pilldroid
Pilldroid est une application de gestion de stock **théorique** de médicament à
-destinations des personnes résidant en France.
+destination des personnes résidant en France.
## Ce que n'est pas Pilldroid
@@ -21,13 +21,13 @@ jour`. Ce calcul est fait tous les jours entre 11h et midi.
## De quelles autorisations l'application Pilldroid a-t-elle besoin ?
-- Pilldroid à besoin de savoir que le téléphone a été redémarré pour elle-même
+- Pilldroid a besoin de savoir que le téléphone a été redémarré pour elle-même
lancer son cycle de réveil journalier ;
- Pilldroid a besoin d'accéder à l'appareil photo de votre téléphone pour
scanner le code barre des boites de médicaments ;
- Pilldroid a besoin de pouvoir vous envoyer des 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 ?
@@ -35,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
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 ?
@@ -54,7 +49,7 @@ prochainement mis sur mon compte `github`.
## Comment peut-on participer à Pilldroid ?
Mon code est de piètre qualité et mes connaissances Java maigrelettes toute
-amélioration **que je comprends** sera la bien venue (je n'ai pas pigé les
+amélioration **que je comprends** sera la bienvenue (je n'ai pas pigé les
`lambda` par exemple).
Marché de niche, Pilldroid a besoin de testeuses et testeurs.
diff --git a/app/build.gradle b/app/build.gradle
index 4210b5a..4bd997d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,14 +1,6 @@
//noinspection GradleCompatible
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
def secretsPropertiesFile = rootProject.file("secrets.properties")
def secretProperties = new Properties()
@@ -40,9 +32,14 @@ android {
applicationId "net.foucry.pilldroid"
minSdkVersion defaultMinSdkVersion
targetSdkVersion defaultTargetSdkVersion
- versionCode generateVersionCode() // 190010203
- versionName generateVersionName() // 1.2.3-SNAPSHOT
+ versionCode 201
+ versionName "v0.201-beta"
multiDexEnabled true
+ javaCompileOptions {
+ annotationProcessorOptions {
+ arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
+ }
+ }
}
buildTypes {
@@ -55,6 +52,7 @@ android {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
+ signingConfig signingConfigs.release
}
prerelease {
minifyEnabled false
@@ -81,15 +79,11 @@ android {
}
compileOptions {
- coreLibraryDesugaringEnabled true
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- dexOptions {
- incremental false
- javaMaxHeapSize "4g"
- }
+ buildToolsVersion = "32.0.0"
allprojects {
tasks.withType(JavaCompile) {
@@ -109,43 +103,21 @@ sourceSets {
}
}
dependencies {
+ implementation "androidx.room:room-common:2.4.2"
+ annotationProcessor "androidx.room:room-compiler:2.4.2"
+ implementation "androidx.room:room-testing:2.4.2"
+ implementation "androidx.room:room-rxjava3:2.4.2"
+ implementation "androidx.room:room-runtime:2.4.2"
+
implementation fileTree(include: ['*.jar'], dir: 'libs')
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 '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 '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'
-}
-
-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
}
\ No newline at end of file
diff --git a/app/build_BACKUP_2537.gradle b/app/build_BACKUP_2537.gradle
new file mode 100644
index 0000000..9314be9
--- /dev/null
+++ b/app/build_BACKUP_2537.gradle
@@ -0,0 +1,121 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+<<<<<<< HEAD
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+=======
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+>>>>>>> 5fe29e5 (Change compileSskVersion)
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_BACKUP_2948.gradle b/app/build_BACKUP_2948.gradle
new file mode 100644
index 0000000..9314be9
--- /dev/null
+++ b/app/build_BACKUP_2948.gradle
@@ -0,0 +1,121 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+<<<<<<< HEAD
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+=======
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+>>>>>>> 5fe29e5 (Change compileSskVersion)
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_BACKUP_3178.gradle b/app/build_BACKUP_3178.gradle
new file mode 100644
index 0000000..9314be9
--- /dev/null
+++ b/app/build_BACKUP_3178.gradle
@@ -0,0 +1,121 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+<<<<<<< HEAD
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+=======
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+>>>>>>> 5fe29e5 (Change compileSskVersion)
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_BACKUP_3356.gradle b/app/build_BACKUP_3356.gradle
new file mode 100644
index 0000000..9314be9
--- /dev/null
+++ b/app/build_BACKUP_3356.gradle
@@ -0,0 +1,121 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+<<<<<<< HEAD
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+=======
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+>>>>>>> 5fe29e5 (Change compileSskVersion)
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_BASE_2537.gradle b/app/build_BASE_2537.gradle
new file mode 100644
index 0000000..4abead4
--- /dev/null
+++ b/app/build_BASE_2537.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 30
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_BASE_2948.gradle b/app/build_BASE_2948.gradle
new file mode 100644
index 0000000..4abead4
--- /dev/null
+++ b/app/build_BASE_2948.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 30
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_BASE_3178.gradle b/app/build_BASE_3178.gradle
new file mode 100644
index 0000000..4abead4
--- /dev/null
+++ b/app/build_BASE_3178.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 30
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_BASE_3356.gradle b/app/build_BASE_3356.gradle
new file mode 100644
index 0000000..4abead4
--- /dev/null
+++ b/app/build_BASE_3356.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 30
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_LOCAL_2537.gradle b/app/build_LOCAL_2537.gradle
new file mode 100644
index 0000000..cc3eb2b
--- /dev/null
+++ b/app/build_LOCAL_2537.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_LOCAL_2948.gradle b/app/build_LOCAL_2948.gradle
new file mode 100644
index 0000000..cc3eb2b
--- /dev/null
+++ b/app/build_LOCAL_2948.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_LOCAL_3178.gradle b/app/build_LOCAL_3178.gradle
new file mode 100644
index 0000000..cc3eb2b
--- /dev/null
+++ b/app/build_LOCAL_3178.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_LOCAL_3356.gradle b/app/build_LOCAL_3356.gradle
new file mode 100644
index 0000000..cc3eb2b
--- /dev/null
+++ b/app/build_LOCAL_3356.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.1'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.7.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_REMOTE_2537.gradle b/app/build_REMOTE_2537.gradle
new file mode 100644
index 0000000..f39eced
--- /dev/null
+++ b/app/build_REMOTE_2537.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_REMOTE_2948.gradle b/app/build_REMOTE_2948.gradle
new file mode 100644
index 0000000..f39eced
--- /dev/null
+++ b/app/build_REMOTE_2948.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_REMOTE_3178.gradle b/app/build_REMOTE_3178.gradle
new file mode 100644
index 0000000..f39eced
--- /dev/null
+++ b/app/build_REMOTE_3178.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/build_REMOTE_3356.gradle b/app/build_REMOTE_3356.gradle
new file mode 100644
index 0000000..f39eced
--- /dev/null
+++ b/app/build_REMOTE_3356.gradle
@@ -0,0 +1,117 @@
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+// Try reading secrets from file
+def secretsPropertiesFile = rootProject.file("secrets.properties")
+def secretProperties = new Properties()
+
+if (secretsPropertiesFile.exists()) {
+ secretProperties.load(new FileInputStream(secretsPropertiesFile))
+}
+// Otherwise read from environment variables, this happens in CI
+else {
+ secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
+ secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
+ secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
+}
+
+android {
+ signingConfigs {
+ 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 {
+ storeFile rootProject.file("android-signing-keystore.jks")
+ storePassword secretProperties['signing_keystore_password']
+ keyAlias secretProperties['signing_pre-release_key_alias']
+ keyPassword secretProperties['signing_pre-release_key_password']
+ }
+ }
+ compileSdkVersion 31
+
+ defaultConfig {
+ applicationId "net.foucry.pilldroid"
+ minSdkVersion defaultMinSdkVersion
+ targetSdkVersion defaultTargetSdkVersion
+ versionCode 100
+ versionName "v0.100-beta"
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ debug {
+ minifyEnabled false
+ debuggable true
+ applicationIdSuffix ".debug"
+ }
+ release {
+ minifyEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.release
+ }
+ prerelease {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ debuggable false
+ signingConfig signingConfigs.prerelease
+ }
+ }
+ flavorDimensions "version"
+ productFlavors {
+ dev {
+ resValue "string", "app_name", "PillDroid dev"
+ dimension ="version"
+ }
+
+ product {
+ resValue "string", "app_name", "PillDroid"
+ dimension ="version"
+ }
+ preproduct {
+ resValue "string", "app_name", "PillDroid Pre-Release"
+ dimension ="version"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ buildToolsVersion '32.0.0'
+
+ allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+sourceSets {
+ main {
+ java {
+ exclude 'net/foucry/pilldroid/scanActivity.java'
+ }
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ testImplementation 'junit:junit:4.13.2'
+
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+
+ implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
+ implementation 'androidx.core:core:1.6.0'
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
+}
diff --git a/app/schemas/net.foucry.pilldroid.databases.MedicineDatabase/1.json b/app/schemas/net.foucry.pilldroid.databases.MedicineDatabase/1.json
new file mode 100644
index 0000000..8c74d87
--- /dev/null
+++ b/app/schemas/net.foucry.pilldroid.databases.MedicineDatabase/1.json
@@ -0,0 +1,82 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 1,
+ "identityHash": "96dc5c4ccb337047e323d613eb86bdd1",
+ "entities": [
+ {
+ "tableName": "drugs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER NOT NULL, `cis` TEXT, `cip13` TEXT, `cip7` TEXT, `administration_mode` TEXT, `name` TEXT, `presentation` TEXT, `label_group` TEXT, `generic_type` INTEGER, PRIMARY KEY(`_id`))",
+ "fields": [
+ {
+ "fieldPath": "_id",
+ "columnName": "_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cis",
+ "columnName": "cis",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "cip13",
+ "columnName": "cip13",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "cip7",
+ "columnName": "cip7",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "administration_mode",
+ "columnName": "administration_mode",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "presentation",
+ "columnName": "presentation",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "label_group",
+ "columnName": "label_group",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "generic_type",
+ "columnName": "generic_type",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "_id"
+ ],
+ "autoGenerate": false
+ },
+ "indices": [],
+ "foreignKeys": []
+ }
+ ],
+ "views": [],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '96dc5c4ccb337047e323d613eb86bdd1')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/schemas/net.foucry.pilldroid.databases.PrescriptionDatabase/1.json b/app/schemas/net.foucry.pilldroid.databases.PrescriptionDatabase/1.json
new file mode 100644
index 0000000..898897c
--- /dev/null
+++ b/app/schemas/net.foucry.pilldroid.databases.PrescriptionDatabase/1.json
@@ -0,0 +1,100 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 1,
+ "identityHash": "7d1384a7162a98602e19c3ee54b7aee5",
+ "entities": [
+ {
+ "tableName": "prescriptions",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cis` TEXT NOT NULL, `cip13` TEXT, `name` TEXT, `administration_mode` TEXT, `presentation` TEXT, `stock` REAL, `take` REAL, `warning` INTEGER, `alert` INTEGER, `last_update` INTEGER, `label_group` TEXT, `genetic_type` INTEGER, PRIMARY KEY(`cis`))",
+ "fields": [
+ {
+ "fieldPath": "cis",
+ "columnName": "cis",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cip13",
+ "columnName": "cip13",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "administration_mode",
+ "columnName": "administration_mode",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "presentation",
+ "columnName": "presentation",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "stock",
+ "columnName": "stock",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "take",
+ "columnName": "take",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "warning",
+ "columnName": "warning",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "alert",
+ "columnName": "alert",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "last_update",
+ "columnName": "last_update",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "label_group",
+ "columnName": "label_group",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "genetic_type",
+ "columnName": "genetic_type",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "cis"
+ ],
+ "autoGenerate": false
+ },
+ "indices": [],
+ "foreignKeys": []
+ }
+ ],
+ "views": [],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7d1384a7162a98602e19c3ee54b7aee5')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ebfc2b6..96a3315 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -13,12 +13,12 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
+ android:screenOrientation="portrait"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:allowBackup="true">
@@ -30,7 +30,8 @@
android:name=".DrugDetailActivity"
android:label="@string/title_drug_detail"
android:parentActivityName=".DrugListActivity"
- android:theme="@style/AppTheme.NoActionBar">
+ android:theme="@style/AppTheme.NoActionBar"
+ android:windowSoftInputMode="adjustResize">
@@ -59,7 +60,5 @@
-
-
-
\ No newline at end of file
+
diff --git a/app/src/main/assets/about.html b/app/src/main/assets/about.html
index 13cb3ab..c20e71c 100644
--- a/app/src/main/assets/about.html
+++ b/app/src/main/assets/about.html
@@ -14,11 +14,11 @@
}
-
+
-PillDroid © 2021 Jacques Foucry
-PillDroid est une gestion théorique de votre stock de médicaments.
-PillDroid n'a aucune connaissance des interactions des médicaments entre eux.
+Pilldroid © 2022 Jacques Foucry
+Pilldroid est une gestion théorique de votre stock de médicaments.
+Pilldroid n'a aucune connaissance des interactions des médicaments entre eux.
EN CAS DE DOUTE, CONSULTEZ VOTRE MÉDECIN OU VOTRE PHARMACIEN.
PillDroid ne vous rappelle pas de prendre vos médicaments.
LA RESPONSABILITÉ DE L'AUTEUR NE SAURAIT ÊTRE ENGAGÉE EN CAS DE SURDOSAGE OU D'OUBLI DE PRISE.
@@ -28,9 +28,9 @@
Les conseils et aides de mob-dev.fr.
Le soutien actif et les conseils du Dr Kauffmann me permettent de faire
- évoluer PillDroid.
+ évoluer Pilldroid.
Vous pouvez me contacter à l'adresse suivante : jacques+pilldroid@foucry.net
.
Le site web de l'application.
diff --git a/app/src/main/assets/drugs.db b/app/src/main/assets/drugs.db
index 2cc6502..adeb8a2 100644
Binary files a/app/src/main/assets/drugs.db and b/app/src/main/assets/drugs.db differ
diff --git a/app/src/main/assets/icon_pilldroid.png b/app/src/main/assets/icon_pilldroid.png
new file mode 100644
index 0000000..c72814e
Binary files /dev/null and b/app/src/main/assets/icon_pilldroid.png differ
diff --git a/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java b/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java
index 8883956..26265c6 100644
--- a/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java
+++ b/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java
@@ -14,6 +14,10 @@ import android.widget.Toast;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
+import net.foucry.pilldroid.dao.PrescriptionsDAO;
+import net.foucry.pilldroid.databases.PrescriptionDatabase;
+import net.foucry.pilldroid.models.Prescription;
+
import java.time.LocalTime;
import java.util.Date;
import java.util.List;
@@ -41,24 +45,24 @@ public class AlarmReceiver extends BroadcastReceiver {
if (BuildConfig.DEBUG) { Toast.makeText(context, "New stock calculated", Toast.LENGTH_LONG).show(); }
createNotificationChannel(context);
- DBHelper dbHelper = new DBHelper(context);
- dbHelper.getAllDrugs();
-
- List drugs = dbHelper.getAllDrugs();
-
- Drug firstDrug = null;
+ PrescriptionDatabase prescriptions = null;
+ assert false;
+ PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
+ List prescriptionList = prescriptionsDAO.getAllMedics();
+ Prescription firstPrescription = null ;
+ //List drugs = dbHelper.getAllDrugs();
try {
- firstDrug = drugs.get(0);
+ firstPrescription = prescriptionList.get(1);
}
catch (Exception e){
Log.e(TAG, e.toString());
e.printStackTrace();
}
- if (firstDrug != null) {
- if (firstDrug.getTake() != 0) {
- if(firstDrug.getStock() <= firstDrug.getAlertThreshold()) {
+ if (firstPrescription != null) {
+ if (firstPrescription.getTake() != 0) {
+ if(firstPrescription.getStock() <= firstPrescription.getAlertThreshold()) {
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(context, DrugListActivity.class);
@@ -81,7 +85,7 @@ public class AlarmReceiver extends BroadcastReceiver {
notificationManager.notify(notificationId, builder.build());
} else
{
- double dummy = (firstDrug.getStock() - firstDrug.getAlertThreshold());
+ double dummy = (firstPrescription.getStock() - firstPrescription.getAlertThreshold());
Log.d(TAG, "no notification scheduled " + dummy);
}
}
@@ -96,26 +100,24 @@ public class AlarmReceiver extends BroadcastReceiver {
String description = context.getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
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);
- channel.setDescription(description);
- channel.enableLights(true);
- channel.setLightColor(R.color.led);
- channel.enableVibration(true);
- 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
- // or other notification behaviors after this
- NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
- try {
- notificationManager.createNotificationChannel(channel);
- } catch (Exception e) {
- // This will catch any exception, because they are all descended from Exception
- Log.e(TAG, e.toString());
- //At the level Exception Class handle the error in Exception Table
- // Exception Create That Error Object and throw it
- //E.g: FileNotFoundException ,etc
- e.printStackTrace();
- }
+ NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
+ channel.setDescription(description);
+ channel.enableLights(true);
+ channel.setLightColor(R.color.led);
+ channel.enableVibration(true);
+ 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
+ // or other notification behaviors after this
+ NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
+ try {
+ notificationManager.createNotificationChannel(channel);
+ } catch (Exception e) {
+ // This will catch any exception, because they are all descended from Exception
+ Log.e(TAG, e.toString());
+ //At the level Exception Class handle the error in Exception Table
+ // Exception Create That Error Object and throw it
+ //E.g: FileNotFoundException ,etc
+ e.printStackTrace();
}
}
public static void scheduleAlarm(Context context) {
@@ -150,4 +152,10 @@ public class AlarmReceiver extends BroadcastReceiver {
if (BuildConfig.DEBUG) { Toast.makeText(context, "Alarm scheduled for " + UtilDate.convertDate(calendar.getTimeInMillis()), Toast.LENGTH_SHORT).show(); }
}
-}
\ No newline at end of file
+
+ public static Boolean isAlarmScheduled(Context context) {
+ AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+
+ return alarmManager.getNextAlarmClock() != null;
+ }
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java
index 0fb949b..3186aad 100644
--- a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java
+++ b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java
@@ -1,15 +1,19 @@
package net.foucry.pilldroid;
import android.app.Activity;
+import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
+import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageButton;
import androidx.annotation.NonNull;
+import com.journeyapps.barcodescanner.BarcodeCallback;
+import com.journeyapps.barcodescanner.BarcodeResult;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
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.
*/
-public class CustomScannerActivity extends Activity implements
- DecoratedBarcodeView.TorchListener {
+public class CustomScannerActivity extends Activity implements DecoratedBarcodeView.TorchListener {
+
+ private static final String TAG = CustomScannerActivity.class.getName();
private CaptureManager capture;
private DecoratedBarcodeView barcodeScannerView;
private ImageButton switchFlashlightButton;
private ViewfinderView viewfinderView;
+ final Bundle captureIntentBundle = new Bundle();
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_custom_scanner);
+
+ setContentView(R.layout.custom_scanner_activty);
+
+ //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);
+ viewfinderView = findViewById(R.id.zxing_viewfinder_view);
barcodeScannerView = findViewById(R.id.zxing_barcode_scanner);
- barcodeScannerView.setTorchListener(this);
-
- switchFlashlightButton = findViewById(R.id.switch_flashlight);
-
- viewfinderView = findViewById(R.id.zxing_viewfinder_view);
// if the device does not have flashlight in its camera,
// then remove the switch flashlight button...
if (!hasFlash()) {
- switchFlashlightButton.setVisibility(View.GONE);
+ findViewById(R.id.switch_flashlight).setVisibility(View.GONE);
}
capture = new CaptureManager(this, barcodeScannerView);
capture.initializeFromIntent(getIntent(), savedInstanceState);
capture.setShowMissingCameraPermissionDialog(false);
- capture.decode();
- changeMaskColor(null);
+ //changeMaskColor(null);
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
@@ -85,6 +109,7 @@ public class CustomScannerActivity extends Activity implements
/**
* Check if the device's camera has a Flashlight.
+ *
* @return true if there is Flashlight, otherwise false.
*/
private boolean hasFlash() {
@@ -93,30 +118,27 @@ public class CustomScannerActivity extends Activity implements
}
public void switchFlashlight(View view) {
+ Log.d(TAG, "Switch torch");
if (switchFlashlightButton.isActivated()) {
barcodeScannerView.setTorchOff();
+ switchFlashlightButton.setActivated(false);
} else {
barcodeScannerView.setTorchOn();
+ switchFlashlightButton.setActivated(true);
}
}
- public void changeMaskColor(View view) {
- Random rnd = new Random();
- int color = Color.argb(100, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
- viewfinderView.setMaskColor(color);
- }
-
public void changeLaserVisibility(boolean visible) {
viewfinderView.setLaserVisibility(visible);
}
- @Override
public void onTorchOn() {
+ Log.d(TAG, "TorchON");
switchFlashlightButton.setActivated(true);
}
- @Override
public void onTorchOff() {
+ Log.d(TAG, "TorchOFF");
switchFlashlightButton.setActivated(false);
}
@@ -125,14 +147,20 @@ public class CustomScannerActivity extends Activity implements
capture.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
-
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();
}
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();
}
+
}
diff --git a/app/src/main/java/net/foucry/pilldroid/DBDrugs.java b/app/src/main/java/net/foucry/pilldroid/DBDrugs.java
index 1ff6a2a..912cf42 100644
--- a/app/src/main/java/net/foucry/pilldroid/DBDrugs.java
+++ b/app/src/main/java/net/foucry/pilldroid/DBDrugs.java
@@ -46,9 +46,10 @@ class DBDrugs extends SQLiteOpenHelper {
public boolean isDBFileExist(File database)
{
- try {
+ try {
myContext.getDatabasePath(String.valueOf(database));
- } catch (final Exception exception) {
+ }
+ catch (final Exception e){
return false;
}
return true;
@@ -108,9 +109,8 @@ class DBDrugs extends SQLiteOpenHelper {
@Override
public synchronized void close() {
- if (myDataBase != null) {
- myDataBase.close();
- }
+ assert false;
+ myDataBase.close();
}
/**
@@ -154,7 +154,7 @@ class DBDrugs extends SQLiteOpenHelper {
drug.setAlertThreshold(7);
// Log
- Log.d(TAG, "getDrug(" + cip13 + ")" + drug.toString());
+ Log.d(TAG, "getDrug(" + cip13 + ")" + drug);
// Return drug
@@ -222,7 +222,7 @@ class DBDrugs extends SQLiteOpenHelper {
drug.setAlertThreshold(7);
// Log
- Log.d(TAG, "getDrug(" + cip7 + ")" + drug.toString());
+ Log.d(TAG, "getDrug(" + cip7 + ")" + drug);
// Return drug
diff --git a/app/src/main/java/net/foucry/pilldroid/DBHelper.java b/app/src/main/java/net/foucry/pilldroid/DBHelper.java
index 5d9954e..d2dc1bf 100644
--- a/app/src/main/java/net/foucry/pilldroid/DBHelper.java
+++ b/app/src/main/java/net/foucry/pilldroid/DBHelper.java
@@ -41,7 +41,7 @@ class DBHelper extends SQLiteOpenHelper {
private static final String TAG = DBHelper.class.getName();
- private static final String[] COLUMS = {KEY_ID, KEY_CIS,KEY_CIP13, KEY_NAME, KEY_ADMIN, KEY_PRES, KEY_STOCK, KEY_TAKE,
+ private static final String[] COLUMNS = {KEY_ID, KEY_CIS,KEY_CIP13, KEY_NAME, KEY_ADMIN, KEY_PRES, KEY_STOCK, KEY_TAKE,
KEY_THRESHOLD_WARN, KEY_THRESHOLD_ALERT, KEY_LAST_UPDATE};
DBHelper(Context context) {
@@ -114,7 +114,7 @@ class DBHelper extends SQLiteOpenHelper {
// Insert
db.insert(TABLE_DRUG, // table
- null, // colunms list not needed
+ null, // columns list not needed
values); // key/value
// Close database
@@ -132,7 +132,7 @@ class DBHelper extends SQLiteOpenHelper {
// Build query
Cursor cursor = db.query(TABLE_DRUG, // Which table
- COLUMS, // column names
+ COLUMNS, // column names
" id = ?", // selections
new String[] { String.valueOf(id) }, // selections args
null, // group by
@@ -161,7 +161,7 @@ class DBHelper extends SQLiteOpenHelper {
drug.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
}
// Log
- Log.d(TAG, "getDrug("+id+")" + drug.toString());
+ Log.d(TAG, "getDrug("+id+")" + drug);
assert cursor != null;
cursor.close();
@@ -173,7 +173,7 @@ class DBHelper extends SQLiteOpenHelper {
/**
*
- * @param cip13 drug id in French nomemclature
+ * @param cip13 drug id in French nomenclature
* @return the drug object found in DB or null
*/
public Drug getDrugByCIP13(String cip13) {
@@ -182,7 +182,7 @@ class DBHelper extends SQLiteOpenHelper {
// Build query
Cursor cursor = db.query(TABLE_DRUG, // Which table
- COLUMS, // column names
+ COLUMNS, // column names
" cip13 = ?", // selections
new String[]{String.valueOf(cip13)}, // selections args
null, // group by
@@ -212,7 +212,7 @@ class DBHelper extends SQLiteOpenHelper {
assert cursor != null;
cursor.close();
- Log.d(TAG, "getDrug(" + cip13 + ")" + drug.toString());
+ Log.d(TAG, "getDrug(" + cip13 + ")" + drug);
return drug;
}
@@ -274,10 +274,7 @@ class DBHelper extends SQLiteOpenHelper {
- Log.d(TAG, "Before sort == " + drugs.toString());
-
- /*drugs.sort(Comparator.comparing(Drug::getDateEndOfStock)
- .thenComparing(Drug::getStock));*/
+ Log.d(TAG, "Before sort == " + drugs);
drugs.sort(new Comparator() {
@Override
@@ -288,7 +285,7 @@ class DBHelper extends SQLiteOpenHelper {
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
// todo: If some drug moved, must redo all the loop
@@ -320,7 +317,7 @@ class DBHelper extends SQLiteOpenHelper {
// Get reference to writable DB
SQLiteDatabase db = this.getWritableDatabase();
- // Create ContentValues to add columnm/value
+ // Create ContentValues to add column/value
ContentValues values = new ContentValues();
values.put(KEY_ID, drug.getId());
values.put(KEY_CIS, drug.getCis());
@@ -336,14 +333,14 @@ class DBHelper extends SQLiteOpenHelper {
String[] selectionArgs = { String.valueOf(drug.getId()) };
- db.update(TABLE_DRUG, // table
- values, // column/value
- KEY_ID + " = ?", // selections
+ db.update(TABLE_DRUG, // table
+ values, // column/value
+ KEY_ID + " = ?", // selections
selectionArgs);
// Close DB
db.close();
- Log.d(TAG, "values == " + values.toString());
+ Log.d(TAG, "values == " + values);
}
/**
diff --git a/app/src/main/java/net/foucry/pilldroid/Drug.java b/app/src/main/java/net/foucry/pilldroid/Drug.java
index 54a1686..5c5b011 100644
--- a/app/src/main/java/net/foucry/pilldroid/Drug.java
+++ b/app/src/main/java/net/foucry/pilldroid/Drug.java
@@ -165,7 +165,7 @@ public class Drug implements Serializable {
}
void newStock() {
- Log.d(TAG, "current drug = " + this.toString());
+ Log.d(TAG, "current drug = " + this);
Date lastUpdate = new Date(getDateLastUpdate());
diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java
index f39b211..5e7cd07 100644
--- a/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java
+++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java
@@ -1,5 +1,7 @@
package net.foucry.pilldroid;
+import static net.foucry.pilldroid.R.id.detail_toolbar;
+
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
@@ -13,9 +15,11 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
-import java.util.Date;
+import net.foucry.pilldroid.dao.PrescriptionsDAO;
+import net.foucry.pilldroid.databases.PrescriptionDatabase;
+import net.foucry.pilldroid.models.Prescription;
-import static net.foucry.pilldroid.R.id.detail_toolbar;
+import java.util.Date;
/**
* An activity representing a single Drug detail screen. This
@@ -27,27 +31,20 @@ public class DrugDetailActivity extends AppCompatActivity {
private static final String TAG = DrugDetailActivity.class.getName();
- Drug drug;
-
+ Prescription aPrescription;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Bundle extras = getIntent().getExtras();
+ Bundle bundle = getIntent().getExtras();
+ assert bundle != null;
+ aPrescription = (Prescription) bundle.get("prescription");
+ Log.d(TAG, "aPrescription == " + aPrescription);
- /* fetching the string passed with intent using ‘extras’*/
-
- assert extras != null;
- drug = (Drug) extras.getSerializable("drug");
-
- assert drug != null;
- Log.d(TAG, "drug == " + drug.toString());
-
- setContentView(R.layout.activity_drug_detail);
+ setContentView(R.layout.drug_detail_activity);
Toolbar toolbar = findViewById(detail_toolbar);
-
if (toolbar != null) {
setSupportActionBar(toolbar);
}
@@ -58,7 +55,7 @@ public class DrugDetailActivity extends AppCompatActivity {
public void onClick(View view) {
Log.d(TAG, "Click on save icon");
- getMDrugChanges();
+ getDrugChanges();
setResult(1);
finish();
overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
@@ -69,7 +66,7 @@ public class DrugDetailActivity extends AppCompatActivity {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(false);
- actionBar.setTitle(drug.getName());
+ actionBar.setTitle(aPrescription.getName());
}
// savedInstanceState is non-null when there is fragment state
@@ -85,8 +82,7 @@ public class DrugDetailActivity extends AppCompatActivity {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Bundle arguments = new Bundle();
- arguments.putSerializable("drug",
- getIntent().getSerializableExtra("drug"));
+ arguments.putSerializable("prescription", aPrescription);
DrugDetailFragment fragment = new DrugDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
@@ -111,12 +107,13 @@ public class DrugDetailActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
- private void getMDrugChanges() {
+ private void getDrugChanges() {
Log.d(TAG, "Time to save new values");
- DBHelper dbHelper = new DBHelper(this);
+ PrescriptionDatabase prescriptions = PrescriptionDatabase.getInstanceDatabase(this);
+ PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
- Drug newDrug = dbHelper.getDrugByCIP13(drug.getCip13());
+ Prescription newPrescription = prescriptionsDAO.getMedicByCIP13(aPrescription.getCip13());
View stockView;
View takeView;
@@ -139,18 +136,19 @@ public class DrugDetailActivity extends AppCompatActivity {
TextView warningTextView = warningView.findViewById(R.id.value);
String warningValue = warningTextView.getText().toString();
- newDrug.setStock(Double.parseDouble(stockValue));
- newDrug.setTake(Double.parseDouble(takeValue));
- newDrug.setWarnThreshold(Integer.parseInt(warningValue));
- newDrug.setAlertThreshold(Integer.parseInt(alertValue));
- newDrug.setDateEndOfStock();
+ newPrescription.setStock(Float.parseFloat(stockValue));
+ newPrescription.setTake(Float.parseFloat(takeValue));
+ newPrescription.setWarning(Integer.parseInt(warningValue));
+ newPrescription.setAlert(Integer.parseInt(alertValue));
+ newPrescription.getDateEndOfStock();
- if (drug.equals(newDrug)) {
- Log.d(TAG, "drug and newDrug are Equals");
+ if (aPrescription.equals(newPrescription)) {
+ Log.d(TAG, "medic and newPrescription are Equals");
} else {
- Log.d(TAG, "drug and newDrug are NOT Equals");
- newDrug.setDateLastUpdate(new Date().getTime());
- dbHelper.updateDrug(newDrug);
+ Log.d(TAG, "medic and newPrescription are NOT Equals");
+ newPrescription.setLast_update(new Date().getTime());
+ prescriptionsDAO.update(newPrescription);
+ //dbHelper.updateDrug(newDrug);
}
}
}
diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailContract.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailContract.java
new file mode 100644
index 0000000..1dcef08
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailContract.java
@@ -0,0 +1,38 @@
+package net.foucry.pilldroid;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.activity.result.contract.ActivityResultContract;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+public class DrugDetailContract extends ActivityResultContract {
+ /**
+ * 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;
+ }
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java
index 9466bb8..763746a 100644
--- a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java
+++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java
@@ -11,6 +11,8 @@ import androidx.fragment.app.Fragment;
import com.google.android.material.appbar.CollapsingToolbarLayout;
+import net.foucry.pilldroid.models.Prescription;
+
/**
* A fragment representing a single Drug detail screen.
* This fragment is either contained in a {@link DrugListActivity}
@@ -23,12 +25,12 @@ public class DrugDetailFragment extends Fragment {
* The fragment argument representing the item ID that this fragment
* represents.
*/
- public static final String ARG_ITEM_ID = "drug";
+ public static final String ARG_ITEM_ID = "prescription";
/**
* The dummy content this fragment is presenting.
*/
- private Drug drug;
+ private Prescription prescription;
/**
* Mandatory empty constructor for the fragment manager to instantiate the
@@ -46,13 +48,13 @@ public class DrugDetailFragment extends Fragment {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
- drug = (Drug) getArguments().getSerializable(ARG_ITEM_ID);
+ prescription = (Prescription) getArguments().getSerializable(ARG_ITEM_ID);
Activity activity = this.getActivity();
assert activity != null;
CollapsingToolbarLayout appBarLayout = activity.findViewById(R.id.toolbar_layout);
if (appBarLayout != null) {
- appBarLayout.setTitle(drug.getName());
+ appBarLayout.setTitle(prescription.getName());
}
}
}
@@ -69,56 +71,59 @@ public class DrugDetailFragment extends Fragment {
View alertView;
// Show the dummy content as text in a TextView.
- if (drug != null) {
+ if (prescription != null) {
// Find each component of rootView
nameView = detailView.findViewById(R.id.name_cell);
TextView nameLabel = nameView.findViewById(R.id.label);
TextView nameValue = nameView.findViewById(R.id.value);
nameLabel.setText(R.string.drug_name_label);
- nameValue.setText(drug.getName());
+ nameValue.setText(prescription.getName());
presentationView = detailView.findViewById(R.id.presentation_cell);
TextView presentationLabel = presentationView.findViewById(R.id.label);
TextView presentationValue = presentationView.findViewById(R.id.value);
- presentationLabel.setText(R.string.drug_presention_labal);
- presentationValue.setText(drug.getPresentation());
+ presentationLabel.setText(R.string.drug_presentation_label);
+ presentationValue.setText(prescription.getPresentation());
adminModeView = detailView.findViewById(R.id.administration_cell);
TextView adminModeLabel = adminModeView.findViewById(R.id.label);
TextView adminModeValue = adminModeView.findViewById(R.id.value);
- adminModeLabel.setText(R.string.drug_administationMode_label);
- adminModeValue.setText(drug.getAdministration_mode());
+ adminModeLabel.setText(R.string.drug_administrationMode_label);
+ adminModeValue.setText(prescription.getAdministration_mode());
stockView = detailView.findViewById(R.id.stock_cell);
TextView stockLibelle = (stockView.findViewById(R.id.label));
TextView stockValue = stockView.findViewById(R.id.value);
stockLibelle.setText(R.string.drug_current_stock_label);
- stockValue.setText(Double.toString(drug.getStock()));
+ stockValue.setText(Utils.fmt(prescription.getStock()));
stockValue.setHint(R.string.drug_current_stock_label);
stockValue.setSelectAllOnFocus(true);
takeView = detailView.findViewById(R.id.take_cell);
- TextView priseLabel = takeView.findViewById(R.id.label);
- TextView priseValue = (takeView.findViewById(R.id.value));
- priseLabel.setText(R.string.drug_take_label);
- priseValue.setText(Double.toString(drug.getTake()));
- priseValue.setHint(R.string.drug_take_label);
- priseValue.setSelectAllOnFocus(true);
+ TextView takeLabel = takeView.findViewById(R.id.label);
+ TextView takeValue = (takeView.findViewById(R.id.value));
+ takeLabel.setText(R.string.drug_take_label);
+ //takeValue.setText(Double.toString(prescription.getTake()));
+ takeValue.setText(Utils.fmt(prescription.getTake()));
+ takeValue.setHint(R.string.drug_take_label);
+ takeValue.setSelectAllOnFocus(true);
warningView = detailView.findViewById(R.id.warning_cell);
TextView warningLibelle = warningView.findViewById(R.id.label);
TextView warningValue = warningView.findViewById(R.id.value);
- warningLibelle.setText(R.string.drug_warningTherehold_label);
- warningValue.setText(Integer.toString(drug.getWarnThreshold()));
- warningValue.setHint(R.string.drug_warningTherehold_label);
+ warningLibelle.setText(R.string.drug_warningThreshold_label);
+ //warningValue.setText(Integer.toString(prescription.getWarnThreshold()));
+ warningValue.setText(Utils.fmt(prescription.getWarning()));
+ warningValue.setHint(R.string.drug_warningThreshold_label);
warningValue.setSelectAllOnFocus(true);
alertView = detailView.findViewById(R.id.alert_cell);
TextView alertLibelle = alertView.findViewById(R.id.label);
TextView alertValue = alertView.findViewById(R.id.value);
- alertLibelle.setText(R.string.drug_alertTherehold_label);
- alertValue.setText(Integer.toString(drug.getAlertThreshold()));
- alertValue.setHint(R.string.drug_alertTherehold_label);
+ alertLibelle.setText(R.string.drug_alertThreshold_label);
+ //alertValue.setText(Integer.toString(prescription.getAlertThreshold()));
+ alertValue.setText(Utils.fmt(prescription.getAlert()));
+ alertValue.setHint(R.string.drug_alertThreshold_label);
alertValue.setSelectAllOnFocus(true);
}
diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java
index 343fa98..628f7fb 100644
--- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java
+++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java
@@ -1,5 +1,9 @@
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.content.Context;
import android.content.Intent;
@@ -21,24 +25,30 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.activity.result.ActivityResultLauncher;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.RecyclerView;
+import androidx.room.Room;
+import com.google.zxing.client.android.BuildConfig;
import com.google.zxing.client.android.Intents;
-import com.google.zxing.integration.android.IntentIntegrator;
-import com.google.zxing.integration.android.IntentResult;
+import com.journeyapps.barcodescanner.ScanOptions;
+
+import net.foucry.pilldroid.dao.MedicinesDAO;
+import net.foucry.pilldroid.dao.PrescriptionsDAO;
+import net.foucry.pilldroid.databases.MedicineDatabase;
+import net.foucry.pilldroid.databases.PrescriptionDatabase;
+import net.foucry.pilldroid.models.Medicine;
+import net.foucry.pilldroid.models.Prescription;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
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
* has different presentations for handset and tablet-size devices. On
@@ -48,35 +58,95 @@ import static net.foucry.pilldroid.Utils.intRandomExclusive;
* item details side-by-side using two vertical panes.
*/
public class DrugListActivity extends AppCompatActivity {
- /**
- * Whether or not the activity is in two-pane mode, i.e. running on a tablet
- * device.
- */
-
- // TODO: Change DEMO/DBDEMO form static to non-static. In order to create fake data at only at launchtime
+ // Used for dev and debug
final Boolean DEMO = false;
- final Boolean DBDEMO = false;
public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;
+ public final String BARCODE_FORMAT_NAME = "Barcode Format name";
+ public final String BARCODE_CONTENT = "Barcode Content";
- /**
- * Start tutorial
- */
+ private ActivityResultLauncher mBarcodeScannerLauncher;
+ private static final String TAG = DrugListActivity.class.getName();
+ public PrescriptionDatabase prescriptions;
+ public MedicineDatabase medicines;
+
+ private List prescriptionList; // used for prescriptions
+
+ private SimpleItemRecyclerViewAdapter mAdapter;
@Override
public void onStart() {
super.onStart();
+ if(BuildConfig.DEBUG) {
+ String manufacturer = Build.MANUFACTURER;
+ String model = Build.MODEL;
+ int version = Build.VERSION.SDK_INT;
+ String versionRelease = Build.VERSION.RELEASE;
+
+ Log.e(TAG, "manufacturer " + manufacturer
+ + " \n model " + model
+ + " \n version " + version
+ + " \n versionRelease " + versionRelease
+ );
+ }
+
+ // Create medicines Room database from drugs.db files
+ medicines = MedicineDatabase.getInstanceDatabase(this);
+
+ // Create prescriptions Room database
+ prescriptions = PrescriptionDatabase.getInstanceDatabase(this);
+
+ // Manually migrate old database to room
+ PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
+ DBHelper dbHelper = new DBHelper(this);
+ if (dbHelper.getCount() !=0) {
+ List drugs=dbHelper.getAllDrugs();
+ for (int count=0; count < dbHelper.getCount(); count++) {
+ Drug drug = drugs.get(count);
+ Prescription prescription = new Prescription();
+
+ if(prescriptionsDAO.getMedicByCIP13(drug.getCip13()) == null) {
+ prescription.setName(drug.getName());
+ prescription.setCip13(drug.getCip13());
+ prescription.setCis(drug.getCis());
+ prescription.setPresentation(drug.getPresentation());
+ prescription.setAdministration_mode(drug.getAdministration_mode());
+ prescription.setStock((float) drug.getStock());
+ prescription.setTake((float) drug.getTake());
+ prescription.setWarning(drug.getWarnThreshold());
+ prescription.setAlert(drug.getAlertThreshold());
+ prescription.setLast_update(drug.getDateLastUpdate());
+
+ prescriptionsDAO.insert(prescription);
+ }
+ else {
+ Log.i(TAG, "Already in the database");
+ }
+ }
+ dbHelper.dropDrug();
+ }
+ // remove old notification
Log.d(TAG, "Remove old notification and old job");
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if (nm != null) {
nm.cancelAll();
}
- // tuto
- Log.i(TAG, "Launch tuto");
- startActivity(new Intent(this, WelcomeActivity.class));
+ // start tutorial (only in non debug mode)
+ // if(!net.foucry.pilldroid.BuildConfig.DEBUG) {
+ Log.i(TAG, "Launch tutorial");
+ startActivity(new Intent(this, WelcomeActivity.class));
+ // }
+
+ PrefManager prefManager = new PrefManager(this);
+ if (!prefManager.isUnderstood()) {
+ askForComprehensive();
+ prefManager.setUnderstood(true);
+ }
+
+
}
@Override
@@ -84,41 +154,28 @@ public class DrugListActivity extends AppCompatActivity {
super.onStop();
}
- private static final String TAG = DrugListActivity.class.getName();
+ public void onPause() {
+ super.onPause();
+ Log.d(TAG, "onPause");
- private DBHelper dbHelper;
- private DBDrugs dbDrug;
-
- private List drugs;
-
- private SimpleItemRecyclerViewAdapter mAdapter;
-
- public void constructDrugsList()
- {
- dbHelper = new DBHelper(getApplicationContext());
-
- if (!(drugs == null)) {
- if (!drugs.isEmpty()) {
- drugs.clear();
- }
+ if (!AlarmReceiver.isAlarmScheduled(this)){
+ AlarmReceiver.scheduleAlarm(this);
}
- drugs = dbHelper.getAllDrugs();
- View mRecyclerView = findViewById(R.id.drug_list);
- assert mRecyclerView != null;
- setupRecyclerView((RecyclerView) mRecyclerView);
}
-
+ @SuppressLint("NotifyDataSetChanged")
@Override
- protected void onCreate(Bundle savedInstanceState) {
+ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_drug_list);
+ // Create Room database
+ prescriptions = Room
+ .databaseBuilder(getApplicationContext(), PrescriptionDatabase.class, "prescriptions")
+ .allowMainThreadQueries()
+ .build();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- dbHelper = new DBHelper(this);
- }
- dbDrug = new DBDrugs(this);
+ // Set view content
+ setContentView(R.layout.drug_list_activity);
Toolbar toolbar = findViewById(R.id.toolbar);
@@ -127,59 +184,103 @@ public class DrugListActivity extends AppCompatActivity {
toolbar.setTitle(getTitle());
}
- // Added to drop database each the app is launch.
- if (DBDEMO) {
- dbHelper.dropDrug();
- }
-
if (DEMO) {
- if (dbHelper.getCount() == 0) {
+ PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
- // String cis, String cip13, String nom, String mode_administration,
- // String presentation,double stock, double prise, int warn, int alert
+ if (prescriptionsDAO.getMedicCount() == 0) {
+ final int min_stock = 5;
+ final int max_stock = 50;
+ final int min_take = 0;
+ final int max_take = 3;
- // Limit for randoms generator
- final int min_stock=5;
- final int max_stock=50;
- final int min_prise=0;
- final int max_prise=3;
+ for (int i = 1; i < 9; i++) {
+ Prescription prescription = new Prescription();
+ prescription.setName("Medicament test " + i);
+ prescription.setCip13("340093000001" + i);
+ prescription.setCis("6000001" + i);
+ prescription.setAdministration_mode("oral");
+ prescription.setPresentation("plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)");
+ prescription.setStock((float) intRandomExclusive(min_stock, max_stock));
+ prescription.setTake((float) intRandomExclusive(min_take, max_take));
+ prescription.setWarning(14);
+ prescription.setAlert(7);
+ prescription.setLast_update(UtilDate.dateAtNoon(new Date()).getTime());
- dbHelper.addDrug(new Drug("60000011", "3400930000011", "Médicament test 01", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000012", "3400930000012", "Médicament test 02", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000013", "3400930000013", "Médicament test 03", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000014", "3400930000014", "Médicament test 04", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000015", "3400930000015", "Médicament test 05", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000016", "3400930000016", "Médicament test 06", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000017", "3400930000017", "Médicament test 07", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000018", "3400930000018", "Médicament test 08", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000019", "3400930000019", "Médicament test 09", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- dbHelper.addDrug(new Drug("60000010", "3400930000010", "Médicament test 10", "orale",
- "plaquette(s) thermoformée(s) PVC PVDC aluminium de 10 comprimé(s)",
- intRandomExclusive(min_stock, max_stock), intRandomExclusive(min_prise, max_prise), 14, 7, UtilDate.dateAtNoon(new Date()).getTime()));
- }
+ prescriptionsDAO.insert(prescription);
+ }
+ List prescriptions = prescriptionsDAO.getAllMedics();
+ System.out.println(prescriptions);
+ Log.d(TAG, "prescriptions ==" + prescriptions);
+ }
}
+ 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 formatName = " + bundle.getString(BARCODE_FORMAT_NAME));
+ if (BuildConfig.DEBUG) {
+ Toast.makeText(this, "Scanned: " + bundle.getString(BARCODE_FORMAT_NAME),
+ Toast.LENGTH_LONG).show();
+ }
+
+ String cip13;
+ switch (bundle.getString(BARCODE_FORMAT_NAME)) {
+ case "CODE_128":
+ case "EAN_13": //CODE_128 || EAN 13
+ cip13 = bundle.getString(BARCODE_CONTENT);
+ break;
+ case "DATA_MATRIX":
+ cip13 = bundle.getString(BARCODE_CONTENT).substring(4, 17);
+ break;
+ default:
+ scanNotOK();
+ return;
+ }
+
+ // Get Drug from database
+ MedicinesDAO medicinesDAO = medicines.getMedicinesDAO();
+ final Medicine scannedMedicine = medicinesDAO.getMedicineByCIP13(cip13);
+
+ // add Drug to prescription database
+ askToAddInDB(scannedMedicine);
+ }
+ }
+ }
+ });
constructDrugsList();
}
+ public void constructDrugsList() {
+
+ PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
+ prescriptionList = prescriptionsDAO.getAllMedics();
+
+ View mRecyclerView = findViewById(R.id.drug_list);
+ assert mRecyclerView != null;
+ setupRecyclerView((RecyclerView) mRecyclerView);
+ }
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
@@ -188,113 +289,46 @@ public class DrugListActivity extends AppCompatActivity {
}
public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.about:
- startActivity(new Intent(this, About.class));
- return true;
- case R.id.help:
- PrefManager prefManager = new PrefManager(this);
- prefManager.setFirstTimeLaunch(true);
+ int id = item.getItemId();
+ if (id == R.id.about) {
+ startActivity(new Intent(this, About.class));
+ return true;
+ } else if (id == R.id.help) {
+ PrefManager prefManager = new PrefManager(this);
+ prefManager.setFirstTimeLaunch(true);
- startActivity(new Intent(this, WelcomeActivity.class));
- return true;
+ startActivity(new Intent(this, WelcomeActivity.class));
+ return true;
}
return super.onOptionsItemSelected(item);
}
- public void onPause() {
- super.onPause();
- Log.d(TAG, "onPause really!");
- AlarmReceiver.scheduleAlarm(this);
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ constructDrugsList();
}
public void 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();
- }
+ // Launch scan
+ public void onButtonClick(View v) {
+ Log.d(TAG, "add medication");
+ ScanOptions options = new ScanOptions();
+ options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_128);
+ options.setCameraId(0); // Use a specific camera of the device
+ options.setBeepEnabled(true);
+ options.setBarcodeImageEnabled(true);
+ options.setTimeout(60);
+ options.setCaptureActivity(CustomScannerActivity.class);
+ options.setBeepEnabled(true);
+ options.addExtra(Intents.Scan.SCAN_TYPE, Intents.Scan.MIXED_SCAN);
+ options.addExtra(Intents.Scan.SCAN_TYPE, Intents.Scan.INVERTED_SCAN);
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent 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();
- } else {
- IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);
-
- if (BuildConfig.DEBUG) { Toast.makeText(this, "REQUEST_CODE = " + requestCode,
- Toast.LENGTH_LONG).show(); }
-
- 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);
- }
- }
+ Log.d(TAG, "scanOptions == " + options);
+ mBarcodeScannerLauncher.launch(options);
}
/**
@@ -315,8 +349,9 @@ public class DrugListActivity extends AppCompatActivity {
.setPositiveButton("OK", (dialog, id) -> {
String cip13 = editText.getText().toString();
- Drug aDrug = dbDrug.getDrugByCIP13(cip13);
- askToAddInDB(aDrug);
+ MedicinesDAO medicineDAO = medicines.getMedicinesDAO();
+ Medicine aMedicine = medicineDAO.getMedicineByCIP13(cip13);
+ askToAddInDB(aMedicine);
})
.setNegativeButton("Cancel",
(dialog, id) -> dialog.cancel());
@@ -346,14 +381,15 @@ public class DrugListActivity extends AppCompatActivity {
/**
* Ask if the drug found in the database should be include in the
* user database
- * @param aDrug Drug- drug to be added
+ *
+ * @param aMedicine Prescription- medication to be added
*/
- private void askToAddInDB(Drug aDrug) {
+ private void askToAddInDB(Medicine aMedicine) {
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setTitle(getString(R.string.app_name));
- if (aDrug != null) {
- String msg = aDrug.getName() + " " + getString(R.string.msgFound);
+ if (aMedicine != null) {
+ String msg = aMedicine.getName() + " " + getString(R.string.msgFound);
dlg.setMessage(msg);
dlg.setNegativeButton(getString(R.string.button_cancel), (dialog, which) -> {
@@ -361,7 +397,7 @@ public class DrugListActivity extends AppCompatActivity {
});
dlg.setPositiveButton(getString(R.string.button_ok), (dialog, which) -> {
// Add Drug to DB then try to show it
- addDrugToList(aDrug);
+ addDrugToList(Utils.medicine2prescription(aMedicine));
});
} else {
dlg.setMessage(getString(R.string.msgNotFound));
@@ -375,8 +411,7 @@ public class DrugListActivity extends AppCompatActivity {
/**
* Tell user that the barre code cannot be interpreted
*/
- private void scanNotOK()
- {
+ private void scanNotOK() {
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setTitle(getString(R.string.app_name));
@@ -388,56 +423,69 @@ public class DrugListActivity extends AppCompatActivity {
}
/**
- * Add New drug to the user database
- * @param aDrug Drug - drug to be added
+ * askForCompréhensive
*/
- private void addDrugToList(Drug aDrug)
- {
- aDrug.setDateEndOfStock();
- mAdapter.addItem(aDrug);
+ private void askForComprehensive() {
+ AlertDialog.Builder dlg = new AlertDialog.Builder(this);
+ dlg.setTitle(getString(R.string.app_name));
+
+ dlg.setMessage(R.string.understood);
+ dlg.setPositiveButton(R.string.Yes, (dialog, which) -> {
+ // Nothing to do just dismiss dialog
+ });
+ dlg.show();
+ }
+
+
+ /**
+ * Add New drug to the user database
+ *
+ * @param aPrescription Prescription - medication to be added
+ */
+
+ @SuppressWarnings("deprecation")
+ private void addDrugToList(Prescription aPrescription) {
+ aPrescription.getDateEndOfStock();
+ mAdapter.addItem(aPrescription);
Log.d(TAG, "Call DrugDetailActivity");
Context context = this;
Intent intent = new Intent(context, DrugDetailActivity.class);
- intent.putExtra("drug", aDrug);
+ intent.putExtra("prescription", aPrescription);
+
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
}
- /**
- * setupRecyclerView (list of drugs
+ /**
+ * setupRecyclerView (list of drugs)
+ *
* @param recyclerView RecyclerView
*/
private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext()));
- mAdapter = new SimpleItemRecyclerViewAdapter(drugs);
+ mAdapter = new SimpleItemRecyclerViewAdapter(prescriptionList);
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
*/
- public class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter {
+ public class SimpleItemRecyclerViewAdapter extends
+ RecyclerView.Adapter {
- private final List mValues;
- SimpleItemRecyclerViewAdapter(List items) {
+ private final List mValues;
+
+ SimpleItemRecyclerViewAdapter(List items) {
mValues = items;
}
- void addItem(Drug scannedDrug) {
- if (!dbHelper.isDrugExist(scannedDrug.getCip13())) {
- mValues.add(scannedDrug);
+ void addItem(Prescription scannedPrescription) {
+ PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
+ if (prescriptionsDAO.getMedicByCIP13(scannedPrescription.getCip13()) == null) {
+ mValues.add(scannedPrescription);
//notifyDataSetChanged();
notifyItemInserted(mValues.size());
- dbHelper.addDrug(scannedDrug);
+ prescriptionsDAO.insert(scannedPrescription);
} else {
Toast.makeText(getApplicationContext(), "already in the database", Toast.LENGTH_LONG).show();
}
@@ -452,6 +500,7 @@ public class DrugListActivity extends AppCompatActivity {
}
@Override
+ @SuppressWarnings("deprecation")
public void onBindViewHolder(final ViewHolder holder, int dummy) {
final int position = holder.getBindingAdapterPosition();
SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE d MMMM yyyy", Locale.getDefault());
@@ -473,6 +522,19 @@ public class DrugListActivity extends AppCompatActivity {
if (mValues.get(position).getTake() == 0) {
holder.mView.setBackgroundResource(R.drawable.gradient_bg);
holder.mIconView.setImageResource(R.drawable.ic_suspended_pill);
+
+ holder.mView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Prescription aPrescription = mValues.get(position);
+ Context context = v.getContext();
+ Intent intent = new Intent(context, DrugDetailActivity.class);
+ intent.putExtra("prescription", aPrescription);
+ startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
+ overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
+
+ }
+ });
} else {
int remainingStock = (int) Math.floor(mValues.get(position).getStock() / mValues.get(position).getTake());
if (remainingStock <= mValues.get(position).getAlertThreshold()) {
@@ -486,19 +548,21 @@ public class DrugListActivity extends AppCompatActivity {
holder.mView.setBackgroundResource(R.drawable.gradient_bg_ok);
holder.mIconView.setImageResource(R.drawable.ok_stock_vect);
}
+
+ holder.mView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Prescription prescription = mValues.get(position);
+ Context context = v.getContext();
+ Intent intent = new Intent(context, DrugDetailActivity.class);
+ intent.putExtra("prescription", prescription);
+ 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
@@ -511,8 +575,7 @@ public class DrugListActivity extends AppCompatActivity {
final TextView mContentView;
final TextView mEndOfStock;
final ImageView mIconView;
-
- Drug mItem;
+ public Prescription mItem;
ViewHolder(View view) {
super(view);
@@ -529,4 +592,14 @@ public class DrugListActivity extends AppCompatActivity {
}
}
}
-}
\ No newline at end of file
+
+ 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) : "???");
+ }
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/PillDroidJobService.java b/app/src/main/java/net/foucry/pilldroid/PillDroidJobService.java
index 5d37158..3ee2e7b 100644
--- a/app/src/main/java/net/foucry/pilldroid/PillDroidJobService.java
+++ b/app/src/main/java/net/foucry/pilldroid/PillDroidJobService.java
@@ -13,7 +13,6 @@ import androidx.core.app.NotificationManagerCompat;
import java.util.List;
-
/**
* Created by jacques on 17/09/16.
*/
@@ -89,7 +88,7 @@ public class PillDroidJobService extends JobService {
Log.d(TAG, "schedule notification");
createNotificationChannel();
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")
.setSmallIcon(R.drawable.ic_pill_alarm)
.setContentTitle(getString(R.string.app_name))
@@ -114,23 +113,21 @@ public class PillDroidJobService extends JobService {
int importance = NotificationManager.IMPORTANCE_DEFAULT;
String CHANNEL_ID = "PillDroid";
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);
- // Register the channel with the system; you can't change the importance
- // or other notification behaviors after this
- NotificationManager notificationManager = getSystemService(NotificationManager.class);
- try {
- notificationManager.createNotificationChannel(channel);
- } catch (Exception e) {
- // This will catch any exception, because they are all descended from Exception
- Log.e(TAG, e.toString());
- //At the level Exception Class handle the error in Exception Table
- // Exception Create That Error Object and throw it
- //E.g: FileNotFoundException ,etc
- e.printStackTrace();
- }
+ channel.setDescription(description);
+ // Register the channel with the system; you can't change the importance
+ // or other notification behaviors after this
+ NotificationManager notificationManager = getSystemService(NotificationManager.class);
+ try {
+ notificationManager.createNotificationChannel(channel);
+ } catch (Exception e) {
+ // This will catch any exception, because they are all descended from Exception
+ Log.e(TAG, e.toString());
+ //At the level Exception Class handle the error in Exception Table
+ // Exception Create That Error Object and throw it
+ //E.g: FileNotFoundException ,etc
+ e.printStackTrace();
}
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/PilldroidScanContract.java b/app/src/main/java/net/foucry/pilldroid/PilldroidScanContract.java
new file mode 100644
index 0000000..8c8478a
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/PilldroidScanContract.java
@@ -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{
+ 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);
+ }
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/PrefManager.java b/app/src/main/java/net/foucry/pilldroid/PrefManager.java
index cbd6736..8d0989d 100644
--- a/app/src/main/java/net/foucry/pilldroid/PrefManager.java
+++ b/app/src/main/java/net/foucry/pilldroid/PrefManager.java
@@ -8,16 +8,17 @@ import android.content.SharedPreferences;
* Created by Lincoln on 05/05/16.
*/
public class PrefManager {
- SharedPreferences pref;
+ final SharedPreferences pref;
SharedPreferences.Editor editor;
// shared pref mode
- int PRIVATE_MODE = 0;
+ final int PRIVATE_MODE = 0;
// Shared preferences file name
private static final String PREF_NAME = "Pildroid-Prefs";
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
private static final String DATABASE_VERSION = "DatabaseVersion";
+ private static final String IS_UNDERSTOOD = "IsUnderStood";
public PrefManager(Context context) {
pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
@@ -35,10 +36,17 @@ import android.content.SharedPreferences;
editor.apply();
}
+ public void setUnderstood(boolean isUnderstood) {
+ editor = pref.edit();
+ editor.putBoolean(IS_UNDERSTOOD, isUnderstood);
+ editor.apply();
+ }
+
public boolean isFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
}
public int getDatabaseVersion() {
return pref.getInt(DATABASE_VERSION, 0);
}
+ public boolean isUnderstood() {return pref.getBoolean(IS_UNDERSTOOD, false); }
}
diff --git a/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java b/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java
index 86a5bcf..e6fa4c4 100644
--- a/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java
+++ b/app/src/main/java/net/foucry/pilldroid/SimpleDividerItemDecoration.java
@@ -6,7 +6,7 @@ import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.NonNull;
-import androidx.core.content.ContextCompat;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.recyclerview.widget.RecyclerView;
/**
@@ -16,7 +16,8 @@ public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration {
private final Drawable mDivider;
SimpleDividerItemDecoration(Context context) {
- mDivider = context.getDrawable(R.drawable.line_divider);
+ //mDivider = context.getDrawable(R.drawable.line_divider);
+ mDivider = AppCompatResources.getDrawable(context, R.drawable.line_divider);
}
@Override
diff --git a/app/src/main/java/net/foucry/pilldroid/UtilDate.java b/app/src/main/java/net/foucry/pilldroid/UtilDate.java
index 1213256..fe7075a 100644
--- a/app/src/main/java/net/foucry/pilldroid/UtilDate.java
+++ b/app/src/main/java/net/foucry/pilldroid/UtilDate.java
@@ -5,7 +5,6 @@ import android.util.Log;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
-import java.time.LocalTime;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
@@ -13,7 +12,7 @@ import java.util.Locale;
/**
* Created by jacques on 05/05/16.
*/
-class UtilDate {
+public class UtilDate {
private static final String TAG = UtilDate.class.getName();
@@ -22,7 +21,7 @@ class UtilDate {
* @return date the same date as input but at noon (12:00:00 PM)
* set date time at Noon
*/
- static Date dateAtNoon(Date aDate) {
+ public static Date dateAtNoon(Date aDate) {
Log.d(TAG, "dateAtNoon " + aDate);
@@ -42,7 +41,7 @@ class UtilDate {
* @param days number of days to remove to the ate
* @param date date before day removing
* @return date
- * Substract days to date and return a new date
+ * Subtract days to date and return a new date
*/
static Date removeDaysToDate(int days, Date date) {
Calendar calendar = Calendar.getInstance();
@@ -91,7 +90,7 @@ class UtilDate {
}
/**
- * Convert dateInMilliseconds into string formated date
+ * Convert dateInMilliseconds into string formatted date
* @param dateInMilliseconds long
* @return formatted Date String
*/
diff --git a/app/src/main/java/net/foucry/pilldroid/Utils.java b/app/src/main/java/net/foucry/pilldroid/Utils.java
index b57bd0c..6e2f416 100644
--- a/app/src/main/java/net/foucry/pilldroid/Utils.java
+++ b/app/src/main/java/net/foucry/pilldroid/Utils.java
@@ -1,31 +1,17 @@
package net.foucry.pilldroid;
-import java.io.InputStream;
-import java.io.OutputStream;
+import net.foucry.pilldroid.models.Medicine;
+import net.foucry.pilldroid.models.Prescription;
+
+import java.util.Date;
+import java.util.Locale;
import java.util.Random;
public class Utils {
- private static final String TAG = UtilDate.class.getName();
-
- public static void CopyStream(InputStream is, OutputStream os)
- {
- final int buffer_size=1024;
- try
- {
- byte[] bytes=new byte[buffer_size];
- for(;;)
- {
- int count=is.read(bytes, 0, buffer_size);
- if(count==-1)
- break;
- os.write(bytes, 0, count);
- }
- }
- catch(Exception ignored){}
- }
+ private static final String TAG = Utils.class.getName();
/**
- * Return a random number between twovalues - use to gənerate a false demo DB
+ * Return a random number between two values - use to generate a false demo DB
* @param min minimal value accepted
* @param max maximum value accepted
* @return int random number
@@ -35,4 +21,28 @@ public class Utils {
return r.nextInt(max - min) +max;
}
-}
\ No newline at end of file
+ public static String fmt(double d)
+ {
+ if(d == (long) d)
+ return String.format(Locale.getDefault(),"%d",(long)d);
+ else
+ return String.format("%s",d);
+ }
+
+ public static Prescription medicine2prescription(Medicine aMedicine) {
+ Prescription aPrescription = new Prescription();
+
+ aPrescription.setName(aMedicine.getName());
+ aPrescription.setCis(aMedicine.getCis());
+ aPrescription.setCip13(aMedicine.getCip13());
+ aPrescription.setPresentation(aMedicine.getPresentation());
+ aPrescription.setAdministration_mode(aMedicine.getAdministration_mode());
+ aPrescription.setStock(0F);
+ aPrescription.setAlert(7);
+ aPrescription.setTake(0F);
+ aPrescription.setWarning(14);
+ aPrescription.setLast_update(UtilDate.dateAtNoon(new Date()).getTime());
+
+ return aPrescription;
+ }
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java
index ebb5a8c..1816f83 100644
--- a/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java
+++ b/app/src/main/java/net/foucry/pilldroid/WelcomeActivity.java
@@ -2,16 +2,20 @@ package net.foucry.pilldroid;
import android.content.Intent;
import android.graphics.Color;
+import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
+import android.view.WindowInsets;
+import android.view.WindowInsetsController;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.PagerAdapter;
@@ -41,10 +45,9 @@ public class WelcomeActivity extends AppCompatActivity {
}
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.welcome_activity);
- setContentView(R.layout.activity_welcome);
+ setFullScreen();
viewPager = findViewById(R.id.view_pager);
dotsLayout = findViewById(R.id.layoutDots);
@@ -90,7 +93,7 @@ public class WelcomeActivity extends AppCompatActivity {
public void onClick(View v) {
// checking for last page
// if last page home screen will be launched
- int current = getItem(+1);
+ int current = getItem();
if (current < layouts.length) {
// move to next screen
viewPager.setCurrentItem(current);
@@ -118,8 +121,8 @@ public class WelcomeActivity extends AppCompatActivity {
dots[currentPage].setTextColor(ContextCompat.getColor(this, R.color.dot_light));
}
- private int getItem(int i) {
- return viewPager.getCurrentItem() + i;
+ private int getItem() {
+ return viewPager.getCurrentItem() + 1;
}
void launchHomeScreen() {
@@ -129,7 +132,7 @@ public class WelcomeActivity extends AppCompatActivity {
}
// viewpager change listener
- ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
+ final ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
@@ -167,6 +170,28 @@ public class WelcomeActivity extends AppCompatActivity {
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
*/
@@ -175,8 +200,9 @@ public class WelcomeActivity extends AppCompatActivity {
public MyViewPagerAdapter() {
}
+ @NonNull
@Override
- public Object instantiateItem(ViewGroup container, int position) {
+ public Object instantiateItem(@NonNull ViewGroup container, int position) {
LayoutInflater layoutInflater = getLayoutInflater();
View view = layoutInflater.inflate(layouts[position], container, false);
@@ -191,13 +217,13 @@ public class WelcomeActivity extends AppCompatActivity {
}
@Override
- public boolean isViewFromObject(View view, Object obj) {
+ public boolean isViewFromObject(@NonNull View view, @NonNull Object obj) {
return view == obj;
}
@Override
- public void destroyItem(ViewGroup container, int position, Object object) {
+ public void destroyItem(ViewGroup container, int position, @NonNull Object object) {
View view = (View) object;
container.removeView(view);
}
diff --git a/app/src/main/java/net/foucry/pilldroid/dao/MedicinesDAO.java b/app/src/main/java/net/foucry/pilldroid/dao/MedicinesDAO.java
new file mode 100644
index 0000000..97d8ff9
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/dao/MedicinesDAO.java
@@ -0,0 +1,20 @@
+package net.foucry.pilldroid.dao;
+
+import androidx.room.Dao;
+import androidx.room.Query;
+
+import net.foucry.pilldroid.models.Medicine;
+
+import java.util.List;
+
+@Dao
+public interface MedicinesDAO {
+ @Query("SELECT * FROM drugs")
+ List getAllMedicines();
+
+ @Query("SELECT * FROM drugs WHERE cip13 = :cip13")
+ Medicine getMedicineByCIP13(String cip13);
+
+ @Query("SELECT count(*) FROM drugs")
+ int getMedicineCount();
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/dao/PrescriptionsDAO.java b/app/src/main/java/net/foucry/pilldroid/dao/PrescriptionsDAO.java
new file mode 100644
index 0000000..969ac4a
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/dao/PrescriptionsDAO.java
@@ -0,0 +1,34 @@
+package net.foucry.pilldroid.dao;
+
+import androidx.room.Dao;
+import androidx.room.Delete;
+import androidx.room.Insert;
+import androidx.room.Query;
+import androidx.room.Update;
+
+import net.foucry.pilldroid.models.Prescription;
+
+import java.util.List;
+
+@Dao
+public interface PrescriptionsDAO {
+ @Insert
+ void insert(Prescription... prescriptions);
+
+ @Update
+ void update(Prescription... prescriptions);
+
+ @Delete
+ void delete(Prescription prescription);
+
+ @Query("SELECT * FROM prescriptions")
+ List getAllMedics();
+
+ @Query("SELECT * FROM prescriptions WHERE cip13 = :cip13")
+ Prescription getMedicByCIP13(String cip13);
+
+ @Query("SELECT count(*) FROM prescriptions")
+ int getMedicCount();
+}
+
+
diff --git a/app/src/main/java/net/foucry/pilldroid/databases/MedicineDatabase.java b/app/src/main/java/net/foucry/pilldroid/databases/MedicineDatabase.java
new file mode 100644
index 0000000..0f50517
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/databases/MedicineDatabase.java
@@ -0,0 +1,35 @@
+package net.foucry.pilldroid.databases;
+
+import android.content.Context;
+
+import androidx.room.Database;
+import androidx.room.Room;
+import androidx.room.RoomDatabase;
+
+import net.foucry.pilldroid.dao.MedicinesDAO;
+import net.foucry.pilldroid.models.Medicine;
+
+@Database(
+ version = 1,
+ entities = {Medicine.class}
+)
+
+public abstract class MedicineDatabase extends RoomDatabase {
+ private static MedicineDatabase INSTANCE;
+ public abstract MedicinesDAO getMedicinesDAO();
+ public static MedicineDatabase getInstanceDatabase(Context context) {
+ if (INSTANCE == null) {
+ INSTANCE =
+ Room
+ .databaseBuilder(context.getApplicationContext(), MedicineDatabase.class, "medicines")
+ .createFromAsset("drugs.db")
+ .allowMainThreadQueries()
+ .build();
+ }
+ return INSTANCE;
+ }
+
+ public static void destroyInstance() {
+ INSTANCE = null;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/net/foucry/pilldroid/databases/PrescriptionDatabase.java b/app/src/main/java/net/foucry/pilldroid/databases/PrescriptionDatabase.java
new file mode 100644
index 0000000..e8a3387
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/databases/PrescriptionDatabase.java
@@ -0,0 +1,39 @@
+package net.foucry.pilldroid.databases;
+
+import android.content.Context;
+
+import androidx.room.AutoMigration;
+import androidx.room.Database;
+import androidx.room.Room;
+import androidx.room.RoomDatabase;
+
+import net.foucry.pilldroid.dao.PrescriptionsDAO;
+import net.foucry.pilldroid.models.Prescription;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Database(
+ version = 1,
+ entities = {Prescription.class}
+)
+
+public abstract class PrescriptionDatabase extends RoomDatabase {
+ private static PrescriptionDatabase INSTANCE;
+ public abstract PrescriptionsDAO getPrescriptionsDAO();
+ public static PrescriptionDatabase getInstanceDatabase(Context context) {
+ if (INSTANCE == null) {
+ INSTANCE =
+ Room
+ .databaseBuilder(context.getApplicationContext(),
+ PrescriptionDatabase.class, "prescriptions")
+ .allowMainThreadQueries()
+ .build();
+ }
+ return INSTANCE;
+ }
+
+ public static void destroyInstance() {
+ INSTANCE = null;
+ }
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/models/Medicine.java b/app/src/main/java/net/foucry/pilldroid/models/Medicine.java
new file mode 100644
index 0000000..1fd10be
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/models/Medicine.java
@@ -0,0 +1,97 @@
+package net.foucry.pilldroid.models;
+
+import androidx.annotation.NonNull;
+import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+
+@Entity(tableName = "drugs")
+public class Medicine {
+ @PrimaryKey
+ @NonNull private Integer _id;
+ private String cis;
+ private String cip13;
+ private String cip7;
+ private String administration_mode;
+ private String name;
+ private String presentation;
+ private String label_group;
+ private Integer generic_type;
+
+ public Medicine(@NonNull String cis) {
+ this.cis = cis;
+ }
+
+ @NonNull
+ public String getCis() {
+ return cis;
+ }
+
+ public void setCis(@NonNull String cis) {
+ this.cis = cis;
+ }
+
+ public String getCip13() {
+ return cip13;
+ }
+
+ public void setCip13(String cip13) {
+ this.cip13 = cip13;
+ }
+
+ public String getCip7() {
+ return cip7;
+ }
+
+ public void setCip7(String cip7) {
+ this.cip7 = cip7;
+ }
+
+ public String getAdministration_mode() {
+ return administration_mode;
+ }
+
+ public void setAdministration_mode(String administration_mode) {
+ this.administration_mode = administration_mode;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPresentation() {
+ return presentation;
+ }
+
+ public void setPresentation(String presentation) {
+ this.presentation = presentation;
+ }
+
+ public String getLabel_group() {
+ return label_group;
+ }
+
+ public void setLabel_group(String label_group) {
+ this.label_group = label_group;
+ }
+
+ public Integer getGeneric_type() {
+ return generic_type;
+ }
+
+ public void setGeneric_type(Integer generic_type) {
+ this.generic_type = generic_type;
+ }
+
+ @NonNull
+ public Integer get_id() {
+ return _id;
+ }
+
+ public void set_id(@NonNull Integer _id) {
+ this._id = _id;
+ }
+}
diff --git a/app/src/main/java/net/foucry/pilldroid/models/Prescription.java b/app/src/main/java/net/foucry/pilldroid/models/Prescription.java
new file mode 100644
index 0000000..6e3edfc
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/models/Prescription.java
@@ -0,0 +1,151 @@
+package net.foucry.pilldroid.models;
+
+import androidx.annotation.NonNull;
+import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+
+import net.foucry.pilldroid.UtilDate;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.Date;
+
+@Entity(tableName = "prescriptions")
+public class Prescription implements Serializable {
+ @PrimaryKey
+ @NonNull private String cis;
+ private String cip13;
+ private String name;
+ private String administration_mode;
+ private String presentation;
+ private Float stock;
+ private Float take;
+ private Integer warning;
+ private Integer alert;
+ private Long last_update;
+ private String label_group;
+ private Integer genetic_type;
+
+ public void setCis(@NonNull String cis)
+{
+ this.cis = cis;
+}
+
+ public void setCip13(String cip13) {
+ this.cip13 = cip13;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setAdministration_mode(String administration_mode) {
+ this.administration_mode = administration_mode;
+ }
+
+ public void setPresentation(String presentation) {
+ this.presentation = presentation;
+}
+ public void setStock(Float stock) {
+ this.stock = stock;
+}
+
+ public void setTake(Float take) {
+ this.take = take;
+}
+
+ public void setWarning(Integer warning) {
+ this.warning = warning;
+}
+
+ public void setAlert(Integer alert) {
+ this.alert = alert;
+}
+
+ public void setLast_update(Long last_update) {
+ this.last_update = last_update;
+}
+
+ @NonNull
+ public String getCis() {
+ return this.cis;
+}
+
+ public Integer getWarning() {
+ return warning;
+ }
+
+ public String getCip13() {
+ return cip13;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getAdministration_mode() {
+ return administration_mode;
+ }
+
+ public String getPresentation() {
+ return presentation;
+ }
+
+ public Float getStock() {
+ return stock;
+ }
+
+ public Float getTake() {
+ return take;
+ }
+
+ public Integer getAlert() {
+ return alert;
+ }
+
+ public Long getLast_update() {
+ return last_update;
+ }
+
+ public int getAlertThreshold() {
+ return this.alert;
+ }
+
+ public int getWarnThreshold() {
+ return this.warning;
+ }
+ public String getLabel_group() {
+ return label_group;
+ }
+
+ public void setLabel_group(String label_group) {
+ this.label_group = label_group;
+ }
+
+ public Integer getGenetic_type() {
+ return genetic_type;
+ }
+
+ public void setGenetic_type(Integer genetic_type) {
+ this.genetic_type = genetic_type;
+ }
+ public Date getDateEndOfStock() {
+ int numberDayOfTake;
+ if (this.getTake() > 0) {
+ numberDayOfTake = (int) Math.floor(this.getStock() / this.getTake());
+ } else {
+ numberDayOfTake = 0;
+ }
+
+ Date aDate = UtilDate.dateAtNoon(new Date());
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(aDate);
+ calendar.add(Calendar.DAY_OF_YEAR, numberDayOfTake);
+
+ return calendar.getTime();
+ }
+}
+
+
+
+
diff --git a/app/src/main/res/layout-w900dp/drug_list.xml b/app/src/main/res/layout-w900dp/drug_list.xml
index 05c8107..6f8d0f6 100644
--- a/app/src/main/res/layout-w900dp/drug_list.xml
+++ b/app/src/main/res/layout-w900dp/drug_list.xml
@@ -9,6 +9,7 @@
android:divider="?android:attr/dividerHorizontal"
android:orientation="horizontal"
android:showDividers="middle"
+ android:fitsSystemWindows="true"
tools:context="net.foucry.pilldroid.DrugListActivity">
-
+ android:background="@android:color/white"
+ tools:ignore="Overdraw">
+ app:zxing_viewfinder_mask="@color/grey"/>
+ android:src="@drawable/ic_keyboard_black_24dp"
+ tools:ignore="PrivateResource" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_custom_scanner.xml b/app/src/main/res/layout/custom_scanner_activty.xml
similarity index 90%
rename from app/src/main/res/layout/activity_custom_scanner.xml
rename to app/src/main/res/layout/custom_scanner_activty.xml
index 51cda62..298d8c5 100644
--- a/app/src/main/res/layout/activity_custom_scanner.xml
+++ b/app/src/main/res/layout/custom_scanner_activty.xml
@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="example.zxing.CustomScannerActivity">
+ tools:context="net.foucry.pilldroid.CustomScannerActivity">
diff --git a/app/src/main/res/layout/activity_drug_detail.xml b/app/src/main/res/layout/drug_detail_activity.xml
similarity index 96%
rename from app/src/main/res/layout/activity_drug_detail.xml
rename to app/src/main/res/layout/drug_detail_activity.xml
index 17bcf2d..30815da 100644
--- a/app/src/main/res/layout/activity_drug_detail.xml
+++ b/app/src/main/res/layout/drug_detail_activity.xml
@@ -47,8 +47,9 @@
android:id="@+id/fab"
android:layout_width="@dimen/fab_width"
android:layout_height="@dimen/fab_height"
- android:layout_gravity="end|top"
+ android:layout_gravity="end|bottom"
android:layout_marginTop="?attr/actionBarSize"
+ android:layout_marginBottom="?attr/actionBarSize"
android:layout_marginEnd="@dimen/fab_margin"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/save_button"
diff --git a/app/src/main/res/layout/drug_list.xml b/app/src/main/res/layout/drug_list.xml
index d798d15..928091c 100644
--- a/app/src/main/res/layout/drug_list.xml
+++ b/app/src/main/res/layout/drug_list.xml
@@ -6,6 +6,7 @@
android:name="net.foucry.pilldroid.MedicamentListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:fitsSystemWindows="true"
app:layoutManager="LinearLayoutManager"
android:background="@drawable/list_selector"
tools:context="net.foucry.pilldroid.DrugListActivity"
diff --git a/app/src/main/res/layout/activity_drug_list.xml b/app/src/main/res/layout/drug_list_activity.xml
similarity index 94%
rename from app/src/main/res/layout/activity_drug_list.xml
rename to app/src/main/res/layout/drug_list_activity.xml
index 8082bf0..0664590 100644
--- a/app/src/main/res/layout/activity_drug_list.xml
+++ b/app/src/main/res/layout/drug_list_activity.xml
@@ -45,10 +45,11 @@
android:backgroundTint="@android:color/transparent"
android:baselineAlignBottom="false"
android:clickable="false"
- android:onClick="scanNow"
+ android:onClick="onButtonClick"
android:src="@drawable/ic_add_circle_black_24dp"
app:backgroundTint="@android:color/darker_gray"
app:fabCustomSize="60dp"
app:maxImageSize="60dp"
- android:contentDescription="@string/add_button" />
+ android:contentDescription="@string/add_button"
+ tools:ignore="OnClick" />
diff --git a/app/src/main/res/layout/welcome3.xml b/app/src/main/res/layout/welcome3.xml
index 2aa71b6..e1ab90f 100644
--- a/app/src/main/res/layout/welcome3.xml
+++ b/app/src/main/res/layout/welcome3.xml
@@ -10,7 +10,7 @@
+ tools:showIn="@layout/welcome_activity">
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi b/app/src/main/res/mipmap-anydpi
new file mode 100644
index 0000000..e69de29
diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml
index 80fb7dd6..28f8050 100644
--- a/app/src/main/res/values-fr-rFR/strings.xml
+++ b/app/src/main/res/values-fr-rFR/strings.xml
@@ -3,60 +3,60 @@
Détail Médicament
Annuler
OK
- Présentation
+ Contenu de la boite
Nom
- Mode d\'adminitration
+ Mode d\'administration
Médicament introuvable dans la base de données
À propos
Aide
Prise
- Seuil critique
- Seuil d\'alerte
+ Seuil critique
+ Seuil d\'alerte
Médicament trouvé dans la base de données
Stock courant
Vous devez passer à la pharmacie
Utilisez le clavier
Vue de détail
- Enrefistrez
- Allumez/Éteignez le Flash
- Enter cip 13 here..
- Enter CIP 13
+ Enregistrer
+ Allumer/Eteindre le Flash
+ Saisir le code CIP 13 ici..
+ Saisir le code CIP 13
Bienvenue dans Pilldroid
- Pour ajouter un médicament, tapez sur le bouton « Plus »
- Vous pouvez scanner le code barre
- Ou le QRCode
- Fond vert, visage souriant, le stock est bon.
- Fond orange, visage neutre, le stock diminue.
- Fond rouge, visage grincheux le stock est bas.
- Les valeurs modifiables. Le stock est recalculé tous les jours
- Les informations sur le médicament
- Traitement suspendu, la prise est mise à zéro, le stock n\'est plus calculé.
- L\'icone de sauvegarde de vos modifications.
- Merci d\'utiliser PilllDroid.
- Le gestionnaire de stock theorique de médicaments
- Vous ajouter un médicament à la base de données
- Appellé cip13
- Icône de PillDroid
+ Ajouter un médicament, avec le bouton +
+ Scanner le code barre
+ Ou le QR code
+ Fond vert, visage souriant, le stock est bon
+ Fond orange, visage neutre, le stock diminue
+ Fond rouge, visage grincheux, le stock est faible
+ Consulter les informations sur le médicament
+ Les valeurs sont modifiables, le stock est recalculé tous les jours
+ Traitement suspendu, la prise est à zéro, le stock n\'est plus calculé
+ Sauvegarder vos modifications
+ Merci d\'utiliser Pilldroid
+ Le gestionnaire de stock théorique de médicaments
+ Pour ajouter un médicament dans le stock
+ Pour obtenir le CIP 13
+ Icône de Pilldroid
L\'icône Plus
- Pour trouver le CIP13
+ Pour obtenir le CIP 13
Visage souriant
- Icône de code barre
- icône de QR-Code
+ Icône de code barre
+ icône de QR code
Visage neutre
Visage grincheux
Capture d\'écran sur la partie information du médicament
- Réglages
- Mettre la prise à zéro suspend le traitement et les calculs de stock
- Icône de traitemernt suspendu
+ Réglages
+ Mettre la prise à zéro suspend le traitement et le calcul du stock
+ Icône de traitement suspendu
Pour enregistrer les changements, utilisez l\'icône de sauvegarde
- l\'icône de sauvegarde
+ L\'icône de sauvegarde
Plus de renseignements sur https://pilldroid.foucry.net
Passer
Suivant
Démarrer
- Ajout d\'un médicament à votre liste
+ Ajout d\'un médicament dans votre liste
Nom Médicament
Icône de stock
lundi 1 janvier 2001
@@ -64,4 +64,8 @@
Libellé
Attributs d\'un médicament
Le code barre ne peut pas être interprété
+ Scan annulé
+ Autorisation appareil photo manquante
+ Oui, j\'ai compris
+ Je comprends que le développeur de app_name n\'est pas responsable de la gestion de vos médicaments. CELA RELÈVE DE VOTRE SEULE RESPONSABILITË.
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 9213a92..b689444 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -3,6 +3,7 @@
#3F51B5
#303F9F
#FF4081
+ #FFFFFF
#4f91ff
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 63b85e2..dd34a09 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -8,28 +8,28 @@
Help
You have to go to the pharmacy
Name
- Presentation
- Administration mode
+ Presentation
+ Administration mode
Current stock
Take
- Alert therehold
- Critical therehold
+ Alert threshold
+ Critical threshold
"Use the keyboard"
Detail view
Save
- Toggle Flash
- Enter cip 13 here..
+ Toggle Flash
+ Enter CIP 13 here..
Enter CIP 13
- PillDroid_NotificationChannel
- PillDroidChannel
+ Pilldroid_NotificationChannel
+ PilldroidChannel
Welcome on Pilldroid
- The theorical Pill Stock Manager
+ The theoretical Pill Stock Manager
To add a med, tap on the "Plus" button
You\'ll add a drug to the database
You can scan classic barcode
- called cip13
+ called CIP13
Or QRCode
Green background, happy face
Orange background, neutral face
@@ -39,16 +39,16 @@
Treatment suspended
save icon
Thanks
- PillDroid Icon
+ Pilldroid Icon
The plus icon
In order to find the CIP13
Happy face
- Barre code icon
+ Barre code icon
qr-code icon
neutral face
unhappy face
Drug info screenshot
- Tunables
+ Tunable
Take to 0 to suspend treatment
Treatment suspended icon
To save changes
@@ -65,5 +65,9 @@
Value
Label
Drug\'s attributes
- Barre code cannot be intrepreted
+ Barre code cannot be interpreted
+ Scan canceled
+ Missing camera permission
+ Yes, I understood
+ I understood that de developer of app_name cannot be responsible ot your medication management. IT\'S YOU OWN RESPONSIBILITY.
diff --git a/build.gradle b/build.gradle
index cfe6773..f0bbbef 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,7 +9,7 @@ buildscript {
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.0.4'
+ classpath 'com.android.tools.build:gradle:7.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -20,10 +20,9 @@ ext {
buildToolsVersion = '28.0.1'
var = '3.4.2'
//buildToolsVersion1 = '29.0.3'
- defaultMinSdkVersion = 24
+ defaultMinSdkVersion = 26
defaultTargetSdkVersion = 30
defaultVersionCode = 1
- defaultVersionCode1 = defaultVersionCode
}
allprojects {
diff --git a/fastlane/metadata/android/en-US/changelogs/v0.100-beta.txt b/fastlane/metadata/android/en-US/changelogs/v0.100-beta.txt
index 2b9c958..fc97d3a 100644
--- a/fastlane/metadata/android/en-US/changelogs/v0.100-beta.txt
+++ b/fastlane/metadata/android/en-US/changelogs/v0.100-beta.txt
@@ -1,6 +1,6 @@
# beta-0.100 – First public release
-**REMENBER** Pilldroid is a French people user only.
+**REMEMBER** Pilldroid is a French people user only.
I made a lot a tests but there must stay some bugs.
@@ -9,10 +9,10 @@ I made a lot a tests but there must stay some bugs.
find the code.
## What is not implemented
-- removing of a medic from the list;
-- take medic reminder. It will be never been implemented (by me).
+- removing of a prescription from the list;
+- take prescription reminder. It will be never been implemented (by me).
-**ATTENTION**, Pilldroid does not manage creams, liquids
+**WARNING**, Pilldroid does not manage creams, liquids
(like insulin).
Thanks to use [github](https://github/jfoucry/pilldroid) for bugs
@@ -23,4 +23,4 @@ do not stress me it will be unproductive.
Pilldroid will available only from [f-droid](https://f-droid.org)
-You can reach me and discuss on [Pildroid](mailto://jacques+pilldroid@foucry.net).
+You can reach me and discuss on [Pilldroid](mailto://jacques+pilldroid@foucry.net).
diff --git a/fastlane/metadata/android/en-US/changelogs/v0.200-beta.txt b/fastlane/metadata/android/en-US/changelogs/v0.200-beta.txt
new file mode 100644
index 0000000..90116bf
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/v0.200-beta.txt
@@ -0,0 +1,30 @@
+# v0.2.0 – New semantic version number (VMajor.Minor.Patch)
+
+**REMEMBER** Pilldroid is a French people user only.
+
+I made a lot a tests but there must stay some bugs.
+
+## What's new
+
+A lot of things under the surface :
+- Add an alert about non responsibility of the author in case of trouble;
+- Using `Room` to manage databases;
+- Migration of the old database to the new one, you should not see anything;
+- Code cleaning.
+
+## What should work.
+- QR-code scan on a dark background. The library have an option for that.
+
+
+**WARNING**, Pilldroid does not manage creams, liquids
+(like insulin).
+
+Thanks to use [github](https://github/jfoucry/pilldroid) for bugs
+reports and new features.
+
+> I made Pilldroid on my free time which is not expandable. Please
+do not stress me it will be unproductive.
+
+Pilldroid will available only from [f-droid](https://f-droid.org)
+
+You can reach me and discuss on [Pilldroid](mailto:jacques+pilldroid@foucry.net).
diff --git a/fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt b/fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt
new file mode 100644
index 0000000..45162b3
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt
@@ -0,0 +1,35 @@
+# v0.201-beta - fix bug in `alarmReceiver`
+
+The `alarmReceiver` was still using the old database that *should* be empty. I use `room` database
+management now.
+
+# v0.200-beta – New semantic version number (VRelease.MajorMinorPatch)
+
+**REMEMBER** Pilldroid is a French people user only.
+
+I made a lot a tests but there must stay some bugs.
+
+## What's new
+
+A lot of things under the surface :
+- Add an alert about non responsibility of the author in case of trouble;
+- Using `Room` to manage databases;
+- Migration of the old database to the new one, you should not see anything;
+- Code cleaning.
+
+## What should work.
+- QR-code scan on a dark background. The library have an option for that.
+
+
+**WARNING**, Pilldroid does not manage creams, liquids
+(like insulin).
+
+Thanks to use [github](https://github/jfoucry/pilldroid) for bugs
+reports and new features.
+
+> I made Pilldroid on my free time which is not expandable. Please
+do not stress me it will be unproductive.
+
+Pilldroid will available only from [f-droid](https://f-droid.org)
+
+You can reach me and discuss on [Pilldroid](mailto:jacques+pilldroid@foucry.net).
diff --git a/fastlane/metadata/android/fr-FR/changelogs/v0.100-beta.txt b/fastlane/metadata/android/fr-FR/changelogs/v0.100-beta.txt
index 8a0be22..c4f841a 100644
--- a/fastlane/metadata/android/fr-FR/changelogs/v0.100-beta.txt
+++ b/fastlane/metadata/android/fr-FR/changelogs/v0.100-beta.txt
@@ -4,7 +4,7 @@ Malgré de nombreux tests et une utilisation quotidienne,
tout est à tester.
## Ce qui ne fonctionne pas
-- le scan de QR-code sur fond foncé. La blibliothèque utilisée n'arrive
+- le scan de QR-code sur un fond foncé. La bibliothèque utilisée n'arrive
pas à les repérer.
## Ce qui n'est pas implémenté
@@ -15,11 +15,11 @@ pas à les repérer.
(l'insuline par exemple).
Merci d'utiliser [github](https://github/jfoucry/pilldroid) pour
-les rapports de bogues et demandes de fonctionnalités.
+rapporter des bogues et demander des fonctionnalités.
-> Je fais Pilldroid sur mon temps libre et accesible. Il est inutile
-et contre productif de me « mettre la pression ».
+> Je fais Pilldroid sur mon temps libre et accessible. Il est inutile
+et contre-productif de me « mettre la pression ».
Pilldroid ne sera diffusé que par [f-droid](https://f-droid.org)
-Vous pouvez m'écrire pour discuter de [Pildroid](mailto://jacques+pilldroid@foucry.net).
\ No newline at end of file
+Vous pouvez m'écrire pour discuter de [Pilldroid](mailto:jacques+pilldroid@foucry.net).
\ No newline at end of file
diff --git a/fastlane/metadata/android/fr-FR/changelogs/v0.200-beta.txt b/fastlane/metadata/android/fr-FR/changelogs/v0.200-beta.txt
new file mode 100644
index 0000000..a0ec5c2
--- /dev/null
+++ b/fastlane/metadata/android/fr-FR/changelogs/v0.200-beta.txt
@@ -0,0 +1,29 @@
+# v0.200 – Nouvelle numérotation sémantique (VMajor.Minor.Patch)
+
+Malgré de nombreux tests et une utilisation quotidienne,
+tout est à tester.
+
+## Nouveautés
+
+Pas grand-chose de visible pour les personnes utilisatrices :
+- Ajout d'une demande explicite de non-responsabilité de l'auteur en cas de problème ;
+- Utilisation de `Room` pour gérer les bases de données ;
+- Migration de l'ancienne base de données à la nouvelle, vous ne devriez rien voir ;
+- Nettoyage du code.
+
+## Ce qui devrait fonctionner
+- le scan de QR-code sur un fond foncé. La bibliothèque utilisée a un paramètre pour cela.
+
+
+**ATTENTION**, Pilldroid ne sait pas gérer les crèmes, les liquides
+(l'insuline par exemple).
+
+Merci d'utiliser [github](https://github/jfoucry/pilldroid) pour
+rapporter des bogues et demander des fonctionnalités.
+
+> Je fais Pilldroid sur mon temps libre et accessible. Il est inutile
+et contre-productif de me « mettre la pression ».
+
+Pilldroid ne sera diffusé que par [f-droid](https://f-droid.org)
+
+Vous pouvez m'écrire pour discuter de [Pilldroid](mailto:jacques+pilldroid@foucry.net).
diff --git a/fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt b/fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt
new file mode 100644
index 0000000..f06e17b
--- /dev/null
+++ b/fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt
@@ -0,0 +1,34 @@
+# v0.201-beta - deverminage dans `alarmReceiver`
+
+`alarmReceiver` utilisait l'ancienne base de données qui *doit* être vide. J'utilise maintenant
+la base de données gérée par `room`
+
+# v0.200 – Nouvelle numérotation sémantique (VMajor.Minor.Patch)
+
+Malgré de nombreux tests et une utilisation quotidienne,
+tout est à tester.
+
+## Nouveautés
+
+Pas grand-chose de visible pour les personnes utilisatrices :
+- Ajout d'une demande explicite de non-responsabilité de l'auteur en cas de problème ;
+- Utilisation de `Room` pour gérer les bases de données ;
+- Migration de l'ancienne base de données à la nouvelle, vous ne devriez rien voir ;
+- Nettoyage du code.
+
+## Ce qui devrait fonctionner
+- le scan de QR-code sur un fond foncé. La bibliothèque utilisée a un paramètre pour cela.
+
+
+**ATTENTION**, Pilldroid ne sait pas gérer les crèmes, les liquides
+(l'insuline par exemple).
+
+Merci d'utiliser [github](https://github/jfoucry/pilldroid) pour
+rapporter des bogues et demander des fonctionnalités.
+
+> Je fais Pilldroid sur mon temps libre et accessible. Il est inutile
+et contre-productif de me « mettre la pression ».
+
+Pilldroid ne sera diffusé que par [f-droid](https://f-droid.org) (pour l'instant)
+
+Vous pouvez m'écrire pour discuter de [Pilldroid](mailto:jacques+pilldroid@foucry.net).
diff --git a/fastlane/metadata/android/fr-FR/short_description.txt b/fastlane/metadata/android/fr-FR/short_description.txt
index a4f0ccc..253323e 100644
--- a/fastlane/metadata/android/fr-FR/short_description.txt
+++ b/fastlane/metadata/android/fr-FR/short_description.txt
@@ -1 +1 @@
-Pilldroid est un gestionnaire théorique de stock de médicaments
\ No newline at end of file
+Pilldroid est un gestionnaire théorique de stock de médicaments.
\ No newline at end of file