本文整理汇总了Java中com.bumptech.glide.request.RequestOptions.circleCrop方法的典型用法代码示例。如果您正苦于以下问题:Java RequestOptions.circleCrop方法的具体用法?Java RequestOptions.circleCrop怎么用?Java RequestOptions.circleCrop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bumptech.glide.request.RequestOptions
的用法示例。
在下文中一共展示了RequestOptions.circleCrop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupGlideOptions
import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void setupGlideOptions() {
options = new RequestOptions();
if (isShapeCircle) {
if (Defaults.CIRCLE_RADIUS > 0) {
options.transforms(new CenterCrop(), new RoundedCorners(Defaults.CIRCLE_RADIUS));
} else {
options.circleCrop();
}
}
options.override(Defaults.IMAGE_HEIGHT, Defaults.IMAGE_HEIGHT);
options.placeholder(placeholder_image);
options.priority(Priority.HIGH);
}
示例2: setupGlideOptions
import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void setupGlideOptions() {
options = new RequestOptions();
int size;
if (isShapeCircle) {
if (Defaults.CIRCLE_RADIUS > 0) {
size = (int) (0.65 * Defaults.IMAGE_HEIGHT);
options.transforms(new CenterCrop(), new RoundedCorners(Defaults.CIRCLE_RADIUS));
} else {
size = Defaults.IMAGE_HEIGHT;
options.circleCrop();
}
} else {
size = (int) (0.65 * Defaults.IMAGE_HEIGHT);
}
options.override(size, size);
options.error(error_image);
options.priority(Priority.HIGH);
}
示例3: setImageUrl
import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
/**
* Reference : https://medium.com/fueled-android/data-binding-adapter-write-bind-repeat-50e9c64fe806
* Bind Glide with an ImageView.
*
* @param view the ImageView to bind to Glide.
* @param src The URL of the image to load.
* @param placeholder The placeholder icon.
* @param error The error icon.
* @param blurValue The blur radius value between 1 and 25.
* @param cropCircle Crop the image in a circle of not.
*/
@SuppressWarnings("unchecked")
@android.databinding.BindingAdapter(value = {"src", "placeholder", "error", "blur", "cropCircle"},
requireAll = false)
public void setImageUrl(ImageView view, String src, Drawable placeholder, Drawable error,
int blurValue, boolean cropCircle) {
Context ctx = view.getContext();
RequestOptions options = new RequestOptions();
RequestBuilder<Drawable> glideBuilder = requestManager.load(src);
if (placeholder != null) {
options.placeholder(placeholder);
}
if (error != null) {
options.error(error);
}
if (blurValue > 0) {
options.transform(new BlurTransformation(ctx, blurValue));
}
if (cropCircle) {
options.circleCrop();
}
glideBuilder
.apply(options)
.into(view);
}
示例4: GlideManager
import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
public GlideManager(Builder builder){
RequestOptions options = new RequestOptions()
.placeholder(builder.placeresid);
if (builder.eroorresid != 0){
options.error(builder.eroorresid);
}
switch (builder.type){
case BITMAP_SCAN_CENTERN:
options.centerCrop();
break;
case BITMAP_SCAN_FIT:
options.fitCenter();
break;
default:
break;
}
if (builder.setCircleCrop){
options.circleCrop();
}
if (builder.radius != 0){
options.transform(new RoundedCorners(builder.radius));
}
RequestBuilder requestBuilder = null;
requestBuilder = Glide.with(builder.context).load(builder.source);
if (builder.animtime > 0){
requestBuilder.transition(new DrawableTransitionOptions().crossFade(builder.animtime));
}
requestBuilder.apply(options)
.listener(new LoadListener())
.into(builder.imageView);
}