Android_Q_Launcher调整为横向滑动

Android_Q_Launcher调整为横向滑动

以下内容为原创,其中有参考部分同行的blog。

 

需求说明:

1.Android Q Launcher去掉抽屉功能,屏蔽从下往上的滑动功能;

2.将系统中apk及新安装的apk全部显示在workspace中;

3.workspace中,不可卸载的应用长按滑动后,只能有cancel功能,可卸载应用,长按滑动后,有卸载功能;

4.Launcher横屏显示时,屏蔽从下往上的滑动功能;

 

需求分解:备注:以下相关代码注释请搜索“by lj”

1.将 AllAppsContainerView 中的图标加载到 Workspace,需要在LoaderTask中,将所有APP都Load并且通过addAndBindAddedWorkspaceItems,添加显示到workspace。packages\apps\Launcher3\src\com\android\launcher3\model\LoaderTask.java文件中,在run()方法中,

// second step

            TraceHelper.partitionSection(TAG, "step 2.1: loading all apps");

            List<LauncherActivityInfo> allActivityList = loadAllApps();

            /*add start by lj on 20200530*/

            verifyApplications();

            /*add end by lj on 20200530*/

 

需要添加的方法如下:

/*add start by lj on 20200530*/

    private void verifyApplications() {

        final Context context = mApp.getContext();

        ArrayList<Pair<ItemInfo, Object>> installQueue = new ArrayList<>();

        final List<UserHandle> profiles = mUserManager.getUserProfiles();

        for (UserHandle user : profiles) {

            final List<LauncherActivityInfo> apps = mLauncherApps.getActivityList(null, user);

            ArrayList<InstallShortcutReceiver.PendingInstallShortcutInfo> added =

new ArrayList<InstallShortcutReceiver.PendingInstallShortcutInfo>();

            synchronized (this) {

                for (LauncherActivityInfo app : apps) {

                    InstallShortcutReceiver.PendingInstallShortcutInfo pendingInstallShortcutInfo =

                        new InstallShortcutReceiver.PendingInstallShortcutInfo(app, context);

added.add(pendingInstallShortcutInfo);

                    installQueue.add(pendingInstallShortcutInfo.getItemInfo());

                }

            }

            if (!added.isEmpty()) {

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值