Added setting to enable full notification text

pull/174/head
M66B 5 years ago
parent fe35cc0c1e
commit c6f0ae6dad

@ -2862,6 +2862,7 @@ class Core {
boolean name_email = prefs.getBoolean("name_email", false); boolean name_email = prefs.getBoolean("name_email", false);
boolean flags = prefs.getBoolean("flags", true); boolean flags = prefs.getBoolean("flags", true);
boolean notify_preview = prefs.getBoolean("notify_preview", 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); boolean wearable_preview = prefs.getBoolean("wearable_preview", false);
boolean notify_trash = (prefs.getBoolean("notify_trash", true) || !pro); boolean notify_trash = (prefs.getBoolean("notify_trash", true) || !pro);
boolean notify_junk = (prefs.getBoolean("notify_junk", false) && pro); boolean notify_junk = (prefs.getBoolean("notify_junk", false) && pro);
@ -3210,14 +3211,14 @@ class Core {
if (message.content && notify_preview) { if (message.content && notify_preview) {
// Android will truncate the text // Android will truncate the text
String text = null; String preview = message.preview;
try { if (notify_preview_all)
String html = Helper.readText(message.getFile(context)); try {
text = HtmlHelper.getPreviewText(html); String html = Helper.readText(message.getFile(context));
} catch (Throwable ex) { preview = HtmlHelper.getPreviewText(html);
Log.e(ex); } catch (Throwable ex) {
text = message.preview; Log.e(ex);
} }
// Wearables // Wearables
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -3226,8 +3227,8 @@ class Core {
if (wearable_preview) { if (wearable_preview) {
if (sb.length() != 0) if (sb.length() != 0)
sb.append(" - "); sb.append(" - ");
if (!TextUtils.isEmpty(text)) if (!TextUtils.isEmpty(preview))
sb.append(text); sb.append(preview);
} }
if (sb.length() > 0) if (sb.length() > 0)
mbuilder.setContentText(sb.toString()); mbuilder.setContentText(sb.toString());
@ -3237,8 +3238,8 @@ class Core {
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
sbm.append("<em>").append(message.subject).append("</em>").append("<br>"); sbm.append("<em>").append(message.subject).append("</em>").append("<br>");
if (!TextUtils.isEmpty(text)) if (!TextUtils.isEmpty(preview))
sbm.append(text); sbm.append(preview);
if (sbm.length() > 0) { if (sbm.length() > 0) {
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle() NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()

@ -58,6 +58,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swNotifyRemove; private SwitchCompat swNotifyRemove;
private SwitchCompat swNotifyClear; private SwitchCompat swNotifyClear;
private SwitchCompat swNotifyPreview; private SwitchCompat swNotifyPreview;
private SwitchCompat swNotifyPreviewAll;
private SwitchCompat swWearablePreview; private SwitchCompat swWearablePreview;
private CheckBox cbNotifyActionTrash; private CheckBox cbNotifyActionTrash;
private CheckBox cbNotifyActionJunk; private CheckBox cbNotifyActionJunk;
@ -81,7 +82,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"badge", "unseen_ignored", "badge", "unseen_ignored",
"notify_summary", "notify_remove", "notify_clear", "notify_preview", "wearable_preview", "notify_summary", "notify_remove", "notify_clear", "notify_preview", "notify_preview_all", "wearable_preview",
"notify_trash", "notify_junk", "notify_archive", "notify_move", "notify_trash", "notify_junk", "notify_archive", "notify_move",
"notify_reply", "notify_reply_direct", "notify_reply", "notify_reply_direct",
"notify_flag", "notify_seen", "notify_snooze", "notify_flag", "notify_seen", "notify_snooze",
@ -108,6 +109,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swNotifyRemove = view.findViewById(R.id.swNotifyRemove); swNotifyRemove = view.findViewById(R.id.swNotifyRemove);
swNotifyClear = view.findViewById(R.id.swNotifyClear); swNotifyClear = view.findViewById(R.id.swNotifyClear);
swNotifyPreview = view.findViewById(R.id.swNotifyPreview); swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
swNotifyPreviewAll = view.findViewById(R.id.swNotifyPreviewAll);
swWearablePreview = view.findViewById(R.id.swWearablePreview); swWearablePreview = view.findViewById(R.id.swWearablePreview);
cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash); cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash);
cbNotifyActionJunk = view.findViewById(R.id.cbNotifyActionJunk); cbNotifyActionJunk = view.findViewById(R.id.cbNotifyActionJunk);
@ -217,6 +219,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
} }
}); });
swNotifyPreviewAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("notify_preview_all", checked).apply();
}
});
swWearablePreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swWearablePreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -390,6 +399,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true)); swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false)); swNotifyClear.setChecked(prefs.getBoolean("notify_clear", false));
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true)); swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
swNotifyPreviewAll.setChecked(prefs.getBoolean("notify_preview_all", false));
swWearablePreview.setChecked(prefs.getBoolean("wearable_preview", false)); swWearablePreview.setChecked(prefs.getBoolean("wearable_preview", false));
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true) || !pro); cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true) || !pro);
@ -415,6 +425,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
boolean summary = swNotifySummary.isChecked(); boolean summary = swNotifySummary.isChecked();
swNotifyPreview.setEnabled(!summary); swNotifyPreview.setEnabled(!summary);
swNotifyPreviewAll.setEnabled(!summary && swNotifyPreview.isChecked());
swWearablePreview.setEnabled(!summary && swNotifyPreview.isChecked()); swWearablePreview.setEnabled(!summary && swNotifyPreview.isChecked());
cbNotifyActionTrash.setEnabled(pro && !summary); cbNotifyActionTrash.setEnabled(pro && !summary);
cbNotifyActionJunk.setEnabled(pro && !summary); cbNotifyActionJunk.setEnabled(pro && !summary);

