mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-17 18:41:37 +01:00
Merge branch 'feature/addMenu' into develop
Fin feature addMenu avec HTML About
This commit is contained in:
commit
1aec8a99c2
8 changed files with 133 additions and 3 deletions
|
@ -43,6 +43,11 @@
|
|||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".About"
|
||||
android:label="À propos de PillDroid"
|
||||
android:parentActivityName=".MedicamentListActivity"
|
||||
android:theme="@style/AppTheme">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
32
app/src/main/assets/about.html
Normal file
32
app/src/main/assets/about.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<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_res/mipmap/ic_launcher.png" width="64"/></center>
|
||||
<!--<div class="build">[[[about_string]]]</div>-->
|
||||
<h5>PilStock © 2016 Jacques Foucry </h5>
|
||||
<p>PilStock est une gestion théorique de votre stock de médicaments.</p>
|
||||
<p>PilStock 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>PilStock 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>PilStock n'aurait pas pu voir le jour sans les conseils avisés de Frank, Benoit, Dominique & Aurélien.</p>
|
||||
<p>Stéphane en grand chamboulateur d'interface en fait quelque chose d'utilisable</p>
|
||||
<hr width=45%/>
|
||||
<p>Le soutien actif et les conseils du Dr Kauffmann me permettent de faire évoluer PilStock</p>
|
||||
<p>Vous pouvez me contacter à l'adresse suivante : <a href="mailto:pilstock@pilstock-app.com?subject=À propos de PilStock">pilstock@pilstock-app.com</a></p>
|
||||
</body>
|
||||
</html>
|
52
app/src/main/java/net/foucry/pilldroid/About.java
Normal file
52
app/src/main/java/net/foucry/pilldroid/About.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package net.foucry.pilldroid;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Html;
|
||||
import android.webkit.WebView;
|
||||
|
||||
/**
|
||||
* Created by jacques on 12/06/16.
|
||||
*/
|
||||
public class About extends AppCompatActivity{
|
||||
|
||||
private WebView aboutView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.about);
|
||||
|
||||
String htmlString = null;
|
||||
|
||||
aboutView = (WebView) findViewById(R.id.aboutHtml);
|
||||
|
||||
aboutView.loadUrl("file:///android_asset/about.html");
|
||||
aboutView.clearCache(true);
|
||||
aboutView.clearHistory();
|
||||
aboutView.getSettings().setJavaScriptEnabled(true);
|
||||
aboutView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
aboutView.setBackgroundColor(Color.WHITE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class ImageGetter implements Html.ImageGetter {
|
||||
|
||||
public Drawable getDrawable(String source) {
|
||||
int id;
|
||||
if (source.equals("ic_launcher.png")) {
|
||||
id = R.mipmap.ic_launcher;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Drawable d = getResources().getDrawable(id);
|
||||
// Drawable d = ResourcesCompat.getDrawable(getResources(),id, null);
|
||||
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,14 +47,13 @@ public class DBMedoc extends SQLiteOpenHelper{
|
|||
}
|
||||
|
||||
public void createDatabase() throws IOException {
|
||||
Log.e(MedicamentListActivity.Constants.TAG, "createDatabase called");
|
||||
|
||||
boolean dbExist = checkDatabase();
|
||||
|
||||
if (dbExist) {
|
||||
// Nothing to do, DB already exist
|
||||
Log.v("DB Exists", "db exists");
|
||||
} else {
|
||||
this.getDatabaseName();
|
||||
this.getReadableDatabase();
|
||||
try {
|
||||
copyDatabase();
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -11,6 +11,9 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.support.v7.widget.Toolbar;
|
||||
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.ImageView;
|
||||
|
@ -147,6 +150,25 @@ public class MedicamentListActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public void scanNow(View view) {
|
||||
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
|
||||
//intent.putExtra("SCAN_MODE", "CODE_128");
|
||||
|
|
11
app/src/main/res/layout/about.xml
Normal file
11
app/src/main/res/layout/about.xml
Normal 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="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
7
app/src/main/res/menu/about.xml
Normal file
7
app/src/main/res/menu/about.xml
Normal 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>
|
|
@ -126,4 +126,6 @@
|
|||
<string name="sbc_name">Google Book Search</string>
|
||||
<string name="wifi_changing_network">Requesting connection to network\u2026</string>
|
||||
<string name="msgNotFound">Médicament introuvable dans la base de données</string>
|
||||
<string name="about">À propos</string>
|
||||
<string name="help">Aide</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue