Java 类com.bumptech.glide.load.resource.bitmap.FitCenter 实例源码

项目:PeSanKita-android    文件:BitmapUtil.java   
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();
}
项目:Nird2    文件:BitmapUtil.java   
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();
}
项目:Nird2    文件:BitmapUtil.java   
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();
}
项目:Cable-Android    文件:BitmapUtil.java   
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();
}
项目:MVVMArms    文件:WeatherDailyAdapter.java   
@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());
}
项目:glide-support    文件:TestFragment.java   
@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);
}
项目:Silence    文件:BitmapUtil.java   
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();
}
项目:glide-support    文件:HtmlChatAdapter.java   
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());
}
项目:glide-support    文件:TestFragment.java   
@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)
    ;
}
项目:saarang-iosched    文件:DrawableRequestBuilder.java   
public DrawableRequestBuilder<ModelType> fitCenter() {
    return bitmapTransform(new FitCenter(glide.getBitmapPool()));
}
项目:AppDevFestSudeste2015    文件:DrawableRequestBuilder.java   
public DrawableRequestBuilder<ModelType> fitCenter() {
    return bitmapTransform(new FitCenter(glide.getBitmapPool()));
}
项目:devfestnorte-app    文件:DrawableRequestBuilder.java   
public DrawableRequestBuilder<ModelType> fitCenter() {
    return bitmapTransform(new FitCenter(glide.getBitmapPool()));
}
项目:saarang-iosched    文件:DrawableRequestBuilder.java   
public DrawableRequestBuilder<ModelType> fitCenter() {
    return bitmapTransform(new FitCenter(glide.getBitmapPool()));
}
项目:v2ex    文件:ImageLoader.java   
/**
 * 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());
}
项目:GitHub    文件:RequestOptions.java   
/**
 * 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());
}
项目:GitHub    文件:RequestOptions.java   
/**
 * 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());
}
项目:GitHub    文件:RequestOptions.java   
/**
 *
 * 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());
}
项目:GitHub    文件:RequestOptions.java   
/**
 * 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());
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
/**
 * Transform images using {@link FitCenter}.
 *
 * @return This RequestBuilder
 */
public BitmapRequestBuilder<ModelType, TranscodeType> fitCenter() {
    return transform(new FitCenter(bitmapPool));
}
项目:AppDevFestSudeste2015    文件:BitmapRequestBuilder.java   
/**
 * Transform images using {@link FitCenter}.
 *
 * @return This RequestBuilder
 */
public BitmapRequestBuilder<ModelType, TranscodeType> fitCenter() {
    return transform(new FitCenter(bitmapPool));
}
项目:devfestnorte-app    文件:BitmapRequestBuilder.java   
/**
 * Transform images using {@link FitCenter}.
 *
 * @return This RequestBuilder
 */
public BitmapRequestBuilder<ModelType, TranscodeType> fitCenter() {
    return transform(new FitCenter(bitmapPool));
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
/**
 * Transform images using {@link FitCenter}.
 *
 * @return This RequestBuilder
 */
public BitmapRequestBuilder<ModelType, TranscodeType> fitCenter() {
    return transform(new FitCenter(bitmapPool));
}