mirror of https://github.com/tasks/tasks
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.
34 lines
987 B
Java
34 lines
987 B
Java
10 years ago
|
package org.tasks.notifications;
|
||
|
|
||
|
import android.app.Notification;
|
||
|
import android.content.Context;
|
||
|
|
||
10 years ago
|
import org.tasks.R;
|
||
10 years ago
|
import org.tasks.injection.ForApplication;
|
||
10 years ago
|
import org.tasks.preferences.Preferences;
|
||
10 years ago
|
|
||
|
import javax.inject.Inject;
|
||
|
|
||
|
public class NotificationManager {
|
||
|
|
||
|
private final android.app.NotificationManager notificationManager;
|
||
10 years ago
|
private final Preferences preferences;
|
||
10 years ago
|
|
||
|
@Inject
|
||
10 years ago
|
public NotificationManager(@ForApplication Context context, Preferences preferences) {
|
||
|
this.preferences = preferences;
|
||
10 years ago
|
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) {
|
||
10 years ago
|
if (preferences.getBoolean(R.string.p_rmd_enabled, true)) {
|
||
|
notificationManager.notify(notificationId, notification);
|
||
|
}
|
||
10 years ago
|
}
|
||
|
}
|