Merge branch 'fix-misc' of ssh://git.exodus-privacy.eu.org:2225/foucry.net/PillDroid into fix-misc

This commit is contained in:
Jacques Foucry 2021-02-07 21:58:12 +01:00
commit b7f4402d17
128 changed files with 5047 additions and 1 deletions

47
.gitignore vendored
View file

@ -1 +1,46 @@
.idea
# Built application files
/*/build/
/build
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
.gradle/
# Signing files
.signing/
# User-specific configurations
.idea/
.idea/gradle.xml
.idea/libraries/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
*.iml
# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.apk
*.ap_
*.class
gen/

View file

@ -0,0 +1,116 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

View file

@ -0,0 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="jacques">
<words>
<w>médicaments</w>
</words>
</dictionary>
</component>

21
.idea/gradle.xml Normal file
View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

1
app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

90
app/build.gradle Normal file
View file

@ -0,0 +1,90 @@
//noinspection GradleCompatible
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
def versionPropsFile = file('version.properties')
def versionBuild
/*Setting default value for versionBuild which is the last incremented value stored in the file */
if (versionPropsFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
versionBuild = versionProps['VERSION_BUILD'].toInteger()
} else {
throw new FileNotFoundException("Could not read version.properties!")
}
/*Wrapping inside a method avoids auto incrementing on every gradle task run. Now it runs only when we build apk*/
ext.autoIncrementBuildNumber = {
if (versionPropsFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
versionBuild = versionProps['VERSION_BUILD'].toInteger() + 1
versionProps['VERSION_BUILD'] = versionBuild.toString()
versionProps.store(versionPropsFile.newWriter(), null)
} else {
throw new FileNotFoundException("Could not read version.properties!")
}
}
defaultConfig {
applicationId "net.foucry.pilldroid"
minSdkVersion defaultMinSdkVersion
targetSdkVersion defaultTargetSdkVersion
versionCode 1
versionName "1.0.0." + versionBuild
applicationIdSuffix = 'alpha'
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
/*dexOptions {
incremental false
}*/
buildToolsVersion = buildToolsVersion1
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
repositories {
jcenter()
}
sourceSets {
main {
java {
exclude 'net/foucry/pilldroid/scanActivity.java'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.journeyapps:zxing-android-embedded:4.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core:1.3.2'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
}

17
app/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Volumes/Users/jacques/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View file

@ -0,0 +1,13 @@
package net.foucry.pilldroid;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.foucry.pilldroid">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:fullBackupContent="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MedicamentListActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MedicamentDetailActivity"
android:label="@string/title_medicament_detail"
android:parentActivityName=".MedicamentListActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="net.foucry.pilldroid.MedicamentListActivity" />
</activity>
<activity
android:name=".WelcomeActivity"
android:label="Welcome"
android:parentActivityName=".MedicamentListActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="net.foucry.pilldroid.MedicamentListActivity" />
</activity>
<activity
android:name=".About"
android:label="À propos de PillDroid"
android:parentActivityName=".MedicamentListActivity"
android:theme="@style/AppTheme" />
<activity android:name=".CustomScannerActivity" />
<service
android:name=".PillDroidJobService"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
</manifest>

View file

@ -0,0 +1,37 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
p {
font-size: .8em;
}
div.build {
font-size: .7em;
text-align: center;
}
p.red {
color: #ff2600;
}</style>
</head>
<body>
<center><img src="file:///android_asset/ic_launcher-web.png" width="64"/></center>
<!--<div class="build">[[[about_string]]]</div>-->
<h5>PillDroid &copy;&nbsp;2020 Jacques Foucry </h5>
<p>PillDroid est une gestion théorique de votre stock de médicaments.</p>
<p>PillDroid n'a aucune connaissance des interactions des médicaments entre eux.</p>
<p class="red">EN CAS DE DOUTE, CONSULTEZ VOTRE MÉDECIN OU VOTRE PHARMACIEN.</p>
<p>PillDroid ne vous rappelle pas de prendre vos médicaments.</p>
<p class="red">LA RESPONSABILITÉ DE L'AUTEUR NE SAURAIT ÊTRE ENGAGÉE EN CAS DE SURDOSAGE OU D'OUBLI DE PRISE.</p>
<hr width=45%/>
<p>PillDroid n'aurait pas pu voir le jour sans les conseils avisés de Frank, Benoit, Dominique &amp; Aurélien.</p>
<p>Stéphane en grand chamboulateur d'interface en fait quelque chose d'utilisable</p>
<hr width=45%/>
<p>Les conseils et aides de <a href="mob-dev.fr">mob-dev.fr</a>.</p>
<p>Le soutien actif et les conseils du Dr Kauffmann me permettent de faire
évoluer PillDroid.</p>
<p>Vous pouvez me contacter à l'adresse suivante : <a
href="mailto:jacques+PillDroid@foucry.net?subject=À propos de
PillDroid">jacques+pilldroid@foucry.net</a></p>.
<p>Le site web de l'<a href="https://pildroid.foucry.net">application</a>.
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -0,0 +1,29 @@
package net.foucry.pilldroid;
import android.graphics.Color;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.webkit.WebView;
/**
* Created by jacques on 12/06/16.
*/
public class About extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
WebView aboutView = findViewById(R.id.aboutHtml);
aboutView.loadUrl("file:///android_asset/about.html");
aboutView.clearCache(true);
aboutView.clearHistory();
aboutView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
aboutView.setBackgroundColor(Color.WHITE);
}
}

View file

@ -0,0 +1,16 @@
package net.foucry.pilldroid;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent)
{
// Show the toast like in above screen shot
Toast.makeText(context, "New stock calculted", Toast.LENGTH_LONG).show();
}
}

View file

@ -0,0 +1,138 @@
package net.foucry.pilldroid;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageButton;
import androidx.annotation.NonNull;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
import com.journeyapps.barcodescanner.ViewfinderView;
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 {
private CaptureManager capture;
private DecoratedBarcodeView barcodeScannerView;
private ImageButton switchFlashlightButton;
private ViewfinderView viewfinderView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_scanner);
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);
}
capture = new CaptureManager(this, barcodeScannerView);
capture.initializeFromIntent(getIntent(), savedInstanceState);
capture.setShowMissingCameraPermissionDialog(false);
capture.decode();
changeMaskColor(null);
changeLaserVisibility(true);
}
@Override
protected void onResume() {
super.onResume();
capture.onResume();
}
@Override
protected void onPause() {
super.onPause();
capture.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
capture.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
capture.onSaveInstanceState(outState);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return barcodeScannerView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
}
/**
* Check if the device's camera has a Flashlight.
* @return true if there is Flashlight, otherwise false.
*/
private boolean hasFlash() {
return getApplicationContext().getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
}
public void switchFlashlight(View view) {
if (switchFlashlightButton.isActivated()) {
barcodeScannerView.setTorchOff();
} else {
barcodeScannerView.setTorchOn();
}
}
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() {
switchFlashlightButton.setActivated(true);
}
@Override
public void onTorchOff() {
switchFlashlightButton.setActivated(false);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
capture.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
public void onKeyboard(View view) {
setResult(3);
finish();
}
public void onCancel(View view) {
setResult(2);
finish();
}
}

View file

