mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Use notification counts (instead of assuming all 1)
We still ignore group summary headers, which means, for example, we won't get Gmail unread count. But single notifications that have numbers associated, such as messages from a single contact will be included in the badge count. So if you have 2 hangounts threads, one with 10 messages and one with 8, the badge would say 18. Bug: 34939841 Change-Id: I20b9a857d91715e10c0da400a1cee209d7b837b8
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3.notification;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
@@ -31,14 +32,17 @@ import java.util.List;
|
||||
public class NotificationKeyData {
|
||||
public final String notificationKey;
|
||||
public final String shortcutId;
|
||||
public int count;
|
||||
|
||||
private NotificationKeyData(String notificationKey, String shortcutId) {
|
||||
private NotificationKeyData(String notificationKey, String shortcutId, int count) {
|
||||
this.notificationKey = notificationKey;
|
||||
this.shortcutId = shortcutId;
|
||||
this.count = Math.max(1, count);
|
||||
}
|
||||
|
||||
public static NotificationKeyData fromNotification(StatusBarNotification sbn) {
|
||||
return new NotificationKeyData(sbn.getKey(), sbn.getNotification().getShortcutId());
|
||||
Notification notif = sbn.getNotification();
|
||||
return new NotificationKeyData(sbn.getKey(), notif.getShortcutId(), notif.number);
|
||||
}
|
||||
|
||||
public static List<String> extractKeysOnly(@NonNull List<NotificationKeyData> notificationKeys) {
|
||||
|
||||
Reference in New Issue
Block a user