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.

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

  • 相关阅读:
    最痛心以前做的笔记 Python 练习实例1
    JavaScript 简介
    Javascript简明教程(5) 条件判断
    Javascript简明教程(3) 数组
    Javascript简明教程(2) 字符串
    《SaltStack技术入门与实践》—— Mine
    《SaltStack技术入门与实践》—— Renderer组件
    【SaltStack官方版】—— Events&Reactor系统—BEACONS
    【SaltStack官方版】—— Events&Reactor系统—EVENT SYSTEM
    《SaltStack技术入门与实践》—— Event和Reactor系统
  • 原文地址:https://www.cnblogs.com/lyz459/p/2725122.html
Copyright © 2011-2022 走看看