@ -0,0 +1,380 @@
package net.foucry.pilldroid;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.text.format.DateUtils;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
/**
* Created by jacques on 24/04/16.
*/
class DBHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final ThreadLocal<String> DATABASE_NAME = ThreadLocal.withInitial(() -> "ordonnance.db");
private static final String TABLE_DRUG = "drug";
private static final String KEY_ID = "id";
private static final String KEY_CIS = "cis";
private static final String KEY_CIP13 = "cip13";
private static final String KEY_NAME = "nom";
private static final String KEY_ADMIN = "mode_administration";
private static final String KEY_PRES = "presentation";
private static final String KEY_STOCK = "stock";
private static final String KEY_PRISE = "prise";
private static final String KEY_SEUIL_WARN = "warning";
private static final String KEY_SEUIL_ALERT = "alerte";
private static final String KEY_LAST_UPDATE = "last_update";
final List<Medicament> medicaments = new LinkedList<>();
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_PRISE,
KEY_SEUIL_WARN, KEY_SEUIL_ALERT, KEY_LAST_UPDATE};
DBHelper(Context context) {
super(context, DATABASE_NAME.get(), null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_DRUG_TABLE = "CREATE TABLE drug ( " +
"id INTEGER PRIMARY KEY AUTOINCREMENT," +
"cis TEXT, " +
"cip13 TEXT, " +
"nom TEXT, " +
"mode_administration TEXT, " +
"presentation TEXT, " +
"stock REAL, " +
"prise REAL, " +
"warning INT, " +
"alerte INT, " +
"last_update LONG)";
db.execSQL(CREATE_DRUG_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop old database
db.execSQL("DROP TABLE IF EXISTS drug");
// Create fresh book table
this.onCreate(db);
}
/**
* Drop current database. Debug code only
*/
void dropDrug() {
SQLiteDatabase db = this.getWritableDatabase();
Log.d(TAG, "Drop drug table");
db.execSQL("DROP TABLE IF EXISTS drug");
this.onCreate(db);
}
/**
* Split medicament values into database record and record it to the DB
* @param medicament the medicament object to be saved
*/
void addDrug(Medicament medicament) {
// Logging
Log.d(TAG, medicament.toString());
// Get reference to writable DB
SQLiteDatabase db = this.getWritableDatabase();
// Create ContentValues to add key "column"/value
ContentValues values = new ContentValues();
values.put(KEY_CIS, medicament.getCis());
values.put(KEY_CIP13, medicament.getCip13());
values.put(KEY_NAME, medicament.getNom());
values.put(KEY_ADMIN, medicament.getMode_administration());
values.put(KEY_PRES, medicament.getPresentation());
values.put(KEY_STOCK, medicament.getStock());
values.put(KEY_PRISE, medicament.getPrise());
values.put(KEY_SEUIL_WARN, medicament.getWarnThreshold());
values.put(KEY_SEUIL_ALERT, medicament.getAlertThreshold());
values.put(KEY_LAST_UPDATE, medicament.getDateLastUpdate());
// Calculate some medicament's fields
// Insert
db.insert(TABLE_DRUG, // table
null, // colunms list not needed
values); // key/value
// Close database
db.close();
}
/**
* return a medicament from the DB with is id
* @param id of the medicament we looking for (not used)
* @return return the found medicament of null
*/
public Medicament getDrug(int id) {
// Get reference to readable DB
SQLiteDatabase db = this.getReadableDatabase();
// Build query
Cursor cursor = db.query(TABLE_DRUG, // Which table
COLUMS, // column names
" id = ?", // selections
new String[] { String.valueOf(id) }, // selections args
null, // group by
null, // having
null, // order by
null); // limits
Log.d(TAG, "Cursor == " + DatabaseUtils.dumpCursorToString(cursor));
// if case we got result, go to the first one
Medicament medicament = new Medicament();
if (cursor != null) {
cursor.moveToFirst();
// Build medicament object
medicament.setId(Integer.parseInt(cursor.getString(0)));
medicament.setCis(cursor.getString(1));
medicament.setCip13(cursor.getString(2));
medicament.setNom(cursor.getString(3));
medicament.setMode_administration(cursor.getString(4));
medicament.setPresentation(cursor.getString(5));
medicament.setStock(Double.parseDouble(cursor.getString(6)));
medicament.setPrise(Double.parseDouble(cursor.getString(7)));
medicament.setWarnThreshold(Integer.parseInt(cursor.getString(8)));
medicament.setAlertThreshold(Integer.parseInt(cursor.getString(9)));
medicament.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
}
// Log
Log.d(TAG, "getDrug("+id+")" + medicament.toString());
assert cursor != null;
cursor.close();
db.close();
// Return medicament
return medicament;
}
/**
*
* @param cip13 drug id in French nomemclature
* @return the medicament object found in DB or null
*/
public Medicament getDrugByCIP13(String cip13) {
// Get reference to readable DB
SQLiteDatabase db = this.getReadableDatabase();
// Build query
Cursor cursor = db.query(TABLE_DRUG, // Which table
COLUMS, // column names
" cip13 = ?", // selections
new String[]{String.valueOf(cip13)}, // selections args
null, // group by
null, // having
null, // order by
null); // limits
// if case we got result, go to the first one
Medicament medicament = new Medicament();
if (cursor != null) {
cursor.moveToFirst();
// Build medicament object
medicament.setId(Integer.parseInt(cursor.getString(0)));
medicament.setCis(cursor.getString(1));
medicament.setCip13(cursor.getString(2));
medicament.setNom(cursor.getString(3));
medicament.setMode_administration(cursor.getString(4));
medicament.setPresentation(cursor.getString(5));
medicament.setStock(Double.parseDouble(cursor.getString(6)));
medicament.setPrise(Double.parseDouble(cursor.getString(7)));
medicament.setWarnThreshold(Integer.parseInt(cursor.getString(8)));
medicament.setAlertThreshold(Integer.parseInt(cursor.getString(9)));
medicament.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
}
assert cursor != null;
cursor.close();
Log.d(TAG, "getDrug(" + cip13 + ")" + medicament.toString());
return medicament;
}
/**
*
* @return a Sorted and updated by dateEndOfStock List of All medicaments presents in database
*/
List<Medicament> getAllDrugs() {
// Build the query
String query = "SELECT * FROM " + TABLE_DRUG;
// Get reference to readable DB
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
Log.d(TAG, "Cursor == " + DatabaseUtils.dumpCursorToString(cursor));
// For Each row, build a medicament and add it to the list
Medicament medicament;
if (cursor.moveToFirst()) {
do {
medicament = new Medicament();
medicament.setId(Integer.parseInt(cursor.getString(0)));
medicament.setCis(cursor.getString(1));
medicament.setCip13(cursor.getString(2));
medicament.setNom(cursor.getString(3));
medicament.setMode_administration(cursor.getString(4));
medicament.setPresentation(cursor.getString(5));
medicament.setStock(Double.parseDouble(cursor.getString(6)));
medicament.setPrise(Double.parseDouble(cursor.getString(7)));
medicament.setWarnThreshold(Integer.parseInt(cursor.getString(8)));
medicament.setAlertThreshold(Integer.parseInt(cursor.getString(9)));
medicament.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
// Call calcul method
medicament.setDateEndOfStock();
// Add medicament to medicaments
medicaments.add(medicament);
} while (cursor.moveToNext());
}
cursor.close();
db.close();
Medicament currentMedicament;
for (int position = 0 ; position < getCount() ; position++ ) {
currentMedicament = getItem(position);
// if (!DateUtils.isToday(currentMedicament.getDateLastUpdate()))
// {
currentMedicament.newStock();
updateDrug(currentMedicament);
//}
}
medicaments.sort(new Comparator<Medicament>() {
@Override
public int compare(Medicament lhs, Medicament rhs) {
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
}
});
Log.d(TAG, "getAllDrugs " + medicaments.toString());
return medicaments;
}
/**
*
* @param medicament object to be updated in DB
*/
public void updateDrug(Medicament medicament) {
Log.d(TAG, "Update Drug == " + medicament);
// Get reference to writable DB
SQLiteDatabase db = this.getWritableDatabase();
// Create ContentValues to add columnm/value
ContentValues values = new ContentValues();
values.put(KEY_ID, medicament.getId());
values.put(KEY_CIS, medicament.getCis());
values.put(KEY_CIP13, medicament.getCip13());
values.put(KEY_NAME, medicament.getNom());
values.put(KEY_ADMIN, medicament.getMode_administration());
values.put(KEY_PRES, medicament.getPresentation());
values.put(KEY_STOCK, medicament.getStock());
values.put(KEY_PRISE, medicament.getPrise());
values.put(KEY_LAST_UPDATE, medicament.getDateLastUpdate());
String[] selectionArgs = { String.valueOf(medicament.getId()) };
db.update(TABLE_DRUG, // table
values, // column/value
KEY_ID + " = ?", // selections
selectionArgs);
// Close DB
db.close();
}
/**
* Delete a medicament object in database
* @param medicament object to be delete in the DB
*/
public void deleteDrug(Medicament medicament) {
// Get writable database
SQLiteDatabase db = this.getWritableDatabase();
// Delete record
db.delete(TABLE_DRUG, // table
KEY_ID+ " = ?", // selections
new String[] { String.valueOf(medicament.getId()) } ); // selections args
// Close DB
db.close();
// log
Log.d(TAG, "delete drug "+medicament);
}
/**
* Get count of all medicament present in database
* @return number of medicament in DB
*/
int getCount() {
String query = "SELECT count (*) FROM " + TABLE_DRUG;
// Get reference to readable DB (tutorial parle de writable, mais bof... on verra)
SQLiteDatabase db = this.getReadableDatabase();
Cursor mCount = db.rawQuery(query, null);
mCount.moveToFirst();
int count = mCount.getInt(0);
mCount.close();
db.close();
return count;
}
public Medicament getItem(int position) {
return medicaments.get(position);
}
boolean isMedicamentExist(String cip13) {
boolean value = false;
try {
Cursor c = this.getReadableDatabase().rawQuery("SELECT * FROM "+ TABLE_DRUG + " where cip13 = "+cip13, null);
if(c.getCount()>0)
{
value = true;
}
c.close();
} catch(Exception e)
{
e.printStackTrace();
}
return value;
}
}

View file

@ -0,0 +1,158 @@
package net.foucry.pilldroid;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Created by jfoucry on 5/25/16.
*/
class DBMedoc extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String dbName = "medicaments.db";
private final Context myContext;
private final SQLiteDatabase myDataBase = null;
private static final String TABLE_NAME = "medicaments";
private static final String MEDOC_CIS = "cis";
private static final String MEDOC_CIP13 = "cip13";
private static final String MEDOC_ADMIN = "mode_administration";
private static final String MEDOC_NOM = "nom";
private static final String MEDOC_PRES = "presentation";
private static final String[] COLUMNS_NAMES = {MEDOC_CIS, MEDOC_CIP13, MEDOC_ADMIN, MEDOC_NOM, MEDOC_PRES};
private static final String TAG = DBMedoc.class.getName();
DBMedoc(Context context) {
super(context, dbName, null, DATABASE_VERSION);
this.myContext = context;
}
@Override
public synchronized SQLiteDatabase getWritableDatabase() {
File dbFile = myContext.getDatabasePath(dbName);
if (!dbFile.exists()) {
copyDatabase(dbFile.getPath());
}
return super.getWritableDatabase();
}
@Override
public synchronized SQLiteDatabase getReadableDatabase() {
File dbFile = myContext.getDatabasePath(dbName);
if (dbFile.exists()) return super.getReadableDatabase();
copyDatabase(dbFile.getPath());
return super.getReadableDatabase();
}
@Override
public void onCreate(SQLiteDatabase db) {
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
private void copyDatabase(String dbPath) {
Log.d(TAG, "try to copy database");
try {
InputStream assetDB = myContext.getAssets().open(dbName);
OutputStream appDB = new FileOutputStream(dbPath, false);
byte[] buffer = new byte[1024];
int length;
while ((length = assetDB.read(buffer)) > 0) {
appDB.write(buffer, 0, length);
}
appDB.flush();
appDB.close();
assetDB.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/* void openDatabase() throws SQLiteException {
Log.e(TAG, "openDatabase called");
String myPath = myContext.getDatabasePath(dbName).getPath();
myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
}*/
@Override
public synchronized void close() {
if (myDataBase != null) {
myDataBase.close();
}
}
/**
* Lookup in the DB for a record corresponding to cip13
*
* @param cip13 string representing the object we're looking for
* @return return a medicament object
*/
Medicament getMedocByCIP13(String cip13) {
Log.e(TAG, "CIP13 - " + cip13);
SQLiteDatabase db = this.getReadableDatabase();
// Build query
Cursor cursor = db.query(TABLE_NAME, // Which table
COLUMNS_NAMES, // column names
" cip13 =?", // selections
new String[]{cip13}, // selections args
null, // group by
null, // having
null, // order by
null); // limits
//Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_NAME + " where cip13 = " + cip13, null);
if (cursor.getCount() != 0) {
cursor.moveToFirst();
// Build medicament object
Medicament medicament = new Medicament();
// medicament.setId(Integer.parseInt(cursor.getString(0)));
medicament.setCis(cursor.getString(0));
medicament.setCip13(cursor.getString(1));
medicament.setMode_administration(cursor.getString(2));
medicament.setNom(cursor.getString(3));
medicament.setPresentation(cursor.getString(4));
// Set default values
medicament.setStock(0);
medicament.setPrise(0);
medicament.setWarnThreshold(14);
medicament.setAlertThreshold(7);
// Log
Log.d(TAG, "getDrug(" + cip13 + ")" + medicament.toString());
// Return medicament
cursor.close();
return medicament;
} else
return null;
}
}

View file

@ -0,0 +1,172 @@
package net.foucry.pilldroid;
import java.io.Serializable;
import java.lang.String;
import java.util.Calendar;
import java.util.Date;
import static net.foucry.pilldroid.UtilDate.*;
/**
* Created by jacques on 26/11/15.
*/
public class Medicament implements Serializable {
/* part read form database */
private int id;
private String nom;
private String cip13;
private String cis;
private String mode_administration;
private String presentation;
private double stock;
private double prise;
private int warnThreshold;
private int alertThreshold;
private long dateLastUpdate;
/* calculate part */
private Date dateEndOfStock;
Medicament() {
}
Medicament(final String cis, final String cip13, final String nom, final String mode_administration, final String presentation,
double stock, double prise, int warn, int alert, long dateLastUpdate) {
super();
this.cis = cis;
this.cip13 = cip13;
this.nom = nom;
this.mode_administration = mode_administration;
this.presentation = presentation;
this.stock = stock;
this.prise = prise;
this.warnThreshold = warn;
this.alertThreshold = alert;
this.dateLastUpdate = dateLastUpdate;
}
public int getId() {
return id;
}
String getNom() {
return nom;
}
String getCip13() {
return cip13;
}
String getCis() {
return cis;
}
String getMode_administration() {
return mode_administration;
}
String getPresentation() {
return presentation;
}
double getStock() {
return stock;
}
double getPrise() {
return prise;
}
int getAlertThreshold() {
return alertThreshold;
}
int getWarnThreshold() {
return warnThreshold;
}
long getDateLastUpdate() {
return dateLastUpdate;
}
Date getDateEndOfStock() {
return dateEndOfStock;
}
public void setId(int id) {
this.id = id;
}
void setNom(String nom) {
this.nom = nom;
}
void setCip13(String cip13) {
this.cip13 = cip13;
}
void setCis(String cis) {
this.cis = cis;
}
void setMode_administration(String mode_administration) {
this.mode_administration = mode_administration;
}
void setPresentation(String presentation) {
this.presentation = presentation;
}
void setStock(double stock) {
this.stock = stock;
}
void setPrise(double prise) {
this.prise = prise;
}
void setWarnThreshold(int warn) {
if (warn == 0)
warn = 14;
this.warnThreshold = warn;
}
void setAlertThreshold(int alert) {
if (alert == 0)
alert = 7;
this.alertThreshold = alert;
}
void setDateLastUpdate(long l) {
this.dateLastUpdate = l;
}
void setDateEndOfStock() {
int numberDayOfPrise;
if (this.prise > 0) {
numberDayOfPrise = (int) Math.floor(this.stock / this.prise);
} else {
numberDayOfPrise = 0;
}
Date aDate = dateAtNoon(new Date());
Calendar calendar = Calendar.getInstance();
calendar.setTime(aDate);
calendar.add(Calendar.DAY_OF_YEAR, numberDayOfPrise);
this.dateEndOfStock = calendar.getTime();
}
void newStock() {
Date lastUpdate = new Date(getDateLastUpdate());
int numberOfDays = nbOfDaysBetweenDateAndToday(lastUpdate);
if (numberOfDays > 0) {
double takeDuringPeriod = this.prise * numberOfDays;
setStock(getStock() - takeDuringPeriod);
setDateLastUpdate(new Date().getTime());
}
}
}

View file

@ -0,0 +1,159 @@
package net.foucry.pilldroid;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import java.util.Date;
import static net.foucry.pilldroid.R.id.detail_toolbar;
/**
* An activity representing a single Medicament detail screen. This
* activity is only used narrow width devices. On tablet-size devices,
* item details are presented side-by-side with a list of items
* in a {@link MedicamentListActivity}.
*/
public class MedicamentDetailActivity extends AppCompatActivity {
private static final String TAG = MedicamentDetailActivity.class.getName();
Medicament medicament;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
/* fetching the string passed with intent using extras*/
assert extras != null;
medicament = (Medicament) extras.getSerializable("medicament");
assert medicament != null;
Log.d(TAG, "medicament == " + medicament.toString());
setContentView(R.layout.activity_medicament_detail);
Toolbar toolbar = findViewById(detail_toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
}
ImageButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "Click on save icon");
getMedicamentChanges();
setResult(1);
finish();
overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
}
});
// Show the Up button in the action bar.
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(medicament.getNom());
}
// savedInstanceState is non-null when there is fragment state
// saved from previous configurations of this activity
// (e.g. when rotating the screen from portrait to landscape).
// In this case, the fragment will automatically be re-added
// to its container so we don't need to manually add it.
// For more information, see the Fragments API guide at:
//
// http://developer.android.com/guide/components/fragments.html
//
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Bundle arguments = new Bundle();
arguments.putSerializable("medicament",
getIntent().getSerializableExtra("medicament"));
MedicamentDetailFragment fragment = new MedicamentDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.medicament_detail_container, fragment)
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
navigateUpTo(new Intent(this, MedicamentListActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
private void getMedicamentChanges()
{
Log.d(TAG, "Time to save new values");
DBHelper dbHelper = new DBHelper(this);
Medicament newMedicament = dbHelper.getDrugByCIP13(medicament.getCip13());
View stockView;
View priseView;
View warningView;
View alertView;
stockView = findViewById(R.id.stock_cell);
EditText stockTextView = stockView.findViewById(R.id.valeur);
String stockValue = stockTextView.getText().toString();
priseView = findViewById(R.id.prise_cell);
TextView priseTextView = priseView.findViewById(R.id.valeur);
String priseValue = priseTextView.getText().toString();
alertView = findViewById(R.id.alert_cell);
TextView alertTextView = alertView.findViewById(R.id.valeur);
String alertValue = alertTextView.getText().toString();
warningView = findViewById(R.id.warning_cell);
TextView warningTextView = warningView.findViewById(R.id.valeur);
String warningValue = warningTextView.getText().toString();
Log.d(TAG, "StockValue == "+ stockValue);
Log.d(TAG, "PriseValue == "+ priseValue);
Log.d(TAG, "AlertValue == "+ alertValue);
Log.d(TAG, "WarningValue == "+ warningValue);
Log.d(TAG, "medicamentID == "+ medicament.getId());
Log.d(TAG, "medicament == "+ medicament.toString());
newMedicament.setStock(Double.parseDouble(stockValue));
newMedicament.setPrise(Double.parseDouble(priseValue));
newMedicament.setWarnThreshold(Integer.parseInt(warningValue));
newMedicament.setAlertThreshold(Integer.parseInt(alertValue));
// newMedicament.setDateLastUpdate(UtilDate.dateAtNoon(new Date()).getTime());
newMedicament.setDateLastUpdate(new Date().getTime());
newMedicament.setDateEndOfStock();
dbHelper.updateDrug(newMedicament);
}
}

View file

@ -0,0 +1,121 @@
package net.foucry.pilldroid;
import android.app.Activity;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* A fragment representing a single Medicament detail screen.
* This fragment is either contained in a {@link MedicamentListActivity}
* in two-pane mode (on tablets) or a {@link MedicamentDetailActivity}
* on handsets.
*/
public class MedicamentDetailFragment extends Fragment {
/**
* The fragment argument representing the item ID that this fragment
* represents.
*/
public static final String ARG_ITEM_ID = "medicament";
private static final String TAG = MedicamentDetailFragment.class.getName();
/**
* The dummy content this fragment is presenting.
*/
private Medicament medicament;
private DBHelper dbHelper;
/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
*/
public MedicamentDetailFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
assert getArguments() != null;
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
medicament = (Medicament) 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(medicament.getNom());
}
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View detailView = inflater.inflate(R.layout.medicament_detail, container, false);
View nameView;
View adminModeView;
View presentationView;
View stockView;
View priseView;
View warningView;
View alertView;
// Show the dummy content as text in a TextView.
if (medicament != null) {
// Find each conponment of rootView
nameView = detailView.findViewById(R.id.name_cell);
TextView nameLabel = nameView.findViewById(R.id.label);
TextView nameValeur = nameView.findViewById(R.id.valeur);
nameLabel.setText(R.string.med_name_label);
nameValeur.setText(medicament.getNom());
presentationView = detailView.findViewById(R.id.presentation_cell);
TextView presentationLabel = presentationView.findViewById(R.id.label);
TextView presentationValeur = presentationView.findViewById(R.id.valeur);
presentationLabel.setText(R.string.med_presention_labal);
presentationValeur.setText(medicament.getPresentation());
adminModeView = detailView.findViewById(R.id.administration_cell);
TextView adminModeLabel = adminModeView.findViewById(R.id.label);
TextView adminModeValeur = adminModeView.findViewById(R.id.valeur);
adminModeLabel.setText(R.string.med_administationMode_label);
adminModeValeur.setText(medicament.getMode_administration());
stockView = detailView.findViewById(R.id.stock_cell);
TextView stockLibelle = (stockView.findViewById(R.id.libelle));
TextView stockValue = stockView.findViewById(R.id.valeur);
stockLibelle.setText(R.string.med_current_stock_label);
stockValue.setText(Double.toString(medicament.getStock()));
priseView = detailView.findViewById(R.id.prise_cell);
TextView priseLibelle = priseView.findViewById(R.id.libelle);
TextView priseValue = (priseView.findViewById(R.id.valeur));
priseLibelle.setText(R.string.med_take_label);
priseValue.setText(Double.toString(medicament.getPrise()));
warningView = detailView.findViewById(R.id.warning_cell);
TextView warningLibelle = warningView.findViewById(R.id.libelle);
TextView warningValue = warningView.findViewById(R.id.valeur);
warningLibelle.setText(R.string.med_warningTherehold_label);
warningValue.setText(Integer.toString(medicament.getWarnThreshold()));
alertView = detailView.findViewById(R.id.alert_cell);
TextView alertLibelle = alertView.findViewById(R.id.libelle);
TextView alertValue = alertView.findViewById(R.id.valeur);
alertLibelle.setText(R.string.med_criticalTherehold_label);
alertValue.setText(Integer.toString(medicament.getAlertThreshold()));
}
return detailView;
}
}

