本文整理汇总了Java中com.bumptech.glide.Glide类的典型用法代码示例。如果您正苦于以下问题:Java Glide类的具体用法?Java Glide怎么用?Java Glide使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Glide类属于com.bumptech.glide包,在下文中一共展示了Glide类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initWith
import com.bumptech.glide.Glide; //导入依赖的package包/类
public void initWith(AddRequest item) {
AVUser avUser = item.getFromUser();
if (avUser != null) {
User user = UserBeanCacheHelper.AvUserToUser(avUser,new User());
nickTv.setText(user.getNick());
Glide.with(mAppCtx).load(user.getAvatar()).placeholder(R.drawable.default_avatar).into(iconIv);
infoTv.setText(mAppCtx.getText(R.string.preIntroduce)+user.getNick());
int status = item.getStatus();
if (status == AddRequest.STATUS_WAIT) {
acceptBtn.setSelected(false);
acceptBtn.setText(R.string.accept);
} else if (status == AddRequest.STATUS_DONE) {
acceptBtn.setSelected(true);
acceptBtn.setText(R.string.accepted);
}
}
}
示例2: getView
import com.bumptech.glide.Glide; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHoder viewHoder;
if(convertView ==null){
convertView = View.inflate(context, R.layout.net_video_item,null);
viewHoder = new ViewHoder();
viewHoder.iv_icon = (ImageView) convertView.findViewById(R.id.net_video_img);
viewHoder.tv_name = (TextView) convertView.findViewById(R.id.net_video_name);
viewHoder.tv_desc = (TextView) convertView.findViewById(R.id.net_video_desc);
convertView.setTag(viewHoder);
}else{
viewHoder = (ViewHoder) convertView.getTag();
}
SearchBean.ItemData mediaItem = mediaItems.get(position);
viewHoder.tv_name.setText(mediaItem.getItemTitle());
viewHoder.tv_desc.setText(mediaItem.getKeywords());
Glide.with(context).load(mediaItem.getItemImage().getImgUrl1())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.video_default)
.error(R.drawable.video_default)
.into(viewHoder.iv_icon);
return convertView;
}
示例3: updateAvatar
import com.bumptech.glide.Glide; //导入依赖的package包/类
private void updateAvatar(AVIMConversation conversation,ImageView avatarView) {
if(null != conversation) {
if(!conversation.isTransient() && conversation.getMembers().size() <= 2) {
ConversationUtils.getConversationPeerIcon(conversation, new AVCallback<String>() {
protected void internalDone0(String s, AVException e) {
if(null != e) {
NLog.e(TagUtil.makeTag(getClass()),"updateAvatar failed :",e);
}
if(!TextUtils.isEmpty(s)) {
Glide.with(HiTalkApplication.mAppContext).load(s).placeholder(R.drawable.default_avatar).into(avatarView);
} else {
avatarView.setImageResource(R.drawable.default_avatar);
}
}
});
} else {
avatarView.setImageResource(R.drawable.default_group_icon);
}
}
}
示例4: onBindViewHolder
import com.bumptech.glide.Glide; //导入依赖的package包/类
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
AllareasRankInfo.RankBean.ListBean listBean = allRanks.get(position);
itemViewHolder.mVideoTitle.setText(listBean.getTitle());
itemViewHolder.mVideoPlayNum.setText(String.valueOf(listBean.getPlay()));
itemViewHolder.mVideoReviewCount.setText(String.valueOf(listBean.getVideo_review()));
itemViewHolder.mUserName.setText(listBean.getAuthor());
itemViewHolder.mSortNum.setText(String.valueOf(position + 1));
setSortNumTextSize(itemViewHolder, position);
Glide.with(getContext())
.load(listBean.getPic())
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.bili_default_image_tv)
.dontAnimate()
.into(itemViewHolder.mVideoImg);
}
super.onBindViewHolder(holder, position);
}
示例5: instantiateItem
import com.bumptech.glide.Glide; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
// TODO Auto-generated method stub
View view = null;
view= inflater.inflate(R.layout.main_viewpager_popular, null);
ImageView img= (ImageView)view.findViewById(R.id.img_viewpager_childimage);
TextView maintext = (TextView)view.findViewById(R.id.text_viewpager_main);
TextView subtext = (TextView)view.findViewById(R.id.text_viewpager_sub);
Log.d("position", position+"");
maintext.setText(mDataset.get(position).getTitle());
subtext.setText(mDataset.get(position).getEng_title());
Log.d("image url", mDataset.get(position).getImage());
if(mDataset.get(position).getImage() == "NoImage"){
Glide.with(mContext).load(R.drawable.noimage).into(img);
} else {
String imgUrl = mDataset.get(position).getImage().substring(1, mDataset.get(position).getImage().length() - 1);
Log.d("image url2", imgUrl);
Glide.with(mContext).load(imgUrl).into(img);
}
container.addView(view);
return view;
}
示例6: updateMetadata
import com.bumptech.glide.Glide; //导入依赖的package包/类
private void updateMetadata(final Movie movie) {
final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder();
String title = movie.getTitle().replace("_", " -");
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title);
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE,
movie.getDescription());
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI,
movie.getCardImageUrl());
// And at minimum the title and artist for legacy support
metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, title);
metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, movie.getStudio());
Glide.with(this)
.load(Uri.parse(movie.getCardImageUrl()))
.asBitmap()
.into(new SimpleTarget<Bitmap>(500, 500) {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap);
mSession.setMetadata(metadataBuilder.build());
}
});
}
示例7: setImageOrSensitive
import com.bumptech.glide.Glide; //导入依赖的package包/类
private void setImageOrSensitive(String url, ImageView imageView, boolean sensitiveContent) {
if (!sensitiveContent) {
Glide
.with(parentCtx)
.load(url)
.crossFade()
.into(imageView);
} else {
imageView.setImageDrawable(new ColorDrawable(Color.GRAY));
}
imageView.setVisibility(View.VISIBLE);
}
示例8: generateImageThumbnail
import com.bumptech.glide.Glide; //导入依赖的package包/类
private static Bitmap generateImageThumbnail(Context context, MasterSecret masterSecret, Uri uri)
throws BitmapDecodingException
{
try {
int maxSize = context.getResources().getDimensionPixelSize(R.dimen.media_bubble_height);
return Glide.with(context)
.load(new DecryptableUri(masterSecret, uri))
.asBitmap()
.centerCrop()
.into(maxSize, maxSize)
.get();
} catch (InterruptedException | ExecutionException e) {
Log.w(TAG, e);
throw new BitmapDecodingException(e);
}
}
示例9: onBindViewHolder
import com.bumptech.glide.Glide; //导入依赖的package包/类
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
BangumiDetailsRecommendInfo.ResultBean.ListBean listBean = bangumiRecommends.get(position);
Glide.with(getContext())
.load(listBean.getCover())
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.bili_default_image_tv)
.dontAnimate()
.into(itemViewHolder.mImage);
itemViewHolder.mTitle.setText(listBean.getTitle());
itemViewHolder.mFollow.setText(
NumberUtil.converString(Integer.valueOf(listBean.getFollow())) + "人追番");
}
super.onBindViewHolder(holder, position);
}
示例10: renderData
import com.bumptech.glide.Glide; //导入依赖的package包/类
private void renderData(ProductDetailsViewState.DataState state) {
TransitionManager.beginDelayedTransition(rootView);
errorView.setVisibility(View.GONE);
loadingView.setVisibility(View.GONE);
detailsView.setVisibility(View.VISIBLE);
isProductInshoppingCart = state.getDetail().isInShoppingCart();
product = state.getDetail().getProduct();
price.setText("Price: $" + String.format(Locale.US, "%.2f", product.getPrice()));
description.setText(product.getDescription());
toolbar.setTitle(product.getName());
collapsingToolbarLayout.setTitle(product.getName());
if (isProductInshoppingCart) {
fab.setImageResource(R.drawable.ic_in_shopping_cart);
} else {
fab.setImageResource(R.drawable.ic_add_shopping_cart);
}
Glide.with(this)
.load(DependencyInjection.BASE_IMAGE_URL + product.getImage())
.centerCrop()
.into(backdrop);
}
示例11: setPicture
import com.bumptech.glide.Glide; //导入依赖的package包/类
/**
* 高斯背景图和一般图片
*/
private void setPicture() {
Glide.with(this)
.load(IMAGE_URL_LARGE)
.override((int) CommonUtils.getDimens(R.dimen.movie_detail_width), (int) CommonUtils.getDimens(R.dimen.movie_detail_height))
.into(binding.include.ivOnePhoto);
// "14":模糊度;"3":图片缩放3倍后再进行模糊
Glide.with(this)
.load(IMAGE_URL_MEDIUM)
.error(R.drawable.stackblur_default)
.placeholder(R.drawable.stackblur_default)
.crossFade(500)
.bitmapTransform(new BlurTransformation(this, 14, 3))
.into(binding.include.imgItemBg);
}
示例12: onBindViewHolder
import com.bumptech.glide.Glide; //导入依赖的package包/类
@Override
public void onBindViewHolder(StepHolder holder, int position) {
holder.mStep = mStepList.get(position);
holder.mBinding.cvStepItemHolder.setSelected(mSelectedPosition == position);
if(holder.mStep.getVideoURL()!=null && !holder.mStep.getVideoURL().matches("")) {
Glide.with(holder.itemView.getContext())
.load(holder.mStep.getThumbnailURL())
.placeholder(R.drawable.ic_videocam_black_24dp)
.error(R.drawable.ic_videocam_black_24dp)
.dontAnimate()
.into(holder.mBinding.ivStepItemVideoThumb);
} else {
holder.mBinding.ivStepItemVideoThumb.setImageResource(R.drawable.ic_videocam_off_black_24dp);
}
if(holder.mStep.getId() == 0)
holder.mBinding.tvStepListStepNumber.setText(" ");
else
holder.mBinding.tvStepListStepNumber.setText(String.valueOf(holder.mStep.getId()) + ": ");
holder.mBinding.tvStepListStepShortDesc.setText(holder.mStep.getShortDescription());
}
示例13: onBindViewHolder
import com.bumptech.glide.Glide; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
Contentlist contentlist= list.get(position);
// 随机高度, 模拟瀑布效果.
if (mHeights.size() <= position) {
mHeights.add((int) (100 + Math.random() * 300));
}
ViewGroup.LayoutParams lp = ((ViewHolder) holder).imageView.getLayoutParams();
lp.height = mHeights.get(position);
((ViewHolder) holder).imageView.setLayoutParams(lp);
Glide.with(UIcollector.getContext())
.load(contentlist.getList().get(0).getMiddle())
.override(300, 400)
.into(((ViewHolder) holder).imageView);
((ViewHolder) holder).imageView.setOnClickListener(view -> {
if (null != onItemClickListener) {
onItemClickListener.onItemClickListener(((ViewHolder) holder).imageView, position);
}
});
}
示例14: onBindViewHolder
import com.bumptech.glide.Glide; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder,int position){
//得到当前项DiseaseInfo实例
DiseaseInfo disease= myDiseaseInfoList.get(position);
//得到时间
holder.time.setText(disease.getInfoTime());
//得到疾病名称
holder.name.setText(disease.getDiseaseKind().getDiseaseName());
//得到疾病位置,精确到个位
int longitude=(int)disease.getLongitude();
int latitude=(int)disease.getLatitude();
String longitudeStr=String.valueOf(longitude);
String latitudeStr=String.valueOf(latitude);
holder.location.setText("("+longitudeStr+","+latitudeStr+")");
//得到疾病图片
Bitmap bm=PictureClass.StringToBitmap(disease.getPicture());
ByteArrayOutputStream baos=new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG,100,baos);
byte[] buff=baos.toByteArray();
Glide.with(mContext).load(buff).into(holder.disease_pic);
}
示例15: onBindViewHolder
import com.bumptech.glide.Glide; //导入依赖的package包/类
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
ActivityCenterInfo.ListBean listBean = activityCenters.get(position);
Glide.with(getContext())
.load(listBean.getCover())
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.bili_default_image_tv)
.dontAnimate()
.into(itemViewHolder.mImage);
itemViewHolder.mTitle.setText(listBean.getTitle());
if (listBean.getState() == 1) {
itemViewHolder.mState.setImageResource(R.drawable.ic_badge_end);
} else {
itemViewHolder.mState.setImageResource(R.drawable.ic_badge_going);
}
}
super.onBindViewHolder(holder, position);
}