当前位置: 首页>>代码示例>>Java>>正文


Java MultiModelLoaderFactory类代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:GlideTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:GlideTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:GlideTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:GlideTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:GlideTest.java

示例6: build

import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
  return new OkHttpUrlLoader(client);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:OkHttpUrlLoader.java

示例7: build

import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory factory) {
  return new VolleyUrlLoader(requestQueue, requestFactory);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:VolleyUrlLoader.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:GiphyModelLoader.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:FlickrModelLoader.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:HttpUriLoader.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:UrlLoader.java

示例12: build

import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<Uri, InputStream> build(MultiModelLoaderFactory multiFactory) {
  return new MediaStoreVideoThumbLoader(context);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:MediaStoreVideoThumbLoader.java

示例13: build

import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
  return new HttpGlideUrlLoader(modelCache);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:HttpGlideUrlLoader.java

示例14: build

import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@Override
public ModelLoader<Uri, InputStream> build(MultiModelLoaderFactory multiFactory) {
  return new MediaStoreImageThumbLoader(context);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:MediaStoreImageThumbLoader.java

示例15: build

import com.bumptech.glide.load.model.MultiModelLoaderFactory; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
  return new OkHttpUrlLoader(client);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:OkHttpUrlLoader.java


注:本文中的com.bumptech.glide.load.model.MultiModelLoaderFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。