本文整理汇总了Java中com.bumptech.glide.request.target.ImageViewTarget类的典型用法代码示例。如果您正苦于以下问题:Java ImageViewTarget类的具体用法?Java ImageViewTarget怎么用?Java ImageViewTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageViewTarget类属于com.bumptech.glide.request.target包,在下文中一共展示了ImageViewTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLoadFailed
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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;
}
示例2: onResourceReady
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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;
}
示例3: displayVideoThumbnail
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
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);
}
});
}
示例4: onException
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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;
}
示例5: onResourceReady
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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;
}
示例6: load
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
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);
}
});
}
示例7: showAvatar
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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);
});
}
});
}
示例8: instantiateItem
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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;
}
示例9: showArt
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
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);
});
}
});
}
}
示例10: showPlaylistArt
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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();
}
});
}
}
示例11: onBindViewHolder
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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);
}
});
}
}
示例12: convert
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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);
}
示例13: initData
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
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);
}
});
}
示例14: displayImage
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@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) {
}
});
}
示例15: loadAndCompressImage
import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
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);
}
});
}