diff options
author | Tony Wickham <twickham@google.com> | 2017-04-27 21:49:08 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-04-27 21:49:08 +0000 |
commit | 19d2e7fc55df1fae3979615899c8b7dde95e5509 (patch) | |
tree | 97dd2358caae191bec64ba999962bb03b766568b | |
parent | 22f8f9fc4be1c1717258851a4da30dd2f829d3c9 (diff) | |
parent | f77a6f7fd75243999912d040470a543e825d6d12 (diff) | |
download | android_packages_apps_Trebuchet-19d2e7fc55df1fae3979615899c8b7dde95e5509.tar.gz android_packages_apps_Trebuchet-19d2e7fc55df1fae3979615899c8b7dde95e5509.tar.bz2 android_packages_apps_Trebuchet-19d2e7fc55df1fae3979615899c8b7dde95e5509.zip |
Re-enable badges, with all dots
am: f77a6f7fd7
Change-Id: I139ea47c73ee01a2777132f63b1d8add687579b0
6 files changed, 10 insertions, 15 deletions
diff --git a/res/values-v26/bools.xml b/res/values-v26/bools.xml index b15b6d942..30537fe12 100644 --- a/res/values-v26/bools.xml +++ b/res/values-v26/bools.xml @@ -17,7 +17,7 @@ --> <resources> - <bool name="notification_badging_enabled">false</bool> + <bool name="notification_badging_enabled">true</bool> <bool name="enable_install_shortcut_api">false</bool> </resources>
\ No newline at end of file diff --git a/src/com/android/launcher3/badge/BadgeRenderer.java b/src/com/android/launcher3/badge/BadgeRenderer.java index 2971ceb80..ba1977af4 100644 --- a/src/com/android/launcher3/badge/BadgeRenderer.java +++ b/src/com/android/launcher3/badge/BadgeRenderer.java @@ -38,6 +38,8 @@ import com.android.launcher3.graphics.ShadowGenerator; */ public class BadgeRenderer { + private static final boolean DOTS_ONLY = true; + // The badge sizes are defined as percentages of the app icon size. private static final float SIZE_PERCENTAGE = 0.38f; // Used to expand the width of the badge for each additional digit. @@ -101,7 +103,7 @@ public class BadgeRenderer { String notificationCount = badgeInfo == null ? "0" : String.valueOf(badgeInfo.getNotificationCount()); int numChars = notificationCount.length(); - int width = mSize + mCharSize * (numChars - 1); + int width = DOTS_ONLY ? mSize : mSize + mCharSize * (numChars - 1); // Lazily load the background with shadow. Bitmap backgroundWithShadow = mBackgroundsWithShadow.get(numChars); if (backgroundWithShadow == null) { @@ -112,8 +114,8 @@ public class BadgeRenderer { // We draw the badge relative to its center. int badgeCenterX = iconBounds.right - width / 2; int badgeCenterY = iconBounds.top + mSize / 2; - boolean isText = badgeInfo != null && badgeInfo.getNotificationCount() != 0; - boolean isIcon = icon != null; + boolean isText = !DOTS_ONLY && badgeInfo != null && badgeInfo.getNotificationCount() != 0; + boolean isIcon = !DOTS_ONLY && icon != null; boolean isDot = !(isText || isIcon); if (isDot) { badgeScale *= DOT_SCALE; diff --git a/src/com/android/launcher3/graphics/IconPalette.java b/src/com/android/launcher3/graphics/IconPalette.java index 1212cba05..0182e53b9 100644 --- a/src/com/android/launcher3/graphics/IconPalette.java +++ b/src/com/android/launcher3/graphics/IconPalette.java @@ -35,7 +35,7 @@ public class IconPalette { private static final boolean DEBUG = false; private static final String TAG = "IconPalette"; - public static final IconPalette FOLDER_ICON_PALETTE = new IconPalette(Color.WHITE); + public static final IconPalette FOLDER_ICON_PALETTE = new IconPalette(Color.parseColor("#BDC1C6")); private static final float MIN_PRELOAD_COLOR_SATURATION = 0.2f; private static final float MIN_PRELOAD_COLOR_LIGHTNESS = 0.6f; diff --git a/src/com/android/launcher3/graphics/ShadowGenerator.java b/src/com/android/launcher3/graphics/ShadowGenerator.java index 5dd8d200b..469fe34e9 100644 --- a/src/com/android/launcher3/graphics/ShadowGenerator.java +++ b/src/com/android/launcher3/graphics/ShadowGenerator.java @@ -87,8 +87,6 @@ public class ShadowGenerator { float shadowRadius = height * 1f / 32; float shadowYOffset = height * 1f / 16; - int ambientShadowAlpha = AMBIENT_SHADOW_ALPHA / 2; - int keyShadowAlpha = KEY_SHADOW_ALPHA / 2; int radius = height / 2; @@ -109,11 +107,11 @@ public class ShadowGenerator { int bottom = center + height / 2; // Draw ambient shadow, center aligned within size - blurPaint.setAlpha(ambientShadowAlpha); + blurPaint.setAlpha(AMBIENT_SHADOW_ALPHA); canvas.drawRoundRect(left, top, right, bottom, radius, radius, blurPaint); // Draw key shadow, bottom aligned within size - blurPaint.setAlpha(keyShadowAlpha); + blurPaint.setAlpha(KEY_SHADOW_ALPHA); canvas.drawRoundRect(left, top + shadowYOffset, right, bottom + shadowYOffset, radius, radius, blurPaint); diff --git a/src/com/android/launcher3/notification/NotificationKeyData.java b/src/com/android/launcher3/notification/NotificationKeyData.java index 154ea216b..bf7ae1a5c 100644 --- a/src/com/android/launcher3/notification/NotificationKeyData.java +++ b/src/com/android/launcher3/notification/NotificationKeyData.java @@ -37,7 +37,7 @@ public class NotificationKeyData { private NotificationKeyData(String notificationKey, String shortcutId, int count) { this.notificationKey = notificationKey; this.shortcutId = shortcutId; - this.count = count; + this.count = Math.max(1, count); } public static NotificationKeyData fromNotification(StatusBarNotification sbn) { diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index deab3d96d..dc7fa05f7 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -562,11 +562,6 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra } private void updateNotificationHeader() { - if (true) { - // For now, don't show any number in the popup. - // TODO: determine whether a number makes sense, and if not, remove associated code. - return; - } ItemInfo itemInfo = (ItemInfo) mOriginalIcon.getTag(); BadgeInfo badgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo); if (mNotificationItemView != null && badgeInfo != null) { |