// Path: SWADroid/src/main/java/es/ugr/swad/swadroid/utils/NotificationUtils.java
// @TargetApi(Build.VERSION_CODES.O)
// public class NotificationUtils extends ContextWrapper {
// 
//     private NotificationManager mManager;
//     public static final String SWADROID_CHANNEL_ID = "es.ugr.swad.swadroid.SWADROID";
//     public static final String SWADROID_CHANNEL_NAME = "SWADROID CHANNEL";
// 
//     public NotificationUtils(Context base) {
//         super(base);
//         createChannels();
//     }
// 
//     public void createChannels() {
// 
//         // create SWADroid channel
//         NotificationChannel androidChannel = new NotificationChannel(SWADROID_CHANNEL_ID,
//                 SWADROID_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
//         // Sets whether notifications posted to this channel should display notification lights
//         androidChannel.enableLights(true);
//         // Sets whether notification posted to this channel should vibrate.
//         androidChannel.enableVibration(true);
//         // Sets the notification light color for notifications posted to this channel
//         androidChannel.setLightColor(Color.GREEN);
//         // Sets whether notifications posted to this channel appear on the lockscreen or not
//         androidChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
// 
//         getManager().createNotificationChannel(androidChannel);
//     }
// 
//     public NotificationManager getManager() {
//         if (mManager == null) {
//             mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//         }
//         return mManager;
//     }
// }
// 
// Path: SWADroid/src/main/java/es/ugr/swad/swadroid/utils/NotificationUtils.java
// public static final String SWADROID_CHANNEL_ID = "es.ugr.swad.swadroid.SWADROID";


import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.BitmapFactory;
import androidx.core.app.NotificationCompat;
import es.ugr.swad.swadroid.utils.NotificationUtils;
import static es.ugr.swad.swadroid.utils.NotificationUtils.SWADROID_CHANNEL_ID;
        return notifBuilder.build();
    }
	
	public static Notification createProgressNotification(Context context, String contentTitle, String contentText,
			String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon,
			boolean autocancel, boolean ongoing, boolean onlyAlertOnce, int maxProgress, int progress, boolean indeterminate) {

    	NotificationCompat.Builder notifBuilder = createProgressNotificationBuilder(context, 
    			contentTitle, 
    			contentText,
    			ticker, 
    			pendingIntent, 
    			smallIcon,
    			largeIcon,
    			autocancel,
    			ongoing, 
    			onlyAlertOnce,
    			maxProgress, 
    			progress, 
    			indeterminate);
       
        //Create alert
        return notifBuilder.build();
    }
	
	public static void showAlertNotification(Context context, Notification notif, int notifId) {
        NotificationManager notifManager;

        //Obtain a reference to the notification service
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
// Path: SWADroid/src/main/java/es/ugr/swad/swadroid/utils/NotificationUtils.java
// @TargetApi(Build.VERSION_CODES.O)
// public class NotificationUtils extends ContextWrapper {
// 
//     private NotificationManager mManager;
//     public static final String SWADROID_CHANNEL_ID = "es.ugr.swad.swadroid.SWADROID";
//     public static final String SWADROID_CHANNEL_NAME = "SWADROID CHANNEL";
// 
//     public NotificationUtils(Context base) {
//         super(base);
//         createChannels();
//     }
// 
//     public void createChannels() {
// 
//         // create SWADroid channel
//         NotificationChannel androidChannel = new NotificationChannel(SWADROID_CHANNEL_ID,
//                 SWADROID_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
//         // Sets whether notifications posted to this channel should display notification lights
//         androidChannel.enableLights(true);
//         // Sets whether notification posted to this channel should vibrate.
//         androidChannel.enableVibration(true);
//         // Sets the notification light color for notifications posted to this channel
//         androidChannel.setLightColor(Color.GREEN);
//         // Sets whether notifications posted to this channel appear on the lockscreen or not
//         androidChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
// 
//         getManager().createNotificationChannel(androidChannel);
//     }
// 
//     public NotificationManager getManager() {
//         if (mManager == null) {
//             mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//         }
//         return mManager;
//     }
// }
// 
// Path: SWADroid/src/main/java/es/ugr/swad/swadroid/utils/NotificationUtils.java
// public static final String SWADROID_CHANNEL_ID = "es.ugr.swad.swadroid.SWADROID";


// Path: SWADroid/src/main/java/es/ugr/swad/swadroid/gui/AlertNotificationFactory.java
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.BitmapFactory;
import androidx.core.app.NotificationCompat;
import es.ugr.swad.swadroid.utils.NotificationUtils;
import static es.ugr.swad.swadroid.utils.NotificationUtils.SWADROID_CHANNEL_ID;

        return notifBuilder.build();
    }
	
	public static Notification createProgressNotification(Context context, String contentTitle, String contentText,
			String ticker, PendingIntent pendingIntent, int smallIcon, int largeIcon,
			boolean autocancel, boolean ongoing, boolean onlyAlertOnce, int maxProgress, int progress, boolean indeterminate) {

    	NotificationCompat.Builder notifBuilder = createProgressNotificationBuilder(context, 
    			contentTitle, 
    			contentText,
    			ticker, 
    			pendingIntent, 
    			smallIcon,
    			largeIcon,
    			autocancel,
    			ongoing, 
    			onlyAlertOnce,
    			maxProgress, 
    			progress, 
    			indeterminate);
       
        //Create alert
        return notifBuilder.build();
    }
	
	public static void showAlertNotification(Context context, Notification notif, int notifId) {
        NotificationManager notifManager;

        //Obtain a reference to the notification service
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
            NotificationUtils mNotificationUtils = new NotificationUtils(context);