MainActivity.java 文件源码

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

项目:Prodigal 作者:
public void loadBackground(SongBean bean) {
    if (bean == null ) {
        backgroundImage.setImageBitmap(null);
        return;
    }
    final Uri image = Uri.parse(MediaLibrary.getStaticInstance(getApplicationContext())
            .getCoverUriByAlbumId(bean.getAlbumId()));
    Picasso.with(this).load(image).resize(windowSize.x, windowSize.y)
            .centerCrop()
            .transform(new Transformation() {
                @Override
                public Bitmap transform(Bitmap source) {
                    BlurFactor factor = new BlurFactor();
                    factor.radius = 25;
                    factor.sampling = 4;
                    factor.width = windowSize.x;
                    factor.height = windowSize.y;
                    factor.color = ColorUtils.setAlphaComponent(
                            ThemeManager.getInstance(getApplicationContext())
                            .loadCurrentTheme().getBackgroundColor(), 20);
                    Bitmap ret = Blur.of(getApplicationContext(), source, factor);
                    source.recycle();
                    return ret;
                }

                @Override
                public String key() {
                    return image.toString() + "/blured";
                }
            })
            .config(Bitmap.Config.RGB_565).into(backgroundImage);

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号