本文整理汇总了Java中com.bumptech.glide.request.target.BitmapImageViewTarget类的典型用法代码示例。如果您正苦于以下问题:Java BitmapImageViewTarget类的具体用法?Java BitmapImageViewTarget怎么用?Java BitmapImageViewTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BitmapImageViewTarget类属于com.bumptech.glide.request.target包,在下文中一共展示了BitmapImageViewTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayImage
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public void displayImage(final String uri, final ImageView imageView, int defaultIcon, final DisplayListener listener) {
GenericRequestBuilder req = Glide.with(imageView.getContext().getApplicationContext()).load(uri).asBitmap().diskCacheStrategy(mDiskCacheStrategy);
if (defaultIcon > 0) {
req.placeholder(defaultIcon);
}
req.into(new BitmapImageViewTarget(imageView) {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
super.onResourceReady(resource, glideAnimation);
if (listener != null) {
listener.onLoadCompleted(uri, imageView, resource);
}
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
if (listener != null) {
listener.onLoadFailed(uri, imageView);
}
}
});
}
示例2: loadRound
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public static void loadRound(final Context context, String url, final ImageView iv) {
Glide.with(context)//
.load(url)//
.asBitmap()//
.placeholder(R.drawable.company_logo)//
.centerCrop()//
.into(new BitmapImageViewTarget(iv) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(context.getResources(),
resource);
circularBitmapDrawable.setCircular(true);
iv.setImageDrawable(circularBitmapDrawable);
}
});
}
示例3: handleSignInResult
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
/**
* Handle a google signIn
* @param result - the result of the signin attempt
*/
private void handleSignInResult(GoogleSignInResult result) {
Log.d(TAG, "handleSignInResult:" + result.isSuccess());
final ImageView accountImageView = findViewById(R.id.account_picture);
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
if (acct != null) {
Glide.with(this).load(acct.getPhotoUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(accountImageView) {
/**
* Set a glide image
* @param resource - the image to set
*/
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), resource);
circularBitmapDrawable.setCircular(true);
accountImageView.setImageDrawable(circularBitmapDrawable);
}
});
}
}
}
示例4: loadRoundImage
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public void loadRoundImage(final Context context, String imgPath, final ImageView imageView, int placeholderResId, int failedResId) {
if (context == null) {
return;
}
Context appContext = context.getApplicationContext();
Glide.with(appContext).
load(imgPath)
.asBitmap()
.placeholder(placeholderResId)
.error(failedResId)
.centerCrop()
.into(new BitmapImageViewTarget(imageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(context.getResources(), resource);
circularBitmapDrawable.setCircular(true);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
}
示例5: showAvatar
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
/*****
* MVP View methods implementation
*****/
@Override public void showAvatar(String avatarUrl) {
if (avatarUrl.contains("gif")) {
Glide.with(this).load(avatarUrl).asGif().into(avatar);
} else {
Glide.with(this).load(avatarUrl).asBitmap().centerCrop().into(new BitmapImageViewTarget(avatar) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), resource);
circularBitmapDrawable.setCircular(true);
avatar.setImageDrawable(circularBitmapDrawable);
}
});
}
}
示例6: displayRoundImageFromUrl
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
/**
* Crops image into a circle that fits within the ImageView.
*/
public static void displayRoundImageFromUrl(final Context context, final String url, final ImageView imageView) {
Glide.with(context)
.load(url)
.asBitmap()
.centerCrop()
.dontAnimate()
.into(new BitmapImageViewTarget(imageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(context.getResources(), resource);
circularBitmapDrawable.setCircular(true);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
}
示例7: onBindViewHolder
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
@Override
public void onBindViewHolder(final AnchorHotViewHolder holder, final int position) {
ComMember member = mData.get(position);
if (StringUtils.isNotEmpty(member.getImageUrl())){
Glide.with(mContext).load(member.getImageUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(holder.pic) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
circularBitmapDrawable.setCircular(true);
holder.pic.setImageDrawable(circularBitmapDrawable);
}
});
}
}
示例8: setCircleInfo
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public void setCircleInfo(CircleInfo info) {
mTvCircleName.setText(info.getCircleName());
mTvTitle.setText(info.getCircleName());
mTvCircleNum.setText(info.getNum() + "人");
mTvIntroduce.setText(info.getAnnouncement());
String path = info.getLogoUrl();
if (!path.contains("http://")) {
path = BuildConfig.QiniuBase + path;
}
Glide.with(this.getActivity()).load(path).asBitmap().error(R.mipmap.icon_default_pic).centerCrop().into(new BitmapImageViewTarget(mImgTop) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
circularBitmapDrawable.setCircular(true);
mImgTop.setImageDrawable(circularBitmapDrawable);
}
});
}
示例9: setData
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public void setData(CircleInfo info)
{
Glide.with(this.getActivity()).load(info.getLogoUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(mImgPic) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
circularBitmapDrawable.setCircular(true);
mImgPic.setImageDrawable(circularBitmapDrawable);
}
});
mTvName.setText(info.getCircleName());
mEdtAnnouncement.setText(info.getAnnouncement());
// mTvType.setText();
}
示例10: onBindViewHolder
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
@Override
public void onBindViewHolder(final AnchorHotViewHolder holder, final int position) {
ProjectComments comments = mData.get(position);
if (comments != null) {
ComMember member = comments.getCommentUser();
if (null != member && StringUtils.isNotEmpty(member.getName())) {
holder.tvName.setText(member.getName());
}
if (StringUtils.isNotEmpty(member.getImageUrl())){
Glide.with(mContext).load(member.getImageUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(holder.pic) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
circularBitmapDrawable.setCircular(true);
holder.pic.setImageDrawable(circularBitmapDrawable);
}
});
}
}
holder.tvContent.setText(comments.getComment());
holder.tvTime.setText(TimeUtil.getDateToString(comments.getCreateTime()));
}
示例11: setUserInfo
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public void setUserInfo(ComMember member) {
if (member.getImageUrl() != null) {
Glide.with(this.getActivity()).load(member.getImageUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(imgPic) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
circularBitmapDrawable.setCircular(true);
imgPic.setImageDrawable(circularBitmapDrawable);
}
});
}
if (member.getName() != null)
tvName.setText(member.getName());
tv_center_shareholder.setVisibility(member.getShareholder() == 0 ? View.GONE : View.VISIBLE);
tv_center_investor.setVisibility(member.getInvestor() == 0 ? View.GONE : View.VISIBLE);
if (StringUtils.isNotEmpty(member.getCompany()))
tv_center_company.setText(member.getCompany());
if (StringUtils.isNotEmpty(member.getPosition()))
tv_center_position.setText(member.getPosition());
}
示例12: setData
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public void setData(ReciveRedPacket info,String name ,String tip) {
tv_money.setText(info.getMoney()+"");
String path = info.getImgUrl();
if (!path.contains("http://")){
path = BuildConfig.QiniuBase + path;
}
Glide.with(this.getActivity()).load(path).asBitmap().centerCrop().into(new BitmapImageViewTarget(img_icon) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
circularBitmapDrawable.setCircular(true);
img_icon.setImageDrawable(circularBitmapDrawable);
}
});
tv_name.setText(name+"的红包");
// EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
// Spannable span = EaseSmileUtils.getSmiledText(this.getActivity(), txtBody.getMessage());
// 设置内容
tv_tip.setText(tip);
}
示例13: requestCircleImg
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
/**
* 将url编程圆形的加载在 ImageView中
*/
public static void requestCircleImg(final Context context, String url, final ImageView imageView) {
Glide.with(context)
.load(url)
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(imageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(context.getResources(), resource);
circularBitmapDrawable.setCircular(true);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
}
示例14: setRightMessage
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
public void setRightMessage(Context context, String name, String message, String time, String avatar) {
layoutright.setVisibility(View.VISIBLE);
layoutLeft.setVisibility(View.GONE);
txtNameRight.setVisibility(View.GONE);
txtNameRight.setText(name);
txtMessageRight.setText(message);
txtTimeRight.setText(time);
Glide.with(context)
.load(avatar)
.asBitmap().centerCrop()
.placeholder(R.mipmap.ic_nfkita_round)
.into(new BitmapImageViewTarget(imgAvatar) {
@Override protected void setResource(Bitmap resource) {
RoundedBitmapDrawable rounded =
RoundedBitmapDrawableFactory.create(context.getResources(), resource);
rounded.setCircular(true);
imgAvatar.setImageDrawable(rounded);
}
});
}
示例15: loadData
import com.bumptech.glide.request.target.BitmapImageViewTarget; //导入依赖的package包/类
private void loadData() {
String avatar = CacheManager.grabString("avatar");
String name = CacheManager.grabString("name");
String email = CacheManager.grabString("email");
Glide.with(getContext())
.load(avatar)
.asBitmap().centerCrop()
.placeholder(R.mipmap.ic_nfkita_round)
.into(new BitmapImageViewTarget(imgAvatar) {
@Override protected void setResource(Bitmap resource) {
RoundedBitmapDrawable rounded =
RoundedBitmapDrawableFactory.create(getContext().getResources(), resource);
rounded.setCircular(true);
imgAvatar.setImageDrawable(rounded);
}
});
txtFullName.setText(name);
txtEmail.setText(email);
}