ShortcutHelper.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:transistor 作者:
public void placeShortcut(Station station) {

        // credit: https://medium.com/@BladeCoder/using-support-library-26-0-0-you-can-do-bb75911e01e8
        if (ShortcutManagerCompat.isRequestPinShortcutSupported(mContext)) {
            ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(mContext, station.getStationName())
                    .setShortLabel(station.getStationName())
                    .setLongLabel(station.getStationName())
                    .setIcon(IconCompat.createWithBitmap(createShortcutIcon(station)))
                    .setIntent(createShortcutIntent(station))
                    .build();
            ShortcutManagerCompat.requestPinShortcut(mContext, shortcut, null);
            Toast.makeText(mContext, mContext.getString(R.string.toastmessage_shortcut_created), Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(mContext, mContext.getString(R.string.toastmessage_shortcut_not_created), Toast.LENGTH_LONG).show();
        }

    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号