Added option to enable inverting original message

This commit is contained in:
M66B
2019-04-20 16:00:46 +02:00
parent 4c974be407
commit 4ac61a7d34
6 changed files with 41 additions and 12 deletions

View File

@@ -1400,16 +1400,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
};
if (dark) {
float[] NEGATIVE = new float[]{
-1, 0, 0, 0, 255, // red
0, -1, 0, 0, 255, // green
0, 0, -1, 0, 255, // blue
0, 0, 0, 1, 0 // alpha
};
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean invert = prefs.getBoolean("invert", false);
if (dark && invert) {
// https://bugs.chromium.org/p/chromium/issues/detail?id=578150
Paint paint = new Paint();
paint.setColorFilter(new ColorMatrixColorFilter(NEGATIVE));
paint.setColorFilter(new ColorMatrixColorFilter(Helper.MATRIX_NEGATIVE));
webView.setLayerType(View.LAYER_TYPE_HARDWARE, paint);
}