use of com.bumptech.glide.load.model.GlideUrl in project glide by bumptech.
the class BaseGlideUrlLoaderTest method testReturnsUrlFromCacheIfPresent.
@Test
public void testReturnsUrlFromCacheIfPresent() {
Object model = new Object();
int width = 100;
int height = 200;
GlideUrl expectedUrl = mock(GlideUrl.class);
when(modelCache.get(eq(model), eq(width), eq(height))).thenReturn(expectedUrl);
when(wrapped.buildLoadData(eq(expectedUrl), eq(width), eq(height), eq(options))).thenReturn(new ModelLoader.LoadData<>(mock(Key.class), fetcher));
assertEquals(fetcher, urlLoader.buildLoadData(model, width, height, options).fetcher);
}
use of com.bumptech.glide.load.model.GlideUrl in project glide by bumptech.
the class HttpUriLoaderTest method testHandlesMostlyInvalidHttpUris.
// Test for https://github.com/bumptech/glide/issues/71.
@Test
public void testHandlesMostlyInvalidHttpUris() {
Uri mostlyInvalidHttpUri = Uri.parse("http://myserver_url.com:80http://myserver_url.com/webapp/images/no_image.png?size=100");
assertTrue(loader.handles(mostlyInvalidHttpUri));
loader.buildLoadData(mostlyInvalidHttpUri, IMAGE_SIDE, IMAGE_SIDE, OPTIONS);
verify(urlLoader).buildLoadData(eq(new GlideUrl(mostlyInvalidHttpUri.toString())), eq(IMAGE_SIDE), eq(IMAGE_SIDE), eq(OPTIONS));
}
use of com.bumptech.glide.load.model.GlideUrl in project CircleDemo by Naoki2015.
the class CircleVideoView method init.
private void init() {
inflate(getContext(), R.layout.layout_video, this);
videoPlayer = (TextureVideoView) findViewById(R.id.video_player);
videoFrame = (ImageView) findViewById(R.id.iv_video_frame);
videoProgress = (CircularProgressBar) findViewById(R.id.video_progress);
videoButton = (ImageView) findViewById(R.id.iv_video_play);
videoTarget = new VideoLoadTarget(this);
progressTarget = new VideoProgressTarget(videoTarget, videoProgress);
videoPlayer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (videoPlayer.isPlaying()) {
videoPlayer.stop();
}
}
});
videoButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (TextUtils.isEmpty(videoUrl)) {
Toast.makeText(getContext(), "video url is empty...", Toast.LENGTH_LONG).show();
return;
}
// load video file
videoState = STATE_ACTIVED;
progressTarget.start();
Glide.with(getContext()).using(VideoListGlideModule.getOkHttpUrlLoader(), InputStream.class).load(new GlideUrl(videoUrl)).as(File.class).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(progressTarget);
videoButton.setVisibility(View.INVISIBLE);
if (onPlayClickListener != null) {
onPlayClickListener.onPlayClick(postion);
}
}
});
}
Aggregations