mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-08 03:24:04 +08:00
Added!: Support for delete intent for Notification.Builder in NotificationUtils
This commit is contained in:
@@ -53,20 +53,25 @@ public class NotificationUtils {
|
||||
* @param title The title for the notification.
|
||||
* @param notificationText The second line text of the notification.
|
||||
* @param notificationBigText The full text of the notification that may optionally be styled.
|
||||
* @param pendingIntent The {@link PendingIntent} which should be sent when notification is clicked.
|
||||
* @param contentIntent The {@link PendingIntent} which should be sent when notification is clicked.
|
||||
* @param deleteIntent The {@link PendingIntent} which should be sent when notification is deleted.
|
||||
* @param notificationMode The notification mode. It must be one of {@code NotificationUtils.NOTIFICATION_MODE_*}.
|
||||
* The builder returned will be {@code null} if {@link #NOTIFICATION_MODE_NONE}
|
||||
* is passed. That case should ideally be handled before calling this function.
|
||||
* @return Returns the {@link Notification.Builder}.
|
||||
*/
|
||||
@Nullable
|
||||
public static Notification.Builder geNotificationBuilder(final Context context, final String channelId, final int priority, final CharSequence title, final CharSequence notificationText, final CharSequence notificationBigText, final PendingIntent pendingIntent, final int notificationMode) {
|
||||
public static Notification.Builder geNotificationBuilder(
|
||||
final Context context, final String channelId, final int priority, final CharSequence title,
|
||||
final CharSequence notificationText, final CharSequence notificationBigText,
|
||||
final PendingIntent contentIntent, final PendingIntent deleteIntent, final int notificationMode) {
|
||||
if (context == null) return null;
|
||||
Notification.Builder builder = new Notification.Builder(context);
|
||||
builder.setContentTitle(title);
|
||||
builder.setContentText(notificationText);
|
||||
builder.setStyle(new Notification.BigTextStyle().bigText(notificationBigText));
|
||||
builder.setContentIntent(pendingIntent);
|
||||
builder.setContentIntent(contentIntent);
|
||||
builder.setDeleteIntent(deleteIntent);
|
||||
|
||||
builder.setPriority(priority);
|
||||
|
||||
|
Reference in New Issue
Block a user