View file

@ -0,0 +1,704 @@
package net.foucry.pilldroid;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.icu.util.Calendar;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
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 com.google.zxing.client.android.Intents;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import static net.foucry.pilldroid.UtilDate.date2String;
import static net.foucry.pilldroid.UtilDate.dateAtNoon;
import static net.foucry.pilldroid.Utils.intRandomExclusive;
// Todo: - add launch tuto at first launch
// - add preference to know if the tuto as already been launch
// - use same color in website and about
// - remove twopanes code
/**
* An activity representing a list of Medicaments. This activity
* has different presentations for handset and tablet-size devices. On
* handsets, the activity presents a list of items, which when touched,
* lead to a {@link MedicamentDetailActivity} representing
* item details. On tablets, the activity presents the list of items and
* item details side-by-side using two vertical panes.
*/
public class MedicamentListActivity 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
private boolean mTwoPane;
final Boolean DEMO = false;
final Boolean DBDEMO = false;
public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;
private ViewPager viewPager;
private LinearLayout dotsLayout;
private int[] layouts;
private Button btnSkip, btnNext;
private PrefManager prefManager;
/**
* Start tutorial
*/
@Override
public void onStart() {
super.onStart();
Log.d(TAG, "Remove old notification and old job");
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if (nm != null) {
nm.cancelAll();
}
// tuto
Log.i(TAG, "Launchd tuto");
startActivity(new Intent(this, WelcomeActivity.class));
//JobScheduler js = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
//if (js != null) {
// js.cancelAll();
//}
}
@Override
public void onStop() {
super.onStop();
}
private static final String TAG = MedicamentListActivity.class.getName();
private DBHelper dbHelper;
private DBMedoc dbMedoc;
private List<Medicament> medicaments;
private SimpleItemRecyclerViewAdapter mAdapter;
public int getCount() {
return medicaments.size();
}
public Medicament getItem(int position) {
return medicaments.get(position);
}
public void constructMedsList()
{
dbHelper = new DBHelper(getApplicationContext());
if (!(medicaments == null)) {
if (!medicaments.isEmpty()) {
medicaments.clear();
}
}
medicaments = dbHelper.getAllDrugs();
View mRecyclerView = findViewById(R.id.medicament_list);
assert mRecyclerView != null;
setupRecyclerView((RecyclerView) mRecyclerView);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_medicament_list);
dbHelper = new DBHelper(this);
dbMedoc = new DBMedoc(this);
Toolbar toolbar = findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setTitle(getTitle());
}
// Added to drop database each the app is launch.
if (DBDEMO) {
dbHelper.dropDrug();
}
if (DEMO) {
if (dbHelper.getCount() == 0) {
// String cis, String cip13, String nom, String mode_administration,
// String presentation,double stock, double prise, int warn, int alert
// Limit for randoms generator
final int min_stock=5;
final int max_stock=50;
final int min_prise=0;
final int max_prise=3;
dbHelper.addDrug(new Medicament("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 Medicament("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 Medicament("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 Medicament("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 Medicament("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 Medicament("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 Medicament("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 Medicament("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 Medicament("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 Medicament("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()));
}
}
constructMedsList();
if (findViewById(R.id.medicament_detail_container) != null) {
// The detail container view will be present only in the
// large-screen layouts (res/values-w900dp).
// If this view is present, then the
// activity should be in two-pane mode.
mTwoPane = true;
}
}
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.about, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.about:
startActivity(new Intent(this, About.class));
return true;
case R.id.help:
//startActivity(new Intent(this, Help.class));
//loadTutorial();
return true;
}
return super.onOptionsItemSelected(item);
}
public void onPause() {
super.onPause();
//scheduleJob();
}
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();
}
@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) {
Toast.makeText(this, "REQUEST_CODE = " + requestCode + "RESULT_CODE = " + resultCode, Toast.LENGTH_LONG).show();
Log.d(TAG, "REQUEST_CODE = " + requestCode + " RESULT_CODE = " + resultCode);
if (resultCode == 1) {
constructMedsList();
} else {
Toast.makeText(this, "What are you doing here?", Toast.LENGTH_SHORT).show();
Log.d(TAG, "What are you doing here?");
}
} else {
IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);
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) {
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);
}
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());
Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
String cip13;
// Handle successful scan
if (result.getFormatName().equals("CODE_128")) { //CODE_128
cip13 = result.getContents();
} else {
cip13 = result.getContents().substring(4, 17);
}
// Get Medoc from database
final Medicament scannedMedoc = dbMedoc.getMedocByCIP13(cip13);
askToAddInDB(scannedMedoc);
}
}
}
/**
* show keyboardInput dialog
*/
protected void showInputDialog() {
// get prompts.xml view
LayoutInflater layoutInflater = LayoutInflater.from(MedicamentListActivity.this);
View promptView = layoutInflater.inflate(R.layout.input_dialog, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MedicamentListActivity.this);
alertDialogBuilder.setView(promptView);
final EditText editText = promptView.findViewById(R.id.edittext);
// setup a dialog window
alertDialogBuilder.setCancelable(false)
.setPositiveButton("OK", (dialog, id) -> {
String cip13 = editText.getText().toString();
Medicament med = dbMedoc.getMedocByCIP13(cip13);
askToAddInDB(med);
})
.setNegativeButton("Cancel",
(dialog, id) -> dialog.cancel());
// create an alert dialog
AlertDialog alert = alertDialogBuilder.create();
alert.show();
}
/**
* Ask if the medicament found in the database should be include in the
* user database
* @param med Medicament- medicament to be added
*/
private void askToAddInDB(Medicament med) {
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setTitle(getString(R.string.app_name));
if (med != null) {
String msg = med.getNom() + " " + getString(R.string.msgFound);
dlg.setMessage(msg);
dlg.setNegativeButton(getString(R.string.button_cancel), (dialog, which) -> {
// Nothing to do in case of cancel
});
dlg.setPositiveButton(getString(R.string.button_ok), (dialog, which) -> {
// Add Medicament to DB then try to show it
addMedToList(med);
});
} else {
dlg.setMessage(getString(R.string.msgNotFound));
dlg.setPositiveButton("OK", (dialog, which) -> {
// nothing to do to just dismiss dialog
});
}
dlg.show();
}
/**
* Add New medicament to the user database
* @param med Medicament - medicament to be added
*/
private void addMedToList(Medicament med)
{
med.setDateEndOfStock();
mAdapter.addItem(med);
Log.d(TAG, "Call MedicamentDetailActivity");
Context context = this;
Intent intent = new Intent(context, MedicamentDetailActivity.class);
intent.putExtra("medicament", med);
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
}
/**
* scheduleJob
* call at onPause, schedule job for next 24 hours
*/
// public void scheduleJob() {
// Calendar calendar = Calendar.getInstance();
// Date today = calendar.getTime();
// calendar.add(Calendar.MINUTE, 15);
// Date tomorrow = calendar.getTime();
// Date scheduleDate;
// JobInfo info;
// ComponentName componentName = new ComponentName(this, PillDroidJobService.class);
/*info = new JobInfo.Builder(24560, componentName)
.setMinimumLatency(60 * 15 * 1000)
.setOverrideDeadline(60 * 60 * 1000)
.build();*/
// if (today.before(dateAtNoon(today))) {
// info = new JobInfo.Builder(24560, componentName)
// .setPersisted(true)
// .setPeriodic(dateAtNoon(today).getTime())
// .setPeriodic(today.getTime())
// .build();
// scheduleDate = today;
// } else {
// info = new JobInfo.Builder(24560, componentName)
// .setPersisted(true)
// .setPeriodic(dateAtNoon(tomorrow).getTime())
// .setPeriodic(tomorrow.getTime())
// .build();
// scheduleDate = tomorrow;
// }
// String scheduleDate = UtilDate.convertDate(today.getTime()+info.getMinLatencyMillis());
//JobScheduler scheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
//int resultCode = scheduler.schedule(info);
//if (resultCode == JobScheduler.RESULT_SUCCESS) {
// Log.d(TAG, "Job scheduled at " + scheduleDate);
//} else {
// Log.d(TAG, "Job scheduling failed");
//}
// }
/**
* cancelJob in PillDroidJobService
* @param V View
*/
/* public void cancelJob(View v) {
JobScheduler scheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
scheduler.cancel(24560);
Log.d(TAG, "Job cancelled");
}*/
public void scheduleAlarm(View V) {
Calendar calendar = Calendar.getInstance();
Long time = calendar.getTimeInMillis()+24*60*60*1000;
Intent intentAlarm = new Intent(this, AlarmReceiver.class);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP,time, PendingIntent.getBroadcast(this,1, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT));
Toast.makeText(this, R.string.notification_text, Toast.LENGTH_LONG).show();
}
/**
* setupRecyclerView (list of medicaments
* @param recyclerView RecyclerView
*/
private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext()));
mAdapter = new SimpleItemRecyclerViewAdapter(medicaments);
recyclerView.setAdapter(mAdapter);
}
// TODO: remove in release
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<SimpleItemRecyclerViewAdapter.ViewHolder> {
private final List<Medicament> mValues;
SimpleItemRecyclerViewAdapter(List<Medicament> items) {
mValues = items;
}
void addItem(Medicament scannedMedoc) {
if (!dbHelper.isMedicamentExist(scannedMedoc.getCip13())) {
mValues.add(scannedMedoc);
notifyDataSetChanged();
dbHelper.addDrug(scannedMedoc);
} else {
Toast.makeText(getApplicationContext(), "aleready in the database", Toast.LENGTH_SHORT).show();
}
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.medicament_list_content, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE d MMMM yyyy", Locale.getDefault());
String dateEndOfStock = date2String(mValues.get(position).getDateEndOfStock(), dateFormat);
Log.d(TAG, "dateEndOfStock == " + dateEndOfStock);
Log.d(TAG, "stock == " + mValues.get(position).getStock());
Log.d(TAG, "prise == " + mValues.get(position).getPrise());
Log.d(TAG, "warn == " + mValues.get(position).getWarnThreshold());
Log.d(TAG, "alert == " + mValues.get(position).getAlertThreshold());
holder.mItem = mValues.get(position);
holder.mIDView.setText(mValues.get(position).getCip13());
holder.mContentView.setText(mValues.get(position).getNom());
holder.mEndOfStock.setText(dateEndOfStock);
// Test to change background programmatically
if (mValues.get(position).getPrise() == 0) {
holder.mView.setBackgroundResource(R.drawable.gradient_bg);
holder.mIconView.setImageResource(R.drawable.ic_suspended_pill);
} else {
int remainingStock = (int) Math.floor(mValues.get(position).getStock() / mValues.get(position).getPrise());
if (remainingStock <= mValues.get(position).getAlertThreshold()) {
holder.mView.setBackgroundResource(R.drawable.gradient_bg_alert);
holder.mIconView.setImageResource(R.drawable.lower_stock_vect);
} else if ((remainingStock > mValues.get(position).getAlertThreshold()) &&
(remainingStock <= (mValues.get(position).getWarnThreshold()))) {
holder.mView.setBackgroundResource(R.drawable.gradient_bg_warning);
holder.mIconView.setImageResource(R.drawable.warning_stock_vect);
} else {
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) {
Medicament medicamentCourant = mValues.get(position);
if (mTwoPane) { // This part is used on tablets
Bundle arguments = new Bundle();
arguments.putSerializable("medicament", medicamentCourant);
MedicamentDetailFragment fragment = new MedicamentDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.replace(R.id.medicament_detail_container, fragment)
.commit();
} else { // This part is used on phones
Context context = v.getContext();
Intent intent = new Intent(context, MedicamentDetailActivity.class);
intent.putExtra("medicament", medicamentCourant);
startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE);
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
}
}
});
}
@Override
public int getItemCount() {
return mValues.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
final View mView;
final TextView mIDView;
final TextView mContentView;
final TextView mEndOfStock;
final ImageView mIconView;
Medicament mItem;
ViewHolder(View view) {
super(view);
mView = view;
mIDView = view.findViewById(R.id.cip13);
mContentView = view.findViewById(R.id.valeur);
mEndOfStock = view.findViewById(R.id.endOfStock);
mIconView = view.findViewById(R.id.list_image);
}
@NonNull
@Override
public String toString() {
return super.toString() + " '" + mContentView.getText() + "'";
}
}
}
/*public void loadTutorial() {
Intent mainAct = new Intent(this, MaterialTutorialActivity.class);
mainAct.putParcelableArrayListExtra(MaterialTutorialActivity.MATERIAL_TUTORIAL_ARG_TUTORIAL_ITEMS,
getTutorialItems(this));
startActivityForResult(mainAct, 1);
}
private ArrayList<TutorialItem> getTutorialItems(Context context) {
TutorialItem tutorialItem1 = new TutorialItem(context.getString(R.string.slide_1_Pilldroid),
context.getString(R.string.slide_1_Pilldroid),
R.color.slide_1, R.drawable.icon_small);
// You can also add gifs, [IN BETA YET] (because Glide is awesome!)
// TutorialItem tutorialItem1 = new TutorialItem(context.getString(R.string.slide_1_african_story_books), context.getString(R.string.slide_1_african_story_books_subtitle),
// R.color.slide_1, R.drawable.gif_drawable, true);
TutorialItem tutorialItem2 = new TutorialItem(context.getString(R.string.slide2_Pilldroid),
context.getString(R.string.slide2_Pilldroid),
R.color.slide_2, R.drawable.plus_icon_small);
TutorialItem tutorialItem3 = new TutorialItem(context.getString(R.string.slide3_Pilldroid),
context.getString(R.string.slide3_Pilldroid),
R.color.slide_3, R.drawable.barcode_scan);
TutorialItem tutorialItem4 = new TutorialItem(context.getString(R.string.slide4_Pilldroid),
context.getString(R.string.slide4_Pilldroid),
R.color.slide_4, R.drawable.qr_code_scan);
TutorialItem tutorialItem5 = new TutorialItem(context.getString(R.string.slide5_Pilldroid),
context.getString(R.string.slide5_Pilldroid),
R.color.slide_3, R.drawable.ok_stock_bitmap);
TutorialItem tutorialItem6 = new TutorialItem(context.getString(R.string.slide6_Pilldroid),
context.getString(R.string.slide6_Pilldroid),
R.color.slide_2, R.drawable.lower_stock_bitmap);
TutorialItem tutorialItem7 = new TutorialItem(context.getString(R.string.slide7_Pilldroid),
context.getString(R.string.slide7_Pilldroid),
R.color.slide_4, R.drawable.warning_stock_bitmap);
TutorialItem tutorialItem8 = new TutorialItem(context.getString(R.string.slide8_Pilldroid),
context.getString(R.string.slide8_Pilldroid),
R.color.slide_1, R.drawable.info);
TutorialItem tutorialItem9 = new TutorialItem(context.getString(R.string.slide9_Pilldroid),
context.getString(R.string.slide9_Pilldroid),
R.color.slide_2, R.drawable.tunable);
TutorialItem tutorialItem10 = new TutorialItem(context.getString(R.string.slide10_Pilldroid),
context.getString(R.string.slide10_Pilldroid),
R.color.slide_10, R.drawable.suspended_pill_slide);
TutorialItem tutorialItem11 = new TutorialItem(context.getString(R.string.slide11_Pilldroid),
context.getString(R.string.slide11_Pilldroid),
R.color.slide_1, R.drawable.content_save);
TutorialItem tutorialItem12 = new TutorialItem(getString(R.string.slide12_Pilldroid), getString(R.string.slide12_Pilldroid),
R.color.slide_1, R.drawable.icon_small);
ArrayList<TutorialItem> tutorialItems = new ArrayList<>();
tutorialItems.add(tutorialItem1);
tutorialItems.add(tutorialItem2);
tutorialItems.add(tutorialItem3);
tutorialItems.add(tutorialItem4);
tutorialItems.add(tutorialItem5);
tutorialItems.add(tutorialItem6);
tutorialItems.add(tutorialItem7);
tutorialItems.add(tutorialItem10);
tutorialItems.add(tutorialItem8);
tutorialItems.add(tutorialItem9);
tutorialItems.add(tutorialItem11);
tutorialItems.add(tutorialItem12);
return tutorialItems;
}*/
}
/*
editText.addTextChangeListener( new TextWatcher() {
@Override
void afterTextChanged(Editable s){
}
void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
*/

