public ShortcutHelper createShortcut(@NonNull CharSequence shortLabel, @NonNull CharSequence longLabel, @NonNull int iconResource, @NonNull Intent intent) {
if (Build.VERSION.SDK_INT < 25) {
return this;
}
String shortcutId = shortLabel.toString().replaceAll("\\s+","").toLowerCase() + "_shortcut";
ShortcutInfo shortcut = new ShortcutInfo.Builder(mActivity, shortcutId)
.setShortLabel(shortLabel)
.setLongLabel(longLabel)
.setIcon(Icon.createWithResource(mActivity, iconResource))
.setIntent(intent)
.build();
mShortcutInfos.add(shortcut);
return this;
}
ShortcutHelper.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:shortcut-helper
作者:
评论列表
文章目录