Revert "Added option to suppress notification actions on the lock screen"

This reverts commit 64fb75ae44.
pull/214/head
M66B 7 months ago
parent cb156c8fa3
commit 97f042b299

@ -99,7 +99,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swUnseenIgnored;
private SwitchCompat swNotifyGrouping;
private SwitchCompat swNotifyPrivate;
private SwitchCompat swNotifyPublicActions;
private SwitchCompat swNotifyBackgroundOnly;
private SwitchCompat swNotifyKnownOnly;
private SwitchCompat swNotifySuppressInCall;
@ -140,7 +139,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
"notify_flag", "notify_seen", "notify_hide", "notify_snooze",
"light", "sound", "notify_screen_on",
"badge", "unseen_ignored",
"notify_grouping", "notify_private", "notify_public_actions", "notify_background_only", "notify_known", "notify_suppress_in_call", "notify_suppress_in_car",
"notify_grouping", "notify_private", "notify_background_only", "notify_known", "notify_suppress_in_call", "notify_suppress_in_car",
"notify_remove", "notify_clear",
"notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "notify_transliterate", "notify_ascii",
"wearable_preview",
@ -191,7 +190,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored);
swNotifyGrouping = view.findViewById(R.id.swNotifyGrouping);
swNotifyPrivate = view.findViewById(R.id.swNotifyPrivate);
swNotifyPublicActions = view.findViewById(R.id.swNotifyPublicActions);
swNotifyBackgroundOnly = view.findViewById(R.id.swNotifyBackgroundOnly);
swNotifyKnownOnly = view.findViewById(R.id.swNotifyKnownOnly);
swNotifySuppressInCall = view.findViewById(R.id.swNotifySuppressInCall);
@ -567,14 +565,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("notify_private", checked).apply();
swNotifyPublicActions.setEnabled(!checked);
}
});
swNotifyPublicActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("notify_public_actions", checked).apply();
}
});
@ -866,8 +856,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
swNotifyGrouping.setChecked(prefs.getBoolean("notify_grouping", true));
swNotifyPrivate.setChecked(prefs.getBoolean("notify_private", true));
swNotifyPublicActions.setChecked(prefs.getBoolean("notify_public_actions", true));
swNotifyPublicActions.setEnabled(!swNotifyPrivate.isChecked());
swNotifyBackgroundOnly.setChecked(prefs.getBoolean("notify_background_only", false));
swNotifyKnownOnly.setChecked(prefs.getBoolean("notify_known", false));
swNotifySuppressInCall.setChecked(prefs.getBoolean("notify_suppress_in_call", false));

