/**
* Badges the provided icon with the user badge if required.
*/
public static Bitmap badgeIconForUser(Bitmap icon, UserHandleCompat user, Context context) {
if (Utilities.ATLEAST_LOLLIPOP && user != null
&& !UserHandleCompat.myUserHandle().equals(user)) {
BitmapDrawable drawable = new FixedSizeBitmapDrawable(icon);
Drawable badged = context.getPackageManager().getUserBadgedIcon(
drawable, user.getUser());
if (badged instanceof BitmapDrawable) {
return ((BitmapDrawable) badged).getBitmap();
} else {
return createIconBitmap(badged, context);
}
} else {
return icon;
}
}
Utilities.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:SimpleUILauncher
作者:
评论列表
文章目录