Add now playing to smartspace
This commit is contained in:
1 parent
08f026478d
commit
49f8bed912
11 files changed
+448
-2
No files matched your search
@@ -48,6 +48,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import app.lawnchair.NotificationManager;
|
||||
|
||||
/**
|
||||
* A {@link NotificationListenerService} that sends updates to its
|
||||
* {@link NotificationsChangedListener} when notifications are posted or canceled,
|
||||
@@ -84,6 +86,8 @@ public class NotificationListener extends NotificationListenerService {
|
||||
private SettingsCache mSettingsCache;
|
||||
private SettingsCache.OnChangeListener mNotificationSettingsChangedListener;
|
||||
|
||||
private NotificationManager mNotificationManager;
|
||||
|
||||
public NotificationListener() {
|
||||
mWorkerHandler = new Handler(MODEL_EXECUTOR.getLooper(), this::handleWorkerMessage);
|
||||
mUiHandler = new Handler(Looper.getMainLooper(), this::handleUiMessage);
|
||||
@@ -112,6 +116,12 @@ public class NotificationListener extends NotificationListenerService {
|
||||
sNotificationsChangedListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mNotificationManager = NotificationManager.INSTANCE.get(this);
|
||||
}
|
||||
|
||||
private boolean handleWorkerMessage(Message message) {
|
||||
switch (message.what) {
|
||||
case MSG_NOTIFICATION_POSTED: {
|
||||
@@ -226,6 +236,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
|
||||
private void onNotificationFullRefresh() {
|
||||
mWorkerHandler.obtainMessage(MSG_NOTIFICATION_FULL_REFRESH).sendToTarget();
|
||||
mNotificationManager.onNotificationFullRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,6 +251,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
public void onNotificationPosted(final StatusBarNotification sbn) {
|
||||
if (sbn != null) {
|
||||
mWorkerHandler.obtainMessage(MSG_NOTIFICATION_POSTED, sbn).sendToTarget();
|
||||
mNotificationManager.onNotificationPosted(sbn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,6 +259,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
public void onNotificationRemoved(final StatusBarNotification sbn) {
|
||||
if (sbn != null) {
|
||||
mWorkerHandler.obtainMessage(MSG_NOTIFICATION_REMOVED, sbn).sendToTarget();
|
||||
mNotificationManager.onNotificationRemoved(sbn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user