@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if (holder instanceof BookCommentHolder) {
List<HotReview.Reviews> reviews = mHotView.getReviews();
Glide.with(UIUtils.getContext())
.load(EBookUtils.getImageUrl(reviews.get(position).getAuthor().getAvatar()))
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(((BookCommentHolder) holder).iv_avatar) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(UIUtils.getContext().getResources(), resource);
circularBitmapDrawable.setCircular(true);
((BookCommentHolder) holder).iv_avatar.setImageDrawable(circularBitmapDrawable);
}
});
((BookCommentHolder) holder).tv_user_name.setText(reviews.get(position).getAuthor().getNickname());
((BookCommentHolder) holder).ratingBar_hots.setRating((float) reviews.get(position).getRating());
((BookCommentHolder) holder).tv_comment_content.setText(reviews.get(position).getContent());
((BookCommentHolder) holder).tv_favorite_num.setText(reviews.get(position).getLikeCount() + "");
((BookCommentHolder) holder).tv_update_time.setText(reviews.get(position).getUpdated().split("T")[0]);
}
}
java类android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory的实例源码
EBookReviewsAdapter.java 文件源码
项目:MaterialHome
阅读 24
收藏 0
点赞 0
评论 0
BookReviewsAdapter.java 文件源码
项目:MaterialHome
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if (holder instanceof BookCommentHolder) {
List<BookReviewResponse> reviews = reviewsListResponse.getReviews();
Glide.with(UIUtils.getContext())
.load(reviews.get(position).getAuthor().getAvatar())
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(((BookCommentHolder) holder).iv_avatar) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(UIUtils.getContext().getResources(), resource);
circularBitmapDrawable.setCircular(true);
((BookCommentHolder) holder).iv_avatar.setImageDrawable(circularBitmapDrawable);
}
});
((BookCommentHolder) holder).tv_user_name.setText(reviews.get(position).getAuthor().getName());
if (reviews.get(position).getRating() != null) {
((BookCommentHolder) holder).ratingBar_hots.setRating(Float.valueOf(reviews.get(position).getRating().getValue()));
}
((BookCommentHolder) holder).tv_comment_content.setText(reviews.get(position).getSummary());
((BookCommentHolder) holder).tv_favorite_num.setText(reviews.get(position).getVotes() + "");
((BookCommentHolder) holder).tv_update_time.setText(reviews.get(position).getUpdated().split(" ")[0]);
}
}
SingleFriendActivity.java 文件源码
项目:ReactiveFB
阅读 30
收藏 0
点赞 0
评论 0
private void fillProfile(Profile value) {
Glide.with(this)
.load(value.getPicture())
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(imageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getResources(), resource);
circularBitmapDrawable.setCircular(true);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
result.setText(value.getName());
}
ProfileActivity.java 文件源码
项目:ReactiveFB
阅读 36
收藏 0
点赞 0
评论 0
private void fillProfile(Profile value) {
Glide.with(this)
.load(value.getPicture())
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(imageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getResources(), resource);
circularBitmapDrawable.setCircular(true);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
result.setText(value.getName());
}
ProfileFragment.java 文件源码
项目:bridddle-for-dribbble
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void showProfile(User user) {
Glide.with(getContext()).load(user.getAvatarUrl())
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(avatar) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getContext().getResources(), resource);
circularBitmapDrawable.setCircular(true);
avatar.setImageDrawable(circularBitmapDrawable);
}
});
name.setText(user.getName());
username.setText(user.getUsername());
shotCount.setText(String.valueOf(user.getShotsCount()));
followerCount.setText(String.valueOf(user.getFollowersCount()));
likesCount.setText(String.valueOf(user.getLikesReceivedCount()));
bio.setText(Html.fromHtml("Co-founder & designer of <a href=\\\"https://dribbble.com/dribbble\\\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist."));
}
CommentViewHolder.java 文件源码
项目:bridddle-for-dribbble
阅读 18
收藏 0
点赞 0
评论 0
public void bind(Comment comment) {
Glide.with(itemView.getContext()).load(comment.getUser().getAvatarUrl())
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(avatar) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(itemView.getContext().getResources(), resource);
circularBitmapDrawable.setCircular(true);
avatar.setImageDrawable(circularBitmapDrawable);
}
});
name.setText(comment.getUser().getName());
content.setText(comment.getBody());
LinkUtils.setTextWithLinks(content, comment.getBody());
time.setText(DateUtils.parse(comment.getCreatedAt()));
}
ImageCache.java 文件源码
项目:MyDebts
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void onResponse(Call call, Response response) throws IOException {
if (!response.isSuccessful()) {
return;
}
try(ResponseBody body = response.body()) {
Bitmap loaded = BitmapFactory.decodeStream(body.byteStream());
if (loaded == null) { // decode failed
return;
}
Bitmap scaled = Bitmap.createScaledBitmap(loaded, mCaller.getWidth(), mCaller.getHeight(), false);
RoundedBitmapDrawable rbd = RoundedBitmapDrawableFactory.create(mCaller.getContext().getResources(), scaled);
rbd.setCornerRadius(Math.max(scaled.getWidth(), scaled.getHeight()) / 2.0f);
setRetrieved(rbd);
ImageCache.getInstance(mCaller.getContext()).putCached(call.request().url().toString(), rbd);
mCaller.post(this);
}
}
FloatingView.java 文件源码
项目:FastAccess
阅读 25
收藏 0
点赞 0
评论 0
public void setupImageView() {
if (imageView != null) {
String path = PrefHelper.getString(PrefConstant.CUSTOM_ICON);
if (!InputHelper.isEmpty(path)) {
path = Uri.decode(PrefHelper.getString(PrefConstant.CUSTOM_ICON));
boolean fileExists = new File(path).exists();
if (fileExists) {
imageView.setImageDrawable(null);
Bitmap src = BitmapFactory.decodeFile(path);
if (src == null) {
imageView.setImageResource(R.drawable.ic_app_drawer_icon);
onMoving(false);
return;
}
RoundedBitmapDrawable dr = RoundedBitmapDrawableFactory.create(getResources(), src);
dr.setCornerRadius(Math.max(src.getWidth(), src.getHeight()) / 2.0f);
imageView.setImageDrawable(dr);
return;
}
}
imageView.setImageResource(R.drawable.ic_app_drawer_icon);
onMoving(false);
}
}
ArticleListFragment.java 文件源码
项目:android-design-template
阅读 24
收藏 0
点赞 0
评论 0
@Override
public View getView(int position, View convertView, ViewGroup container) {
if (convertView == null) {
convertView = LayoutInflater.from(getActivity()).inflate(R.layout.list_item_article, container, false);
}
final DummyContent.DummyItem item = (DummyContent.DummyItem) getItem(position);
((TextView) convertView.findViewById(R.id.article_title)).setText(item.title);
((TextView) convertView.findViewById(R.id.article_subtitle)).setText(item.author);
final ImageView img = (ImageView) convertView.findViewById(R.id.thumbnail);
Glide.with(getActivity()).load(item.photoId).asBitmap().fitCenter().into(new BitmapImageViewTarget(img) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
circularBitmapDrawable.setCircular(true);
img.setImageDrawable(circularBitmapDrawable);
}
});
return convertView;
}
HistoryItemView.java 文件源码
项目:365browser
阅读 13
收藏 0
点赞 0
评论 0
@Override
public void onLargeIconAvailable(Bitmap icon, int fallbackColor,
boolean isFallbackColorDefault) {
// TODO(twellington): move this somewhere that can be shared with bookmarks.
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(getItem().getUrl());
mIconImageView.setImageDrawable(new BitmapDrawable(getResources(), icon));
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(),
Bitmap.createScaledBitmap(icon, mDisplayedIconSize, mDisplayedIconSize, false));
roundedIcon.setCornerRadius(mCornerRadius);
mIconImageView.setImageDrawable(roundedIcon);
}
}