summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/popup/PopupContainerWithArrow.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-02-24 15:08:13 -0800
committerTony Wickham <twickham@google.com>2017-03-02 11:27:16 -0800
commit9407d4ab57a0c3500647f1f5f9a9a44b51d222b4 (patch)
treef71d04a0f8abead00df1762ad83abe8b4e61148c /src/com/android/launcher3/popup/PopupContainerWithArrow.java
parentf2db25398a029b6f13afccbec331e35c8007dde6 (diff)
downloadandroid_packages_apps_Trebuchet-9407d4ab57a0c3500647f1f5f9a9a44b51d222b4.tar.gz
android_packages_apps_Trebuchet-9407d4ab57a0c3500647f1f5f9a9a44b51d222b4.tar.bz2
android_packages_apps_Trebuchet-9407d4ab57a0c3500647f1f5f9a9a44b51d222b4.zip
Update notification visuals (part 2)
- Background is now white, and color beneath and divider color updated accordingly (not from color extraction) - Removed overflow text ("+6") and added it to a header ("6 Notifications"). Use "..." instead if there is an overflow. - Even spaced out icons in notification footer between the far right icon and the ellipsis - Remove code to change arrow tint, since it is always white now. This also fixes the issue where it was drawn as a rect. Bug: 35766387 Change-Id: I03bfda4ff029f23dd8b3dd1b72f534ea0e2c0816
Diffstat (limited to 'src/com/android/launcher3/popup/PopupContainerWithArrow.java')
-rw-r--r--src/com/android/launcher3/popup/PopupContainerWithArrow.java32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 0b0f88aaf..b8d38f587 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -63,14 +63,12 @@ import com.android.launcher3.badge.BadgeInfo;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragOptions;
-import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.graphics.TriangleShape;
import com.android.launcher3.notification.NotificationItemView;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.shortcuts.ShortcutsItemView;
import com.android.launcher3.util.PackageUserKey;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -184,20 +182,20 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
orientAboutIcon(originalIcon, arrowHeight + arrowVerticalOffset);
}
+ ItemInfo originalItemInfo = (ItemInfo) originalIcon.getTag();
List<DeepShortcutView> shortcutViews = mShortcutsItemView == null
? Collections.EMPTY_LIST
: mShortcutsItemView.getDeepShortcutViews(reverseOrder);
if (mNotificationItemView != null) {
- IconPalette iconPalette = originalIcon.getIconPalette();
- mNotificationItemView.applyColors(iconPalette);
+ BadgeInfo badgeInfo = mLauncher.getPopupDataProvider()
+ .getBadgeInfoForItem(originalItemInfo);
+ updateNotificationHeader(badgeInfo);
}
// Add the arrow.
mArrow = addArrowView(arrowHorizontalOffset, arrowVerticalOffset, arrowWidth, arrowHeight);
mArrow.setPivotX(arrowWidth / 2);
mArrow.setPivotY(mIsAboveIcon ? 0 : arrowHeight);
- PopupItemView firstItem = getItemViewAt(mIsAboveIcon ? getItemCount() - 1 : 0);
- mArrow.setBackgroundTintList(firstItem.getAttachedArrowColor());
animateOpen();
@@ -208,7 +206,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
// Load the shortcuts on a background thread and update the container as it animates.
final Looper workerLooper = LauncherModel.getWorkerLooper();
new Handler(workerLooper).postAtFrontOfQueue(PopupPopulator.createUpdateRunnable(
- mLauncher, (ItemInfo) originalIcon.getTag(), new Handler(Looper.getMainLooper()),
+ mLauncher, originalItemInfo, new Handler(Looper.getMainLooper()),
this, shortcutIds, shortcutViews, notificationKeys, mNotificationItemView));
}
@@ -540,6 +538,24 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
return true;
}
+ /**
+ * Updates the notification header to reflect the badge info. Since this can be called
+ * for any badge info (not necessarily the one associated with this app), we first
+ * check that the ItemInfo matches the one of this popup.
+ */
+ public void updateNotificationHeader(BadgeInfo badgeInfo, ItemInfo originalItemInfo) {
+ if (originalItemInfo != mOriginalIcon.getTag()) {
+ return;
+ }
+ updateNotificationHeader(badgeInfo);
+ }
+
+ private void updateNotificationHeader(BadgeInfo badgeInfo) {
+ if (mNotificationItemView != null && badgeInfo != null) {
+ mNotificationItemView.updateHeader(badgeInfo.getNotificationCount());
+ }
+ }
+
public void trimNotifications(Map<PackageUserKey, BadgeInfo> updatedBadges) {
if (mNotificationItemView == null) {
return;
@@ -576,8 +592,6 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
close(false);
return;
}
- View firstItem = getItemViewAt(mIsAboveIcon ? getItemCount() - 1 : 0);
- mArrow.setBackgroundTintList(firstItem.getBackgroundTintList());
}
});
removeNotification.play(fade);