summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/notification
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-01-27 14:28:42 -0800
committerTony Wickham <twickham@google.com>2017-01-27 14:28:42 -0800
commit1f0b5347b8aeb1f796c7d68ca4ee06660cbb1a2c (patch)
tree1844221afdc60f0163a3d73ac114a28b8686ca32 /src/com/android/launcher3/notification
parent5cfd1158ec1e4a19689217e9fbddd0fd795b2611 (diff)
downloadandroid_packages_apps_Trebuchet-1f0b5347b8aeb1f796c7d68ca4ee06660cbb1a2c.tar.gz
android_packages_apps_Trebuchet-1f0b5347b8aeb1f796c7d68ca4ee06660cbb1a2c.tar.bz2
android_packages_apps_Trebuchet-1f0b5347b8aeb1f796c7d68ca4ee06660cbb1a2c.zip
Use notification icon views' tags to store NotificationInfo.
Previously we had a mapping from View to NotificationInfo, but this way we don't have to maintain that separate mapping and can follow the pattern used throughout the rest of launcher. Change-Id: Ia988f822613b9978bab3d0127226de920a3e73c9
Diffstat (limited to 'src/com/android/launcher3/notification')
-rw-r--r--src/com/android/launcher3/notification/NotificationFooterLayout.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/com/android/launcher3/notification/NotificationFooterLayout.java b/src/com/android/launcher3/notification/NotificationFooterLayout.java
index cd610bd3b..f84ddb1fb 100644
--- a/src/com/android/launcher3/notification/NotificationFooterLayout.java
+++ b/src/com/android/launcher3/notification/NotificationFooterLayout.java
@@ -36,10 +36,8 @@ import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.popup.PopupContainerWithArrow;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
/**
* A {@link LinearLayout} that contains only icons of notifications.
@@ -57,7 +55,6 @@ public class NotificationFooterLayout extends LinearLayout {
private final List<NotificationInfo> mNotifications = new ArrayList<>();
private final List<NotificationInfo> mOverflowNotifications = new ArrayList<>();
- private final Map<View, NotificationInfo> mViewsToInfos = new HashMap<>();
LinearLayout.LayoutParams mIconLayoutParams;
private LinearLayout mIconRow;
@@ -113,7 +110,6 @@ public class NotificationFooterLayout extends LinearLayout {
*/
public void commitNotificationInfos() {
mIconRow.removeAllViews();
- mViewsToInfos.clear();
for (int i = 0; i < mNotifications.size(); i++) {
NotificationInfo info = mNotifications.get(i);
@@ -139,8 +135,8 @@ public class NotificationFooterLayout extends LinearLayout {
icon.setAlpha(0);
icon.animate().alpha(1);
}
+ icon.setTag(info);
mIconRow.addView(icon, addIndex, mIconLayoutParams);
- mViewsToInfos.put(icon, info);
}
private void updateOverflowText(TextView overflowTextView) {
@@ -163,7 +159,7 @@ public class NotificationFooterLayout extends LinearLayout {
moveAndScaleIcon.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- callback.onIconAnimationEnd(mViewsToInfos.get(firstNotification));
+ callback.onIconAnimationEnd((NotificationInfo) firstNotification.getTag());
}
});
animation.play(moveAndScaleIcon);
@@ -205,11 +201,10 @@ public class NotificationFooterLayout extends LinearLayout {
if (child instanceof TextView) {
overflowView = (TextView) child;
} else {
- NotificationInfo childInfo = mViewsToInfos.get(child);
+ NotificationInfo childInfo = (NotificationInfo) child.getTag();
if (!notifications.contains(childInfo.notificationKey)) {
mIconRow.removeView(child);
mNotifications.remove(childInfo);
- mViewsToInfos.remove(child);
if (!mOverflowNotifications.isEmpty()) {
NotificationInfo notification = mOverflowNotifications.remove(0);
mNotifications.add(notification);