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


Java RequestBuilder类代码示例

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


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

示例1: thumbnail

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
@Override
@CheckResult
@SafeVarargs
@SuppressWarnings("varargs")
public final GlideRequest<TranscodeType> thumbnail(@Nullable RequestBuilder<TranscodeType>... arg0) {
  return (GlideRequest<TranscodeType>) super.thumbnail(arg0);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:GlideRequest.java

示例2: onCreate

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  ImageView giphyLogoView = (ImageView) findViewById(R.id.giphy_logo_view);

  Glide.with(this)
      .load(R.raw.large_giphy_logo)
      .into(giphyLogoView);

  RecyclerView gifList = (RecyclerView) findViewById(R.id.gif_list);
  LinearLayoutManager layoutManager = new LinearLayoutManager(this);
  gifList.setLayoutManager(layoutManager);

  RequestBuilder<Drawable> gifItemRequest = Glide.with(this).asDrawable();

  ViewPreloadSizeProvider<Api.GifResult> preloadSizeProvider =
      new ViewPreloadSizeProvider<>();
  adapter = new GifAdapter(this, gifItemRequest, preloadSizeProvider);
  gifList.setAdapter(adapter);
  RecyclerViewPreloader<Api.GifResult> preloader =
      new RecyclerViewPreloader<>(Glide.with(this), adapter, preloadSizeProvider, 4);
  gifList.addOnScrollListener(preloader);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:MainActivity.java

示例3: setupUserAvatar

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
private void setupUserAvatar(AppCompatImageView avatar, Me.ProfileImage image) {
    int flag = CalendarUtils.festivalFlag();
    if (2 == flag) {
        avatar.setImageResource(R.mipmap.new_year_round);
    } else if (1 == flag) {
        avatar.setImageResource(R.mipmap.new_year_dog2);
    } else {
        if (null == image) {
            avatar.setImageResource(R.mipmap.bg_dark_avatar_male_big_normal);
        } else {
            RequestBuilder<Bitmap> bitmapRequestBuilder = GlideApp.with(getActivity())
                    .asBitmap()
                    .load(image.large)
                    .error(R.mipmap.bg_dark_avatar_male_big_normal)
                    .placeholder(R.mipmap.bg_dark_avatar_male_big_normal)
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .fallback(R.mipmap.bg_dark_avatar_male_big_normal);
            bitmapRequestBuilder.into(avatar);
        }
    }
}
 
开发者ID:alphater,项目名称:garras,代码行数:22,代码来源:NavigationFragment.java

示例4: showImage

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
public static void showImage(Activity activity, ImageView imageView, String image,
                             Drawable placeholder, boolean anim) {
    RequestOptions requestOptions = RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL);

    RequestBuilder<Drawable> builder = Glide.with(activity)
            .load(image);

    if (placeholder != null) {
        requestOptions.placeholder(placeholder);     //设置占位图片

    }
    if (!anim) {
        requestOptions.dontAnimate();
    }

    builder.apply(requestOptions);
    builder.into(imageView);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:19,代码来源:G.java

示例5: loadImage

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
@BindingAdapter({"url", "thumbUrl", "manager", "show"})
public static void loadImage(LargeImageView largeImageView, String url, @Nullable String thumbUrl, DownloadPreferencesManager manager, boolean show) {
    if (!show || TextUtils.isEmpty(url)) {
        return;
    }
    Context context = largeImageView.getContext();
    RequestBuilder<File> builder = Glide.with(context)
            .download(new ForcePassUrl(url));
    //avatar signature
    if (manager != null && Api.isAvatarUrl(url)) {
        builder = builder.apply(new RequestOptions()
                .signature(manager.getAvatarCacheInvalidationIntervalSignature()));
    }

    builder.into(new LargeImageViewTarget(largeImageView) {
        @Override
        public void onLoadFailed(@Nullable Drawable errorDrawable) {
            if (thumbUrl != null) {
                loadImage(largeImageView, thumbUrl, null, manager, show);
            } else {
                super.onLoadFailed(errorDrawable);
            }
        }
    });
}
 
开发者ID:ykrank,项目名称:S1-Next,代码行数:26,代码来源:LargeImageViewBindingAdapter.java

示例6: startImageGetterViewTarget

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
private void startImageGetterViewTarget(RequestBuilder<Drawable> glideRequestBuilder,
                                        ImageGetterViewTarget imageGetterViewTarget, boolean emoticon) {
    Single.just(glideRequestBuilder)
            .subscribeOn(AndroidSchedulers.mainThread())
            .to(imageGetterScoper)
            .subscribe(builder -> {
                if (emoticon) {
                    imageGetterViewTarget.mDrawable.setWidthTargetSize(emoticonSize);
                    imageGetterViewTarget.mDrawable.setHeightTargetSize(emoticonSize);
                } else {
                    //Big image scale to fit width
                    imageGetterViewTarget.mDrawable.setTriggerSize(200);
                    if (mTextView.getWidth() > 0) {
                        imageGetterViewTarget.mDrawable.setWidthTargetSize(mTextView.getWidth());
                    }
                }
                builder.into(imageGetterViewTarget);
            }, L::report);
}
 
开发者ID:ykrank,项目名称:S1-Next,代码行数:20,代码来源:GlideImageGetter.java

示例7: loadAsPath

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
public void loadAsPath(final String path, final int width, final int height, final int maskId, final String ext) {
    if (TextUtils.isEmpty(path)) {
        loadAsResource(R.drawable.nim_image_default, maskId);
        return;
    }

    setBlendDrawable(maskId);

    RequestBuilder builder;
    if (ImageUtil.isGif(ext)) {
        builder = Glide.with(getContext().getApplicationContext()).asGif().load(new File(path));
    } else {
        RequestOptions options = new RequestOptions()
                .override(width, height)
                .fitCenter()
                .placeholder(R.drawable.nim_image_default)
                .error(R.drawable.nim_image_default);

        builder = Glide.with(getContext().getApplicationContext())
                .asBitmap()
                .apply(options)
                .load(new File(path))
        ;
    }
    builder.into(this);
}
 
开发者ID:netease-im,项目名称:NIM_Android_UIKit,代码行数:27,代码来源:MsgThumbImageView.java

示例8: getPreloadRequestBuilder

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
@Override
@Nullable
public RequestBuilder getPreloadRequestBuilder(IconDataParcelable iconData) {
    GlideRequest request;

    if(!showThumbs) {
        request = GlideApp.with(fragment).asDrawable().fitCenter().load(iconData.image);
    } else {
        if (iconData.type == IconDataParcelable.IMAGE_FROMFILE) {
            request = GlideApp.with(fragment).asDrawable().centerCrop().load(iconData.path).fallback(iconData.image);
        } else {
            request = GlideApp.with(fragment).asDrawable().centerCrop().load(iconData.image);
        }
    }

    return request;
}
 
开发者ID:TeamAmaze,项目名称:AmazeFileManager,代码行数:18,代码来源:RecyclerPreloadModelProvider.java

示例9: loadFlickrThumb

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
public static void loadFlickrThumb(Photo photo, ImageView image) {
    final RequestOptions options = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.DATA)
            .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
            .dontTransform();

    final RequestBuilder<Drawable> thumbRequest = Glide.with(image)
            .load(photo.getThumbnailUrl())
            .apply(options)
            .transition(DrawableTransitionOptions.with(TRANSITION_FACTORY));

    Glide.with(image).load(photo.getMediumUrl())
            .apply(options)
            .thumbnail(thumbRequest)
            .into(image);
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:17,代码来源:DemoGlideHelper.java

示例10: loadFlickrFull

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
public static void loadFlickrFull(Photo photo, ImageView image, LoadingListener listener) {
    final String photoUrl = photo.getLargeSize() == null
            ? photo.getMediumUrl() : photo.getLargeUrl();

    final RequestOptions options = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.DATA)
            .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
            .dontTransform();

    final RequestBuilder<Drawable> thumbRequest = Glide.with(image)
            .load(photo.getThumbnailUrl())
            .apply(options);

    Glide.with(image)
            .load(photoUrl)
            .apply(new RequestOptions().apply(options).placeholder(image.getDrawable()))
            .thumbnail(thumbRequest)
            .listener(new RequestListenerWrapper<>(listener))
            .into(image);
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:21,代码来源:DemoGlideHelper.java

示例11: loadFull

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
/**
 * Loads thumbnail and then replaces it with full image.
 */
public static void loadFull(ImageView image, int imageId, int thumbId) {
    // We don't want Glide to crop or resize our image
    final RequestOptions options = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .override(Target.SIZE_ORIGINAL)
            .dontTransform();

    final RequestBuilder<Drawable> thumbRequest = Glide.with(image)
            .load(thumbId)
            .apply(options);

    Glide.with(image)
            .load(imageId)
            .apply(options)
            .thumbnail(thumbRequest)
            .into(image);
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:21,代码来源:GlideHelper.java

示例12: getPreloadRequestBuilder

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
@Override
public RequestBuilder<Drawable> getPreloadRequestBuilder(MediaStoreData item) {
  MediaStoreSignature signature =
      new MediaStoreSignature(item.mimeType, item.dateModified, item.orientation);
  return requestBuilder
      .clone()
      .signature(signature)
      .load(item.uri);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RecyclerAdapter.java

示例13: getPreloadRequestBuilder

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
@Override
public RequestBuilder<Drawable> getPreloadRequestBuilder(Api.GifResult item) {
  return requestBuilder.load(item);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:MainActivity.java

示例14: getRequestBuilder

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
private static RequestBuilder<Bitmap> getRequestBuilder(
    RequestManager requestManager, int width, int height) {
  return requestManager
      .asBitmap()
      .apply(
          diskCacheStrategyOf(DiskCacheStrategy.NONE)
              .skipMemoryCache(true)
              .override(width, height));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:GifFrameLoader.java

示例15: setUp

import com.bumptech.glide.RequestBuilder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  when(handler.obtainMessage(anyInt(), isA(DelayTarget.class))).thenReturn(mock(Message.class));

  firstFrame = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);

  ByteBuffer byteBuffer = ByteBuffer.allocate(10);
  when(gifDecoder.getData()).thenReturn(byteBuffer);

  requestBuilder = mock(RequestBuilder.class, new ReturnsSelfAnswer());

  loader = createGifFrameLoader(handler);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:GifFrameLoaderTest.java


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