zoukankan      html  css  js  c++  java
  • launcher4.0修改应用图标

    一、LauncherModel的LoaderTask的loadAndBindWorkspace方法开始

    private void loadAndBindWorkspace() {
                // Load the workspace
                if (DEBUG_LOADERS) {
                    Log.d(TAG, "loadAndBindWorkspace mWorkspaceLoaded=" + mWorkspaceLoaded);
                }

                if (!mWorkspaceLoaded) {
                    loadWorkspace();
                    synchronized (LoaderTask.this) {
                        if (mStopped) {
                            return;
                        }
                        mWorkspaceLoaded = true;
                    }
                }

                // Bind the workspace
                bindWorkspace();
            }

    二、进到 loadWorkspace();

    if (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
                                    info = getShortcutInfo(manager, intent, context, c, iconIndex,
                                            titleIndex, mLabelCache);
    } else {
                                    info = getShortcutInfo(c, context, iconTypeIndex,
                                            iconPackageIndex, iconResourceIndex, iconIndex,
                                            titleIndex);
    }

    四、进到getShortcutInfo

     final ResolveInfo resolveInfo = manager.resolveActivity(intent, 0);
            if (resolveInfo != null) {
                icon = mIconCache.getIcon(componentName, resolveInfo, labelCache);
            }

    五、进到getIcon()

    public Bitmap getIcon(ComponentName component, ResolveInfo resolveInfo,
                HashMap<Object, CharSequence> labelCache) {
            synchronized (mCache) {
                if (resolveInfo == null || component == null) {
                    return null;
                }

                CacheEntry entry = cacheLocked(component, resolveInfo, labelCache);
                return entry.icon;
            }
        }

    六、进到cacheLocked

    entry.icon = Utilities.createIconBitmap(
                        getFullResIcon(info), mContext);

    七、查看createIconBitmap  //Returns a bitmap suitable for the all apps view.

    可以在这个类中添加或者修改图片

  • 相关阅读:
    14 break
    13 for循环
    Python 3.7 将引入 dataclass 装饰器
    工程师如何在面试中脱颖而出
    如何避免 async/await 地狱
    命令行里打 cd 简直是浪费生命
    GitHub 十大 CI 工具
    GitHub CEO:GitHub 十年,感谢有你
    如何在 2 分钟内入睡(二战时期美国飞行员训练法)
    一分钟了解 TCP/IP 模型
  • 原文地址:https://www.cnblogs.com/lyz459/p/2725122.html
Copyright © 2011-2022 走看看