Search in sources :

Example 11 with RequestListener

use of com.bumptech.glide.request.RequestListener 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);
    }
}
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

RequestListener (com.bumptech.glide.request.RequestListener)11 Target (com.bumptech.glide.request.target.Target)11 GlideDrawable (com.bumptech.glide.load.resource.drawable.GlideDrawable)8 BlurTransformation (jp.wasabeef.glide.transformations.BlurTransformation)4 Animator (android.animation.Animator)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 ObjectAnimator (android.animation.ObjectAnimator)2 ValueAnimator (android.animation.ValueAnimator)2 Bitmap (android.graphics.Bitmap)2 ColorMatrixColorFilter (android.graphics.ColorMatrixColorFilter)2 Drawable (android.graphics.drawable.Drawable)2 View (android.view.View)2 DataSource (com.bumptech.glide.load.DataSource)2 GlideException (com.bumptech.glide.load.engine.GlideException)2 ClipData (android.content.ClipData)1 ClipboardManager (android.content.ClipboardManager)1 Context (android.content.Context)1 Nullable (android.support.annotation.Nullable)1 RecyclerView (android.support.v7.widget.RecyclerView)1 ViewGroup (android.view.ViewGroup)1