View file

@ -0,0 +1,133 @@
package net.foucry.pilldroid;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import java.util.List;
/**
* Created by jacques on 17/09/16.
*/
public class PillDroidJobService extends JobService {
private static final String TAG = JobService.class.getName();
private boolean jobCancelled = false;
private final DBHelper dbHelper = new DBHelper(this);
@Override
public boolean onStartJob(JobParameters params) {
Log.d(TAG, "Job started");
createNotificationChannel();
doBackgroundWork(params);
return false;
}
/**
* Grab sorted list of medicaments
* test dateAlert of the first of the list
* if dateAlert < now
* schedule notification
* @param params JobParameters
*/
private void doBackgroundWork(final JobParameters params) {
Log.d(TAG,"background job");
if (jobCancelled) {
return;
}
List<Medicament> medicaments = dbHelper.getAllDrugs();
Medicament firstMedicament = null;
try {
firstMedicament = medicaments.get(0);
}
catch (Exception e){
Log.e(TAG, e.toString());
e.printStackTrace();
}
if (firstMedicament != null) {
if (firstMedicament.getPrise() != 0) {
if(firstMedicament.getStock() < firstMedicament.getAlertThreshold()) {
scheduleNotification();
} else
{
double dummy = (firstMedicament.getStock() - firstMedicament.getAlertThreshold());
Log.d(TAG, "no notification scheduled " + dummy);
}
}
}
Log.d(TAG, "Job finished");
jobFinished(params, true);
}
@Override
public boolean onStopJob(JobParameters params) {
Log.d(TAG, "Job cancelled before completion");
jobCancelled = true;
return false;
}
/**
* Schedule Notification for the delay
*/
private void scheduleNotification() {
Log.d(TAG, "schedule notification");
createNotificationChannel();
Intent intent = new Intent(this, MedicamentListActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "PillDroid")
.setSmallIcon(R.drawable.ic_pill_alarm)
.setContentTitle(getString(R.string.app_name))
.setContentText(getString(R.string.notification_text))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(pendingIntent)
.setAutoCancel(true);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
int notificationId = 666;
notificationManager.notify(notificationId, builder.build());
}
/**
* createNotificationChannelid for android API >= 28
*/
private void createNotificationChannel() {
Log.d(TAG, "start create notification channel");
CharSequence name = getString(R.string.channel_name);
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
String CHANNEL_ID = "PillDroid";
NotificationChannel 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();
}
}
}

