use of jp.wasabeef.glide.transformations.BlurTransformation in project CloudReader by youlookwhat.
the class TestActivity method setData.
private void setData() {
if (subjectsBean != null) {
// 高斯模糊背景
Glide.with(this).load(subjectsBean.getImages().getLarge()).error(R.drawable.stackblur_default).bitmapTransform(new BlurTransformation(this, 12, 5)).listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
mToolbar.setBackgroundColor(Color.TRANSPARENT);
binding.ivTitleBg.setImageAlpha(0);
binding.ivTitleBg.setVisibility(View.VISIBLE);
return false;
}
}).into(binding.ivTitleBg);
}
}
use of jp.wasabeef.glide.transformations.BlurTransformation in project SpotiQ by ZinoKader.
the class TracklistRecyclerAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(SongHolder songHolder, int position) {
Song song = songs.get(position);
Context context = songHolder.itemView.getContext();
String artistsName = ArtistMapper.joinArtistNames(song.getArtists());
String runTimeText = String.format(Locale.getDefault(), "%d minutes, %d seconds", TimeUnit.MILLISECONDS.toMinutes(song.getDurationMs()), TimeUnit.MILLISECONDS.toSeconds(song.getDurationMs()) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(song.getDurationMs())));
songHolder.cropTransformation = new CropTransformation(context, ApplicationConstants.DEFAULT_TRACKLIST_CROP_WIDTH, ApplicationConstants.DEFAULT_TRACKLIST_CROP_HEIGHT, CropTransformation.CropType.CENTER);
songHolder.blurTransformation = new BlurTransformation(context, ApplicationConstants.DEFAULT_TRACKLIST_BLUR_RADIUS);
songHolder.colorFilterTransformation = new ColorFilterTransformation(context, R.color.colorPrimary);
Glide.with(songHolder.itemView.getContext()).load(song.getAlbumArtUrl()).fitCenter().placeholder(R.drawable.image_album_placeholder).bitmapTransform(songHolder.blurTransformation, songHolder.cropTransformation, songHolder.colorFilterTransformation).into(new SimpleTarget<GlideDrawable>() {
@Override
public void onResourceReady(GlideDrawable drawable, GlideAnimation<? super GlideDrawable> glideAnimation) {
songHolder.cardViewRoot.setBackground(drawable);
}
});
Glide.with(context).load(song.getAlbumArtUrl()).placeholder(R.drawable.image_album_placeholder).fitCenter().into(songHolder.albumArt);
songHolder.songName.setText(song.getName());
songHolder.artistsName.setText(artistsName);
songHolder.runTime.setText(runTimeText);
songHolder.albumName.setText(song.getAlbum().name);
}
Aggregations