修改Laucnher3桌面应用名字

前段时间做的一个Laucnher应用,因为可以在IconCache中修改应用图标。现在有需求需要修改应用的名字,但是在IconCache中修改已知都没法实现。

跟踪代码发现每次加载桌面时,都会执行BubbleTextView类中的applyFromShortcutInfo方法去设置应用的图标和名字。测试后发现在该方法中根据应用包名去设置应用的名字是可行的。

public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache,
        boolean setDefaultPadding, boolean promiseStateChanged) {
    Bitmap b = info.getIcon(iconCache);
    LauncherAppState app = LauncherAppState.getInstance();

    FastBitmapDrawable iconDrawable = Utilities.createIconDrawable(b);
    iconDrawable.setGhostModeEnabled(info.isDisabled != 0);

    setCompoundDrawables(null, iconDrawable, null, null);
    if (setDefaultPadding) {
        DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
        setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
    }
    if (info.contentDescription != null) {
        setContentDescription(info.contentDescription);
    }
    setText(info.title);
    setTag(info);


    //远程工具
    if (info.getIntent().getComponent().getPackageName().equals(
            "com.teamviewer.quicksupport.market")){
        setText(mContext.getString(R.string.quicksupport));
    }
}

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值