mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Code de chargement et affichage de la page About
This commit is contained in:
parent
fe3a1fef56
commit
3a0e0e1301
1 changed files with 4 additions and 27 deletions
|
@ -1,17 +1,11 @@
|
|||
package net.foucry.pilldroid;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Created by jacques on 12/06/16.
|
||||
|
@ -27,33 +21,16 @@ public class About extends AppCompatActivity{
|
|||
|
||||
String htmlString = null;
|
||||
|
||||
/* aboutView = (WebView) findViewById(R.id.aboutHtml);
|
||||
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.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
aboutView.setBackgroundColor(Color.WHITE);
|
||||
|
||||
try {
|
||||
InputStream is = getAssets().open("about.html");
|
||||
int size = is.available();
|
||||
|
||||
byte[] buffer = new byte[size];
|
||||
|
||||
is.read(buffer);
|
||||
is.close();
|
||||
|
||||
htmlString = new String(buffer);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
TextView htmlTextView = (TextView)findViewById(R.id.aboutHtml);
|
||||
htmlTextView.setText(Html.fromHtml(htmlString, new ImageGetter(), null));
|
||||
|
||||
Log.i("PillDroid", htmlTextView.getText().toString());
|
||||
}
|
||||
|
||||
private class ImageGetter implements Html.ImageGetter {
|
||||
|
|
Loading…
Reference in a new issue