SubscriptionAdapter.java 文件源码

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

项目:JianshuApp 作者:
private void showAddToDesktop(SubscriptionType type, String id, String imgUrl, String name) {
    Alerts.list(null, AppUtils.getContext().getString(R.string.add_to_desktop))
            .flatMap(it -> {
                return ImageUtils.loadImage(ImageUtils.parseUri(imgUrl), 128, 128)
                        .map(bitmap -> {
                            RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(AppUtils.getContext().getResources(), bitmap);
                            drawable.setCornerRadius(20);
                            return (Drawable)drawable;
                        })
                        .onErrorReturnItem(AppUtils.getContext().getResources().getDrawable(R.drawable.jianshu_icon))
                        .map(BitmapUtils::toBitmap);
            })
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(bitmap -> {
                ShortcutUtils.addShortcut(type, id, name, bitmap);
            }, err -> {
                LogUtils.e(err);
            });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号