当前位置: 首页>>代码示例>>Java>>正文


Java CenterCrop类代码示例

本文整理汇总了Java中com.bumptech.glide.load.resource.bitmap.CenterCrop的典型用法代码示例。如果您正苦于以下问题:Java CenterCrop类的具体用法?Java CenterCrop怎么用?Java CenterCrop使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CenterCrop类属于com.bumptech.glide.load.resource.bitmap包,在下文中一共展示了CenterCrop类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onNext

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
@Override
public void onNext() {

    storyStatusView.pause();
    ++counter;
    target.setModel(statusResources[counter]);
    Glide.with(image.getContext())
            .load(target.getModel())
            .asBitmap()
            .crossFade()
            .centerCrop()
            .skipMemoryCache(!isCaching)
            .diskCacheStrategy(isCaching ? DiskCacheStrategy.ALL : DiskCacheStrategy.NONE)
            .transform(new CenterCrop(image.getContext()), new DelayBitmapTransformation(1000))
            .listener(new LoggingListener<String, Bitmap>())
            .into(target);
}
 
开发者ID:RahulJanagouda,项目名称:StatusStories,代码行数:18,代码来源:StatusStoriesActivity.java

示例2: onPrev

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
@Override
public void onPrev() {

    if (counter - 1 < 0) return;
    storyStatusView.pause();
    --counter;
    target.setModel(statusResources[counter]);
    Glide.with(image.getContext())
            .load(target.getModel())
            .asBitmap()
            .centerCrop()
            .crossFade()
            .skipMemoryCache(!isCaching)
            .diskCacheStrategy(isCaching ? DiskCacheStrategy.ALL : DiskCacheStrategy.NONE)
            .transform(new CenterCrop(image.getContext()), new DelayBitmapTransformation(1000))
            .listener(new LoggingListener<String, Bitmap>())
            .into(target);
}
 
开发者ID:RahulJanagouda,项目名称:StatusStories,代码行数:19,代码来源:StatusStoriesActivity.java

示例3: setImage

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
@BindingAdapter(value = {"imageUrl", "defaultImg", "radius"}, requireAll = false)
public static void setImage(ImageView imageView, String imageUrl, Drawable defaultImg, int radius) {
    DrawableRequestBuilder drawableTypeRequest = Glide.with(imageView.getContext()).load(imageUrl).crossFade();
    if (defaultImg != null) {
        drawableTypeRequest.placeholder(defaultImg).error(defaultImg);
    } else {
        drawableTypeRequest.placeholder(R.drawable.bg_defautl_imageview).error(R.drawable.bg_defautl_imageview);
    }
    if (radius > 0) {
        drawableTypeRequest.bitmapTransform(new CenterCrop(imageView.getContext()),
                new RoundedCornersTransformation(imageView.getContext(), PixelUtil.dp2px(radius), 0));
    } else {
        drawableTypeRequest.bitmapTransform(new CenterCrop(imageView.getContext()));
    }
    drawableTypeRequest.into(imageView);
}
 
开发者ID:chenzj-king,项目名称:RetrofitSample,代码行数:17,代码来源:DataBindingAdapter.java

示例4: setupGlideOptions

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的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);
}
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:18,代码来源:ImageViewerActivity.java

示例5: setupGlideOptions

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的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);
   }
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:24,代码来源:ImagePickerActivity.java

示例6: loadRoundImage

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
/**
 * 异步加载圆角图片, 使用 Glide 内置的圆角裁剪 —— bitmapTransform.
 *
 * 注意: bitmapTransform 与 外在的裁剪不兼容。即: https://github.com/wasabeef/glide-transformations/issues/54
 *
 *      1. 此时的 imageView 不能是自定义的圆角View.
 *      2. scaleType 也不能设。
 *
 * 否则重复裁剪, 会有 bug.
 *
 * @param url 图片路径
 * @param drawableId 占位图
 * @param radiusPixels 圆角像素值
 */
