Added option to disable notification subtext

pull/199/head
M66B 4 years ago
parent 6867991593
commit cc74e500ca

@ -4079,6 +4079,7 @@ class Core {
boolean prefer_contact = prefs.getBoolean("prefer_contact", false);
boolean flags = prefs.getBoolean("flags", true);
boolean notify_messaging = prefs.getBoolean("notify_messaging", false);
boolean notify_subtext = prefs.getBoolean("notify_subtext", true);
boolean notify_preview = prefs.getBoolean("notify_preview", true);
boolean notify_preview_all = prefs.getBoolean("notify_preview_all", false);
boolean wearable_preview = prefs.getBoolean("wearable_preview", false);
@ -4194,10 +4195,11 @@ class Core {
builder.setColor(color);
builder.setColorized(true);
}
if (amessage.folderUnified)
builder.setSubText(amessage.accountName);
else
builder.setSubText(amessage.accountName + " · " + amessage.getFolderName(context));
if (notify_subtext)
if (amessage.folderUnified && !EntityFolder.INBOX.equals(amessage.folderType))
builder.setSubText(amessage.accountName);
else
builder.setSubText(amessage.accountName + " · " + amessage.getFolderName(context));
}
Notification pub = builder.build();
@ -4357,10 +4359,11 @@ class Core {
Address[] afrom = messageFrom.get(message.id);
String from = MessageHelper.formatAddresses(afrom, name_email, false);
mbuilder.setContentTitle(from);
if (message.folderUnified && !EntityFolder.INBOX.equals(message.folderType))
mbuilder.setSubText(message.accountName + " · " + message.getFolderName(context));
else
mbuilder.setSubText(message.accountName);
if (notify_subtext)
if (message.folderUnified && !EntityFolder.INBOX.equals(message.folderType))
mbuilder.setSubText(message.accountName + " · " + message.getFolderName(context));
else
mbuilder.setSubText(message.accountName);
DB db = DB.getInstance(context);

@ -87,6 +87,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swNotifySummary;
private SwitchCompat swNotifyRemove;
private SwitchCompat swNotifyClear;
private SwitchCompat swNotifySubtext;
private SwitchCompat swNotifyPreview;
private SwitchCompat swNotifyPreviewAll;
private SwitchCompat swNotifyPreviewOnly;
@ -111,7 +112,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
"light", "sound",
"badge", "unseen_ignored",
"notify_background_only", "notify_known", "notify_summary", "notify_remove", "notify_clear",
"notify_preview", "notify_preview_all", "notify_preview_only", "wearable_preview",
"notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "wearable_preview",
"notify_messaging",
"biometrics_notify",
"alert_once"
@ -160,6 +161,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swNotifySummary = view.findViewById(R.id.swNotifySummary);
swNotifyRemove = view.findViewById(R.id.swNotifyRemove);
swNotifyClear = view.findViewById(R.id.swNotifyClear);
swNotifySubtext = view.findViewById(R.id.swNotifySubtext);
swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
swNotifyPreviewAll = view.findViewById(R.id.swNotifyPreviewAll);
swNotifyPreviewOnly = view.findViewById(R.id.swNotifyPreviewOnly);
@ -408,6 +410,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
swNotifySubtext.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("notify_subtext", checked).apply();
}
});
swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -574,6 +583,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swNotifySummary.setChecked(prefs.getBoolean("notify_summary", false));
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false));
swNotifySubtext.setChecked(prefs.getBoolean("notify_subtext", true));
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
swNotifyPreviewAll.setChecked(prefs.getBoolean("notify_preview_all", false));
swNotifyPreviewOnly.setChecked(prefs.getBoolean("notify_preview_only", false));

@ -531,13 +531,24 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_notify_clear"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyRemoveHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifySubtext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_notify_subtext"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyClear"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyPreview"
android:layout_width="0dp"
@ -547,7 +558,7 @@
android:text="@string/title_advanced_notify_preview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyClear"
app:layout_constraintTop_toBottomOf="@id/swNotifySubtext"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

@ -486,6 +486,7 @@
<string name="title_advanced_notify_action_snooze">Snooze</string>
<string name="title_advanced_notify_remove">Remove new message notification on tapping on notification</string>
<string name="title_advanced_notify_clear">Remove new message notifications on viewing message list</string>
<string name="title_advanced_notify_subtext">Show account or folder name as subtext</string>
<string name="title_advanced_wearable_preview">Only send notifications with a message preview to wearables</string>
<string name="title_advanced_notify_messaging">Use Android \'messaging style\' notification format</string>
<string name="title_advanced_biometrics_notify">Show notification content when using biometric authentication</string>

Loading…
Cancel
Save