本文整理汇总了Java中com.bumptech.glide.request.target.GlideDrawableImageViewTarget类的典型用法代码示例。如果您正苦于以下问题:Java GlideDrawableImageViewTarget类的具体用法?Java GlideDrawableImageViewTarget怎么用?Java GlideDrawableImageViewTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GlideDrawableImageViewTarget类属于com.bumptech.glide.request.target包,在下文中一共展示了GlideDrawableImageViewTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showAdPacket
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
private void showAdPacket() {
adaptationADBanner();
Glide.with(mContext).load(mBannerUrl).into(new GlideDrawableImageViewTarget(mAdBg) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
mPresenter.sendADStatistics(RPConstant.STATISTICS_TYPE_VIEW_AD, mRedPacketInfo.redPacketId);
}
});
Glide.with(mContext).load(mRedPacketInfo.logoURL).transform(new CircleTransform(mContext)).into(mAdIcon);
mLayoutBom.setBackgroundColor(Color.parseColor(mRedPacketInfo.adBgColor));
mTVSponsor.setText(String.format(getString(R.string.money_sponsor_username_format), mRedPacketInfo.ownerName));
if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_RECEIVABLE) {//未领取
mTVMoney.setText(mRedPacketInfo.redPacketGreeting);
} else if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_RECEIVED) {//已被领取
//myAmount大于0,说明当前用户领取到了红包
if (Double.parseDouble(mRedPacketInfo.myAmount) > 0) {
receiveSuccess();
} else {//红包抢完了
redPacketOut(getString(R.string.money_is_out));
}
} else if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_EXPIRED) {//红包过期
redPacketOut(getString(R.string.ad_packet_out));
}
}
示例2: setImageViewUri
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
private void setImageViewUri(MasterSecret masterSecret, Uri uri) {
subsamplingImageView.setVisibility(View.GONE);
imageView.setVisibility(View.VISIBLE);
Glide.with(getContext())
.load(new DecryptableUri(masterSecret, uri))
.diskCacheStrategy(DiskCacheStrategy.NONE)
.dontTransform()
.dontAnimate()
.into(new GlideDrawableImageViewTarget(imageView) {
@Override protected void setResource(GlideDrawable resource) {
super.setResource(resource);
imageViewAttacher.update();
}
});
}
示例3: loadGif
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
/**
* 加载gif
*/
private void loadGif() {
Glide.with(ImageBrowseActivity.this)
.load(mImageUrl)
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(new GlideDrawableImageViewTarget(pvPic) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<?
super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
//在这里添加一些图片加载完成的操作
pbPicBrowse.setVisibility(View.GONE);
}
});
}
示例4: showPhoto
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
private void showPhoto() {
if (_photoUrl == null) {
getRandomPhoto();
}
if (_photoUrl == null) return;
String url = _photoUrl;
if (!_photoUrl.startsWith("http")) url = "file:" + url;
Glide
.with(getContext())
.load(url)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.into(new GlideDrawableImageViewTarget(_photoView));
_photoRepo.startPhotoView(_photoUrl);
}
示例5: loadImageWithProgress
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
/**
* 显示加载进度
*
* @param path 图片地址
* @param mImageView 图片控件
* @param loadView 加载view
*/
public static void loadImageWithProgress(String path, final ImageView mImageView, final View loadView, int errorRes) {
Glide.with(mImageView.getContext()).load(path).error(errorRes).into(new GlideDrawableImageViewTarget(mImageView) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
loadView.setVisibility(View.GONE);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
loadView.setVisibility(View.GONE);
}
});
}
示例6: onViewCreated
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
@Override
protected void onViewCreated(Bundle savedInstanceState) {
// 隐藏状态栏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
splashAdvEntity = (SplashAdvEntity) getIntent().getSerializableExtra("splashAdvEntity");
Glide.with(BaseApplication.getInstance())
.load(new File(splashAdvEntity.filePath))
.error(R.mipmap.firing_page)
.into(new GlideDrawableImageViewTarget(ivSplash) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
timer.schedule(task, 1000, 1000);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
toNext();
}
});
}
示例7: bind
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
public void bind(Shot shot, @DrawableRes int placeholderId) {
mGifLabel.setVisibility(shot.isAnimated() ? VISIBLE : INVISIBLE);
Glide.with(getContext())
.load(shot.getImages().getHighResImage())
.placeholder(placeholderId)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(new GlideDrawableImageViewTarget(mShotImageView) {
@Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
resource.stop();
}
@Override public void onStart() {}
@Override public void onStop() {}
});
}
示例8: loadResource
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
public static void loadResource(@DrawableRes int drawableId, @NonNull ImageView image) {
DisplayMetrics metrics = image.getResources().getDisplayMetrics();
final int w = metrics.widthPixels, h = metrics.heightPixels;
Glide.with(image.getContext())
.load(drawableId)
.animate(ANIMATOR)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(new GlideDrawableImageViewTarget(image) {
@Override
public void getSize(final SizeReadyCallback cb) {
// We don't want to load very big images on devices with small screens.
// This will help Glide correctly choose images scale when reading them.
super.getSize(new SizeReadyCallback() {
@Override
public void onSizeReady(int width, int height) {
cb.onSizeReady(w / 2, h / 2);
}
});
}
});
}
示例9: onCreateView
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.fragment_picture_slide,container,false);
imageView= (ImageView) v.findViewById(R.id.iv_main_pic);
mAttacher = new PhotoViewAttacher(imageView);
Glide.with(getActivity()).load(url).crossFade().into(new GlideDrawableImageViewTarget(imageView) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
mAttacher.update();
}
});
return v;
}
示例10: loadImage
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
/**
* Load the image in the view
*/
private void loadImage(){
if(TextUtils.isEmpty(mImageUrl)){
return;
}
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(mImageView);
Glide.with(mImageView.getContext())
.load(mImageUrl)
.listener(this)
.error(R.drawable.ic_error_white_24dp)
.into(imageViewTarget);
mImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
MediaContextDialog.openDialog(mImageView.getContext(), mWebsiteName, mCurrentAnecdote, mImageUrl, mImageView);
return true;
}
});
}
示例11: onActivityCreated
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final ListItem model = (ListItem)getArguments().getSerializable("model");
Glide
.with(this)
.using(new NetworkDisablingLoader<String>()) // TODO disables network for debug
.load(model.getStandardUrl())
.listener(new LoggingListener<String, GlideDrawable>())
.into(new GlideDrawableImageViewTarget(imageView) {
@Override public void onLoadFailed(Exception e, Drawable errorDrawable) {
Glide
.with(DetailFragment.this)
.using(new NetworkDisablingLoader<String>()) // TODO disables network for debug
.load(model.getLowUrl())
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.error(R.drawable.glide_error)
.listener(new LoggingListener<String, GlideDrawable>())
.into(imageView);
}
});
}
示例12: bind
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
private void bind(final ListItem model) {
bound = model;
Glide
.with(itemView.getContext())
.load(model.getLowUrl())
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.listener(new LoggingListener<String, GlideDrawable>())
.into(new GlideDrawableImageViewTarget(image) {
@Override public void onLoadFailed(Exception e, Drawable errorDrawable) {
Glide
.with(itemView.getContext())
.load(model.getThumbUrl())
.error(R.drawable.glide_error)
.listener(new LoggingListener<String, GlideDrawable>())
.into(image);
}
});
}
示例13: load
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
@Override protected void load(final Context context) throws Exception {
String url = "http://www.kizoa.com/img/e8nZC.gif";
Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.github_1261_nine_to_five);
if (drawable instanceof Animatable) {
((Animatable)drawable).stop();
((Animatable)drawable).start();
}
Glide
.with(this)
.load(url)
.placeholder(drawable)
.crossFade(3000)
.skipMemoryCache(true) // make sure the image is reloaded so the placeholder has a chance
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.bitmapTransform(DelayTransformation.<Bitmap>create(2000)) // debug lengthen decode to see placeholder
.listener(new LoggingListener<String, GlideDrawable>())
.into(new LoggingTarget<>(new GlideDrawableImageViewTarget(imageView)))
;
}
示例14: initPhoto
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
private void initPhoto() {
final ProgressBar progressBar = (ProgressBar) findViewById(R.id.photo_progressBar);
progressBar.setVisibility(View.VISIBLE);
ImageView img = (ImageView) findViewById(R.id.photo_img);
Glide.with(this)
.load(url)
.dontAnimate()
.fitCenter()
.into(new GlideDrawableImageViewTarget(img) {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
progressBar.setVisibility(View.GONE);
}
});
}
示例15: loadMainViewShotWithPlaceholderAndListener
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; //导入依赖的package包/类
public static void loadMainViewShotWithPlaceholderAndListener(Context context, ImageView placeholderView,
ImageView targetView, ShotImage shot,
RequestListener<String, GlideDrawable> requestListener) {
Glide.clear(targetView);
String imageUrl = getImageUrl(shot);
Glide.clear(placeholderView);
placeholderView.setVisibility(View.GONE);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(targetView);
Glide.with(context)
.load(imageUrl)
.listener(requestListener)
.placeholder(R.drawable.shot_placeholder)
.thumbnail(ShotLoadingUtil.getThumbnailRequest(context, shot.thumbnailUrl()))
.animate(android.R.anim.fade_in)
.into(imageViewTarget);
}