/**
* If the platform is running O but the app is not providing AdaptiveIconDrawable, then
* shrink the legacy icon and set it as foreground. Use color drawable as background to
* create AdaptiveIconDrawable.
*/
private static Drawable wrapToAdaptiveIconDrawable(Context context, Drawable drawable, float scale) {
if (!(AndroidVersion.isAtLeastOreo())) {
return drawable;
}
try {
if (!(drawable instanceof AdaptiveIconDrawable)) {
AdaptiveIconDrawable iconWrapper = (AdaptiveIconDrawable)
context.getDrawable(R.drawable.adaptive_icon_drawable_wrapper).mutate();
FixedScaleDrawable fsd = ((FixedScaleDrawable) iconWrapper.getForeground());
fsd.setDrawable(drawable);
fsd.setScale(scale);
return (Drawable) iconWrapper;
}
} catch (Exception e) {
return drawable;
}
return drawable;
}
LauncherIcons.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:LaunchEnr
作者:
评论列表
文章目录