use of com.bumptech.glide.request.RequestOptions in project GestureViews by alexvasilkov.
the class GlideHelper method loadFull.
/**
* Loads thumbnail and then replaces it with full image.
*/
public static void loadFull(ImageView image, int imageId, int thumbId) {
// We don't want Glide to crop or resize our image
final RequestOptions options = new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE).override(Target.SIZE_ORIGINAL).dontTransform();
final RequestBuilder<Drawable> thumbRequest = Glide.with(image).load(thumbId).apply(options);
Glide.with(image).load(imageId).apply(options).thumbnail(thumbRequest).into(image);
}
use of com.bumptech.glide.request.RequestOptions in project GestureViews by alexvasilkov.
the class DemoGlideHelper method loadFlickrFull.
public static void loadFlickrFull(Photo photo, ImageView image, LoadingListener listener) {
final RequestOptions options = new RequestOptions().diskCacheStrategy(DiskCacheStrategy.DATA).override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).dontTransform();
final RequestBuilder<Drawable> thumbRequest = Glide.with(image).load(photo.getMediumUrl()).apply(options);
Glide.with(image).load(photo.getLarge1600Url()).apply(new RequestOptions().apply(options).placeholder(image.getDrawable())).thumbnail(thumbRequest).listener(new RequestListenerWrapper<>(listener)).into(image);
}
use of com.bumptech.glide.request.RequestOptions in project PhotoPicker by donglua.
the class PhotoGridAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final PhotoViewHolder holder, int position) {
if (getItemViewType(position) == ITEM_TYPE_PHOTO) {
List<Photo> photos = getCurrentPhotos();
final Photo photo;
if (showCamera()) {
photo = photos.get(position - 1);
} else {
photo = photos.get(position);
}
boolean canLoadImage = AndroidLifecycleUtils.canLoadImage(holder.ivPhoto.getContext());
if (canLoadImage) {
final RequestOptions options = new RequestOptions();
options.centerCrop().dontAnimate().override(imageSize, imageSize).placeholder(R.drawable.__picker_ic_photo_black_48dp).error(R.drawable.__picker_ic_broken_image_black_48dp);
glide.setDefaultRequestOptions(options).load(new File(photo.getPath())).thumbnail(0.5f).into(holder.ivPhoto);
}
final boolean isChecked = isSelected(photo);
holder.vSelected.setSelected(isChecked);
holder.ivPhoto.setSelected(isChecked);
holder.ivPhoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (onPhotoClickListener != null) {
int pos = holder.getAdapterPosition();
if (previewEnable) {
onPhotoClickListener.onClick(view, pos, showCamera());
} else {
holder.vSelected.performClick();
}
}
}
});
holder.vSelected.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int pos = holder.getAdapterPosition();
boolean isEnable = true;
if (onItemCheckListener != null) {
isEnable = onItemCheckListener.onItemCheck(pos, photo, getSelectedPhotos().size() + (isSelected(photo) ? -1 : 1));
}
if (isEnable) {
toggleSelection(photo);
notifyItemChanged(pos);
}
}
});
} else {
holder.ivPhoto.setImageResource(R.drawable.__picker_camera);
}
}
use of com.bumptech.glide.request.RequestOptions in project DevRing by LJYcoder.
the class GlideManager method load.
private RequestBuilder load(RequestBuilder requestBuilder, LoadOption loadOption) {
RequestOptions requestOptions = new RequestOptions();
mImageConfig = DevRing.ringComponent().imageConfig();
// 使用全局的配置进行设置
if (loadOption == null) {
if (mImageConfig.isShowTransition()) {
requestBuilder.transition(DrawableTransitionOptions.withCrossFade(600));
}
if (mImageConfig.getLoadingResId() > 0) {
requestOptions.placeholder(mImageConfig.getLoadingResId());
}
if (mImageConfig.getErrorResId() > 0) {
requestOptions.error(mImageConfig.getErrorResId());
}
requestOptions.skipMemoryCache(!mImageConfig.isUseMemoryCache());
if (mImageConfig.isUseDiskCache()) {
requestOptions.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC);
} else {
requestOptions.diskCacheStrategy(DiskCacheStrategy.NONE);
}
} else // 使用临时的配置进行设置
{
if (loadOption.isShowTransition()) {
requestBuilder.transition(DrawableTransitionOptions.withCrossFade(600));
}
if (loadOption.getLoadingResId() > 0) {
requestOptions.placeholder(loadOption.getLoadingResId());
}
if (loadOption.getErrorResId() > 0) {
requestOptions.error(loadOption.getErrorResId());
}
requestOptions.skipMemoryCache(!loadOption.isUseMemoryCache());
if (loadOption.isUseDiskCache()) {
requestOptions.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC);
} else {
requestOptions.diskCacheStrategy(DiskCacheStrategy.NONE);
}
CircleBorderTransformation circleTransformation = null;
// CropCircleTransformation circleTransformation = null;
RoundedCornersTransformation roundedCornersTransformation = null;
BlurTransformation blurTransformation = null;
GrayscaleTransformation grayscaleTransformation = null;
if (loadOption.isCircle()) {
// circleTransformation = new CropCircleTransformation();
int borderWidth = loadOption.getBorderWidth();
int borderColor = loadOption.getBorderColor();
if (borderWidth > 0 && borderColor != 0) {
circleTransformation = new CircleBorderTransformation(borderWidth, borderColor);
} else {
circleTransformation = new CircleBorderTransformation();
}
} else if (loadOption.getRoundRadius() > 0) {
roundedCornersTransformation = new RoundedCornersTransformation(loadOption.getRoundRadius(), 0);
}
if (loadOption.getBlurRadius() > 0) {
blurTransformation = new BlurTransformation(loadOption.getBlurRadius());
}
if (loadOption.isGray()) {
grayscaleTransformation = new GrayscaleTransformation();
}
MultiTransformation multiTransformation = getMultiTransformation(circleTransformation, roundedCornersTransformation, blurTransformation, grayscaleTransformation);
if (multiTransformation != null)
requestOptions.transform(multiTransformation);
}
return requestBuilder.apply(requestOptions);
}
use of com.bumptech.glide.request.RequestOptions in project CustomViews by AndroidStudy233.
the class GlideUtils method loadCircleImg.
public static void loadCircleImg(Context context, String imageUrl, ImageView targetIv) {
RequestOptions requestOptions = new RequestOptions();
requestOptions.error(R.drawable.pic_head_deauft);
requestOptions.circleCrop();
Glide.with(context).load(imageUrl).apply(requestOptions).into(targetIv);
}
Aggregations