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.

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

  • 相关阅读:
    txt文件按行处理工具类(可以截取小说、分析日志等)【我】
    java正则表达式取出匹配字符串
    svn客户端更改用户名
    Spring集成MyBatis完整示例
    redis的list取出数据方式速度测试
    处理大量数据的性能优化一例【我】
    unity3d结合轮廓显示,实现完整的框选目标(附Demo代码)
    Unity3dPro 和免费版的区别
    unity3d 射线扫描 忽略图层
    Unity3D角色攻击范围判定和攻击判定
  • 原文地址:https://www.cnblogs.com/lyz459/p/2725122.html
Copyright © 2011-2022 走看看