diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java
index 527fe23b7b..54ab23cb72 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptions.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java
@@ -86,6 +86,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
private SwitchCompat swAutoResize;
private SwitchCompat swAutoSend;
+ private SwitchCompat swNotifyPreview;
private SwitchCompat swLight;
private Button btnSound;
@@ -104,7 +105,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
"metered", "download",
"unified", "date", "threading", "avatars", "identicons", "name_email", "preview", "addresses", "autoimages", "actionbar",
"pull", "swipenav", "autoexpand", "autoclose", "autonext", "collapse", "autoread", "automove", "sender", "autoresize", "autosend",
- "light", "sound",
+ "notify_preview", "light", "sound",
"debug",
"first", "why", "last_update_check", "app_support", "message_swipe", "message_select", "folder_actions", "folder_sync",
"edit_ref_confirmed", "autosend", "automove", "show_html_confirmed", "show_images_confirmed"
@@ -150,6 +151,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swAutoResize = view.findViewById(R.id.swAutoResize);
swAutoSend = view.findViewById(R.id.swAutoSend);
+ swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
swLight = view.findViewById(R.id.swLight);
btnSound = view.findViewById(R.id.btnSound);
@@ -381,6 +383,13 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
}
});
+ swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("notify_preview", checked).apply();
+ }
+ });
+
swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -512,6 +521,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swAutoResize.setChecked(prefs.getBoolean("autoresize", true));
swAutoSend.setChecked(!prefs.getBoolean("autosend", false));
+ swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
swLight.setChecked(prefs.getBoolean("light", false));
swDebug.setChecked(prefs.getBoolean("debug", false));
diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java
index c86ebc1193..c312ebe4b1 100644
--- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java
+++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java
@@ -552,10 +552,12 @@ public class ServiceSynchronize extends LifecycleService {
builder.setSubText(accountName);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- if (prefs.getBoolean("light", false))
+ boolean light = prefs.getBoolean("light", false);
+ String sound = prefs.getString("sound", null);
+
+ if (light)
builder.setLights(Color.GREEN, 1000, 1000);
- String sound = prefs.getString("sound", null);
if (sound == null) {
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
builder.setSound(uri);
@@ -584,6 +586,7 @@ public class ServiceSynchronize extends LifecycleService {
notifications.add(builder.build());
+ boolean preview = prefs.getBoolean("notify_preview", true);
for (TupleMessageEx message : messages) {
ContactInfo info = messageContact.get(message);
@@ -665,7 +668,7 @@ public class ServiceSynchronize extends LifecycleService {
if (!TextUtils.isEmpty(message.subject))
mbuilder.setContentText(message.subject);
- if (message.content)
+ if (message.content && preview)
try {
String body = Helper.readText(EntityMessage.getFile(this, message.id));
StringBuilder sb = new StringBuilder();
diff --git a/app/src/main/res/layout/fragment_options.xml b/app/src/main/res/layout/fragment_options.xml
index e4e99944f4..c7fe41c7c5 100644
--- a/app/src/main/res/layout/fragment_options.xml
+++ b/app/src/main/res/layout/fragment_options.xml
@@ -603,6 +603,44 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSectionMisc" />
+
+
+
+
+
+