View file

@ -0,0 +1,38 @@
package net.foucry.pilldroid;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by Lincoln on 05/05/16.
*/
public class PrefManager {
SharedPreferences pref;
SharedPreferences.Editor editor;
Context _context;
// shared pref mode
int PRIVATE_MODE = 0;
// Shared preferences file name
private static final String PREF_NAME = "androidhive-welcome";
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
public PrefManager(Context context) {
this._context = context;
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
editor = pref.edit();
}
public void setFirstTimeLaunch(boolean isFirstTime) {
editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime);
editor.commit();
}
public boolean isFirstTimeLaunch() {
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
}
}

View file

@ -0,0 +1,40 @@
package net.foucry.pilldroid;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
/**
* Created by jacques on 10/05/16.
*/
public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration {
private final Drawable mDivider;
SimpleDividerItemDecoration(Context context) {
mDivider = context.getDrawable(R.drawable.line_divider);
}
@Override
public void onDrawOver(@NonNull Canvas c, RecyclerView parent, @NonNull RecyclerView.State state) {
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int top = child.getBottom() + params.bottomMargin;
int bottom = top + mDivider.getIntrinsicHeight();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
}

View file

@ -0,0 +1,62 @@
package net.foucry.pilldroid;
import android.content.Context;
import android.view.View;
import android.view.animation.AnimationUtils;
public class SlideAnimationUtil {
/**
* Animates a view so that it slides in from the left of it's container.
*
* @param context Context
* @param view View
*/
public static void slideInFromLeft(Context context, View view) {
runSimpleAnimation(context, view, R.anim.slide_from_left);
}
/**
* Animates a view so that it slides from its current position, out of view to the left.
*
* @param context Context
* @param view View
*/
public static void slideOutToLeft(Context context, View view) {
runSimpleAnimation(context, view, R.anim.slide_to_left);
}
/**
* Animates a view so that it slides in the from the right of it's container.
*
* @param context Context
* @param view View
*/
public static void slideInFromRight(Context context, View view) {
runSimpleAnimation(context, view, R.anim.slide_from_right);
}
/**
* Animates a view so that it slides from its current position, out of view to the right.
*
* @param context Context
* @param view View
*/
public static void slideOutToRight(Context context, View view) {
runSimpleAnimation(context, view, R.anim.slide_to_right);
}
/**
* Runs a simple animation on a View with no extra parameters.
*
* @param context Context
* @param view View
* @param animationId int
*/
private static void runSimpleAnimation(Context context, View view, int animationId) {
view.startAnimation(AnimationUtils.loadAnimation(
context, animationId
));
}
}

View file

@ -0,0 +1,101 @@
package net.foucry.pilldroid;
import android.util.Log;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
/**
* Created by jacques on 05/05/16.
*/
class UtilDate {
private static final String TAG = UtilDate.class.getName();
/**
* @param aDate any date
* @return date the same date as input but at noon (12:00:00 PM)
* set date time at Noon
*/
static Date dateAtNoon(Date aDate) {
Log.d(TAG, "dateAtNoon " + aDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(aDate);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
}
/**
* @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
*/
static Date removeDaysToDate(int days, Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, -days);
return calendar.getTime();
}
/**
* @param date Date to be converted
* @return String of the converted date
* Convert a date to a String using a SimpleDateFormat
*/
static String date2String(Date date, DateFormat dateFormat) {
Log.d(TAG, "date == " + date);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return dateFormat.format(calendar.getTime());
}
/**
* @param dateString string representing a Date to be converted
* @return date Date after conversion
* Convert String date into Date
*/
static Date string2Date(String dateString) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.FRANCE);
ParsePosition pos = new ParsePosition(0);
return dateFormat.parse(dateString, pos);
}
/**
* @param date start date
* @return int numbers of days between date and today
* Number of days between date (older than today) and today
*/
static int nbOfDaysBetweenDateAndToday(Date date) {
Date oldDate = dateAtNoon(date); // Be sure that the old date is at Noon
Date todayDate = dateAtNoon(new Date()); // Be sure that we use today at Noon
return (int) (todayDate.getTime() - oldDate.getTime())/(86400*1000);
}
/**
* Convert dateInMilliseconds into string formated date
* @param dateInMilliseconds long
* @return formatted Date String
*/
static String convertDate(long dateInMilliseconds) {
DateFormat formatter = new SimpleDateFormat("dd/MM/yy HH:mm:ss", Locale.FRANCE);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(dateInMilliseconds);
return formatter.format(calendar.getTime());
}
}