@ -652,7 +652,6 @@ class NotificationHelper {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean notify_grouping = prefs.getBoolean("notify_grouping", true);
boolean notify_private = prefs.getBoolean("notify_private", true);
boolean notify_public_actions = prefs.getBoolean("notify_public_actions", true);
boolean notify_newest_first = prefs.getBoolean("notify_newest_first", false);
MessageHelper.AddressFormat email_format = MessageHelper.getAddressFormat(context);
boolean prefer_contact = prefs.getBoolean("prefer_contact", false);
@ -969,84 +968,6 @@ class NotificationHelper {
DB db = DB.getInstance(context);
if (message.content && notify_preview) {
// Android will truncate the text
String preview = message.preview;
if (notify_preview_all)
try {
File file = message.getFile(context);
preview = HtmlHelper.getFullText(file);
if (preview != null && preview.length() > MAX_PREVIEW)
preview = preview.substring(0, MAX_PREVIEW);
} catch (Throwable ex) {
Log.e(ex);
}
// Wearables
StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(message.subject))
sb.append(TextHelper.normalizeNotification(context, message.subject));
if (wearable_preview && !TextUtils.isEmpty(preview)) {
if (sb.length() > 0)
sb.append(" - ");
sb.append(TextHelper.normalizeNotification(context, preview));
}
if (sb.length() > 0)
mbuilder.setContentText(sb.toString());
// Device
if (!notify_messaging) {
StringBuilder sbm = new StringBuilder();
if (message.keywords != null && BuildConfig.DEBUG)
for (String keyword : message.keywords)
if (keyword.startsWith("!"))
sbm.append(Html.escapeHtml(keyword)).append(": ");
if (!TextUtils.isEmpty(message.subject))
sbm.append("<em>").append(Html.escapeHtml(message.subject)).append("</em>").append("<br>");
if (!TextUtils.isEmpty(preview))
sbm.append(Html.escapeHtml(preview));
if (sbm.length() > 0) {
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()
.bigText(HtmlHelper.fromHtml(sbm.toString(), context));
if (!TextUtils.isEmpty(message.subject))
bigText.setSummaryText(message.subject);
mbuilder.setStyle(bigText);
}
}
} else {
if (!TextUtils.isEmpty(message.subject))
mbuilder.setContentText(TextHelper.normalizeNotification(context, message.subject));
}
if (info[0].hasPhoto())
mbuilder.setLargeIcon(info[0].getPhotoBitmap());
if (info[0].hasLookupUri()) {
Person.Builder you = new Person.Builder()
.setUri(info[0].getLookupUri().toString());
mbuilder.addPerson(you.build());
}
if (pro) {
Integer color = getColor(message);
if (color != null) {
mbuilder.setColor(color);
mbuilder.setColorized(true);
}
}
if (!notify_private && !notify_public_actions) {
Notification pub = mbuilder.build();
mbuilder
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setPublicVersion(pub);
}
List<NotificationCompat.Action> wactions = new ArrayList<>();
if (notify_trash &&
@ -1281,6 +1202,77 @@ class NotificationHelper {
wactions.add(actionSnooze.build());
}
if (message.content && notify_preview) {
// Android will truncate the text
String preview = message.preview;
if (notify_preview_all)
try {
File file = message.getFile(context);
preview = HtmlHelper.getFullText(file);
if (preview != null && preview.length() > MAX_PREVIEW)
preview = preview.substring(0, MAX_PREVIEW);
} catch (Throwable ex) {
Log.e(ex);
}
// Wearables
StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(message.subject))
sb.append(TextHelper.normalizeNotification(context, message.subject));
if (wearable_preview && !TextUtils.isEmpty(preview)) {
if (sb.length() > 0)
sb.append(" - ");
sb.append(TextHelper.normalizeNotification(context, preview));
}
if (sb.length() > 0)
mbuilder.setContentText(sb.toString());
// Device
if (!notify_messaging) {
StringBuilder sbm = new StringBuilder();
if (message.keywords != null && BuildConfig.DEBUG)
for (String keyword : message.keywords)
if (keyword.startsWith("!"))
sbm.append(Html.escapeHtml(keyword)).append(": ");
if (!TextUtils.isEmpty(message.subject))
sbm.append("<em>").append(Html.escapeHtml(message.subject)).append("</em>").append("<br>");
if (!TextUtils.isEmpty(preview))
sbm.append(Html.escapeHtml(preview));
if (sbm.length() > 0) {
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()
.bigText(HtmlHelper.fromHtml(sbm.toString(), context));
if (!TextUtils.isEmpty(message.subject))
bigText.setSummaryText(message.subject);
mbuilder.setStyle(bigText);
}
}
} else {
if (!TextUtils.isEmpty(message.subject))
mbuilder.setContentText(TextHelper.normalizeNotification(context, message.subject));
}
if (info[0].hasPhoto())
mbuilder.setLargeIcon(info[0].getPhotoBitmap());
if (info[0].hasLookupUri()) {
Person.Builder you = new Person.Builder()
.setUri(info[0].getLookupUri().toString());
mbuilder.addPerson(you.build());
}
if (pro) {
Integer color = getColor(message);
if (color != null) {
mbuilder.setColor(color);
mbuilder.setColorized(true);
}
}
// https://developer.android.com/training/wearables/notifications
// https://developer.android.com/reference/androidx/core/app/NotificationCompat.Action.WearableExtender
mbuilder.extend(new NotificationCompat.WearableExtender()

@ -556,19 +556,6 @@
app:layout_constraintTop_toBottomOf="@id/swNotifyGrouping"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyPublicActions"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_notify_public_actions"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyPrivate"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifyBackgroundOnly"
android:layout_width="0dp"
@ -577,7 +564,7 @@
android:text="@string/title_advanced_notify_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyPublicActions"
app:layout_constraintTop_toBottomOf="@id/swNotifyPrivate"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -719,7 +719,6 @@
<string name="title_advanced_unseen_ignored">Let the number of new messages match the number of notifications</string>
<string name="title_advanced_notify_grouping">Group notifications</string>
<string name="title_advanced_notify_private">Keep notifications private when the device is locked</string>
<string name="title_advanced_notify_public_actions">Show notification actions when the device is locked</string>
<string name="title_advanced_notify_background">Show notifications when in the background only</string>
<string name="title_advanced_notify_known">Show notifications for contacts only</string>
<string name="title_advanced_notify_suppress_in_call">Delay notifications while on a call</string>

Loading…
Cancel
Save