Android P Launcher APP替换图标不随系统固定格式而改变
16lz
2021-01-23
--- a/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherIcons.java+++ b/vendor/mediatek/proprietary/packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherIcons.java@@ -195,7 +195,8 @@ public class LauncherIcons implements AutoCloseable { float[] scale = new float[1]; icon = normalizeAndWrapToAdaptiveIcon(icon, iconAppTargetSdk, null, scale); Bitmap bitmap = createIconBitmap(icon, scale[0]);- if (Utilities.ATLEAST_OREO && icon instanceof AdaptiveIconDrawable) {+ if (/*Utilities.ATLEAST_OREO*/false && icon instanceof AdaptiveIconDrawable) { mCanvas.setBitmap(bitmap); getShadowGenerator().recreateIcon(Bitmap.createBitmap(bitmap), mCanvas); mCanvas.setBitmap(null);@@ -241,7 +242,8 @@ public class LauncherIcons implements AutoCloseable { private Drawable normalizeAndWrapToAdaptiveIcon(Drawable icon, int iconAppTargetSdk, RectF outIconBounds, float[] outScale) { float scale = 1f;- if (Utilities.ATLEAST_OREO && iconAppTargetSdk >= Build.VERSION_CODES.O) {+ if (/*Utilities.ATLEAST_OREO*/false && iconAppTargetSdk >= Build.VERSION_CODES.O) { boolean[] outShape = new boolean[1]; if (mWrapperIcon == null) { mWrapperIcon = mContext.getDrawable(R.drawable.adaptive_icon_drawable_wrapper)@@ -250,7 +252,8 @@ public class LauncherIcons implements AutoCloseable { AdaptiveIconDrawable dr = (AdaptiveIconDrawable) mWrapperIcon; dr.setBounds(0, 0, 1, 1); scale = getNormalizer().getScale(icon, outIconBounds, dr.getIconMask(), outShape);- if (Utilities.ATLEAST_OREO && !outShape[0] && !(icon instanceof AdaptiveIconDrawable)) {+ if (/*Utilities.ATLEAST_OREO*/false && !outShape[0] && !(icon instanceof AdaptiveIconDrawable)) { FixedScaleDrawable fsd = ((FixedScaleDrawable) dr.getForeground()); fsd.setDrawable(icon); fsd.setScale(scale);@@ -329,7 +332,8 @@ public class LauncherIcons implements AutoCloseable { final int top = (textureHeight-height) / 2; mOldBounds.set(icon.getBounds());- if (Utilities.ATLEAST_OREO && icon instanceof AdaptiveIconDrawable) {+ if (/*Utilities.ATLEAST_OREO*/false && icon instanceof AdaptiveIconDrawable) { int offset = Math.max((int) Math.ceil(BLUR_FACTOR * textureWidth), Math.max(left, top)); int size = Math.max(width, height); icon.setBounds(offset, offset, offset + size, offset + size);
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer