use of jp.wasabeef.glide.transformations.BlurTransformation in project CloudReader by youlookwhat.
the class MovieDetailActivity method setImgHeaderBg.
/**
* 加载titlebar背景
*/
private void setImgHeaderBg() {
if (subjectsBean != null) {
// 高斯模糊背景 原来 参数:12,5 23,4
Glide.with(this).load(subjectsBean.getImages().getLarge()).error(R.drawable.stackblur_default).bitmapTransform(new BlurTransformation(this, 23, 4)).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) {
binding.titleToolBar.setBackgroundColor(Color.TRANSPARENT);
binding.ivTitleHeadBg.setImageAlpha(0);
binding.ivTitleHeadBg.setVisibility(View.VISIBLE);
return false;
}
}).into(binding.ivTitleHeadBg);
}
}
use of jp.wasabeef.glide.transformations.BlurTransformation in project twicalico by moko256.
the class TweetImageTableView method setMediaEntities.
public void setMediaEntities(MediaEntity[] mediaEntities, boolean sensitive) {
this.mediaEntities = mediaEntities;
updateImageNumber();
int imageNum = mediaEntities.length;
if (imageNum > 4) {
imageNum = 4;
}
for (int ii = 0; ii < imageNum; ii++) {
int finalIi = ii;
covers[ii].setOnClickListener(v -> {
if (isOpen) {
getContext().startActivity(ShowImageActivity.getIntent(getContext(), mediaEntities, finalIi));
} else {
isOpen = true;
for (int iii = 0; iii < mediaEntities.length; iii++) {
GlideApp.with(getContext()).load(TwitterStringUtils.convertSmallImageUrl(mediaEntities[iii].getMediaURLHttps())).diskCacheStrategy(DiskCacheStrategy.NONE).into(imageViews[iii]);
}
}
});
if (GlobalApplication.configuration.isTimelineImageLoad) {
if (sensitive) {
isOpen = false;
GlideApp.with(getContext()).load(TwitterStringUtils.convertSmallImageUrl(mediaEntities[ii].getMediaURLHttps())).transform(new BlurTransformation()).diskCacheStrategy(DiskCacheStrategy.NONE).into(imageViews[ii]);
} else {
isOpen = true;
GlideApp.with(getContext()).load(TwitterStringUtils.convertSmallImageUrl(mediaEntities[ii].getMediaURLHttps())).diskCacheStrategy(DiskCacheStrategy.NONE).into(imageViews[ii]);
}
if (mediaEntities[ii].getType().equals("video")) {
covers[ii].setForeground(AppCompatResources.getDrawable(getContext(), R.drawable.player_foreground));
} else if (mediaEntities[ii].getType().equals("animated_gif")) {
covers[ii].setForeground(AppCompatResources.getDrawable(getContext(), R.drawable.gif_foreground));
} else {
covers[ii].setForeground(null);
}
} else {
imageViews[ii].setImageResource(R.drawable.border_frame);
}
}
}
use of jp.wasabeef.glide.transformations.BlurTransformation in project CloudReader by youlookwhat.
the class BaseHeaderActivity method setImgHeaderBg.
/**
* 加载titlebar背景
*/
private void setImgHeaderBg(String imgUrl) {
if (!TextUtils.isEmpty(imgUrl)) {
// 高斯模糊背景 原来 参数:12,5 23,4
Glide.with(this).load(imgUrl).error(R.drawable.stackblur_default).transform(new BlurTransformation(40, 8)).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
bindingTitleView.tbBaseTitle.setBackgroundColor(Color.TRANSPARENT);
bindingTitleView.ivBaseTitlebarBg.setImageAlpha(0);
bindingTitleView.ivBaseTitlebarBg.setVisibility(View.VISIBLE);
return false;
}
}).into(bindingTitleView.ivBaseTitlebarBg);
}
}
use of jp.wasabeef.glide.transformations.BlurTransformation in project DevRing by LJYcoder.
the class GlideManager method load.
private RequestBuilder load(RequestBuilder requestBuilder, LoadOption loadOption) {
RequestOptions requestOptions = new RequestOptions();
mImageConfig = DevRing.ringComponent().imageConfig();
// 使用全局的配置进行设置
if (loadOption == null) {
if (mImageConfig.isShowTransition()) {
requestBuilder.transition(DrawableTransitionOptions.withCrossFade(600));
}
if (mImageConfig.getLoadingResId() > 0) {
requestOptions.placeholder(mImageConfig.getLoadingResId());
}
if (mImageConfig.getErrorResId() > 0) {
requestOptions.error(mImageConfig.getErrorResId());
}
requestOptions.skipMemoryCache(!mImageConfig.isUseMemoryCache());
if (mImageConfig.isUseDiskCache()) {
requestOptions.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC);
} else {
requestOptions.diskCacheStrategy(DiskCacheStrategy.NONE);
}
} else // 使用临时的配置进行设置
{
if (loadOption.isShowTransition()) {
requestBuilder.transition(DrawableTransitionOptions.withCrossFade(600));
}
if (loadOption.getLoadingResId() > 0) {
requestOptions.placeholder(loadOption.getLoadingResId());
}
if (loadOption.getErrorResId() > 0) {
requestOptions.error(loadOption.getErrorResId());
}
requestOptions.skipMemoryCache(!loadOption.isUseMemoryCache());
if (loadOption.isUseDiskCache()) {
requestOptions.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC);
} else {
requestOptions.diskCacheStrategy(DiskCacheStrategy.NONE);
}
CircleBorderTransformation circleTransformation = null;
// CropCircleTransformation circleTransformation = null;
RoundedCornersTransformation roundedCornersTransformation = null;
BlurTransformation blurTransformation = null;
GrayscaleTransformation grayscaleTransformation = null;
if (loadOption.isCircle()) {
// circleTransformation = new CropCircleTransformation();
int borderWidth = loadOption.getBorderWidth();
int borderColor = loadOption.getBorderColor();
if (borderWidth > 0 && borderColor != 0) {
circleTransformation = new CircleBorderTransformation(borderWidth, borderColor);
} else {
circleTransformation = new CircleBorderTransformation();
}
} else if (loadOption.getRoundRadius() > 0) {
roundedCornersTransformation = new RoundedCornersTransformation(loadOption.getRoundRadius(), 0);
}
if (loadOption.getBlurRadius() > 0) {
blurTransformation = new BlurTransformation(loadOption.getBlurRadius());
}
if (loadOption.isGray()) {
grayscaleTransformation = new GrayscaleTransformation();
}
MultiTransformation multiTransformation = getMultiTransformation(circleTransformation, roundedCornersTransformation, blurTransformation, grayscaleTransformation);
if (multiTransformation != null)
requestOptions.transform(multiTransformation);
}
return requestBuilder.apply(requestOptions);
}
use of jp.wasabeef.glide.transformations.BlurTransformation in project CloudReader by youlookwhat.
the class SlideShadeViewActivity method setData.
/**
* 加载titlebar背景
*/
private void setData() {
if (subjectsBean != null) {
// 高斯模糊背景 原来 参数:12,5 23,4
Glide.with(this).load(subjectsBean.getImages().getLarge()).error(R.drawable.stackblur_default).bitmapTransform(new BlurTransformation(this, 23, 4)).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) {
binding.titleToolBar.setBackgroundColor(Color.TRANSPARENT);
binding.ivTitleHeadBg.setImageAlpha(0);
binding.ivTitleHeadBg.setVisibility(View.VISIBLE);
return false;
}
}).into(binding.ivTitleHeadBg);
}
}
Aggregations