类com.bumptech.glide.load.MultiTransformation源码实例Demo

下面列出了怎么用com.bumptech.glide.load.MultiTransformation的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: AcgClub   文件: ScheduleNewAdapter.java
@Override
protected void convert(BaseViewHolder helper, ScheduleNewItem item) {
  helper.setText(R.id.schedule_new_title, item.getTitle())
      .setText(R.id.schedule_new_spot, item.getSpot())
      .setText(R.id.schedule_new_type, item.getType())
      .setText(R.id.schedule_new_desc, item.getDesc());
  mImageLoader.loadImage(getContext(),
      GlideImageConfig
          .builder()
          .url(item.getImgUrl())
          .transformation(
              new MultiTransformation<>(new CenterCrop(),
                  new RoundedCornersTransformation(DimenUtils.dpToPx(getContext(), 4), 0)))
          .imageView((ImageView) helper.getView(R.id.schedule_new_img))
          .build()
  );
}
 
源代码2 项目: Tok-Android   文件: ImageLoadUtils.java
public static void loadVideoMask(Context context, String path, ImageView imgView, int maskResId) {
    LogUtil.i(TAG, "loadMask video path:" + path);
    Glide.with(context)
        .setDefaultRequestOptions(getVideoOptions())
        .load(path)
        .apply(RequestOptions.bitmapTransform(
            new MultiTransformation<>(new CenterCrop(), new MaskTransformation(maskResId))))
        .thumbnail(THUMB_NAIL)
        .into(imgView);
}
 
源代码3 项目: Tok-Android   文件: ImageLoadUtils.java
public static void loadMask(Context context, String path, ImageView imgView, int maskResId) {
    LogUtil.i(TAG, "loadMask path:" + path);
    Glide.with(context)
        .setDefaultRequestOptions(getOptions())
        .load(path)
        .apply(RequestOptions.bitmapTransform(
            new MultiTransformation<>(new CenterCrop(), new MaskTransformation(maskResId))))
        .thumbnail(THUMB_NAIL)
        .into(imgView);
}
 
源代码4 项目: Tok-Android   文件: ImageLoadUtils.java
public static void loadRoundImg(Context context, int imgResId, ImageView imgView) {
    LogUtil.i(TAG, "loadMask imgResId:");
    Glide.with(context)
        .setDefaultRequestOptions(getPortraitOptions())
        .load(imgResId)
        .apply(RequestOptions.bitmapTransform(new MultiTransformation<>(new CenterCrop(),
            new RoundedCornersTransformation(ScreenUtils.dp2px(context, 4), 0))))
        .thumbnail(THUMB_NAIL)
        .into(imgView);
}
 
源代码5 项目: mollyim-android   文件: Camera1Fragment.java
private void onCaptureClicked() {
  orderEnforcer.reset();

  Stopwatch fastCaptureTimer = new Stopwatch("Capture");

  camera.capture((jpegData, frontFacing) -> {
    fastCaptureTimer.split("captured");

    Transformation<Bitmap> transformation = frontFacing ? new MultiTransformation<>(new CenterCrop(), new FlipTransformation())
                                                        : new CenterCrop();

    GlideApp.with(this)
            .asBitmap()
            .load(jpegData)
            .transform(transformation)
            .override(cameraPreview.getWidth(), cameraPreview.getHeight())
            .into(new SimpleTarget<Bitmap>() {
              @Override
              public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                fastCaptureTimer.split("transform");

                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                resource.compress(Bitmap.CompressFormat.JPEG, 80, stream);
                fastCaptureTimer.split("compressed");

                byte[] data = stream.toByteArray();
                fastCaptureTimer.split("bytes");
                fastCaptureTimer.stop(TAG);

                controller.onImageCaptured(data, resource.getWidth(), resource.getHeight());
              }

              @Override
              public void onLoadFailed(@Nullable Drawable errorDrawable) {
                controller.onCameraError();
              }
            });
  });
}
 
源代码6 项目: giffun   文件: GenericRequestBuilder.java
/**
 * Transform resources with the given {@link Transformation}s. Replaces any existing transformation or
 * transformations.
 *
 * @param transformations the transformations to apply in order.
 * @return This request builder.
 */
public GenericRequestBuilder<ModelType, DataType, ResourceType, TranscodeType> transform(
        Transformation<ResourceType>... transformations) {
    isTransformationSet = true;
    if (transformations.length == 1) {
        transformation = transformations[0];
    } else {
        transformation = new MultiTransformation<ResourceType>(transformations);
    }

    return this;
}
 
源代码7 项目: AcgClub   文件: ScheduleRecommandAdapter.java
@Override
protected void convert(BaseViewHolder helper, ScheduleRecommend item) {
  helper.setText(R.id.tv_schedule_recommand, item.getName());
  mImageLoader.loadImage(getContext(),
      GlideImageConfig
          .builder()
          .url(item.getImgUrl())
          .transformation(
              new MultiTransformation<>(new CenterCrop(),
                  new RoundedCornersTransformation(20, 0)))
          .imageView((ImageView) helper.getView(R.id.img_schedule_recommand))
          .build()
  );
}
 