public static void loadRoundImage(ImageView imageView, String url, int drawableId, int radiusPixels) {
    if(imageView == null) {
        Log.e(TAG, "loadRoundImage() -> imageView is null");
        return;
    }

    Context context = imageView.getContext();
    if(!isValid(context))
        return ;

    Glide.with(context)
            .load(url)
            .placeholder(drawableId)
            .error(drawableId)
            .bitmapTransform(
                    new CenterCrop(context),
                    new RoundedCornersTransformation(context, radiusPixels, 0)
            )
            .crossFade()
            .into(imageView);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:36,代码来源:CXPImageLoaderUtil.java

示例7: load

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
@Override protected void load(Context context) throws Exception {
	String url = "http://placehold.it/3000x2000/AAFF00/000000&text=IMAGE";
	int[] requestedSize = new int[] {540, 540};
	Glide
			.with(this)
			.load(url)
			.override(requestedSize[0], requestedSize[1])
			.transform(new DelayBitmapTransformation(3000), new CenterCrop(context))
			.skipMemoryCache(true)
			.diskCacheStrategy(NONE)
			.listener(new LoggingListener<String, GlideDrawable>())
			.thumbnail(Glide
					.with(this)
					.load(url)
					.override(512, 384)
					.transform(new DelayBitmapTransformation(1000), new CenterCrop(context))
					.skipMemoryCache(true)
					.diskCacheStrategy(NONE)
					.listener(new LoggingListener<String, GlideDrawable>())
			)
			.into(imageView)
	;
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:24,代码来源:TestFragment.java

示例8: testApplyMultiTransform

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
@Test
@SuppressWarnings({"unchecked", "varargs"})
public void testApplyMultiTransform() {
  options.transforms(new CircleCrop(), new CenterCrop());
  assertThat(options.isTransformationRequired()).isTrue();
  assertThat(options.getTransformations()).containsKey(Bitmap.class);
  assertThat(options.getTransformations().get(Bitmap.class))
    .isInstanceOf(MultiTransformation.class);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequestOptionsTest.java

示例9: loadWithRoundCorners

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
public void loadWithRoundCorners(String image, int radius, int margin, ImageView previewImage) {
  Context context = weakContext.get();
  if (context != null) {
    Glide.with(context)
        .load(image)
        .centerCrop()
        .bitmapTransform(new CenterCrop(context),
            new RoundedCornersTransform(context, radius, margin,
                RoundedCornersTransform.CornerType.LEFT))
        .into(previewImage);
  }
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:13,代码来源:ImageLoader.java

示例10: bind

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
void bind(String url) {
	target.setModel(url); // update target's cache
	Glide
			.with(image.getContext())
			.load(url)
			.asBitmap()
			.placeholder(R.drawable.github_232_progress)
			.centerCrop() // needs explicit transformation, because we're using a custom target
			.transform(new CenterCrop(image.getContext()), new DelayBitmapTransformation(1000))
			.listener(new LoggingListener<String, Bitmap>())
			.into(target)
	;
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:14,代码来源:TestFragment.java

示例11: ImageLoader

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
/**
 * Construct a standard ImageLoader object.
 */
public ImageLoader(Context context) {
    VariableWidthImageLoader imageLoader = new VariableWidthImageLoader(context);
    mGlideModelRequest = Glide.with(context).using(imageLoader);
    mCenterCrop = new CenterCrop(Glide.get(context).getBitmapPool());
    mNone = Transformation.NONE;
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:10,代码来源:ImageLoader.java

示例12: onBindViewHolder

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
@Override public void onBindViewHolder(ViewHolder vh, int i) {
  Glide.with(mContext).load(mResponse.getResults().get(i).getUrl()).bitmapTransform(
      new CenterCrop(mPool), new RoundedCornersTransformation(mPool, 8, 0))
      //.crossFade()
      .listener(
          GlidePalette.with(mResponse.getResults().get(i).getUrl()).intoCallBack(palette -> {
                if (mPaletteCallback != null) mPaletteCallback.onPaletteReady(i, palette);
              })).diskCacheStrategy(DiskCacheStrategy.ALL).into(vh.meiZi);
}
 
开发者ID:pkliang,项目名称:gankmaku,代码行数:10,代码来源:FuliAdapter.java

示例13: loadAvatarUrlWithRadius

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
public static void loadAvatarUrlWithRadius(String imgUrl, ImageView imageView) {
    loadAvatarUrlToReqBuilder(imgUrl, imageView)
            .bitmapTransform(new CenterCrop(imageView.getContext()),
                    new RoundedCornersTransformation(imageView.getContext(), 8, 0))
            .into(imageView);
}
 
开发者ID:chenzj-king,项目名称:RetrofitSample,代码行数:7,代码来源:GlideUtil.java

示例14: initBackgroundImage

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
public void initBackgroundImage(ImageView background) {
    Glide.with(context).load(R.drawable.main_background)
            .apply(new RequestOptions().transform(new CenterCrop())).into(background);
}
 
开发者ID:OlegKlimenko,项目名称:Plamber-Android,代码行数:5,代码来源:Utils.java

示例15: setHeaderBackground

import com.bumptech.glide.load.resource.bitmap.CenterCrop; //导入依赖的package包/类
private void setHeaderBackground() {
    ImageView headerImage = (ImageView) mNavigationView.getHeaderView(0).findViewById(R.id.nav_header_image);
    Glide.with(getApplicationContext()).load(R.drawable.main_background).apply(new RequestOptions().transform(new CenterCrop())).into(headerImage);
}
 
开发者ID:OlegKlimenko,项目名称:Plamber-Android,代码行数:5,代码来源:BaseDrawerActivity.java


注:本文中的com.bumptech.glide.load.resource.bitmap.CenterCrop类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。