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.

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

  • 相关阅读:
    iis 500
    无线密码获取
    数据库创建
    系统基础配置指令
    手把手教你用ngrx管理Angular状态
    vue中v-cloak解决刷新或者加载出现闪烁(显示变量)
    HBuilder如何与真机连接
    01 spring boot源码阅读参考
    01 git学习笔记参考
    OAuth2授权基础知识
  • 原文地址:https://www.cnblogs.com/lyz459/p/2725122.html
Copyright © 2011-2022 走看看