源代码8 项目: AcgClub   文件: ScheduleCollectionAdapter.java
@Override
protected void convert(BaseViewHolder helper, ScheduleCache item) {
  helper.setText(R.id.tv_schedule_collection_name, item.getName());
  mImageLoader.loadImage(getContext(),
      GlideImageConfig
          .builder()
          .url(item.getImgUrl())
          .transformation(
              new MultiTransformation<>(new CenterCrop(),
                  new RoundedCornersTransformation(DimenUtils.dpToPx(getContext(), 4), 0)))
          .imageView((ImageView) helper.getView(R.id.img_schedule_collection))
          .build()
  );
}
 
源代码9 项目: VMLibrary   文件: PickerLoader.java
/**
 * 通过上下文对象加载图片
 *
 * @param context   上下文对象
 * @param options   加载配置
 * @param imageView 目标控件
 */
@Override
public void load(Context context, Options options, ImageView imageView) {
    RequestOptions requestOptions = new RequestOptions();
    if (options.isCircle) {
        requestOptions.circleCrop();
    } else if (options.isRadius) {
        requestOptions.transform(new MultiTransformation<>(new CenterCrop(), new RoundedCorners(options.radiusSize)));
    }
    GlideApp.with(context).load(options.url).apply(requestOptions).into(imageView);
}
 
源代码10 项目: Android-IM   文件: GlideUtil.java
/**
 * 加载圆角封面,默认4dp
 */
public static void loadCornerPicture(Context context, String imgUrl, ImageView imageView) {
    Glide.with(context)
            .load(imgUrl)
            .apply(new RequestOptions().error(R.drawable.icon_user))
            .apply(RequestOptions.bitmapTransform(new MultiTransformation<Bitmap>(new CenterCrop(),
                    new RoundedCornersTransformation(ConvertUtils.dp2px(4), 0))))
            .into(imageView);
}
 
源代码11 项目: Android-IM   文件: GlideUtil.java
public static void loadCornerPicture(Context context, String imgUrl, ImageView imageView, int resourceId) {
    Glide.with(context)
            .load(imgUrl)
            .apply(new RequestOptions().error(resourceId))
            .apply(RequestOptions.bitmapTransform(new MultiTransformation<Bitmap>(new CenterCrop(),
                    new RoundedCornersTransformation(ConvertUtils.dp2px(4), 0))))
            .into(imageView);
}
 
源代码12 项目: Android-IM   文件: GlideUtil.java
public static void loadCornerPicture(Context context, String imgUrl, int cornerRadius, int errorResourceId, ImageView imageView) {
    Glide.with(context)
            .load(imgUrl)
            .apply(new RequestOptions().error(errorResourceId))
            .apply(RequestOptions.bitmapTransform(new MultiTransformation<Bitmap>(new CenterCrop(),
                    new RoundedCornersTransformation(ConvertUtils.dp2px(cornerRadius), 0))))
            .into(imageView);
}
 
源代码13 项目: Android-IM   文件: GlideUtil.java
/**
 * 加载自定义封面带圆角
 *
 * @param context      上下文
 * @param imgUrl       图片链接
 * @param cornerRadius 圆角弧度
 * @param imageView    view
 */
public static void loadCornerPicture(Context context, String imgUrl, int cornerRadius, ImageView imageView) {
    Glide.with(context)
            .load(imgUrl)
            .apply(new RequestOptions().error(R.drawable.icon_user))
            .apply(RequestOptions.bitmapTransform(new MultiTransformation<Bitmap>(new CenterCrop(),
                    new RoundedCornersTransformation(ConvertUtils.dp2px(cornerRadius), 0))))
            .into(imageView);
}
 
源代码14 项目: XDroidMvp   文件: GlideLoader.java
@Override
public void loadCorner(String url, final ImageView target, int radius, Options options) {
    RequestOptions requestOptions = wrapScaleType(options);

    //设置图片圆角角度
    MultiTransformation multiTransformation = new MultiTransformation<Bitmap>(new CenterCrop(), new RoundedCorners(radius));
    requestOptions.transform(multiTransformation);

    getRequestManager(target.getContext())
            .load(url)
            .apply(requestOptions)
            .transition(withCrossFade())
            .into(target);

}
 
源代码15 项目: Tutorials   文件: TinderCard.java
@Resolve
private void onResolved(){
    MultiTransformation multi = new MultiTransformation(
            new BlurTransformation(mContext, 30),
            new RoundedCornersTransformation(
                    mContext, Utils.dpToPx(7), 0,
                    RoundedCornersTransformation.CornerType.TOP));

    Glide.with(mContext).load(mProfile.getImageUrl())
            .bitmapTransform(multi)
            .into(profileImageView);
    nameAgeTxt.setText(mProfile.getName() + ", " + mProfile.getAge());
    locationNameTxt.setText(mProfile.getLocation());
}
 
 类所在包
 同包方法