summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/badge
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-01-26 09:54:48 -0800
committerTony Wickham <twickham@google.com>2017-01-26 11:28:43 -0800
commit2efcdd0c783e6ef9a52a25bec1a2508040760bb6 (patch)
tree598a5bb08ad35ffe87bc14b46be6912b3a5d6951 /src/com/android/launcher3/badge
parent9438ed414fdabadb4cd09da184867b1c44b91095 (diff)
downloadandroid_packages_apps_Trebuchet-2efcdd0c783e6ef9a52a25bec1a2508040760bb6.tar.gz
android_packages_apps_Trebuchet-2efcdd0c783e6ef9a52a25bec1a2508040760bb6.tar.bz2
android_packages_apps_Trebuchet-2efcdd0c783e6ef9a52a25bec1a2508040760bb6.zip
Store notification keys in a List instead of a Set.
This will preserve the order when iterating over the notifications to populate the popup container. Bug: 34735689 Change-Id: Ic390ffef140e454566ffc6ab1763950349df25ce
Diffstat (limited to 'src/com/android/launcher3/badge')
-rw-r--r--src/com/android/launcher3/badge/BadgeInfo.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/com/android/launcher3/badge/BadgeInfo.java b/src/com/android/launcher3/badge/BadgeInfo.java
index 673c297dc..77355c75e 100644
--- a/src/com/android/launcher3/badge/BadgeInfo.java
+++ b/src/com/android/launcher3/badge/BadgeInfo.java
@@ -19,8 +19,8 @@ package com.android.launcher3.badge;
import com.android.launcher3.notification.NotificationInfo;
import com.android.launcher3.util.PackageUserKey;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
/**
* Contains data to be used in an icon badge.
@@ -33,17 +33,20 @@ public class BadgeInfo {
* The keys of the notifications that this badge represents. These keys can later be
* used to retrieve {@link NotificationInfo}'s.
*/
- private Set<String> mNotificationKeys;
+ private List<String> mNotificationKeys;
public BadgeInfo(PackageUserKey packageUserKey) {
mPackageUserKey = packageUserKey;
- mNotificationKeys = new HashSet<>();
+ mNotificationKeys = new ArrayList<>();
}
/**
* Returns whether the notification was added (false if it already existed).
*/
- public boolean addNotificationKey(String notificationKey) {
+ public boolean addNotificationKeyIfNotExists(String notificationKey) {
+ if (mNotificationKeys.contains(notificationKey)) {
+ return false;
+ }
return mNotificationKeys.add(notificationKey);
}
@@ -54,7 +57,7 @@ public class BadgeInfo {
return mNotificationKeys.remove(notificationKey);
}
- public Set<String> getNotificationKeys() {
+ public List<String> getNotificationKeys() {
return mNotificationKeys;
}