View file

@ -0,0 +1,36 @@
package net.foucry.pilldroid;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Random;
public class Utils {
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){}
}
/**
* Return a random number between twovalues - use to gənerate a false demo DB
* @param min minimal value accepted
* @param max maximum value accepted
* @return int random number
*/
static int intRandomExclusive(int min, int max) {
Random r = new Random();
return r.nextInt(max - min) +max;
}
}

View file

@ -0,0 +1,209 @@
package net.foucry.pilldroid;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
public class WelcomeActivity extends AppCompatActivity {
private ViewPager viewPager;
private LinearLayout dotsLayout;
private int[] layouts;
private Button btnSkip, btnNext;
private PrefManager prefManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Boolean DEBUG = false;
// Checking for first time launch - before calling setContentView()
prefManager = new PrefManager(this);
if (DEBUG) {
prefManager.setFirstTimeLaunch(true);
}
if (!prefManager.isFirstTimeLaunch()) {
finish();
}
prefManager.setFirstTimeLaunch(false);
// Making notification bar transparent
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
setContentView(R.layout.activity_welcome);
viewPager = findViewById(R.id.view_pager);
dotsLayout = findViewById(R.id.layoutDots);
btnSkip = findViewById(R.id.btn_skip);
btnNext = findViewById(R.id.btn_next);
// layouts of all welcome sliders
// add few more layouts if you want
layouts = new int[]{
R.layout.welcome1,
R.layout.welcome2,
R.layout.welcome3,
R.layout.welcome4,
R.layout.welcome5,
R.layout.welcome6,
R.layout.welcome7,
R.layout.welcome8,
R.layout.welcome9,
R.layout.welcome10,
R.layout.welcome11,
R.layout.welcome12};
// adding bottom dots
addBottomDots(0);
// making notification bar transparent
changeStatusBarColor();
MyViewPagerAdapter myViewPagerAdapter = new MyViewPagerAdapter();
viewPager.setAdapter(myViewPagerAdapter);
viewPager.addOnPageChangeListener(viewPagerPageChangeListener);
btnSkip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
launchHomeScreen();
}
});
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// checking for last page
// if last page home screen will be launched
int current = getItem(+1);
if (current < layouts.length) {
// move to next screen
viewPager.setCurrentItem(current);
} else {
launchHomeScreen();
}
}
});
}
private void addBottomDots(int currentPage) {
TextView[] dots = new TextView[layouts.length];
//int[] colorsActive = getResources().getIntArray(R.array.array_dot_active);
//int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive);
dotsLayout.removeAllViews();
for (int i = 0; i < dots.length; i++) {
dots[i] = new TextView(this);
dots[i].setText("");
dots[i].setTextSize(35);
dots[i].setTextColor(ContextCompat.getColor(this, R.color.dot_dark));
dotsLayout.addView(dots[i]);
}
if (dots.length > 0)
dots[currentPage].setTextColor(ContextCompat.getColor(this, R.color.dot_light));
}
private int getItem(int i) {
return viewPager.getCurrentItem() + i;
}
void launchHomeScreen() {
prefManager.setFirstTimeLaunch(false);
startActivity(new Intent(WelcomeActivity.this, MedicamentListActivity.class));
finish();
}
// viewpager change listener
ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
addBottomDots(position);
// changing the next button text 'NEXT' / 'GOT IT'
if (position == layouts.length - 1) {
// last page. make button text to GOT IT
btnNext.setText(getString(R.string.start));
btnSkip.setVisibility(View.GONE);
} else {
// still pages are left
btnNext.setText(getString(R.string.next));
btnSkip.setVisibility(View.VISIBLE);
}
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
};
/**
* Making notification bar transparent
*/
private void changeStatusBarColor() {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
}
/**
* View pager adapter
*/
public class MyViewPagerAdapter extends PagerAdapter {
public MyViewPagerAdapter() {
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
//LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LayoutInflater layoutInflater = getLayoutInflater();
View view = layoutInflater.inflate(layouts[position], container, false);
container.addView(view);
return view;
}
@Override
public int getCount() {
return layouts.length;
}
@Override
public boolean isViewFromObject(View view, Object obj) {
return view == obj;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
View view = (View) object;
container.removeView(view);
}
}
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="-100%p" android:toXDelta="0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="@integer/slide_animation_duration"/>
</set>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="100%p" android:toXDelta="0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="@integer/slide_animation_duration"/>
</set>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="-100%p"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="@integer/slide_animation_duration"/>
</set>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="100%p"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="@integer/slide_animation_duration"/>
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- Gradient Bg for listrow -->
<gradient
android:startColor="#f1f1f2"
android:centerColor="#e7e7e8"
android:endColor="#cfcfcf"
android:angle="270" />
</shape>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<!-- Gradient Bg for listrow -->
<gradient
android:startColor="#FFD4666E"
android:endColor="#FFBD1421"
android:angle="270" />
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- Gradient BgColor for listrow Selected -->
<gradient
android:startColor="#18d7e5"
android:centerColor="#16cedb"
android:endColor="#09adb9"
android:angle="270" />
</shape>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<!-- Gradient Bg for listrow -->
<gradient
android:startColor="#FF048F01"
android:endColor="#FF5CB65A"
android:angle="90" />
</shape>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<!-- Gradient Bg for listrow -->
<gradient
android:startColor="#FFF8A253"
android:endColor="#FFF7C01E"
android:angle="90" />
</shape>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/>
</vector>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/black"
android:pathData="M6,14l3,3v5h6v-5l3,-3V9H6V14zM11,2h2v3h-2V2zM3.5,5.88l1.41,-1.41l2.12,2.12L5.62,8L3.5,5.88zM16.96,6.59l2.12,-2.12l1.41,1.41L18.38,8L16.96,6.59z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,5L4,5c-1.1,0 -1.99,0.9 -1.99,2L2,17c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,7c0,-1.1 -0.9,-2 -2,-2zM11,8h2v2h-2L11,8zM11,11h2v2h-2v-2zM8,8h2v2L8,10L8,8zM8,11h2v2L8,13v-2zM7,13L5,13v-2h2v2zM7,10L5,10L5,8h2v2zM16,17L8,17v-2h8v2zM16,13h-2v-2h2v2zM16,10h-2L14,8h2v2zM19,13h-2v-2h2v2zM19,10h-2L17,8h2v2z" />
</vector>

View file

@ -0,0 +1,35 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="1024dp"
android:height="1024dp"
android:viewportWidth="1024"
android:viewportHeight="1024"
tools:ignore="VectorRaster">
<path
android:pathData="M0,0h1024v1024h-1024z"
android:strokeWidth="2"
android:fillColor="#2c75ff"
android:strokeColor="#00000000"
android:fillType="nonZero"
android:fillAlpha="1"/>
<path
android:pathData="M270.22,598.75C100.34,496.76 112.04,503.85 103.99,498.08 97.09,493.14 83.3,480.94 77.72,474.84 54.48,449.45 39.25,418.26 32.91,383.12 31.24,373.86 29.8,349.63 30.41,341.17 33.3,301.26 47.02,265.54 70.82,235.94 123.21,170.8 211.33,152.85 283.15,192.69c8.33,4.62 308.41,186.09 308.98,186.46 0.64,0.43 -1.77,0.5 -3.69,1.79 -43.37,28.95 -86.69,76.32 -118.01,129.03 -26.24,44.17 -44.75,95.02 -50.07,137.56 -1.65,13.19 -1.98,28.66 -1.39,36.02 0.17,2.08 0.49,4.23 0.24,4.25 -0.25,0.02 -67.76,-40.29 -148.99,-89.05z"
android:fillColor="#ff0000"
android:strokeColor="#00000000"
android:fillType="evenOdd"
android:fillAlpha="1"/>
<path
android:pathData="m780.26,882.05c-1.22,-0.11 -6.22,-0.35 -11.1,-0.51 -18.42,-0.63 -37.94,-6.33 -55.42,-16.17 -4.98,-2.8 -74.42,-44.42 -154.31,-92.48l-145.25,-87.38 0.11,-11.72c0.12,-13.28 3.18,-32.51 8.11,-51.04 23.6,-88.72 84.95,-183.58 155.56,-240.53 4.14,-3.34 8.25,-6.18 9.18,-6.05 2.62,0.35 293.81,176.26 303.96,183.26 28.37,19.55 48.24,52.78 55.9,93.46 2.93,15.59 2.78,44.99 -0.32,62.58 -6.28,35.63 -19.82,66.45 -41.79,95.14 -21.43,27.99 -44.42,46.36 -74.72,59.71 -7.52,3.31 -14.6,5.32 -28.82,8.16 -10.37,2.07 -19.85,3.68 -21.07,3.56v0z"
android:fillColor="#ebebeb"
android:strokeColor="#00000000"
android:fillType="evenOdd"
android:fillAlpha="1"/>
<path
android:pathData="m268.31,209.94c-55.66,-33.49 -118.17,-29.81 -144.71,7.13 31.24,-23.49 85.79,-21.26 135.58,8.7L861.38,588.14c22.28,13.41 40.35,30.49 53.25,48.82 -9.75,-29.09 -33.17,-58.06 -66.49,-78.11z"
android:strokeAlpha="0.75"
android:strokeWidth="2.1958425"
android:fillColor="#ffffff"
android:strokeColor="#ffffff"
android:fillAlpha="0.75"
android:strokeLineCap="round"/>
</vector>

