2016-06-12 18:46:19 +02:00
|
|
|
package net.foucry.pilldroid;
|
|
|
|
|
2016-06-19 01:47:30 +02:00
|
|
|
import android.graphics.Color;
|
2016-06-12 18:46:19 +02:00
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
import android.os.Bundle;
|
2020-05-16 19:49:14 +02:00
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
2016-06-12 18:46:19 +02:00
|
|
|
import android.text.Html;
|
2016-06-14 23:41:05 +02:00
|
|
|
import android.webkit.WebView;
|
2016-06-12 18:46:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by jacques on 12/06/16.
|
|
|
|
*/
|
|
|
|
public class About extends AppCompatActivity{
|
|
|
|
|
2016-06-19 00:57:40 +02:00
|
|
|
private WebView aboutView;
|
2016-06-12 18:46:19 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.about);
|
|
|
|
|
2016-06-19 00:57:40 +02:00
|
|
|
String htmlString = null;
|
|
|
|
|
2020-07-03 21:43:09 +02:00
|
|
|
aboutView = findViewById(R.id.aboutHtml);
|
2016-06-19 00:57:40 +02:00
|
|
|
|
|
|
|
aboutView.loadUrl("file:///android_asset/about.html");
|
|
|
|
aboutView.clearCache(true);
|
|
|
|
aboutView.clearHistory();
|
|
|
|
aboutView.getSettings().setJavaScriptEnabled(true);
|
2016-06-19 01:47:30 +02:00
|
|
|
aboutView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
|
|
|
|
aboutView.setBackgroundColor(Color.WHITE);
|
2016-06-19 00:57:40 +02:00
|
|
|
|
2016-06-14 23:41:05 +02:00
|
|
|
|
2016-06-12 18:46:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private class ImageGetter implements Html.ImageGetter {
|
|
|
|
|
|
|
|
public Drawable getDrawable(String source) {
|
|
|
|
int id;
|
2020-07-23 09:37:27 +02:00
|
|
|
if (source.equals("ic_launcher-web.png")) {
|
|
|
|
id = R.drawable.ic_launcher;
|
2016-06-12 18:46:19 +02:00
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-09-18 23:03:08 +02:00
|
|
|
// Drawable d = getResources().getDrawable(id);
|
|
|
|
//Drawable d = ResourcesCompatApi21.getDrawable(getResources(),id, null);
|
|
|
|
Drawable d = ContextCompat.getDrawable(getApplicationContext(),id);
|
2020-04-24 21:19:32 +02:00
|
|
|
assert d != null;
|
2016-06-12 18:46:19 +02:00
|
|
|
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|