summaryrefslogtreecommitdiffstats
path: root/app/src/main/java/app/fedilab/android/helper/Helper.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/app/fedilab/android/helper/Helper.java')
-rw-r--r--app/src/main/java/app/fedilab/android/helper/Helper.java38
1 files changed, 20 insertions, 18 deletions
diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java
index d57aa149a..8029b84a7 100644
--- a/app/src/main/java/app/fedilab/android/helper/Helper.java
+++ b/app/src/main/java/app/fedilab/android/helper/Helper.java
@@ -1379,6 +1379,9 @@ public class Helper {
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
+
+ private static int notificationId = 1;
+
/**
* Sends notification with intent
*
@@ -1389,7 +1392,7 @@ public class Helper {
* @param message String message for the notification
*/
@SuppressLint("UnspecifiedImmutableFlag")
- public static void notify_user(Context context, int notificationId, BaseAccount account, Intent intent, Bitmap icon, NotifType notifType, String title, String message) {
+ public static void notify_user(Context context, BaseAccount account, Intent intent, Bitmap icon, NotifType notifType, String title, String message) {
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
// prepare intent which is triggered if the user click on the notification
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
@@ -1440,14 +1443,11 @@ public class Helper {
channelTitle = context.getString(R.string.channel_notif_boost);
}
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, channelId)
- .setSmallIcon(R.drawable.ic_notification).setTicker(message)
- .setWhen(System.currentTimeMillis())
- .setAutoCancel(true);
+ .setSmallIcon(R.drawable.ic_notification).setTicker(message);
if (notifType == NotifType.MENTION) {
if (message.length() > 500) {
message = message.substring(0, 499) + "…";
}
- notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
}
notificationBuilder.setGroup(account.mastodon_account.acct + "@" + account.instance)
.setContentIntent(pIntent)
@@ -1515,19 +1515,21 @@ public class Helper {
}
notificationBuilder.setContentTitle(title);
notificationBuilder.setLargeIcon(icon);
- notificationManager.notify(notificationId, notificationBuilder.build());
-
- Notification summaryNotification =
- new NotificationCompat.Builder(context, channelId)
- .setContentTitle(title)
- .setContentText(channelTitle)
- .setContentIntent(pIntent)
- .setLargeIcon(icon)
- .setSmallIcon(R.drawable.ic_notification)
- .setGroup(account.mastodon_account.acct + "@" + account.instance)
- .setGroupSummary(true)
- .build();
- notificationManager.notify(notificationId, summaryNotification);
+
+
+ Notification summaryNotification = summaryNotification = new NotificationCompat.Builder(context, channelId)
+ .setContentTitle(title)
+ .setContentText(channelTitle)
+ .setContentIntent(pIntent)
+ .setLargeIcon(icon)
+ .setSmallIcon(R.drawable.ic_notification)
+ .setStyle(new NotificationCompat.BigTextStyle().bigText(message))
+ .setGroup(account.mastodon_account.acct + "@" + account.instance)
+ .setGroupSummary(true)
+ .build();
+
+ notificationManager.notify(notificationId++, notificationBuilder.build());
+ notificationManager.notify(0, summaryNotification);
}
public static void transfertIfExist(Context context) {