Merge "FastBitmapDrawable can draw an icon badge (notification count)" into ub-launcher3-master

This commit is contained in:
Tony Wickham authored and Android (Google) Code Review committed 2017-01-18 22:36:17 +00:00
commit 197f97bde4
9 files changed
+223 -7

No files matched your search

+13 -4
View File
@@ -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) &&