diff --git a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java index 2eb148a76..43d95f569 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java +++ b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java @@ -144,28 +144,26 @@ public class PushNotificationReceiver extends BroadcastReceiver{ builder.setContentTitle(pn.title) .setContentText(pn.body) .setContentTitle(pn.title) - .setStyle(new Notification.InboxStyle() - .addLine(pn.body)) + .setStyle(new Notification.BigTextStyle().bigText(pn.body)) + .setSmallIcon(R.drawable.ic_ntf_logo) .setContentIntent(PendingIntent.getActivity(context, notificationId, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT)) .setWhen(notification==null ? System.currentTimeMillis() : notification.createdAt.toEpochMilli()) .setShowWhen(true) .setCategory(Notification.CATEGORY_SOCIAL) .setAutoCancel(true) - .setGroup(accountID) - .setColor(context.getColor(R.color.shortcut_icon_background)); - if(!GlobalUserPreferences.uniformNotificationIcon){ - switch (pn.notificationType) { - case FAVORITE -> builder.setSmallIcon(R.drawable.ic_fluent_star_24_filled); - case REBLOG -> builder.setSmallIcon(R.drawable.ic_fluent_arrow_repeat_all_24_filled); - case FOLLOW -> builder.setSmallIcon(R.drawable.ic_fluent_person_add_24_filled); - case MENTION -> builder.setSmallIcon(R.drawable.ic_fluent_mention_24_filled); - case POLL -> builder.setSmallIcon(R.drawable.ic_fluent_poll_24_filled); - case STATUS -> builder.setSmallIcon(R.drawable.ic_fluent_chat_24_filled); + .setColor(context.getColor(R.color.primary_700)) + .setGroup(accountID); - default -> builder.setSmallIcon(R.drawable.ic_ntf_logo); - } - }else{ - builder.setSmallIcon(R.drawable.ic_ntf_logo); + if (!GlobalUserPreferences.uniformNotificationIcon) { + builder.setSmallIcon(switch (pn.notificationType) { + case FAVORITE -> R.drawable.ic_fluent_star_24_filled; + case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled; + case FOLLOW -> R.drawable.ic_fluent_person_add_24_filled; + case MENTION -> R.drawable.ic_fluent_mention_24_filled; + case POLL -> R.drawable.ic_fluent_poll_24_filled; + case STATUS -> R.drawable.ic_fluent_chat_24_filled; + case UPDATE -> R.drawable.ic_fluent_history_24_filled; + }); } if(avatar!=null){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java index 97ec6f770..8e97743c5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java @@ -2,8 +2,6 @@ package org.joinmastodon.android.fragments; import android.app.Activity; import android.os.Bundle; -import android.view.Menu; -import android.view.MenuInflater; import android.view.View; import com.squareup.otto.Subscribe; @@ -78,6 +76,7 @@ public class NotificationsListFragment extends BaseStatusListFragment getString(R.string.notification_boosted); case FAVORITE -> getString(R.string.user_favorited); case POLL -> getString(R.string.poll_ended); + case UPDATE -> getString(R.string.sk_post_edited); }; HeaderStatusDisplayItem titleItem=extraText!=null ? new HeaderStatusDisplayItem(n.id, n.account, n.createdAt, this, accountID, null, extraText, n, null) : null; if(n.status!=null){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index 3ac6aeb45..68190c213 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -210,15 +210,14 @@ public class SettingsFragment extends MastodonToolbarFragment{ GlobalUserPreferences.save(); needAppRestart=true; })); -// items.add(new SwitchItem(R.string.sk_enable_delete_notifications, R.drawable.ic_fluent_delete_24_regular, GlobalUserPreferences.enableDeleteNotifications, i->{ -// GlobalUserPreferences.enableDeleteNotifications=i.checked; -// GlobalUserPreferences.save(); -// needAppRestart=true; -// })); - items.add(new SwitchItem(R.string.mo_relocate_publish_button, R.drawable.ic_fluent_arrow_autofit_down_24_regular, GlobalUserPreferences.relocatePublishButton, i->{ - GlobalUserPreferences.relocatePublishButton=i.checked; + items.add(new SwitchItem(R.string.sk_settings_single_notification, R.drawable.ic_fluent_convert_range_24_regular, GlobalUserPreferences.keepOnlyLatestNotification, i->{ + GlobalUserPreferences.keepOnlyLatestNotification=i.checked; GlobalUserPreferences.save(); })); +// items.add(new SwitchItem(R.string.sk_settings_translate_only_opened, R.drawable.ic_fluent_translate_24_regular, GlobalUserPreferences.translateButtonOpenedOnly, i->{ +// GlobalUserPreferences.translateButtonOpenedOnly=i.checked; +// GlobalUserPreferences.save(); +// })); // items.add(new SwitchItem(R.string.sk_settings_hide_translate_in_timeline, R.drawable.ic_fluent_translate_24_regular, GlobalUserPreferences.translateButtonOpenedOnly, i->{ // GlobalUserPreferences.translateButtonOpenedOnly=i.checked; // GlobalUserPreferences.save(); @@ -246,11 +245,8 @@ public class SettingsFragment extends MastodonToolbarFragment{ items.add(new SwitchItem(R.string.notify_follow, R.drawable.ic_fluent_person_add_24_regular, pushSubscription.alerts.follow, i->onNotificationsChanged(PushNotification.Type.FOLLOW, i.checked))); items.add(new SwitchItem(R.string.notify_reblog, R.drawable.ic_fluent_arrow_repeat_all_24_regular, pushSubscription.alerts.reblog, i->onNotificationsChanged(PushNotification.Type.REBLOG, i.checked))); items.add(new SwitchItem(R.string.notify_mention, R.drawable.ic_fluent_mention_24_regular, pushSubscription.alerts.mention, i->onNotificationsChanged(PushNotification.Type.MENTION, i.checked))); + items.add(new SwitchItem(R.string.sk_notify_update, R.drawable.ic_fluent_history_24_regular, pushSubscription.alerts.update, i->onNotificationsChanged(PushNotification.Type.UPDATE, i.checked))); items.add(new SwitchItem(R.string.sk_notify_posts, R.drawable.ic_fluent_alert_24_regular, pushSubscription.alerts.status, i->onNotificationsChanged(PushNotification.Type.STATUS, i.checked))); - items.add(new SwitchItem(R.string.sk_settings_single_notification, R.drawable.ic_fluent_convert_range_24_regular, GlobalUserPreferences.keepOnlyLatestNotification, i->{ - GlobalUserPreferences.keepOnlyLatestNotification=i.checked; - GlobalUserPreferences.save(); - })); items.add(new HeaderItem(R.string.settings_account)); items.add(new TextItem(R.string.sk_settings_profile, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/settings/profile"), R.drawable.ic_fluent_open_24_regular)); @@ -455,6 +451,7 @@ public class SettingsFragment extends MastodonToolbarFragment{ case REBLOG -> subscription.alerts.reblog=enabled; case MENTION -> subscription.alerts.mention=subscription.alerts.poll=enabled; case STATUS -> subscription.alerts.status=enabled; + case UPDATE -> subscription.alerts.update=enabled; } needUpdateNotificationSettings=true; } diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/Notification.java b/mastodon/src/main/java/org/joinmastodon/android/model/Notification.java index 545028add..ffd70d8cb 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/Notification.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/Notification.java @@ -48,6 +48,8 @@ public class Notification extends BaseModel implements DisplayItemsParent{ @SerializedName("poll") POLL, @SerializedName("status") - STATUS + STATUS, + @SerializedName("update") + UPDATE } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/PushNotification.java b/mastodon/src/main/java/org/joinmastodon/android/model/PushNotification.java index de5cc3dba..09784d471 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/PushNotification.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/PushNotification.java @@ -45,7 +45,9 @@ public class PushNotification extends BaseModel{ @SerializedName("poll") POLL(R.string.notification_type_poll), @SerializedName("status") - STATUS(R.string.sk_notification_type_status); + STATUS(R.string.sk_notification_type_status), + @SerializedName("update") + UPDATE(R.string.sk_notification_type_update); @StringRes public final int localizedName; diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java b/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java index 7c0fc0967..d9146931e 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java @@ -45,10 +45,11 @@ public class PushSubscription extends BaseModel implements Cloneable{ public boolean mention; public boolean poll; public boolean status; + public boolean update; public static Alerts ofAll(){ Alerts alerts=new Alerts(); - alerts.follow=alerts.favourite=alerts.reblog=alerts.mention=alerts.poll=alerts.status=true; + alerts.follow=alerts.favourite=alerts.reblog=alerts.mention=alerts.poll=alerts.status=alerts.update=true; return alerts; } @@ -61,6 +62,7 @@ public class PushSubscription extends BaseModel implements Cloneable{ ", mention="+mention+ ", poll="+poll+ ", status="+status+ + ", update="+update+ '}'; } diff --git a/mastodon/src/main/res/drawable/ic_fluent_history_24_filled.xml b/mastodon/src/main/res/drawable/ic_fluent_history_24_filled.xml new file mode 100644 index 000000000..b32bc18c0 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_history_24_filled.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/drawable/ic_fluent_history_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_history_24_regular.xml new file mode 100644 index 000000000..cf69e5f70 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_history_24_regular.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml index 798906c1e..2b82f6fcf 100644 --- a/mastodon/src/main/res/values/strings_sk.xml +++ b/mastodon/src/main/res/values/strings_sk.xml @@ -171,4 +171,7 @@ Edit timeline Edit timelines ALT + edited + Edited posts + Edits a reblogged posts \ No newline at end of file