mirror of https://github.com/M66B/FairEmail.git
Added option to enable inverting original message
This commit is contained in:
parent
4c974be407
commit
4ac61a7d34
4
FAQ.md
4
FAQ.md
|
@ -1391,7 +1391,9 @@ FairEmail already tries to workaround these bugs, but if this fail you'll need t
|
|||
~~The original message is shown as the sender has sent it, including all colors.~~
|
||||
~~Changing the background color would not only make the original view not original anymore, it can also result in unreadable messages.~~
|
||||
|
||||
Recent versions of FairEmail will invert all colors of the original message when using a dark or black theme.
|
||||
Recent versions of FairEmail can invert all colors of the original message when using a dark or black theme.
|
||||
You can turn this on the advanced settings.
|
||||
Be aware that this can cause [crashes](https://bugs.chromium.org/p/chromium/issues/detail?id=578150) on some devices.
|
||||
|
||||
<br />
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -503,6 +503,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swImages" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swInvert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:text="@string/title_advanced_invert"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvImagesHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swActionbar"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -512,7 +524,7 @@
|
|||
android:layout_marginEnd="12dp"
|
||||
android:text="@string/title_advanced_actionbar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvImagesHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/swInvert"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
<string name="title_advanced_monospaced">Use monospaced font for message text</string>
|
||||
<string name="title_advanced_html">Automatically show original message for known contacts</string>
|
||||
<string name="title_advanced_images">Automatically show images for known contacts</string>
|
||||
<string name="title_advanced_invert">Invert colors of original message when using a dark theme</string>
|
||||
<string name="title_advanced_actionbar">Conversation action bar</string>
|
||||
|
||||
<string name="title_advanced_pull_refresh">Pull down to refresh</string>
|
||||
|
|
Loading…
Reference in New Issue