本文整理汇总了Java中jp.wasabeef.glide.transformations.RoundedCornersTransformation类的典型用法代码示例。如果您正苦于以下问题:Java RoundedCornersTransformation类的具体用法?Java RoundedCornersTransformation怎么用?Java RoundedCornersTransformation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoundedCornersTransformation类属于jp.wasabeef.glide.transformations包,在下文中一共展示了RoundedCornersTransformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setImage
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@BindingAdapter(value = {"imageUrl", "defaultImg", "radius"}, requireAll = false)
public static void setImage(ImageView imageView, String imageUrl, Drawable defaultImg, int radius) {
DrawableRequestBuilder drawableTypeRequest = Glide.with(imageView.getContext()).load(imageUrl).crossFade();
if (defaultImg != null) {
drawableTypeRequest.placeholder(defaultImg).error(defaultImg);
} else {
drawableTypeRequest.placeholder(R.drawable.bg_defautl_imageview).error(R.drawable.bg_defautl_imageview);
}
if (radius > 0) {
drawableTypeRequest.bitmapTransform(new CenterCrop(imageView.getContext()),
new RoundedCornersTransformation(imageView.getContext(), PixelUtil.dp2px(radius), 0));
} else {
drawableTypeRequest.bitmapTransform(new CenterCrop(imageView.getContext()));
}
drawableTypeRequest.into(imageView);
}
示例2: loadRoundImage
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
/**
* 异步加载圆角图片, 使用 Glide 内置的圆角裁剪 —— bitmapTransform.
*
* 注意: bitmapTransform 与 外在的裁剪不兼容。即: https://github.com/wasabeef/glide-transformations/issues/54
*
* 1. 此时的 imageView 不能是自定义的圆角View.
* 2. scaleType 也不能设。
*
* 否则重复裁剪, 会有 bug.
*
* @param url 图片路径
* @param drawableId 占位图
* @param radiusPixels 圆角像素值
*/
public static void loadRoundImage(ImageView imageView, String url, int drawableId, int radiusPixels) {
if(imageView == null) {
Log.e(TAG, "loadRoundImage() -> imageView is null");
return;
}
Context context = imageView.getContext();
if(!isValid(context))
return ;
Glide.with(context)
.load(url)
.placeholder(drawableId)
.error(drawableId)
.bitmapTransform(
new CenterCrop(context),
new RoundedCornersTransformation(context, radiusPixels, 0)
)
.crossFade()
.into(imageView);
}
示例3: loadingImageWithRoundTransform
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
/**
* Using Glide to load image with round transform
*
* @param context {@link Context}
* @param imageView {@link ImageView}
* @param imagePath {@link String}
* @param isRoundTransform {@link Boolean}
*/
public static void loadingImageWithRoundTransform(final Context context,
final ImageView imageView,
final String imagePath,
final boolean isRoundTransform) {
DrawableRequestBuilder<String> request = Glide.with(context)
.load(imagePath)
.placeholder(R.drawable.image_placeholder);
if (isRoundTransform) {
RoundedCornersTransformation transformation = new RoundedCornersTransformation(context,
50, 0, RoundedCornersTransformation.CornerType.ALL);
request.bitmapTransform(transformation);
}
request.into(imageView);
}
示例4: loadWithRadiusPlaceHolder
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
public static void loadWithRadiusPlaceHolder(ImageView imageView, String url, int radius, @DrawableRes int placeHolder) {
Glide.with(imageView.getContext())
.load(url)
.bitmapTransform(new RoundedCornersTransformation(imageView.getContext(), radius, 0))
.placeholder(placeHolder == 0 ? R.drawable.ic_placeholder : placeHolder)
.into(imageView);
}
示例5: loadData
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
private void loadData(DataHolder dataHolder, ViewHolder holder, int position) {
SongInfo info = dataHolder.info;
final RoundedCornersTransformation rtf = new RoundedCornersTransformation(context, 15, 0);
final ImageView img = holder.image;
Glide.with(context)
.load(info.getAlbum_path())
.diskCacheStrategy(DiskCacheStrategy.RESULT)
.placeholder(R.drawable.default_song)
.bitmapTransform(rtf)
.crossFade()
.into(img);
String number = String.valueOf(position + 1);
holder.number.setText(number);
String name = info.getTitle();
holder.name.setText(name);
String arts = info.getArtist();
holder.arts.setText(arts);
String duration = StringUtils.getGenTimeMS((int) info.getDuration());
holder.duration.setText(duration);
if (multiselectionMode && checksIndex.contains(position)) {
holder.check.setChecked(true);
} else {
holder.check.setChecked(false);
}
bindStatAndColors(holder, position, dataHolder.isFavorite);
}
示例6: transformationsImage
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
public void transformationsImage(Context context, String url, ImageView imageView) {
Glide.with(context)
.load(url)
.error(R.mipmap.image_loading)
.placeholder(R.mipmap.image_loading)
.dontAnimate()
.bitmapTransform(new RoundedCornersTransformation(context, 100, 0))
.into(imageView);
}
示例7: onBindDataToView
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@Override
protected void onBindDataToView(CommonViewHolder holder, HomeModel.ApprecommendationBean bean, int position) {
ImageView image = (ImageView) holder.getView(R.id.live_item_image);
TextView count = (TextView) holder.getView(R.id.live_item_count);
ImageView avatar = (ImageView) holder.getView(R.id.live_item_avatar);
TextView nick = (TextView) holder.getView(R.id.live_item_nick);
TextView title = (TextView) holder.getView(R.id.live_item_title);
LinkObject link_object = bean.getLink_object();
Glide.with(mContext)
.load(link_object.getThumb())
.placeholder(R.mipmap.live_default)
.bitmapTransform(new RoundedCornersTransformation(mContext, ScreenUtil.dp2px(mContext, 5), 0))
.into(image);
int view = link_object.getView();
String text;
if (view > 10000) {
DecimalFormat decimalFormat = new DecimalFormat("#.#");
text = decimalFormat.format(view / (double) 10000) + "W";
} else {
text = String.valueOf(view);
}
count.setText(text);
Glide.with(mContext)
.load(link_object.getAvatar())
.placeholder(R.mipmap.img_touxiang_default)
.bitmapTransform(new CropCircleTransformation(mContext))
.into(avatar);
nick.setText(link_object.getNick());
title.setText(bean.getTitle());
}
示例8: onBindDataToView
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@Override
protected void onBindDataToView(CommonViewHolder holder, LinkObject linkObject, int position) {
ImageView image = (ImageView) holder.getView(R.id.live_item_image);
TextView count = (TextView) holder.getView(R.id.live_item_count);
ImageView avatar = (ImageView) holder.getView(R.id.live_item_avatar);
TextView nick = (TextView) holder.getView(R.id.live_item_nick);
TextView title = (TextView) holder.getView(R.id.live_item_title);
Glide.with(mContext)
.load(linkObject.getThumb())
.bitmapTransform(new RoundedCornersTransformation(mContext, ScreenUtil.dp2px(mContext, 5), 0))
.into(image);
int view = linkObject.getView();
String text;
if (view > 10000) {
DecimalFormat decimalFormat = new DecimalFormat("#.#");
text = decimalFormat.format(view / (double) 10000) + "W";
} else {
text = String.valueOf(view);
}
count.setText(text);
Glide.with(mContext)
.load(linkObject.getAvatar())
.placeholder(R.mipmap.img_touxiang_default)
.bitmapTransform(new CropCircleTransformation(mContext))
.into(avatar);
nick.setText(linkObject.getNick());
title.setText(linkObject.getTitle());
}
示例9: onBindDataToView
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@Override
protected void onBindDataToView(CommonViewHolder holder, CategoryModel categoryModel, int position) {
ImageView image = (ImageView) holder.getView(R.id.item_category_image);
TextView name = (TextView) holder.getView(R.id.item_category_name);
Glide.with(mContext)
.load(categoryModel.getThumb())
.bitmapTransform(new RoundedCornersTransformation(mContext, ScreenUtil.dp2px(mContext, 4), 0))
.into(image);
name.setText(categoryModel.getName());
}
示例10: setRoundImageFromUrl
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
/**
* display round image by url
* @param viewId view id
* @param url image url
* @return BaseRecyclerHolder
*/
public BaseRecyclerHolder setRoundImageFromUrl(int viewId, String url) {
ImageView view = getView(viewId);
Glide.with(mContext)
.load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.bitmapTransform(new RoundedCornersTransformation(mContext,
DensityUtil.dp2px(mContext, 2), 0))
.centerCrop()
.crossFade()
.into(view);
return this;
}
示例11: setRoundImageFromEntity
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
/**
* display round image by entity
* @param viewId view id
* @param entity image entity
* @return BaseRecyclerHolder
*/
public BaseRecyclerHolder setRoundImageFromEntity(int viewId, ImagesEntity entity) {
// get display image url according preference
String url = ImageUtil.getDisplayImage(mContext, entity);
ImageView view = getView(viewId);
Glide.with(mContext)
.load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.bitmapTransform(new RoundedCornersTransformation(mContext,
DensityUtil.dp2px(mContext, 2), 0))
.centerCrop()
.crossFade()
.into(view);
return this;
}
示例12: onCreate
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
placeholder = transformDrawable(
// has white background because it's not transparent, so rounding will be visible
ContextCompat.getDrawable(getContext(), R.drawable.glide_jpeg),
// transformation to be applied
new RoundedCornersTransformation(getContext(), 100, 0),
// size of the target in pixels
256
);
}
示例13: onBindViewHolder
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@Override
public void onBindViewHolder(TweetsArrayAdapter.ViewHolder holder, int position) {
Tweet tweet = mTweets.get(position);
holder.ivProfileImage.setImageResource(android.R.color.darker_gray);
Glide.with(holder.itemView.getContext())
.load(tweet.getUser().getProfileImageUrl())
.bitmapTransform(new RoundedCornersTransformation(holder.itemView.getContext(), 10, 0))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(holder.ivProfileImage);
holder.tvUserName.setText(tweet.getUser().getScreenName());
holder.tvTweetBody.setText(tweet.getStatus());
holder.tvRelativeTimestamp.setText(getRelativeTimeAgo(tweet.getCreatedAt()));
// Remove and hide image from item if re-used in the list view until a new image has loaded
holder.ivMedia.setImageDrawable(null);
holder.ivMedia.setVisibility(View.GONE);
if (tweet.getMediaUrl() != null) {
Glide.with(holder.itemView.getContext())
.load(tweet.getMediaUrl())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(holder.ivMedia);
holder.ivMedia.setVisibility(View.VISIBLE);
}
}
示例14: onBindViewHolder
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@Override
public void onBindViewHolder(FollowListViewHolder holder, int position) {
UserDMModel userProfileModel = userProfileModelList.get(position);
holder.tvName.setText(userProfileModel.getCurrentUserName());
holder.tvUsername.setText(userProfileModel.getCurrentUserId());
holder.tvDescription.setText(userProfileModel.getUserMessage());
Glide.with(context).load(userProfileModel.getCurrentUserProfileImage()).
bitmapTransform(new RoundedCornersTransformation(context,5,5)).into(holder.ivUserImage);
}
示例15: onBindViewHolder
import jp.wasabeef.glide.transformations.RoundedCornersTransformation; //导入依赖的package包/类
@Override
public void onBindViewHolder(FollowListViewHolder holder, int position) {
UserProfileModel userProfileModel = userProfileModelList.get(position);
holder.tvName.setText(userProfileModel.getCurrentUserName());
holder.tvUsername.setText(userProfileModel.getCurrentUserId());
holder.tvDescription.setText(userProfileModel.getUserProfileDescription());
Glide.with(context).load(userProfileModel.getCurrentUserProfile()).
bitmapTransform(new RoundedCornersTransformation(context,5,5)).into(holder.ivUserImage);
}