本文整理汇总了Java中com.bumptech.glide.load.model.MultiModelLoaderFactory类的典型用法代码示例。如果您正苦于以下问题:Java MultiModelLoaderFactory类的具体用法?Java MultiModelLoaderFactory怎么用?Java MultiModelLoaderFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiModelLoaderFactory类属于com.bumptech.glide.load.model包,在下文中一共展示了MultiModelLoaderFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerFailFactory
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private <T, Z> void registerFailFactory(Class<T> failModel, Class<Z> failResource)
throws Exception {
DataFetcher<Z> failFetcher = mock(DataFetcher.class);
doAnswer(new Util.CallDataReady<>(null))
.when(failFetcher)
.loadData(isA(Priority.class), isA(DataFetcher.DataCallback.class));
when(failFetcher.getDataClass()).thenReturn(failResource);
ModelLoader<T, Z> failLoader = mock(ModelLoader.class);
when(failLoader.buildLoadData(isA(failModel), anyInt(), anyInt(), isA(Options.class)))
.thenReturn(new ModelLoader.LoadData<>(mock(Key.class), failFetcher));
when(failLoader.handles(isA(failModel))).thenReturn(true);
ModelLoaderFactory<T, Z> failFactory = mock(ModelLoaderFactory.class);
when(failFactory.build(isA(MultiModelLoaderFactory.class))).thenReturn(failLoader);
Glide.get(getContext()).getRegistry().prepend(failModel, failResource, failFactory);
}
示例2: registerMockModelLoader
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
private static <X, Y> void registerMockModelLoader(Class<X> modelClass, Class<Y> dataClass,
Y loadedData, Registry registry) {
DataFetcher<Y> mockStreamFetcher = mock(DataFetcher.class);
when(mockStreamFetcher.getDataClass()).thenReturn(dataClass);
try {
doAnswer(new Util.CallDataReady<>(loadedData))
.when(mockStreamFetcher)
.loadData(isA(Priority.class), isA(DataFetcher.DataCallback.class));
} catch (Exception e) {
throw new RuntimeException(e);
}
ModelLoader<X, Y> mockUrlLoader = mock(ModelLoader.class);
when(mockUrlLoader.buildLoadData(isA(modelClass), anyInt(), anyInt(), isA(Options.class)))
.thenReturn(new ModelLoader.LoadData<>(mock(Key.class), mockStreamFetcher));
when(mockUrlLoader.handles(isA(modelClass))).thenReturn(true);
ModelLoaderFactory<X, Y> mockUrlLoaderFactory = mock(ModelLoaderFactory.class);
when(mockUrlLoaderFactory.build(isA(MultiModelLoaderFactory.class)))
.thenReturn(mockUrlLoader);
registry.replace(modelClass, dataClass, mockUrlLoaderFactory);
}
示例3: registerFailFactory
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private <T, Z> void registerFailFactory(Class<T> failModel, Class<Z> failResource) {
DataFetcher<Z> failFetcher = mock(DataFetcher.class);
doAnswer(new Util.CallDataReady<>(null))
.when(failFetcher)
.loadData(isA(Priority.class), isA(DataFetcher.DataCallback.class));
when(failFetcher.getDataClass()).thenReturn(failResource);
ModelLoader<T, Z> failLoader = mock(ModelLoader.class);
when(failLoader.buildLoadData(isA(failModel), anyInt(), anyInt(), isA(Options.class)))
.thenReturn(new ModelLoader.LoadData<>(mock(Key.class), failFetcher));
when(failLoader.handles(isA(failModel))).thenReturn(true);
ModelLoaderFactory<T, Z> failFactory = mock(ModelLoaderFactory.class);
when(failFactory.build(isA(MultiModelLoaderFactory.class))).thenReturn(failLoader);
Glide.get(context).getRegistry().prepend(failModel, failResource, failFactory);
}
示例4: registerMockStreamModelLoader
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private <T> void registerMockStreamModelLoader(final Class<T> modelClass) {
ModelLoader<T, InputStream> modelLoader = mockStreamModelLoader(modelClass);
ModelLoaderFactory<T, InputStream> modelLoaderFactory = mock(ModelLoaderFactory.class);
when(modelLoaderFactory.build(isA(MultiModelLoaderFactory.class))).thenReturn(modelLoader);
Glide.get(RuntimeEnvironment.application).getRegistry()
.prepend(modelClass, InputStream.class, modelLoaderFactory);
}
示例5: registerMockStreamModelLoader
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private <T> void registerMockStreamModelLoader(final Class<T> modelClass) {
ModelLoader<T, InputStream> modelLoader = mockStreamModelLoader(modelClass);
ModelLoaderFactory<T, InputStream> modelLoaderFactory = mock(ModelLoaderFactory.class);
when(modelLoaderFactory.build(isA(MultiModelLoaderFactory.class))).thenReturn(modelLoader);
Glide.get(context).getRegistry()
.prepend(modelClass, InputStream.class, modelLoaderFactory);
}
示例6: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new OkHttpUrlLoader(client);
}
示例7: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory factory) {
return new VolleyUrlLoader(requestQueue, requestFactory);
}
示例8: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<Api.GifResult, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new GiphyModelLoader(multiFactory.build(GlideUrl.class, InputStream.class));
}
示例9: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<Photo, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new FlickrModelLoader(multiFactory.build(GlideUrl.class, InputStream.class),
modelCache);
}
示例10: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<Uri, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new HttpUriLoader(multiFactory.build(GlideUrl.class, InputStream.class));
}
示例11: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<URL, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new UrlLoader(multiFactory.build(GlideUrl.class, InputStream.class));
}
示例12: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<Uri, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new MediaStoreVideoThumbLoader(context);
}
示例13: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new HttpGlideUrlLoader(modelCache);
}
示例14: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<Uri, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new MediaStoreImageThumbLoader(context);
}
示例15: build
import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
return new OkHttpUrlLoader(client);
}