Search in sources :

Example 1 with BlurTransformation

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);
    }
}
Also used : BlurTransformation(jp.wasabeef.glide.transformations.BlurTransformation) Target(com.bumptech.glide.request.target.Target) RequestListener(com.bumptech.glide.request.RequestListener) GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable)

Example 2 with BlurTransformation

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);
        }
    }
}
Also used : BlurTransformation(jp.wasabeef.glide.transformations.BlurTransformation)

Example 3 with BlurTransformation

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);
    }
}
Also used : BlurTransformation(jp.wasabeef.glide.transformations.BlurTransformation) Target(com.bumptech.glide.request.target.Target) RequestListener(com.bumptech.glide.request.RequestListener) AnimationDrawable(android.graphics.drawable.AnimationDrawable) Drawable(android.graphics.drawable.Drawable) GlideException(com.bumptech.glide.load.engine.GlideException) Nullable(androidx.annotation.Nullable) DataSource(com.bumptech.glide.load.DataSource)

Example 4 with BlurTransformation

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);
}
Also used : BlurTransformation(jp.wasabeef.glide.transformations.BlurTransformation) RequestOptions(com.bumptech.glide.request.RequestOptions) CircleBorderTransformation(com.ljy.devring.image.support.CircleBorderTransformation) GrayscaleTransformation(jp.wasabeef.glide.transformations.GrayscaleTransformation) MultiTransformation(com.bumptech.glide.load.MultiTransformation) RoundedCornersTransformation(jp.wasabeef.glide.transformations.RoundedCornersTransformation)

Example 5 with BlurTransformation

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);
    }
}
Also used : BlurTransformation(jp.wasabeef.glide.transformations.BlurTransformation) Target(com.bumptech.glide.request.target.Target) RequestListener(com.bumptech.glide.request.RequestListener) GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable)

Aggregations

BlurTransformation (jp.wasabeef.glide.transformations.BlurTransformation)7 GlideDrawable (com.bumptech.glide.load.resource.drawable.GlideDrawable)4 RequestListener (com.bumptech.glide.request.RequestListener)4 Target (com.bumptech.glide.request.target.Target)4 Context (android.content.Context)1 AnimationDrawable (android.graphics.drawable.AnimationDrawable)1 Drawable (android.graphics.drawable.Drawable)1 Nullable (androidx.annotation.Nullable)1 DataSource (com.bumptech.glide.load.DataSource)1 MultiTransformation (com.bumptech.glide.load.MultiTransformation)1 GlideException (com.bumptech.glide.load.engine.GlideException)1 RequestOptions (com.bumptech.glide.request.RequestOptions)1 CircleBorderTransformation (com.ljy.devring.image.support.CircleBorderTransformation)1 ColorFilterTransformation (jp.wasabeef.glide.transformations.ColorFilterTransformation)1 CropTransformation (jp.wasabeef.glide.transformations.CropTransformation)1 GrayscaleTransformation (jp.wasabeef.glide.transformations.GrayscaleTransformation)1 RoundedCornersTransformation (jp.wasabeef.glide.transformations.RoundedCornersTransformation)1 Song (se.zinokader.spotiq.model.Song)1