View file

@ -0,0 +1,29 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.057409793"
android:scaleY="0.057409793"
android:translateX="25.96701"
android:translateY="23.78969">
<path
android:pathData="M270.22,598.75C100.34,496.76 112.04,503.85 103.99,498.08 97.09,493.14 83.3,480.94 77.72,474.84 54.48,449.45 39.25,418.26 32.91,383.12 31.24,373.86 29.8,349.63 30.41,341.17 33.3,301.26 47.02,265.54 70.82,235.94 123.21,170.8 211.33,152.85 283.15,192.69c8.33,4.62 308.41,186.09 308.98,186.46 0.64,0.43 -1.77,0.5 -3.69,1.79 -43.37,28.95 -86.69,76.32 -118.01,129.03 -26.24,44.17 -44.75,95.02 -50.07,137.56 -1.65,13.19 -1.98,28.66 -1.39,36.02 0.17,2.08 0.49,4.23 0.24,4.25 -0.25,0.02 -67.76,-40.29 -148.99,-89.05z"
android:fillColor="#ff0000"
android:strokeColor="#00000000"
android:fillType="evenOdd"/>
<path
android:pathData="m780.26,882.05c-1.22,-0.11 -6.22,-0.35 -11.1,-0.51 -18.42,-0.63 -37.94,-6.33 -55.42,-16.17 -4.98,-2.8 -74.42,-44.42 -154.31,-92.48l-145.25,-87.38 0.11,-11.72c0.12,-13.28 3.18,-32.51 8.11,-51.04 23.6,-88.72 84.95,-183.58 155.56,-240.53 4.14,-3.34 8.25,-6.18 9.18,-6.05 2.62,0.35 293.81,176.26 303.96,183.26 28.37,19.55 48.24,52.78 55.9,93.46 2.93,15.59 2.78,44.99 -0.32,62.58 -6.28,35.63 -19.82,66.45 -41.79,95.14 -21.43,27.99 -44.42,46.36 -74.72,59.71 -7.52,3.31 -14.6,5.32 -28.82,8.16 -10.37,2.07 -19.85,3.68 -21.07,3.56v0z"
android:fillColor="#ebebeb"
android:strokeColor="#00000000"
android:fillType="evenOdd"/>
<path
android:pathData="m268.31,209.94c-55.66,-33.49 -118.17,-29.81 -144.71,7.13 31.24,-23.49 85.79,-21.26 135.58,8.7L861.38,588.14c22.28,13.41 40.35,30.49 53.25,48.82 -9.75,-29.09 -33.17,-58.06 -66.49,-78.11z"
android:strokeAlpha="0.75"
android:strokeWidth="2.1958425"
android:fillColor="#ffffff"
android:strokeColor="#ffffff"
android:fillAlpha="0.75"
android:strokeLineCap="round"/>
</group>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
</vector>

View file

@ -0,0 +1,29 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="120dp"
android:height="120dp"
android:viewportWidth="120"
android:viewportHeight="120">
<path
android:pathData="m53.042,12.816 l27.489,27.489 26.653,26.653c11.143,11.143 11.143,29.083 -0,40.226 -11.143,11.143 -29.083,11.143 -40.226,0L39.794,80.02 39.556,79.782 12.816,53.042c-11.143,-11.143 -11.143,-29.083 0,-40.226 11.143,-11.143 29.083,-11.143 40.226,0z"
android:strokeLineJoin="round"
android:strokeWidth="8.99179"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:fillType="evenOdd"
android:fillAlpha="0.995528"/>
<path
android:pathData="M78.837,40.982 L40.112,80.288"
android:strokeLineJoin="miter"
android:strokeWidth="9.00001"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:fillType="evenOdd"
android:strokeLineCap="butt"/>
<path
android:pathData="m84.429,110.873c-4.043,-0.494 -8.348,-2.259 -11.641,-4.772 -1.112,-0.849 -6.949,-6.506 -14.043,-13.612l-12.14,-12.16 16.713,-16.973 16.713,-16.973 12.511,12.496c6.881,6.873 13.009,13.151 13.618,13.951 2.532,3.327 4.204,7.571 4.715,11.966 0.761,6.542 -1.635,13.557 -6.364,18.632 -5.064,5.434 -12.868,8.328 -20.081,7.445z"
android:strokeLineJoin="round"
android:strokeWidth="4.59213"
android:fillColor="#000000"
android:strokeColor="#000000"
android:fillType="evenOdd"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M9.5,6.5v3h-3v-3H9.5M11,5H5v6h6V5L11,5zM9.5,14.5v3h-3v-3H9.5M11,13H5v6h6V13L11,13zM17.5,6.5v3h-3v-3H17.5M19,5h-6v6h6V5L19,5zM13,13h1.5v1.5H13V13zM14.5,14.5H16V16h-1.5V14.5zM16,13h1.5v1.5H16V13zM13,16h1.5v1.5H13V16zM14.5,17.5H16V19h-1.5V17.5zM16,16h1.5v1.5H16V16zM17.5,14.5H19V16h-1.5V14.5zM17.5,17.5H19V19h-1.5V17.5zM22,7h-2V4h-3V2h5V7zM22,22v-5h-2v3h-3v2H22zM2,22h5v-2H4v-3H2V22zM2,2v5h2V4h3V2H2z"/>
</vector>

View file

@ -0,0 +1,4 @@
<vector android:height="60dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="60dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
</vector>

View file

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M4.22,11.29L11.29,4.22C13.64,1.88 17.43,1.88 19.78,4.22C22.12,6.56 22.12,10.36 19.78,12.71L12.71,19.78C10.36,22.12 6.56,22.12 4.22,19.78C1.88,17.43 1.88,13.64 4.22,11.29M5.64,12.71C4.59,13.75 4.24,15.24 4.6,16.57L10.59,10.59L14.83,14.83L18.36,11.29C19.93,9.73 19.93,7.2 18.36,5.64C16.8,4.07 14.27,4.07 12.71,5.64L5.64,12.71Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M12,10.1876 L5.7146,3.9022C5.2133,3.4009 4.4035,3.4009 3.9022,3.9022c-0.5013,0.5013 -0.5013,1.3111 0,1.8124l7.1916,7.1916 7.1916,7.1916c0.5013,0.5013 1.3111,0.5013 1.8124,0 0.5013,-0.5013 0.5013,-1.3111 0,-1.8124L13.8124,12"
android:strokeWidth="1.28536"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1dp" />
<solid android:color="#d0d0d0" />
</shape>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Selector style for listrow -->
<item android:state_pressed="false" android:state_selected="false" android:drawable="@drawable/gradient_bg" />
<item android:state_pressed="true" android:drawable="@drawable/gradient_bg_hover" />
<item android:state_pressed="false" android:state_selected="true" android:drawable="@drawable/gradient_bg_hover" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M15.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="#FF000000"
android:pathData="M8.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="#FF000000"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12,14c-2.33,0 -4.32,1.45 -5.12,3.5h1.67c0.69,-1.19 1.97,-2 3.45,-2s2.75,0.81 3.45,2h1.67c-0.8,-2.05 -2.79,-3.5 -5.12,-3.5z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M15.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="#FF000000"
android:pathData="M8.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="#FF000000"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12,16c-1.48,0 -2.75,-0.81 -3.45,-2L6.88,14c0.8,2.05 2.79,3.5 5.12,3.5s4.32,-1.45 5.12,-3.5h-1.67c-0.7,1.19 -1.97,2 -3.45,2z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
<solid android:color="#FFFFFF" />
<stroke
android:width="1dp"
android:color="#2f6699" />
<corners
android:radius="10dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

View file

@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9,14h6v1.5H9z"/>
<path
android:fillColor="#FF000000"
android:pathData="M15.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="#FF000000"
android:pathData="M8.5,9.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
<path
android:fillColor="#FF000000"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>

View file

@ -0,0 +1,38 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:baselineAligned="false"
android:divider="?android:attr/dividerHorizontal"
android:orientation="horizontal"
android:showDividers="middle"
tools:context="net.foucry.pilldroid.MedicamentListActivity">
<!--
This layout is a two-pane layout for the Medicaments
master/detail flow.
-->
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/medicament_list"
android:name="net.foucry.pilldroid.MedicamentListFragment"
android:layout_width="@dimen/item_width"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager"
tools:context="net.foucry.pilldroid.MedicamentListActivity"
tools:listitem="@layout/medicament_list_content" />
<FrameLayout
android:id="@+id/medicament_detail_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
</LinearLayout>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<WebView
android:id="@+id/aboutHtml"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.zxing.CustomScannerActivity">
<com.journeyapps.barcodescanner.DecoratedBarcodeView
android:id="@+id/zxing_barcode_scanner"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:zxing_scanner_layout="@layout/custom_barcode_scanner">
<ImageButton
android:id="@+id/switch_flashlight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginStart="@dimen/fab_margin"
android:layout_marginTop="@dimen/fab_margin"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="@dimen/fab_margin"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/flashlighButton"
android:onClick="switchFlashlight"
android:src="@drawable/ic_baseline_highlight_24" />
</com.journeyapps.barcodescanner.DecoratedBarcodeView>
</RelativeLayout>

