Java 类com.bumptech.glide.request.target.ImageViewTarget 实例源码

项目:GitHub    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
    boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
  return false;
}
项目:GitHub    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onResourceReady(PictureDrawable resource, Object model,
    Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
  return false;
}
项目:GitHub    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
    boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
  return false;
}
项目:GitHub    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onResourceReady(PictureDrawable resource, Object model,
    Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
  return false;
}
项目:Android-MVVM-Example    文件:VideoListAdapter.java   
private void displayVideoThumbnail(ViewHolder h, Video v) {
    Glide.with(h.mThumbnail.getContext())
            .load(v.getThumbnailUrl())
            .centerCrop()
            .crossFade()
            .into(new ImageViewTarget<GlideDrawable>(h.mThumbnail) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    view.setImageDrawable(resource);
                }

                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    view.setImageResource(R.drawable.ic_photo_grey600_48dp);
                }
            });
}
项目:react-native-fast-image    文件:FastImageViewManager.java   
@Override
public boolean onException(
        Exception e,
        GlideUrl uri,
        Target<GlideDrawable> target,
        boolean isFirstResource
) {
    OkHttpProgressGlideModule.forget(uri.toStringUrl());
    if (!(target instanceof ImageViewTarget)) {
        return false;
    }
    ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
    ThemedReactContext context = (ThemedReactContext) view.getContext();
    RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
    int viewId = view.getId();
    eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
    return false;
}
项目:react-native-fast-image    文件:FastImageViewManager.java   
@Override
public boolean onResourceReady(
        GlideDrawable resource,
        GlideUrl uri,
        Target<GlideDrawable> target,
        boolean isFromMemoryCache,
        boolean isFirstResource
) {
    if (!(target instanceof ImageViewTarget)) {
        return false;
    }
    ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
    ThemedReactContext context = (ThemedReactContext) view.getContext();
    RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
    int viewId = view.getId();
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, new WritableNativeMap());
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
    return false;
}
项目:UiLib    文件:TestPhotoViewActivity.java   
private void load(int position) {
    Glide.with(this).load(testPhoto.get(position))
            .asBitmap()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(new ImageViewTarget<Bitmap>(photoView) {


                @Override
                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    super.onLoadFailed(e, errorDrawable);
                    Toast.makeText(TestPhotoViewActivity.this, "load fail", Toast.LENGTH_SHORT).show();
                }


                @Override
                protected void setResource(Bitmap resource) {
                    getView().setImageBitmap(resource);
                }
            });

}
项目:Melophile    文件:PersonFragment.java   
@Override
public void showAvatar(String avatarUrl) {
    this.avatarUrl=avatarUrl;
    Glide.with(getContext())
            .load(avatarUrl)
            .asBitmap()
            .priority(Priority.IMMEDIATE)
            .into(new ImageViewTarget<Bitmap>(avatar) {
                @Override
                protected void setResource(Bitmap resource) {
                    avatar.setImageBitmap(resource);
                    avatar.post(()->{
                        media.post(()->{
                            View blank = adapter.getBlank();
                            ViewGroup.LayoutParams params = blank.getLayoutParams();
                            params.height = followers.getTop()+followers.getHeight()
                                    +2*getResources().getDimensionPixelOffset(R.dimen.spacing_large);
                            blank.setLayoutParams(params);
                        });
                        media.setVisibility(View.INVISIBLE);
                        getActivity().supportStartPostponedEnterTransition();
                        presenter.start(id);
                    });
                }
            });
}
项目:Melophile    文件:AlbumAdapter.java   
@Override
public View instantiateItem(ViewGroup container, int position) {
    View view=inflater.inflate(R.layout.adapter_album,container,false);
    ImageView image= ButterKnife.findById(view,R.id.image);

    Glide.with(container.getContext())
            .load(albums.get(position).getArtworkUrl())
            .asBitmap()
            .priority(Priority.IMMEDIATE)
            .diskCacheStrategy(DiskCacheStrategy.RESULT)
            .into(new ImageViewTarget<Bitmap>(image) {
                @Override
                protected void setResource(Bitmap resource) {
                    image.setImageBitmap(resource);
                    if (position == current && !isLoaded) {
                        isLoaded = true;
                        if (callback != null) {
                            callback.onTransitionImageLoaded(image,resource);
                        }
                    }
                }
            });
    container.addView(view);
    return view;
}
项目:Melophile    文件:TrackFragment.java   
public void showArt(String artUrl){
    if(!TextUtils.equals(lastArtUrl,artUrl)) {
        lastArtUrl=artUrl;
        Glide.with(getContext())
                .load(artUrl)
                .asBitmap()
                .priority(Priority.IMMEDIATE)
                .into(new ImageViewTarget<Bitmap>(smallImage) {
                    @Override
                    protected void setResource(Bitmap resource) {
                        smallImage.setImageBitmap(resource);
                        smallImage.post(()->{
                            Blurry.with(getContext())
                                    .async(bitmap->{
                                        background.setImageDrawable(bitmap);
                                        getActivity().supportStartPostponedEnterTransition();
                                    })
                                    .from(resource)
                                    .into(background);
                        });
                    }
                });
    }
}
项目:Melophile    文件:PlaylistFragment.java   
@Override
public void showPlaylistArt(String artUrl) {
    if(!loaded) {
        loaded=true;
        Glide.with(getContext())
                .load(artUrl)
                .asBitmap()
                .priority(Priority.IMMEDIATE)
                .into(new ImageViewTarget<Bitmap>(playlistArt) {
                    @Override
                    protected void setResource(Bitmap resource) {
                        final int imageHeight=playlistArt.getHeight();
                        playlistArt.setImageBitmap(resource);
                        parent.setStaticOffset(imageHeight);
                        parent.setOffset(imageHeight);
                        toggle.setStaticOffset(imageHeight- toggle.getHeight()/2);
                        toggle.setOffset(imageHeight- toggle.getHeight()/2);
                        toggle.setMinOffset(ViewCompat.getMinimumHeight(playlistArt)- toggle.getHeight()/2);
                        tracks.addOnScrollListener(listener);
                        tracks.setOnFlingListener(flingListener);
                        new Palette.Builder(resource).generate(PlaylistFragment.this::applyPalette);
                        getActivity().supportStartPostponedEnterTransition();
                    }
                });
    }
}
项目:Hillffair    文件:SponsorAdapter.java   
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    if(!(sponsorItemArrayList.get(position).sponsor_name.isEmpty())){
        holder.sponsorname.setText(sponsorItemArrayList.get(position).sponsor_name);
    }

    if(!(sponsorItemArrayList.get(position).image_id==null)){
       // holder.sponsorimage.setImageResource(sponsorItemArrayList.get(position).image_id);
        Glide.with(context).load(sponsorItemArrayList.get(position).image_id).asBitmap().diskCacheStrategy(DiskCacheStrategy.ALL).into(new ImageViewTarget<Bitmap>(holder.sponsorimage) {
            @Override
            protected void setResource(Bitmap resource) {
                RoundedBitmapDrawable drawable= RoundedBitmapDrawableFactory.create(context.getResources(),resource);
                drawable.setCircular(false);
                holder.sponsorimage.setImageDrawable(drawable);
            }
        });
    }
}
项目:MeiZiNews    文件:ImageAdapter.java   
@Override
    protected void convert(final BaseAdapterHelper helper, T item, int position) {
        final RadioImageView story_img = (RadioImageView) helper.getView(R.id.story_img);
        TextView story_title = helper.getTextView(R.id.story_item_title);

        story_title.setText(item.getStory_title());
        Glide.with(helper.itemView.getContext())
                .load(item.getImgUrl())
//                                //设置占位图或者加载错误图:
//                        .placeholder(R.drawable.ic_sun_smile)
//                        .error(R.drawable.ic_cloud_sad)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new ImageViewTarget<GlideDrawable>(story_img) {
                    @Override
                    protected void setResource(GlideDrawable resource) {

                        story_img.setOriginalSize(resource.getIntrinsicWidth(), resource.getIntrinsicHeight());
                        story_img.setImageDrawable(resource);
                    }
                });

        helper.itemView.setTag(position);
    }
