mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 11:28:41 +01:00
Added option to enable inverting original message
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
private SwitchCompat swMonospaced;
|
||||
private SwitchCompat swHtml;
|
||||
private SwitchCompat swImages;
|
||||
private SwitchCompat swInvert;
|
||||
private SwitchCompat swActionbar;
|
||||
|
||||
private SwitchCompat swPull;
|
||||
@@ -120,7 +121,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
|
||||
static String[] OPTIONS_RESTART = new String[]{
|
||||
"startup", "date", "threading", "avatars", "identicons", "name_email", "subject_italic", "flags", "preview",
|
||||
"addresses", "monospaced", "autohtml", "autoimages", "actionbar",
|
||||
"addresses", "monospaced", "autohtml", "autoimages", "invert", "actionbar",
|
||||
"pull", "swipenav", "autoexpand", "autoclose", "autonext",
|
||||
"authentication", "debug"
|
||||
};
|
||||
@@ -129,7 +130,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
"enabled", "schedule_start", "schedule_end",
|
||||
"metered", "download", "roaming",
|
||||
"startup", "date", "threading", "avatars", "identicons", "name_email", "subject_italic", "flags", "preview",
|
||||
"addresses", "monospaced", "autohtml", "autoimages", "actionbar",
|
||||
"addresses", "monospaced", "autohtml", "autoimages", "invert", "actionbar",
|
||||
"pull", "swipenav", "autoexpand", "autoclose", "autonext", "collapse", "autoread", "automove",
|
||||
"autoresize", "resize", "prefix_once", "autosend",
|
||||
"notify_preview", "search_local", "light", "sound",
|
||||
@@ -171,6 +172,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
swMonospaced = view.findViewById(R.id.swMonospaced);
|
||||
swHtml = view.findViewById(R.id.swHtml);
|
||||
swImages = view.findViewById(R.id.swImages);
|
||||
swInvert = view.findViewById(R.id.swInvert);
|
||||
swActionbar = view.findViewById(R.id.swActionbar);
|
||||
|
||||
swPull = view.findViewById(R.id.swPull);
|
||||
@@ -390,6 +392,13 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
}
|
||||
});
|
||||
|
||||
swInvert.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("invert", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -686,6 +695,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
|
||||
swHtml.setChecked(prefs.getBoolean("autohtml", false));
|
||||
swImages.setChecked(prefs.getBoolean("autoimages", false));
|
||||
swInvert.setChecked(prefs.getBoolean("invert", false));
|
||||
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
|
||||
|
||||
swPull.setChecked(prefs.getBoolean("pull", true));
|
||||
|
||||
@@ -132,6 +132,13 @@ public class Helper {
|
||||
|
||||
static final float LOW_LIGHT = 0.6f;
|
||||
|
||||
static final float[] MATRIX_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
|
||||
};
|
||||
|
||||
static final String FAQ_URI = "https://github.com/M66B/open-source-email/blob/master/FAQ.md";
|
||||
|
||||
static ThreadFactory backgroundThreadFactory = new ThreadFactory() {
|
||||
|
||||
Reference in New Issue
Block a user