View file

@ -0,0 +1,57 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_selector"
android:backgroundTint="@android:color/transparent"
android:fitsSystemWindows="true"
tools:context="net.foucry.pilldroid.MedicamentDetailActivity"
tools:ignore="MergeRootFrame">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="25dp"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/detail_toolbar" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/detail_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/medicament_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<ImageButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/save_button"
android:src="@drawable/ic_save_black_24dp"
app:backgroundTint="@android:color/transparent"
app:layout_anchor="@+id/medicament_detail_container"
app:layout_anchorGravity="top|end" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include
layout="@layout/medicament_list"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
</FrameLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:accessibilityHeading="true"
android:adjustViewBounds="true"
android:backgroundTint="@android:color/transparent"
android:baselineAlignBottom="false"
android:clickable="false"
android:onClick="scanNow"
android:src="@drawable/ic_add_circle_black_24dp"
app:backgroundTint="@android:color/darker_gray"
app:fabCustomSize="60dp"
app:maxImageSize="60dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:showIn="@layout/activity_welcome">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/layoutDots"
android:layout_width="match_parent"
android:layout_height="@dimen/dots_height"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/dots_margin_bottom"
android:gravity="center"
android:orientation="horizontal">
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha=".5"
android:layout_above="@id/layoutDots"
android:background="@android:color/white" />
<Button
android:id="@+id/btn_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@null"
android:text="@string/next"
android:textColor="@android:color/white"
tools:ignore="RelativeOverlap" />
<Button
android:id="@+id/btn_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="@null"
android:text="@string/skip"
android:textColor="@android:color/white" />
</RelativeLayout>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.journeyapps.barcodescanner.BarcodeView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/zxing_barcode_surface"
app:zxing_framing_rect_width="300dp"
app:zxing_framing_rect_height="150dp">
</com.journeyapps.barcodescanner.BarcodeView>
<com.journeyapps.barcodescanner.ViewfinderView
android:id="@+id/zxing_viewfinder_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:zxing_possible_result_points="@color/zxing_custom_possible_result_points"
app:zxing_result_view="@color/zxing_custom_result_view"
app:zxing_viewfinder_laser="@color/zxing_custom_viewfinder_laser"
app:zxing_viewfinder_laser_visibility="true"
app:zxing_viewfinder_mask="@color/zxing_custom_viewfinder_mask" />
<TextView
android:id="@+id/zxing_status_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:background="@color/zxing_transparent"
android:fontFamily="sans-serif-black"
android:text="@string/zxing_msg_default_status"
android:textColor="@color/design_default_color_primary_dark"
tools:ignore="PrivateResource" />
<ImageButton
android:id="@+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_margin="@dimen/fab_margin"
android:accessibilityHeading="true"
android:backgroundTint="@android:color/transparent"
android:clickable="false"
android:contentDescription="@string/button_cancel"
android:cropToPadding="false"
android:foregroundTint="@android:color/darker_gray"
android:onClick="onCancel"
android:src="@drawable/ic_cancel_black_24dp" />
<ImageButton
android:id="@+id/keyboard_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/button_keyboard"
android:onClick="onKeyboard"
android:src="@drawable/ic_keyboard_black_24dp" />
</merge>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.floatingactionbutton.FloatingActionButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="top|center"
android:backgroundTint="@android:color/transparent"
app:fabCustomSize="60dp"
app:maxImageSize="60dp"
android:src="@drawable/ic_add_circle_black_24dp" />

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/list_selector">
<TextView
android:id="@+id/valeur"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="10sp"
android:paddingTop="5dp"
android:text="Valeur"
android:textColor="#040404"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Label"
android:layout_below="@+id/valeur"
android:layout_alignParentStart="true"
android:textStyle="italic"
android:textColor="#0c4758"
android:background="@android:color/transparent"
android:id="@+id/label"
android:paddingStart="10sp"
android:paddingEnd="10sp"
android:paddingTop="5dp"/>
</RelativeLayout>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/enter_cip_13"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/enter_cip_13_here"
android:inputType="number"
android:padding="10dp" />
</LinearLayout>

View file

@ -0,0 +1,60 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/medicament_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context="net.foucry.pilldroid.MedicamentDetailFragment">
<include
android:id="@+id/name_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5sp"
layout="@layout/info_cell" />
<include
android:id="@+id/presentation_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/info_cell"
android:layout_marginTop="5sp" />
<include
android:id="@+id/administration_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/info_cell"
android:layout_marginTop="5sp" />
<include
android:id="@+id/stock_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/value_input"
android:layout_marginTop="30sp" />
<include
android:id="@+id/prise_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/value_input"
android:layout_marginTop="30sp" />
<include
android:id="@+id/warning_cell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/value_input"
android:layout_marginTop="15sp" />
<include
android:id="@+id/alert_cell"
layout="@layout/value_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5sp" />
</LinearLayout>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/medicament_list"
android:name="net.foucry.pilldroid.MedicamentListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="LinearLayoutManager"
android:background="@drawable/list_selector"
tools:context="net.foucry.pilldroid.MedicamentListActivity"
tools:listitem="@layout/medicament_list_content" />

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:orientation="horizontal">
<!-- Drug's name-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/list_image"
android:layout_width="50sp"
android:layout_height="50sp"
android:layout_marginStart="5dp"
android:src="@drawable/ok_stock_vect"
android:contentDescription="Icone de stock"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/valeur"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nom Médicament"
android:textColor="#040404"
android:typeface="sans"
android:textSize="16sp"
android:textStyle="bold"
android:layout_alignTop="@+id/list_image"
android:layout_toEndOf="@+id/list_image"
android:layout_marginLeft="5dp" />
<TextView
android:id="@+id/cip13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#343434"
android:textSize="14sp"
android:text="cip13 goes here"
android:layout_below="@+id/valeur"
android:layout_toEndOf="@+id/list_image"
android:layout_marginStart="5dp" />
<TextView
android:id="@+id/endOfStock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="lundi 1 janvier 2001"
android:textSize="14sp"
android:textColor="#212121"
android:textStyle="bold"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:layout_marginBottom="5dp" />
</RelativeLayout>
<!-- CIP 13 (should change) -->
<!-- dateEndOfStock -->
<!-- Rightend Arrow -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10sp"
android:contentDescription="@string/detail_view"
android:src="@drawable/ic_navigate_next_black_24dp" />
</RelativeLayout>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:background="@drawable/list_selector"
android:weightSum="1">
<TextView
android:id="@+id/libelle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/valeur"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_toStartOf="@id/valeur"
android:gravity="center_vertical"
android:paddingStart="5dp"
android:paddingEnd="25dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#040404"
android:textStyle="bold" />
<EditText
android:id="@+id/valeur"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:autofillHints=""
android:background="@drawable/rounded_corner"
android:ems="10"
android:gravity="end|fill_vertical"
android:inputType="numberDecimal"
android:labelFor="@id/valeur"
android:paddingEnd="25dp"
android:paddingStart="5dp"
android:text="0"
android:textAlignment="gravity" />
</RelativeLayout>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/ic_launcher_foreground"
android:contentDescription="@string/pilldroid_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide1_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide1_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen5">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/ic_suspended_pill"
android:contentDescription="@string/suspended_treatment_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide10_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textStyle="bold"
android:paddingStart="@dimen/title_padding"
android:paddingEnd="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide10_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/ic_save_black_24dp"
android:contentDescription="@string/save_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide11_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textStyle="bold"
android:paddingStart="@dimen/title_padding"
android:paddingEnd="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide11_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/ic_launcher_foreground"
android:contentDescription="@string/pilldroid_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide12_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textStyle="bold"
android:paddingStart="@dimen/title_padding"
android:paddingEnd="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide12_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen2">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:contentDescription="@string/the_plus_icon"
android:src="@drawable/ic_add_circle_black_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide2_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textAlignment="center"
android:textStyle="bold"
android:paddingEnd="@dimen/title_padding"
android:paddingStart="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide2_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/ic_barcode"
android:contentDescription="@string/barre_code_icone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide3_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textAlignment="center"
android:textStyle="bold"
android:paddingStart="@dimen/title_padding"
android:paddingEnd="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide3_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen4">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/ic_qr_code"
android:contentDescription="@string/qr_code_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide4_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide4_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/ok_stock_vect"
android:contentDescription="@string/happy_face" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide5_Pilldroid"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textStyle="bold"
android:paddingEnd="@dimen/title_padding"
android:paddingStart="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide5_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen2">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:contentDescription="@string/neutral_face"
android:src="@drawable/warning_stock_vect" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide6_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textAlignment="center"
android:textStyle="bold"
android:paddingStart="@dimen/title_padding"
android:paddingEnd="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide6_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen4">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:ignore="UselessParent">
<ImageView
android:layout_width="@dimen/img_width_height"
android:layout_height="@dimen/img_width_height"
android:src="@drawable/lower_stock_vect"
android:contentDescription="@string/unhappy_face" />
<TextView
android:layout_width="349dp"
android:layout_height="wrap_content"
android:text="@string/slide7_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textAlignment="center"
android:textStyle="bold"
android:paddingEnd="@dimen/title_padding"
android:paddingStart="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide7_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen1">
<LinearLayout
android:layout_width="@dimen/screen_shot_view_width"
android:layout_height="@dimen/screen_shot_view_height"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/screen_shot_height"
android:layout_height="@dimen/screen_shot_height"
android:contentDescription="@string/medicament_info"
android:src="@drawable/info" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide8_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textStyle="bold"
android:paddingStart="@dimen/title_padding"
android:paddingEnd="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide8_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_screen2">
<LinearLayout
android:layout_width="@dimen/screen_shot_view_width"
android:layout_height="@dimen/screen_shot_view_height"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/screen_shot_height"
android:layout_height="@dimen/screen_shot_height"
android:contentDescription="@string/tunables"
android:src="@drawable/tunable" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/slide9_Pilldroid"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_title"
android:textAlignment="center"
android:textStyle="bold"
android:paddingStart="@dimen/title_padding"
android:paddingEnd="@dimen/title_padding"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:paddingLeft="@dimen/desc_padding"
android:paddingRight="@dimen/desc_padding"
android:text="@string/slide9_desc"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/slide_desc" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/about"
android:title="@string/about"/>
<item android:id="@+id/help"
android:title="@string/help"/>
</menu>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Some files were not shown because too many files have changed in this diff Show more