切换语言后,桌面上的快捷方式名称没有切换到当前语言
2014-05-08 17:00
260 查看
这个是google默认设计,如果要修改的话,请按照以下步骤操作:
1、请修改LauncherModel.java的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);
//mtk add begin
CharSequence title = getShortcutTitle(manager, intent);
if(title != null ){
info.title = title;
}
//mtk add end
// App shortcuts that used to be automatically added to Launcher
// didn't always have the correct intent flags set, so do that
// here
if (intent.getAction() != null &&
intent.getCategories() != null &&
intent.getAction().equals(Intent.ACTION_MAIN) &&
intent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) {
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
}
}
......
2、请在LauncherModel.java增加如下方法:
private CharSequence getShortcutTitle(PackageManager manager, Intent intent) {
ComponentName componentName = intent.getComponent();
if (componentName == null) {
return null;
}
try {
PackageInfo pi = manager.getPackageInfo( componentName.getPackageName(), 0);
if (!pi.applicationInfo.enabled) {
// If we return null here, the corresponding item will be
// removed from the launcher
// db and will not appear in the workspace.
return null;
}
} catch (NameNotFoundException e) {
Log.d(TAG, "getPackInfo failed for package " + componentName.getPackageName());
}
ResolveInfo resolveInfo = manager.resolveActivity(intent, 0);
if (resolveInfo != null) {
return resolveInfo.activityInfo.loadLabel(manager);
}
return null;
}
PS:标注为黄色的代码即为修改的代码
1、请修改LauncherModel.java的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);
//mtk add begin
CharSequence title = getShortcutTitle(manager, intent);
if(title != null ){
info.title = title;
}
//mtk add end
// App shortcuts that used to be automatically added to Launcher
// didn't always have the correct intent flags set, so do that
// here
if (intent.getAction() != null &&
intent.getCategories() != null &&
intent.getAction().equals(Intent.ACTION_MAIN) &&
intent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) {
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
}
}
......
2、请在LauncherModel.java增加如下方法:
private CharSequence getShortcutTitle(PackageManager manager, Intent intent) {
ComponentName componentName = intent.getComponent();
if (componentName == null) {
return null;
}
try {
PackageInfo pi = manager.getPackageInfo( componentName.getPackageName(), 0);
if (!pi.applicationInfo.enabled) {
// If we return null here, the corresponding item will be
// removed from the launcher
// db and will not appear in the workspace.
return null;
}
} catch (NameNotFoundException e) {
Log.d(TAG, "getPackInfo failed for package " + componentName.getPackageName());
}
ResolveInfo resolveInfo = manager.resolveActivity(intent, 0);
if (resolveInfo != null) {
return resolveInfo.activityInfo.loadLabel(manager);
}
return null;
}
PS:标注为黄色的代码即为修改的代码
相关文章推荐
- MTK 切换语言后,桌面上的快捷方式名称没有切换到当前语言
- 解决没有“快速启动栏”的问题和右键“发送到”没有“桌面快捷方式”的问题
- 电脑 右击 发送到没有桌面快捷方式解决方法
- win7安装程序后为什么在桌面没有创建快捷方式
- inno setup打包,win7下安装没有桌面快捷方式,xp下安装正常
- 桌面的快捷方式右键点击没有“打开”,开头是发送到
- Windows服务System权限下在当前用户桌面创建快捷方式C#实例程序
- Android创建桌面快捷方式和判断当前快捷方式是否已经存在
- Android5.0源码开发之launcher切换语言后Folder和ShortcutT没有切换到当前语言
- 将当前网址生成快捷方式在桌面(仅支持IE)
- WINDOWS7没有"发送到桌面快捷方式“
- 解决MATLAB2016b安装完成后开始菜单和桌面没有快捷方式的问题
- “inno setup打包,win7下安装没有桌面快捷方式,xp下安装正常”
- 右键没有“快捷方式到桌面”快速解决方法
- 工作效率提升之创建桌面快捷方式------不是不知道, 而是没有意识到
- Android修改桌面快捷方式的图片和名称
- 桌面右键没有新建txt文本文档的快捷方式、
- asp怎么在桌面上创建快捷方式?
- Winform 创建桌面快捷方式并开机启动
- Inno Setup入门(四)——为程序创建桌面快捷方式