com.bumptech.glide.RequestBuilder.preload()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中com.bumptech.glide.RequestBuilder.preload方法的一些代码示例,展示了RequestBuilder.preload的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RequestBuilder.preload方法的具体详情如下:
包路径:com.bumptech.glide.RequestBuilder
类名称:RequestBuilder
方法名:preload

RequestBuilder.preload介绍

[英]Preloads the resource into the cache using Target#SIZE_ORIGINAL as the target width and height. Equivalent to calling #preload(int,int) with Target#SIZE_ORIGINAL as the width and height.
[中]使用Target#SIZE_ORIGINAL作为目标宽度和高度,将资源预加载到缓存中。相当于调用#preload(int,int),目标#SIZE_ORIGINAL作为宽度和高度。

代码示例

代码示例来源:origin: bumptech/glide

/**
 * Preloads the resource into the cache using {@link Target#SIZE_ORIGINAL} as the target width and
 * height. Equivalent to calling {@link #preload(int, int)} with {@link Target#SIZE_ORIGINAL} as
 * the width and height.
 *
 * @return A {@link Target} that can be used to cancel the load via
 * {@link RequestManager#clear(Target)}
 * @see #preload(int, int)
 */
@NonNull
public Target<TranscodeType> preload() {
 return preload(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}

代码示例来源:origin: alexvasilkov/GestureViews

@Override
protected void onResume() {
  super.onResume();
  // Warming up thumbnails cache for smoother experience
  for (Painting painting : paintings) {
    Glide.with(this).load(painting.thumbId).preload();
  }
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

private void startDownFrame(String url) {
    for (int i = 1; i <= 100; i++) {
      int time = i * getDuration() / 100;
      int width = CommonUtil.dip2px(getContext(), 150);
      int height = CommonUtil.dip2px(getContext(), 100);
      Glide.with(getContext().getApplicationContext())
          .setDefaultRequestOptions(
              new RequestOptions()
                  .frame(1000 * time)
                  .override(width, height)
                  .centerCrop())
          .load(url).preload(width, height);

    }
  }
}

代码示例来源:origin: mozilla-tw/Rocket

/**
 * Preloads the resource into the cache using {@link Target#SIZE_ORIGINAL} as the target width and
 * height. Equivalent to calling {@link #preload(int, int)} with {@link Target#SIZE_ORIGINAL} as
 * the width and height.
 *
 * @return A {@link Target} that can be used to cancel the load via
 * {@link RequestManager#clear(Target)}
 * @see #preload(int, int)
 */
public Target<TranscodeType> preload() {
 return preload(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}

代码示例来源:origin: jorgegil96/All-NBA

private void preFetchImages(List<SubmissionWrapper> submissions) {
    for (SubmissionWrapper submission : submissions) {
      Optional<Pair<Utilities.ThumbnailType, String>> thumbnailTypeUrl =
          Utilities.getThumbnailToShowFromCustomSubmission(submission);
      if (thumbnailTypeUrl.isPresent()) {
        Glide.with(context)
            .load(thumbnailTypeUrl.get().second)
            .preload();
      }
    }
  }
}

代码示例来源:origin: Leeii/LeeFream

request.into(target);
else {
  request.preload();

代码示例来源:origin: schaal/ocreader

requestBuilder.listener(myTarget).into(imageView);
} else {
  requestBuilder.listener(myTarget).preload();

相关文章