package org.mtransit.android.commons;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Build;

import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;

public final class NotificationUtils {

	public static final String CHANNEL_ID_DB = "db_channel";

	public static void setProgressAndNotify(@NonNull NotificationManagerCompat nm, @NonNull NotificationCompat.Builder nb, int nId, int max, int progress) {
		nb.setProgress(max, progress, false);
		nm.notify(nId, nb.build());
	}

	public static void createNotificationChannel(@NonNull Context context, @NonNull String channelId) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
			CharSequence name = context.getString(R.string.db_channel_name);
			String description = context.getString(R.string.db_channel_description);
			int importance = NotificationManager.IMPORTANCE_LOW;
			NotificationChannel channel = new NotificationChannel(channelId, name, importance);
			channel.setDescription(description);
			NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
			if (notificationManager != null) {
				notificationManager.createNotificationChannel(channel);
			}
		}
	}
}

@@ -32,16 +32,56 @@
 mmons;%0A%0A
+import android.annotation.SuppressLint;%0A
 import a
@@ -112,16 +112,16 @@
 hannel;%0A
-
 import a
@@ -246,16 +246,63 @@
 onNull;%0A
+import androidx.annotation.RequiresPermission;%0A
 import a
@@ -490,16 +490,120 @@
 nnel%22;%0A%0A
+%09@SuppressLint(%22MissingPermission%22)%0A%09@RequiresPermission(%0A%09%09%09%22android.permission.POST_NOTIFICATIONS%22%0A%09)%0A
 %09public 

Fix lint MissingPermission