本文整理了Java中com.bumptech.glide.RequestBuilder.into
方法的一些代码示例,展示了RequestBuilder.into
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RequestBuilder.into
方法的具体详情如下:
包路径:com.bumptech.glide.RequestBuilder
类名称:RequestBuilder
方法名:into
[英]Returns a future that can be used to do a blocking get on a background thread.
[中]返回可用于在后台线程上执行阻塞获取的未来。
代码示例来源:origin: bumptech/glide
private void loadNet() {
Uri uri = Uri.parse("http://www.clker.com/cliparts/u/Z/2/b/a/6/android-toy-h.svg");
requestBuilder.load(uri).into(imageViewNet);
}
}
代码示例来源:origin: bumptech/glide
@Override
public void runTest() {
getNullModelRequest().into(imageView);
}
});
代码示例来源:origin: bumptech/glide
/**
* Set the target the resource will be loaded into.
*
* @param target The target to load the resource into.
* @return The given target.
* @see RequestManager#clear(Target)
*/
@NonNull
public <Y extends Target<TranscodeType>> Y into(@NonNull Y target) {
return into(target, /*targetListener=*/ null, Executors.mainThreadExecutor());
}
代码示例来源:origin: bumptech/glide
@Test
public void testByteData() {
byte[] data = new byte[] { 1, 2, 3, 4, 5, 6 };
requestManager.load(data).into(target);
}
代码示例来源:origin: bumptech/glide
@Test
public void testLoadBitmap_asDrawable() {
Bitmap bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
requestManager
.load(bitmap)
.into(target);
ArgumentCaptor<Object> captor = ArgumentCaptor.forClass(Object.class);
verify(target).onResourceReady(captor.capture(), any(Transition.class));
BitmapDrawable drawable = (BitmapDrawable) captor.getValue();
assertThat(drawable.getBitmap()).isEqualTo(bitmap);
}
代码示例来源:origin: bumptech/glide
@Test
public void testLoadDrawable() {
Drawable drawable = new ColorDrawable(Color.RED);
requestManager
.load(drawable)
.into(target);
ArgumentCaptor<Drawable> drawableCaptor = ArgumentCaptor.forClass(Drawable.class);
verify(target).onResourceReady(drawableCaptor.capture(), any(Transition.class));
assertThat(((ColorDrawable) drawableCaptor.getValue()).getColor()).isEqualTo(Color.RED);
}
代码示例来源:origin: bumptech/glide
@Test
public void testGetNextFrameDoesNotStartLoadIfLoaderIsNotRunning() {
verify(requestBuilder, times(1)).into(aTarget());
loader.unsubscribe(callback);
loader.onFrameReady(mock(DelayTarget.class));
verify(requestBuilder, times(1)).into(aTarget());
}
代码示例来源:origin: bumptech/glide
@Test
@SuppressWarnings("unchecked")
public void testNonDefaultModelWithRegisteredFactoryDoesNotThrow() {
registerMockStreamModelLoader(Float.class);
requestManager.load(0.5f).into(target);
}
代码示例来源:origin: bumptech/glide
@Test
public void testGetNextFrameDoesStartLoadAfterLoadCompletesIfStarted() {
loader.onFrameReady(mock(DelayTarget.class));
verify(requestBuilder, times(2)).into(aTarget());
}
代码示例来源:origin: bumptech/glide
@Test
public void testStartDoesNotStartIfAlreadyRunning() {
loader.subscribe(mock(FrameCallback.class));
verify(requestBuilder, times(1)).into(aTarget());
}
代码示例来源:origin: bumptech/glide
private void runTestFileDefaultLoader() {
File file = new File("fake");
mockUri(Uri.fromFile(file));
requestManager.load(file).into(target);
requestManager.load(file).into(imageView);
verify(target).onResourceReady(isA(BitmapDrawable.class), isA(Transition.class));
verify(target).setRequest((Request) notNull());
assertNotNull(imageView.getDrawable());
}
代码示例来源:origin: bumptech/glide
@Test
public void testNullModelPrefersErrorDrawable() {
Drawable placeholder = new ColorDrawable(Color.GREEN);
Drawable error = new ColorDrawable(Color.RED);
requestManager
.load(NULL)
.apply(placeholderOf(placeholder)
.error(error))
.into(target);
verify(target).onLoadFailed(eq(error));
}
代码示例来源:origin: bumptech/glide
@Test
public void testGetNextFrameIncrementsSignatureAndAdvancesDecoderBeforeStartingLoad() {
InOrder order = inOrder(gifDecoder, requestBuilder);
order.verify(gifDecoder).advance();
order.verify(requestBuilder).apply(isA(RequestOptions.class));
order.verify(requestBuilder).into(aTarget());
}
代码示例来源:origin: bumptech/glide
@Test
public void testGetNextFrameDoesNotStartLoadIfLoadIsInProgress() {
loader.unsubscribe(callback);
loader.subscribe(callback);
verify(requestBuilder, times(1)).into(aTarget());
}
代码示例来源:origin: bumptech/glide
@Test
public void testGetNextFrameDoesStartLoadIfRestartedAndNoLoadIsInProgress() {
loader.unsubscribe(callback);
loader.onFrameReady(mock(DelayTarget.class));
loader.subscribe(callback);
verify(requestBuilder, times(2)).into(aTarget());
}
代码示例来源:origin: bumptech/glide
@Test
public void testReceivesThumbnails() {
String full = mockUri("content://full");
String thumb = mockUri("content://thumb");
requestManager
.load(full)
.thumbnail(requestManager.load(thumb))
.into(target);
verify(target, times(2)).onResourceReady(isA(Drawable.class), isA(Transition.class));
}
代码示例来源:origin: bumptech/glide
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
Glide.with(getContext()).asDrawable().load(android.R.drawable.ic_menu_rotate).into(this);
}
}
代码示例来源:origin: bumptech/glide
@Test
public void testReceivesRecursiveThumbnailWithPercentage() {
requestManager.load(mockUri("content://first"))
.thumbnail(requestManager.load(mockUri("content://second")).thumbnail(0.5f))
.into(target);
verify(target, times(3)).onResourceReady(isA(Drawable.class), isA(Transition.class));
}
代码示例来源:origin: bumptech/glide
@Test
public void testAsBitmapOption() {
Uri uri = Uri.parse("content://something/else");
mockUri(uri);
requestManager.asBitmap().load(uri).into(target);
verify(target).onResourceReady(isA(Bitmap.class), isA(Transition.class));
}
代码示例来源:origin: bumptech/glide
@Test
public void testReceivesBitmapBytes() {
String fakeUri = "content://fake";
mockUri(fakeUri);
requestManager.as(byte[].class).apply(decodeTypeOf(Bitmap.class)).load(fakeUri).into(target);
verify(target).onResourceReady(isA(byte[].class), isA(Transition.class));
}
内容来源于网络,如有侵权,请联系作者删除!