本文整理汇总了Java中com.bumptech.glide.load.resource.bitmap.FitCenter类的典型用法代码示例。如果您正苦于以下问题:Java FitCenter类的具体用法?Java FitCenter怎么用?Java FitCenter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FitCenter类属于com.bumptech.glide.load.resource.bitmap包,在下文中一共展示了FitCenter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createScaledBitmapInto
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
private static <T> Bitmap createScaledBitmapInto(Context context, T model, int width, int height)
throws BitmapDecodingException
{
final Bitmap rough = Downsampler.AT_LEAST.decode(getInputStreamForModel(context, model),
Glide.get(context).getBitmapPool(),
width, height,
DecodeFormat.PREFER_RGB_565);
final Resource<Bitmap> resource = BitmapResource.obtain(rough, Glide.get(context).getBitmapPool());
final Resource<Bitmap> result = new FitCenter(context).transform(resource, width, height);
if (result == null) {
throw new BitmapDecodingException("unable to transform Bitmap");
}
return result.get();
}
示例2: createScaledBitmapInto
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
private static <T> Bitmap createScaledBitmapInto(Context context, T model,
int width, int height)
throws BitmapDecodingException {
final Bitmap rough = Downsampler.AT_LEAST
.decode(getInputStreamForModel(context, model),
Glide.get(context).getBitmapPool(),
width, height, DecodeFormat.PREFER_RGB_565);
final Resource<Bitmap> resource = BitmapResource
.obtain(rough, Glide.get(context).getBitmapPool());
final Resource<Bitmap> result =
new FitCenter(context).transform(resource, width, height);
if (result == null) {
throw new BitmapDecodingException("unable to transform Bitmap");
}
return result.get();
}
示例3: convert
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
@Override
protected void convert(BaseBindHolder helper, WeatherDailyResponse.DailyResult.Daily item) {
ViewDataBinding binding = helper.getBinding();
binding.setVariable(BR.daily, item);
binding.executePendingBindings();
SuperTextView superTextView = helper.getView(R.id.super_item_daily);
ArmsUtils.INSTANCE.obtainArmsComponent(mContext).imageLoader()
.loadImage(mContext,
ImageConfigImpl.builder()
.url(String.format(Locale.CHINESE, Api.API_WEATHER_ICON_URL, item.getCodeDay()))
.placeholder(R.mipmap.ic_placeholder)
.errorPic(R.mipmap.weather_unknown)
.transformation(new FitCenter())
.imageView(superTextView.getRightIconIV())
.build());
}
示例4: load
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
@Override protected void load(Context context) throws Exception {
String urlString = "http://web.twisterrob.net/glide/1257_changing.php";
Glide
.with(this)
.load(new ForceLoadGlideUrl(urlString))
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
//.placeholder(R.drawable.glide_placeholder)
//.error(R.drawable.glide_error)
.listener(new LoggingListener<GlideUrl, GlideDrawable>("full"))
.thumbnail(Glide
.with(this)
.load(new CachedGlideUrl(urlString))
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.listener(new LoggingListener<GlideUrl, GlideDrawable>("thumbnail"))
.bitmapTransform(new FitCenter(context), new GrayscaleTransformation(context))
.sizeMultiplier(0.25f)
)
.into(imageView);
}
示例5: bind
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
void bind(ChatMessage message) {
nameView.setText(message.getUserName());
Context context = avatarView.getContext();
glide.load(message.getAvatarUrl())
.bitmapTransform(new FitCenter(context), new CropCircleTransformation(context))
.listener(new LoggingListener<String, GlideDrawable>())
.into(avatarView);
bindEmoticonMessage(messageView, message.getMessage());
}
示例6: load
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
@Override protected void load(Context context) throws Exception {
Glide
.with(context)
.load(R.drawable.glide)
.diskCacheStrategy(DiskCacheStrategy.NONE) // necessary only because I'm loading an APK resource
.skipMemoryCache(true) // remove in production, this is just there so it's reproducible quickly
.placeholder(R.drawable.glide_placeholder)
// delay to see what's going on, in normal usage replace this with .fitCenter()
.transform(new FitCenter(context), new DelayBitmapTransformation(1000))
.animate(new PaddingAnimationFactory<>(new DrawableCrossFadeFactory<GlideDrawable>(2000)))
.into(imageView)
;
}
示例7: fitCenter
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
public DrawableRequestBuilder<ModelType> fitCenter() {
return bitmapTransform(new FitCenter(glide.getBitmapPool()));
}
示例8: ImageLoader
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
/**
* Construct a standard ImageLoader object.
*/
public ImageLoader(Context context) {
requestManager = Glide.with(context);
mCenterCrop = new CenterCrop(Glide.get(context).getBitmapPool());
mFitCenter = new FitCenter(Glide.get(context).getBitmapPool());
}
示例9: optionalFitCenter
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
/**
* Applies {@link com.bumptech.glide.load.resource.bitmap.FitCenter} to all default types, and
* ignores unknown types.
*
* <p>This will override previous calls to {@link #dontTransform()}.
*
* @see #optionalTransform(Class, Transformation)
* @see #fitCenter()
*/
public RequestOptions optionalFitCenter() {
return optionalTransform(DownsampleStrategy.FIT_CENTER, new FitCenter());
}
示例10: fitCenter
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
/**
* Applies {@link FitCenter} to all default types and
* throws an exception if asked to transform an unknown type.
*
* <p>This will override previous calls to {@link #dontTransform()}.
*
* @see #transform(Class, Transformation)
* @see #optionalFitCenter()
*/
public RequestOptions fitCenter() {
return transform(DownsampleStrategy.FIT_CENTER, new FitCenter());
}
示例11: optionalFitCenter
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
/**
*
* Applies {@link FitCenter} and to all default types, {@link DownsampleStrategy#FIT_CENTER} to
* image types, and ignores unknown types.
*
* <p>This will override previous calls to {@link #dontTransform()} and previous calls to
* {@link #downsample(DownsampleStrategy)}.
*
* @see #optionalTransform(Class, Transformation)
* @see #fitCenter()
*/
@CheckResult
public RequestOptions optionalFitCenter() {
return optionalScaleOnlyTransform(DownsampleStrategy.FIT_CENTER, new FitCenter());
}
示例12: fitCenter
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
/**
* Applies {@link FitCenter} and to all default types, {@link DownsampleStrategy#FIT_CENTER} to
* image types, and throws an exception if asked to transform an unknown
* type.
*
* <p>This will override previous calls to {@link #dontTransform()} and previous calls to
* {@link #downsample(DownsampleStrategy)}.
*
* @see #transform(Class, Transformation)
* @see #optionalFitCenter()
*/
@CheckResult
public RequestOptions fitCenter() {
return scaleOnlyTransform(DownsampleStrategy.FIT_CENTER, new FitCenter());
}
示例13: fitCenter
import com.bumptech.glide.load.resource.bitmap.FitCenter; //导入依赖的package包/类
/**
* Transform images using {@link FitCenter}.
*
* @return This RequestBuilder
*/
public BitmapRequestBuilder<ModelType, TranscodeType> fitCenter() {
return transform(new FitCenter(bitmapPool));
}