|
|
@ -35,7 +35,11 @@ import android.content.SharedPreferences;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.res.ColorStateList;
|
|
|
|
import android.content.res.ColorStateList;
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
|
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.Color;
|
|
|
|
|
|
|
|
import android.graphics.ColorFilter;
|
|
|
|
|
|
|
|
import android.graphics.ColorMatrix;
|
|
|
|
import android.graphics.ColorMatrixColorFilter;
|
|
|
|
import android.graphics.ColorMatrixColorFilter;
|
|
|
|
import android.graphics.Paint;
|
|
|
|
import android.graphics.Paint;
|
|
|
|
import android.graphics.Rect;
|
|
|
|
import android.graphics.Rect;
|
|
|
@ -1392,26 +1396,44 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
// For performance reasons the WebView is created when needed only
|
|
|
|
// For performance reasons the WebView is created when needed only
|
|
|
|
if (!(vwBody instanceof WebView)) {
|
|
|
|
if (!(vwBody instanceof WebView)) {
|
|
|
|
WebView webView = new WebView(context) {
|
|
|
|
WebView webView = new WebView(context) {
|
|
|
|
|
|
|
|
private Bitmap bm;
|
|
|
|
|
|
|
|
private Canvas cc;
|
|
|
|
|
|
|
|
private Paint paint = new Paint();
|
|
|
|
|
|
|
|
private ColorFilter cf = new ColorMatrixColorFilter(new ColorMatrix(Helper.NEGATIVE));
|
|
|
|
|
|
|
|
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
|
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
|
|
int height = getMeasuredHeight();
|
|
|
|
int height = getMeasuredHeight();
|
|
|
|
if (height < tvBody.getMinHeight())
|
|
|
|
if (height < tvBody.getMinHeight())
|
|
|
|
setMeasuredDimension(getMeasuredWidth(), tvBody.getMinHeight());
|
|
|
|
setMeasuredDimension(getMeasuredWidth(), tvBody.getMinHeight());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
|
|
|
|
|
|
super.onSizeChanged(w, h, oldw, oldh);
|
|
|
|
|
|
|
|
bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
|
|
|
|
|
|
|
|
cc = new Canvas(bm);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onDraw(Canvas canvas) {
|
|
|
|
if (dark) {
|
|
|
|
if (dark) {
|
|
|
|
float[] NEGATIVE = new float[]{
|
|
|
|
super.onDraw(cc);
|
|
|
|
-1, 0, 0, 0, 255, // red
|
|
|
|
paint.setColorFilter(cf);
|
|
|
|
0, -1, 0, 0, 255, // green
|
|
|
|
canvas.drawBitmap(bm, 0, 0, paint);
|
|
|
|
0, 0, -1, 0, 255, // blue
|
|
|
|
} else
|
|
|
|
0, 0, 0, 1, 0 // alpha
|
|
|
|
super.onDraw(canvas);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=578150
|
|
|
|
|
|
|
|
if (dark) {
|
|
|
|
Paint paint = new Paint();
|
|
|
|
Paint paint = new Paint();
|
|
|
|
paint.setColorFilter(new ColorMatrixColorFilter(NEGATIVE));
|
|
|
|
paint.setColorFilter(new ColorMatrixColorFilter(Helper.NEGATIVE));
|
|
|
|
webView.setLayerType(View.LAYER_TYPE_HARDWARE, paint);
|
|
|
|
webView.setLayerType(View.LAYER_TYPE_HARDWARE, paint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
webView.setWebViewClient(new WebViewClient() {
|
|
|
|
webView.setWebViewClient(new WebViewClient() {
|
|
|
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
|