项目:likequanmintv    文件:VerFullLiveUI.java   
private void initData() {
    if (mPlayBean!=null){
        livePlayerPresenterImpl.enterRoom(mPlayBean.uid);
    }

    Glide.with(this)
            .load(mPlayBean.love_cover)
            .into(new ImageViewTarget<GlideDrawable>(bgImg) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    bgImg.setImageDrawable(resource);
                    Blurry.with(VerFullLiveUI.this)
                            .animate()
                            .radius(10)
                            .sampling(8)
                            .capture(bgImg)
                            .into(bgImg);
                }
            });
}
项目:GeneqiaoGallery    文件:GlideImageLoader.java   
@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, Drawable defaultDrawable, int width, int height) {
    Glide.with(activity)
            .load("file://" + path)
            .placeholder(defaultDrawable)
            .error(defaultDrawable)
            .override(width, height)
            .diskCacheStrategy(DiskCacheStrategy.NONE) //不缓存到SD卡
            .skipMemoryCache(true)
            //.centerCrop()
            .into(new ImageViewTarget<GlideDrawable>(imageView) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    imageView.setImageDrawable(resource);
                }

                @Override
                public void setRequest(Request request) {
                }
            });
}
项目:GeekZone    文件:BaseAdapter.java   
protected void loadAndCompressImage(String url, ImageView view) {
    getRequestManager()
            .load(url)
            .downloadOnly(new ImageViewTarget<File>(view) {
                @Override
                protected void setResource(File resource) {
                    Bitmap bitmap = ImageUtils.resizeBitmap(resource, view.getWidth(), view.getHeight());
                    view.setImageBitmap(bitmap);
                }
            });
}
项目:LoginConcept    文件:LoginActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);
    final AnimatedViewPager pager= ButterKnife.findById(this,R.id.pager);
    final ImageView background=ButterKnife.findById(this,R.id.scrolling_background);
    int[] screenSize=screenSize();

    for(ImageView element:sharedElements){
        @ColorRes int color=element.getId()!=R.id.logo?R.color.white_transparent:R.color.color_logo_log_in;
        DrawableCompat.setTint(element.getDrawable(), ContextCompat.getColor(this,color));
    }
    //load a very big image and resize it, so it fits our needs
    Glide.with(this)
            .load(R.drawable.busy)
            .asBitmap()
            .override(screenSize[0]*2,screenSize[1])
            .diskCacheStrategy(DiskCacheStrategy.RESULT)
            .into(new ImageViewTarget<Bitmap>(background) {
                @Override
                protected void setResource(Bitmap resource) {
                    background.setImageBitmap(resource);
                    background.post(()->{
                        //we need to scroll to the very left edge of the image
                        //fire the scale animation
                        background.scrollTo(-background.getWidth()/2,0);
                        ObjectAnimator xAnimator=ObjectAnimator.ofFloat(background,View.SCALE_X,4f,background.getScaleX());
                        ObjectAnimator yAnimator=ObjectAnimator.ofFloat(background,View.SCALE_Y,4f,background.getScaleY());
                        AnimatorSet set=new AnimatorSet();
                        set.playTogether(xAnimator,yAnimator);
                        set.setDuration(getResources().getInteger(R.integer.duration));
                        set.start();
                    });
                    pager.post(()->{
                        AuthAdapter adapter = new AuthAdapter(getSupportFragmentManager(), pager, background, sharedElements);
                        pager.setAdapter(adapter);
                    });
                }
            });
}
项目:OzComicReader    文件:ComicAdapter.java   
@Override
public void onBindViewHolder(final ComicViewHolder holder, int position) {
    Comic comic = comics.get(position);

    holder.cardView.setVisibility(View.GONE);
    Glide.with(holder.cardView.getContext())
            .fromString()
            .asBitmap()
            .transcode(new PaletteBitmap.PaletteBitmapTranscoder(holder.cardView.getContext()), PaletteBitmap.class)
            .centerCrop()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .load(comic.getCoverPath())
            .into(new ImageViewTarget<PaletteBitmap>(holder.imageViewCover) {
                @Override
                protected void setResource(PaletteBitmap resource) {
                    super.view.setImageBitmap(resource.bitmap);
                    holder.cardView.setCardBackgroundColor(
                            Prefs.with(holder.cardView.getContext()).readBoolean(Constants.KEY_PREFERENCES_THEME)
                                    ? resource.palette.getMutedColor(Color.WHITE)
                                    : resource.palette.getLightMutedColor(Color.WHITE));
                    Palette.Swatch swatch =
                            Prefs.with(holder.cardView.getContext()).readBoolean(Constants.KEY_PREFERENCES_THEME)
                                    ? resource.palette.getMutedSwatch()
                                    : resource.palette.getLightMutedSwatch();
                    holder.imageViewDate.setColorFilter(swatch == null ? Color.DKGRAY : swatch.getTitleTextColor(), PorterDuff.Mode.SRC_IN);
                    holder.imageViewPages.setColorFilter(swatch == null ? Color.DKGRAY : swatch.getTitleTextColor(), PorterDuff.Mode.SRC_IN);
                    holder.cardView.setVisibility(View.VISIBLE);
                    holder.textViewTitle.setTextColor(swatch == null ? Color.DKGRAY : swatch.getTitleTextColor());
                    holder.textViewPages.setTextColor(swatch == null ? Color.DKGRAY : swatch.getTitleTextColor());
                    holder.textViewTimeStamp.setTextColor(swatch == null ? Color.DKGRAY : swatch.getTitleTextColor());
                }
            });

    holder.textViewTitle.setText(comic.getTitle());
    holder.textViewPages.setText(holder.textViewPages.getContext().getString(R.string.page_of, comic.getCurrentPage(), comic.getNumPages()));
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy");
    String date = simpleDateFormat.format(comic.getAddedTimeStamp());
    holder.textViewTimeStamp.setText(date);
}
项目:AmenEye    文件:GlideImageLoader.java   
@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, Drawable defaultDrawable, int width, int height) {
    Glide.with(activity)
            .load("file://" + path)
            .placeholder(defaultDrawable)
            .error(defaultDrawable)
            .override(width, height)
            .diskCacheStrategy(DiskCacheStrategy.NONE) //不缓存到SD卡
            .skipMemoryCache(true)
            //.centerCrop()
            .into(new ImageViewTarget<GlideDrawable>(imageView) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    imageView.setImageDrawable(resource);
                }

                @Override
                public void setRequest(Request request) {
                    imageView.setTag(mTag, request);
                }

                @Override
                public Request getRequest() {
                    return (Request) imageView.getTag(mTag);
                }
            })
    ;
}
项目:GalleryFinal-master    文件:GlideImageLoader.java   
@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, Drawable defaultDrawable, int width, int height) {
    Glide.with(activity)
            .load("file://" + path)
            .placeholder(defaultDrawable)
            .error(defaultDrawable)
            .override(width, height)
            .diskCacheStrategy(DiskCacheStrategy.NONE) //不缓存到SD卡
            .skipMemoryCache(true)
            //.centerCrop()
            .into(new ImageViewTarget<GlideDrawable>(imageView) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    imageView.setImageDrawable(resource);
                }

                @Override
                public void setRequest(Request request) {
                    imageView.setTag(R.id.adapter_item_tag_key,request);
                }

                @Override
                public Request getRequest() {
                    return (Request) imageView.getTag(R.id.adapter_item_tag_key);
                }
            });
}
项目:udacity-p3    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    return false;
}
项目:udacity-p3    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onResourceReady(PictureDrawable resource, T model, Target<PictureDrawable> target,
                               boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
项目:MeiZiNews    文件:XmTvClassificationAdapter.java   
@Override
protected void convert(BaseAdapterHelper helper, final Items item, int position) {
    final RadioImageView story_img = (RadioImageView) helper.getView(R.id.story_img);
    TextView story_title = helper.getTextView(R.id.story_item_title);

    story_title.setText(item.getName());
    Glide.with(helper.itemView.getContext())
            .load(item.getPictures().getImg())
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(new ImageViewTarget<GlideDrawable>(story_img) {
                @Override
                protected void setResource(GlideDrawable resource) {

                    story_img.setOriginalSize(resource.getIntrinsicWidth(), resource.getIntrinsicHeight());
                    story_img.setImageDrawable(resource);
                }
            });

    helper.itemView.setTag(position);

    helper.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();

            intent.putExtra("title", item.getName());

            intent.setClass(context, M3u8VideoActivity.class);
            intent.putExtra("type", VideoApi.TYPE_XM);
            intent.putExtra("roomid", item.getId());

            context.startActivity(intent);
        }
    });
}
项目:AndroidBaseApplication    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onException (Exception e, Object model, Target target, boolean isFirstResource)
{
    ImageView view = (( ImageViewTarget<?> ) target).getView( );
    if ( Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT )
    {
        view.setLayerType( ImageView.LAYER_TYPE_NONE, null );
    }
    return false;
}
项目:AndroidBaseApplication    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onResourceReady (PictureDrawable resource, T model, Target<PictureDrawable>
        target, boolean isFromMemoryCache, boolean isFirstResource)
{
    ImageView view = (( ImageViewTarget<?> ) target).getView( );
    if ( Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT )
    {
        view.setLayerType( ImageView.LAYER_TYPE_SOFTWARE, null );
    }
    return false;
}
项目:stepik-android    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onException(Exception e, Uri model, Target<PictureDrawable> target, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    return false;
}
项目:stepik-android    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onResourceReady(PictureDrawable resource, Uri model, Target<PictureDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
项目:LoyalNativeSlider    文件:LoyalUtil.java   
public static void hybridImplementation(String u, final ImageView target, Context context, final Runnable callback) {
    if (u.contains(".gif")) {
        Glide.with(context).asGif().load(u)
                .apply(getOpt())
                .into(new ImageViewTarget<GifDrawable>(target) {
                    @Override
                    protected void setResource(GifDrawable resource) {
                        target.setImageDrawable(resource);
                        callback.run();
                    }
                });
    } else {
        picassoImplementation(u, target, context, callback);
    }
}
项目:incubator-taverna-mobile    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target,
                           boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    return false;
}
项目:incubator-taverna-mobile    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onResourceReady(PictureDrawable resource, T model
        , Target<PictureDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
项目:xamoom-android-sdk    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    e.printStackTrace();
    return false;
}
项目:xamoom-android-sdk    文件:SvgSoftwareLayerSetter.java   
@Override
public boolean onResourceReady(PictureDrawable resource, T model, Target<PictureDrawable> target,
                               boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
项目:GalleryFinal    文件:GlideImageLoader.java   
@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, Drawable defaultDrawable, int width, int height) {
    Glide.with(activity)
            .load("file://" + path)
            .placeholder(defaultDrawable)
            .error(defaultDrawable)
            .override(width, height)
            .diskCacheStrategy(DiskCacheStrategy.NONE) //不缓存到SD卡
            .skipMemoryCache(true)
            //.centerCrop()
            .into(new ImageViewTarget<GlideDrawable>(imageView) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    imageView.setImageDrawable(resource);
                }

                @Override
                public void setRequest(Request request) {
                    imageView.setTag(R.id.adapter_item_tag_key,request);
                }

                @Override
                public Request getRequest() {
                    return (Request) imageView.getTag(R.id.adapter_item_tag_key);
                }
            });
}
项目:TWiStErRob    文件:MainActivity.java   
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target,
        boolean isFromMemoryCache, boolean isFirstResource) {
    ImageViewTarget<GlideDrawable> image_target = (ImageViewTarget<GlideDrawable>)target;
    Drawable current = image_target.getCurrentDrawable();

    if (last != null) {
        TransitionDrawable transitionDrawable = new TransitionDrawable(new Drawable[]{current, resource});
        transitionDrawable.setCrossFadeEnabled(true);
        transitionDrawable.startTransition(1000);
        image_target.setDrawable(transitionDrawable);
    }
    last = resource;
    return true;
}
项目:Cinephilia    文件:mListAdapter.java   
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {

    String imageUrl = "http://image.tmdb.org/t/p/w185/" + mMovieList.get(position).getPoster();//+mImageList.get(position);
    String backDropPath= "http://image.tmdb.org/t/p/w342/" + mMovieList.get(position).getBackdrop(); //mImageListBackDrop.get(position);
    if(mMovieList.get(position).getPosterUrl(this.mAct) !=null || mMovieList.get(position).getBackdropUrl(this.mAct) !=null) {
        glideRequest
                .load(backDropPath)
                .diskCacheStrategy( DiskCacheStrategy.RESULT) //Storing only compressed images for saving disk space (Disc Cache)
                .into(new ImageViewTarget<PaletteBitmap>(holder.getImageView()) {
                    @Override protected void setResource(PaletteBitmap resource) {
                        super.view.setImageBitmap(resource.bitmap);
                        holder.setDarkColor(resource.palette.getDarkVibrantColor(defaultColor));
                        holder.setLightColor(resource.palette.getDarkMutedColor(defaultColor));
                        holder.getCardView().setCardBackgroundColor(holder.getDarkColor());
                        holder.getTitleView().setTextColor(ContextCompat.getColor(mAct, android.R.color.white));
                    }
                });
        Glide.with(mAct)
                .load(imageUrl)
                .diskCacheStrategy(DiskCacheStrategy.RESULT)
                .centerCrop()
                .crossFade()
                .into(holder.getmRoundedImageView());

    }
    else {
        //if json data contains nothing
        Glide.clear(holder.getImageView());
        Glide.clear(holder.getmRoundedImageView());
        holder.getImageView().setVisibility(View.GONE);
        holder.getmRoundedImageView().setVisibility(View.GONE);
    }
    holder.getTitleView().setText(mMovieList.get(position).getTitle());
    holder.getTitleView().setTextSize(15);

    if(mMovieList.get(position).getUserRating()!=null && mMovieList.get(position).getUserRating() !="0"){
        holder.getRatingValue().setText(mMovieList.get(position).getUserRating());
        holder.getmIcon().setImageResource(R.mipmap.ic_stars_white_18dp);
    }else{
        holder.getRatingValue().setText("Rating not available.");
        holder.getmIcon().setVisibility(View.GONE);
    }


    holder.getCardView().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(getItemClickListener != null) {
                getItemClickListener.getItemDetails(mMovieList.get(position).getId(),
                        mMovieList.get(position).getBackdrop(),
                        mMovieList.get(position).getTitle(),
                        holder.getDarkColor(),
                        holder.getLightColor());
            }
        }
    });
}