Android12 Launcher3 的一些修改记录

Launcher3 桌面是如何屏蔽返回手势的:

查看LauncherState类,可以看到枚举类型,可以看到NORMAL对象实例化的时候传入的参数flags传了有包含“FLAG_HIDE_BACK_BUTTON”,则会屏蔽返回手势

是否显示返回手势指示具体实现在com.android.launcher3.BaseQuickstepLauncher#shouldBackButtonBeHidden里面。

Launcher3新安装应用从第二页开始放:

类AddWorkspaceItemsTask中,findSpaceForItem方法:

for (int screen = 0; screen < screenCount; screen++)
//screen改成1,从第二页开始查找
for (int screen = 1; screen < screenCount; screen++)

Launcher3图标去掉背景,前景做圆角裁剪,缩放:

Android10 Launcher3应用图标圆角角度调整_android app logo圆角_杰克W的博客-CSDN博客

 其中,上面这篇文章中getRoundCornerBitmap方法里面使用matrix.postScale缩放没有效果,我这边采用画布缩放的方式:

        // 边角处理
        Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(output);
        canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));
        final Paint paint = new Paint();
        final Rect rect = new Rect(0, 0, width, height);
        final RectF rectF = new RectF(1f, 1f, width - 1f, height - 1f);
        paint.setAntiAlias(true);
        canvas.drawARGB(0, 0, 0, 0);
        float rx = width / ratio;
        float ry = height / ratio;
        //缩放效果
        canvas.save();
        canvas.scale(scale, scale, width/2f, height/2f);
        canvas.drawRoundRect(rectF, rx, ry, paint);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        canvas.drawBitmap(bitmap, rect, rect, paint);
        canvas.restore();
        bitmap.recycle();
        return output;

你可能感兴趣的:(android,Launcher3,返回手势,新安装应用,客制化)