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

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

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

RequestBuilder.submit介绍

[英]Returns a future that can be used to do a blocking get on a background thread.

This method defaults to Target#SIZE_ORIGINAL for the width and the height. However, since the width and height will be overridden by values passed to RequestOptions#override(int,int), this method can be used whenever RequestOptionswith override values are applied, or whenever you want to retrieve the image in its original size.
[中]返回可用于在后台线程上执行阻塞获取的未来。
此方法的宽度和高度默认为目标#大小_ORIGINAL。但是,由于宽度和高度将被传递给RequestOptions#override(int,int)的值覆盖,因此每当应用带有覆盖值的RequestOptions时,或者当您想要检索原始大小的图像时,都可以使用此方法。

代码示例

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

@SuppressWarnings("UnnecessaryBoxing")
@Test
public void loadVideoResourceId_fromInteger_decodesFrame() {
 Drawable frame =
   concurrency.get(
     Glide.with(context)
       .load(new Integer(ResourceIds.raw.video))
       .submit());
 assertThat(frame).isNotNull();
}

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

@Test
public void loadVideoResourceId_fromInt_decodesFrame() {
 Drawable frame =
   concurrency.get(
     Glide.with(context)
       .load(ResourceIds.raw.video)
       .submit());
 assertThat(frame).isNotNull();
}

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

@Test
public void load_withShapeDrawableResourceId_asDrawable_producesNonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.shape_drawable)
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

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

@Test
public void load_withStateListDrawableResourceId_asDrawable_producesNonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.state_list_drawable)
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

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

@Override
 public void run() throws Throwable {
  Glide.with(context)
    .load(ResourceIds.drawable.shape_drawable)
    .apply(centerCropTransform())
    .submit()
    .get();
 }
});

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

@Test
public void loadBitmap_asBytes_providesBytesOfBitmap() {
 Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), ResourceIds.raw.canonical);
 byte[] data =
   concurrency.get(
     Glide.with(context)
       .as(byte[].class)
       .load(bitmap)
       .submit());
 assertThat(data).isNotNull();
 assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull();
}

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

@Test
public void load_withShapeDrawableResourceId_asDrawable_withTransformation_validSize_succeeds()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.shape_drawable)
   .apply(bitmapTransform(new RoundedCorners(10)))
   .submit(100, 200)
   .get();
 assertThat(drawable).isNotNull();
 assertThat(drawable.getIntrinsicWidth()).isEqualTo(100);
 assertThat(drawable.getIntrinsicHeight()).isEqualTo(200);
}

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

@Test
public void load_withStateListDrawableResourceId_asDrawable_withTransformation_nonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.state_list_drawable)
   .apply(centerCropTransform())
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

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

@Test
public void load_withVectorDrawableResourceId_asDrawable_withTransformation_nonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.vector_drawable)
   .apply(centerCropTransform())
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

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

@Test
public void load_withBitmapAliasResourceId_asDrawable_withTransformation_producesNonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.bitmap_alias)
   .apply(centerCropTransform())
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

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

@Test
public void load_withWideGamutImage_returnsWideGamutBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(ResourceIds.raw.webkit_logo_p3)
       .submit());
 assertThat(bitmap.getConfig()).isEqualTo(Bitmap.Config.RGBA_F16);
}

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

@Test
public void loadVideoFilePath_asBytes_providesByteOfFrame() throws IOException {
 byte[] data =
   concurrency.get(
     Glide.with(context)
       .as(byte[].class)
       .load(writeVideoToFile().getAbsolutePath())
       .submit());
 assertThat(data).isNotNull();
 assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull();
}

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

@Test
public void loadVideoResourceId_asBitmap_decodesFrame() {
 Bitmap frame =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(ResourceIds.raw.video)
       .submit());
 assertThat(frame).isNotNull();
}

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

@Test
public void load_withBitmapAliasResourceId_asBitmap_producesNonNullBitmap()
  throws ExecutionException, InterruptedException {
 Bitmap bitmap = Glide.with(context)
   .asBitmap()
   .load(ResourceIds.drawable.bitmap_alias)
   .submit()
   .get();
 assertThat(bitmap).isNotNull();
}

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

@Test
public void load_withBitmapResourceId_asBitmap_producesNonNullBitmap()
  throws ExecutionException, InterruptedException {
 Bitmap bitmap = Glide.with(context)
   .asBitmap()
   .load(android.R.drawable.star_big_off)
   .submit()
   .get();
 assertThat(bitmap).isNotNull();
}

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

@Test
public void load_withJpegAsDataUriString_returnsBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(getDataUriString(CompressFormat.JPEG))
       .submit());
 assertThat(bitmap).isNotNull();
}

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

@Test
public void load_withPngAsDataUri_returnsBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(getDataUri(CompressFormat.PNG))
       .submit());
 assertThat(bitmap).isNotNull();
}

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

@Test
public void load_withPngDataUriString_returnsBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(getDataUriString(CompressFormat.PNG))
       .submit());
 assertThat(bitmap).isNotNull();
}

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

@Test
public void load_withJpegAsDataUri_returnsBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(getDataUri(CompressFormat.JPEG))
       .submit());
 assertThat(bitmap).isNotNull();
}

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

@Test
public void loadTransparentGifResource_withNoOtherLoaders_fromBytes_decodesResource() {
 byte[] data = getBytes(ResourceIds.raw.transparent_gif);
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(data)
       .submit());
 assertThat(bitmap).isNotNull();
}

相关文章