You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tasks/app/src/main/java/org/tasks/notifications/NotificationManager.java

34 lines
987 B
Java

package org.tasks.notifications;
import android.app.Notification;
import android.content.Context;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
public class NotificationManager {
private final android.app.NotificationManager notificationManager;
private final Preferences preferences;
@Inject
public NotificationManager(@ForApplication Context context, Preferences preferences) {
this.preferences = preferences;
notificationManager = (android.app.NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
}
public void cancel(long id) {
notificationManager.cancel((int) id);
}
public void notify(int notificationId, Notification notification) {
if (preferences.getBoolean(R.string.p_rmd_enabled, true)) {
notificationManager.notify(notificationId, notification);
}
}
}