diff options
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index cb40d3d5e..07236d6a0 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -43,7 +43,7 @@ import com.android.launcher3.IconCache.IconLoadRequest; import com.android.launcher3.IconCache.ItemInfoUpdateReceiver; import com.android.launcher3.badge.BadgeInfo; import com.android.launcher3.badge.BadgeRenderer; -import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.folder.FolderIconPreviewVerifier; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.HolographicOutlineHelper; import com.android.launcher3.graphics.IconPalette; @@ -206,6 +206,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { // Verify high res immediately verifyHighRes(); + if (info instanceof PromiseAppInfo) { + PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info; + applyProgressLevel(promiseAppInfo.level); + } applyBadgeState(info, false /* animate */); } @@ -547,27 +551,36 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { ((info.hasStatusFlag(ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE) ? 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_waiting_download_title, info.title)); + PreloadIconDrawable preloadDrawable = applyProgressLevel(progressLevel); + if (preloadDrawable != null && promiseStateChanged) { + preloadDrawable.maybePerformFinishedAnimation(); + } + } + } + + public PreloadIconDrawable applyProgressLevel(int progressLevel) { + if (getTag() instanceof ItemInfoWithIcon) { + ItemInfoWithIcon info = (ItemInfoWithIcon) getTag(); + setContentDescription(progressLevel > 0 + ? 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) { final PreloadIconDrawable preloadDrawable; if (mIcon instanceof PreloadIconDrawable) { preloadDrawable = (PreloadIconDrawable) mIcon; + preloadDrawable.setLevel(progressLevel); } else { preloadDrawable = DrawableFactory.get(getContext()) .newPendingIcon(info.iconBitmap, getContext()); + preloadDrawable.setLevel(progressLevel); setIcon(preloadDrawable); } - - preloadDrawable.setLevel(progressLevel); - if (promiseStateChanged) { - preloadDrawable.maybePerformFinishedAnimation(); - } + return preloadDrawable; } } + return null; } public void applyBadgeState(ItemInfo itemInfo, boolean animate) { @@ -627,7 +640,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { applyFromApplicationInfo((AppInfo) info); } else if (info instanceof ShortcutInfo) { applyFromShortcutInfo((ShortcutInfo) info); - if ((info.rank < FolderIcon.NUM_ITEMS_IN_PREVIEW) && (info.container >= 0)) { + FolderIconPreviewVerifier verifier = + new FolderIconPreviewVerifier(mLauncher.getDeviceProfile().inv); + if (verifier.isItemInPreview(info.rank) && (info.container >= 0)) { View folderIcon = mLauncher.getWorkspace().getHomescreenIconByItemId(info.container); if (folderIcon != null) { @@ -667,6 +682,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { .isEmpty(); } + public int getIconSize() { + return mIconSize; + } + /** * Interface to be implemented by the grand parent to allow click shadow effect. */ |