use of com.android.launcher3.dot.DotInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class PopupContainerWithArrow method updateNotificationHeader.
private void updateNotificationHeader() {
ItemInfoWithIcon itemInfo = (ItemInfoWithIcon) mOriginalIcon.getTag();
DotInfo dotInfo = mLauncher.getDotInfoForItem(itemInfo);
if (mNotificationContainer != null && dotInfo != null) {
mNotificationContainer.updateHeader(dotInfo.getNotificationCount());
}
}
use of com.android.launcher3.dot.DotInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class PopupDataProvider method onNotificationPosted.
@Override
public void onNotificationPosted(PackageUserKey postedPackageUserKey, NotificationKeyData notificationKey) {
DotInfo dotInfo = mPackageUserToDotInfos.get(postedPackageUserKey);
if (dotInfo == null) {
dotInfo = new DotInfo();
mPackageUserToDotInfos.put(postedPackageUserKey, dotInfo);
}
if (dotInfo.addOrUpdateNotificationKey(notificationKey)) {
updateNotificationDots(postedPackageUserKey::equals);
}
}
use of com.android.launcher3.dot.DotInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class PopupDataProvider method onNotificationRemoved.
@Override
public void onNotificationRemoved(PackageUserKey removedPackageUserKey, NotificationKeyData notificationKey) {
DotInfo oldDotInfo = mPackageUserToDotInfos.get(removedPackageUserKey);
if (oldDotInfo != null && oldDotInfo.removeNotificationKey(notificationKey)) {
if (oldDotInfo.getNotificationKeys().size() == 0) {
mPackageUserToDotInfos.remove(removedPackageUserKey);
}
updateNotificationDots(removedPackageUserKey::equals);
trimNotifications(mPackageUserToDotInfos);
}
}
use of com.android.launcher3.dot.DotInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class PopupDataProvider method onNotificationFullRefresh.
@Override
public void onNotificationFullRefresh(List<StatusBarNotification> activeNotifications) {
if (activeNotifications == null)
return;
// This will contain the PackageUserKeys which have updated dots.
HashMap<PackageUserKey, DotInfo> updatedDots = new HashMap<>(mPackageUserToDotInfos);
mPackageUserToDotInfos.clear();
for (StatusBarNotification notification : activeNotifications) {
PackageUserKey packageUserKey = PackageUserKey.fromNotification(notification);
DotInfo dotInfo = mPackageUserToDotInfos.get(packageUserKey);
if (dotInfo == null) {
dotInfo = new DotInfo();
mPackageUserToDotInfos.put(packageUserKey, dotInfo);
}
dotInfo.addOrUpdateNotificationKey(NotificationKeyData.fromNotification(notification));
}
// Add and remove from updatedDots so it contains the PackageUserKeys of updated dots.
for (PackageUserKey packageUserKey : mPackageUserToDotInfos.keySet()) {
DotInfo prevDot = updatedDots.get(packageUserKey);
DotInfo newDot = mPackageUserToDotInfos.get(packageUserKey);
if (prevDot == null || prevDot.getNotificationCount() != newDot.getNotificationCount()) {
updatedDots.put(packageUserKey, newDot);
} else {
// No need to update the dot if it already existed (no visual change).
// Note that if the dot was removed entirely, we wouldn't reach this point because
// this loop only includes active notifications added above.
updatedDots.remove(packageUserKey);
}
}
if (!updatedDots.isEmpty()) {
updateNotificationDots(updatedDots::containsKey);
}
trimNotifications(updatedDots);
}
use of com.android.launcher3.dot.DotInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class PopupDataProvider method getDotInfoForItem.
@Nullable
public DotInfo getDotInfoForItem(@NonNull ItemInfo info) {
if (!ShortcutUtil.supportsShortcuts(info)) {
return null;
}
DotInfo dotInfo = mPackageUserToDotInfos.get(PackageUserKey.fromItemInfo(info));
if (dotInfo == null) {
return null;
}
List<NotificationKeyData> notifications = getNotificationsForItem(info, dotInfo.getNotificationKeys());
if (notifications.isEmpty()) {
return null;
}
return dotInfo;
}
Aggregations