Code de chargement et affichage de la page About

This commit is contained in:
Jacques Foucry 2016-06-19 01:47:30 +02:00
parent fe3a1fef56
commit 3a0e0e1301

View file

@ -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 {