2016-06-12 18:46:19 +02:00
|
|
|
package net.foucry.pilldroid;
|
|
|
|
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
|
import android.text.Html;
|
2016-06-14 23:41:05 +02:00
|
|
|
import android.text.Spanned;
|
|
|
|
import android.webkit.WebView;
|
2016-06-12 18:46:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by jacques on 12/06/16.
|
|
|
|
*/
|
|
|
|
public class About extends AppCompatActivity{
|
|
|
|
|
|
|
|
private final String htmlText = "<body>" +
|
|
|
|
"<h1>À propos de " + R.string.app_name + "</h1>" +
|
|
|
|
"<img src=\"ic_launcher.png\">" +
|
|
|
|
"</body>";
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.about);
|
|
|
|
|
2016-06-14 23:41:05 +02:00
|
|
|
String htmlAsString = getString(R.string.html);
|
|
|
|
Spanned htmlAsSpanned = Html.fromHtml(htmlAsString);
|
|
|
|
|
|
|
|
WebView webView = (WebView) findViewById(R.id.aboutHtml);
|
|
|
|
webView.loadDataWithBaseURL(null, htmlAsString, "text/html", "utf-8", null);
|
2016-06-12 18:46:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|