@ -191,6 +191,29 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyPreview" /> app:layout_constraintTop_toBottomOf="@id/swNotifyPreview" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyPreviewAll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_notify_preview_all"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyPreviewHint"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvNotifyPreviewAllHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_notify_preview_all_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyPreviewAll" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swWearablePreview" android:id="@+id/swWearablePreview"
android:layout_width="0dp" android:layout_width="0dp"
@ -199,7 +222,7 @@
android:text="@string/title_advanced_wearable_preview" android:text="@string/title_advanced_wearable_preview"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyPreviewHint" app:layout_constraintTop_toBottomOf="@id/tvNotifyPreviewAllHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<TextView <TextView

@ -360,6 +360,7 @@
<string name="title_advanced_unseen_ignored">Let the number of new messages match the number of notifications</string> <string name="title_advanced_unseen_ignored">Let the number of new messages match the number of notifications</string>
<string name="title_advanced_notify_summary">Show summary notification only</string> <string name="title_advanced_notify_summary">Show summary notification only</string>
<string name="title_advanced_notify_preview">Show message preview in notifications</string> <string name="title_advanced_notify_preview">Show message preview in notifications</string>
<string name="title_advanced_notify_preview_all">Preview all text</string>
<string name="title_advanced_notify_actions">Notification actions</string> <string name="title_advanced_notify_actions">Notification actions</string>
<string name="title_advanced_notify_action_trash">Trash</string> <string name="title_advanced_notify_action_trash">Trash</string>
<string name="title_advanced_notify_action_junk">Spam</string> <string name="title_advanced_notify_action_junk">Spam</string>
@ -465,6 +466,7 @@
<string name="title_advanced_notify_manage_hint">Tap on the channel name to set the channel properties</string> <string name="title_advanced_notify_manage_hint">Tap on the channel name to set the channel properties</string>
<string name="title_advanced_notify_manage_default_hint">To set the default sound, etc</string> <string name="title_advanced_notify_manage_default_hint">To set the default sound, etc</string>
<string name="title_advanced_notify_manage_service_hint">To disable the permanent notification</string> <string name="title_advanced_notify_manage_service_hint">To disable the permanent notification</string>
<string name="title_advanced_notify_preview_all_hint">For wearables that can show the full text (up to 5,000 characters)</string>
<string name="title_advanced_wearable_hint">Notifications are only sent to a wearable after the message text has been downloaded</string> <string name="title_advanced_wearable_hint">Notifications are only sent to a wearable after the message text has been downloaded</string>
<string name="title_advanced_move_hint">The target folder can be configured in the account settings</string> <string name="title_advanced_move_hint">The target folder can be configured in the account settings</string>
<string name="title_advanced_notify_no_grouping">This Android version does not support notification grouping</string> <string name="title_advanced_notify_no_grouping">This Android version does not support notification grouping</string>

Loading…
Cancel
Save