diff options
author | Tony Wickham <twickham@google.com> | 2017-01-11 09:53:12 -0800 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2017-01-13 10:58:10 -0800 |
commit | 9a8d11f930ced4c2706db150b7bbbb21330bd68d (patch) | |
tree | 836cd603e38d3cb17ae0a5950757b479639c6c85 /src/com/android/launcher3/BubbleTextView.java | |
parent | 19ea5cc0c853d48db59363f763d9a06c8691e00d (diff) | |
download | android_packages_apps_Trebuchet-9a8d11f930ced4c2706db150b7bbbb21330bd68d.tar.gz android_packages_apps_Trebuchet-9a8d11f930ced4c2706db150b7bbbb21330bd68d.tar.bz2 android_packages_apps_Trebuchet-9a8d11f930ced4c2706db150b7bbbb21330bd68d.zip |
FastBitmapDrawable can draw an icon badge (notification count)
- Added BadgeInfo to contain data to be shown in a badge
(currently just notification count).
- Added BadgeRenderer in DeviceProfile to contain things
relevant to drawing the badge, such as size and Paint's.
- Added IconPalette to compute colors for the badge based
on a dominant color (will also be used for notifications)
- FastBitmapDrawable uses these classes to draw the badge.
Bug: 32410600
Change-Id: I6595a4879943357590f7d20c22594691a573ecaf
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index b8b43c9c3..77572c7f7 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -39,6 +39,8 @@ import android.widget.TextView; import com.android.launcher3.IconCache.IconLoadRequest; import com.android.launcher3.IconCache.ItemInfoUpdateReceiver; +import com.android.launcher3.badge.BadgeRenderer; +import com.android.launcher3.badge.BadgeInfo; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.HolographicOutlineHelper; @@ -164,7 +166,7 @@ public class BubbleTextView extends TextView applyIconAndLabel(info.iconBitmap, info); setTag(info); if (promiseStateChanged || info.isPromise()) { - applyState(promiseStateChanged); + applyPromiseState(promiseStateChanged); } } @@ -470,7 +472,7 @@ public class BubbleTextView extends TextView mLongPressHelper.cancelLongPress(); } - public void applyState(boolean promiseStateChanged) { + public void applyPromiseState(boolean promiseStateChanged) { if (getTag() instanceof ShortcutInfo) { ShortcutInfo info = (ShortcutInfo) getTag(); final boolean isPromise = info.isPromise(); @@ -479,8 +481,8 @@ public class BubbleTextView extends TextView info.getInstallProgress() : 0)) : 100; setContentDescription(progressLevel > 0 ? - getContext().getString(R.string.app_downloading_title, info.title, - NumberFormat.getPercentInstance().format(progressLevel * 0.01)) : + getContext().getString(R.string.app_downloading_title, info.title, + NumberFormat.getPercentInstance().format(progressLevel * 0.01)) : getContext().getString(R.string.app_waiting_download_title, info.title)); if (mIcon != null) { @@ -500,6 +502,13 @@ public class BubbleTextView extends TextView } } + public void applyBadgeState(BadgeInfo badgeInfo) { + if (mIcon instanceof FastBitmapDrawable) { + BadgeRenderer badgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer; + ((FastBitmapDrawable) mIcon).applyIconBadge(badgeInfo, badgeRenderer); + } + } + private Theme getPreloaderTheme() { Object tag = getTag(); int style = ((tag != null) && (tag instanceof ShortcutInfo) && |