Java 类com.bumptech.glide.load.engine.Engine 实例源码

项目:GitHub    文件:SingleRequestTest.java   
@Test
public void testEngineLoadCancelledOnCancel() {
  Engine.LoadStatus loadStatus = mock(Engine.LoadStatus.class);

  when(harness.engine
     .load(eq(harness.glideContext), eq(harness.model), eq(harness.signature), anyInt(), anyInt(),
        eq(Object.class), eq(List.class), any(Priority.class), any(DiskCacheStrategy.class),
        eq(harness.transformations), anyBoolean(), any(Options.class),
        anyBoolean(), anyBoolean(), anyBoolean(), any(ResourceCallback.class)))
      .thenReturn(loadStatus);

  SingleRequest<List> request = harness.getRequest();
  request.begin();

  request.onSizeReady(100, 100);
  request.cancel();

  verify(loadStatus).cancel();
}
项目:GitHub    文件:GlideContext.java   
public GlideContext(
    Context context,
    ArrayPool arrayPool,
    Registry registry,
    ImageViewTargetFactory imageViewTargetFactory,
    RequestOptions defaultRequestOptions,
    Map<Class<?>, TransitionOptions<?, ?>> defaultTransitionOptions,
    Engine engine,
    int logLevel) {
  super(context.getApplicationContext());
  this.arrayPool = arrayPool;
  this.registry = registry;
  this.imageViewTargetFactory = imageViewTargetFactory;
  this.defaultRequestOptions = defaultRequestOptions;
  this.defaultTransitionOptions = defaultTransitionOptions;
  this.engine = engine;
  this.logLevel = logLevel;

  mainHandler = new Handler(Looper.getMainLooper());
}
项目:GitHub    文件:SingleRequest.java   
public static <R> SingleRequest<R> obtain(
    GlideContext glideContext,
    Object model,
    Class<R> transcodeClass,
    RequestOptions requestOptions,
    int overrideWidth,
    int overrideHeight,
    Priority priority,
    Target<R> target,
    RequestListener<R> requestListener,
    RequestCoordinator requestCoordinator,
    Engine engine,
    TransitionFactory<? super R> animationFactory) {
  @SuppressWarnings("unchecked") SingleRequest<R> request =
      (SingleRequest<R>) POOL.acquire();
  if (request == null) {
    request = new SingleRequest<>();
  }
  request.init(
      glideContext,
      model,
      transcodeClass,
      requestOptions,
      overrideWidth,
      overrideHeight,
      priority,
      target,
      requestListener,
      requestCoordinator,
      engine,
      animationFactory);
  return request;
}
项目:GitHub    文件:SingleRequest.java   
private void init(
    GlideContext glideContext,
    Object model,
    Class<R> transcodeClass,
    RequestOptions requestOptions,
    int overrideWidth,
    int overrideHeight,
    Priority priority,
    Target<R> target,
    RequestListener<R> requestListener,
    RequestCoordinator requestCoordinator,
    Engine engine,
    TransitionFactory<? super R> animationFactory) {
  this.glideContext = glideContext;
  this.model = model;
  this.transcodeClass = transcodeClass;
  this.requestOptions = requestOptions;
  this.overrideWidth = overrideWidth;
  this.overrideHeight = overrideHeight;
  this.priority = priority;
  this.target = target;
  this.requestListener = requestListener;
  this.requestCoordinator = requestCoordinator;
  this.engine = engine;
  this.animationFactory = animationFactory;
  status = Status.PENDING;
}
项目:GitHub    文件:GlideContext.java   
public GlideContext(Context context, Registry registry,
    ImageViewTargetFactory imageViewTargetFactory, RequestOptions defaultRequestOptions,
    Engine engine, ComponentCallbacks2 componentCallbacks, int logLevel) {
  super(context.getApplicationContext());
  this.registry = registry;
  this.imageViewTargetFactory = imageViewTargetFactory;
  this.defaultRequestOptions = defaultRequestOptions;
  this.engine = engine;
  this.componentCallbacks = componentCallbacks;
  this.logLevel = logLevel;

  mainHandler = new Handler(Looper.getMainLooper());
}
项目:GitHub    文件:SingleRequest.java   
public static <R> SingleRequest<R> obtain(
    Context context,
    GlideContext glideContext,
    Object model,
    Class<R> transcodeClass,
    RequestOptions requestOptions,
    int overrideWidth,
    int overrideHeight,
    Priority priority,
    Target<R> target,
    RequestListener<R> targetListener,
    RequestListener<R> requestListener,
    RequestCoordinator requestCoordinator,
    Engine engine,
    TransitionFactory<? super R> animationFactory) {
  @SuppressWarnings("unchecked") SingleRequest<R> request =
      (SingleRequest<R>) POOL.acquire();
  if (request == null) {
    request = new SingleRequest<>();
  }
  request.init(
      context,
      glideContext,
      model,
      transcodeClass,
      requestOptions,
      overrideWidth,
      overrideHeight,
      priority,
      target,
      targetListener,
      requestListener,
      requestCoordinator,
      engine,
      animationFactory);
  return request;
}
项目:GitHub    文件:SingleRequest.java   
private void init(
    Context context,
    GlideContext glideContext,
    Object model,
    Class<R> transcodeClass,
    RequestOptions requestOptions,
    int overrideWidth,
    int overrideHeight,
    Priority priority,
    Target<R> target,
    RequestListener<R> targetListener,
    RequestListener<R> requestListener,
    RequestCoordinator requestCoordinator,
    Engine engine,
    TransitionFactory<? super R> animationFactory) {
  this.context = context;
  this.glideContext = glideContext;
  this.model = model;
  this.transcodeClass = transcodeClass;
  this.requestOptions = requestOptions;
  this.overrideWidth = overrideWidth;
  this.overrideHeight = overrideHeight;
  this.priority = priority;
  this.target = target;
  this.targetListener = targetListener;
  this.requestListener = requestListener;
  this.requestCoordinator = requestCoordinator;
  this.engine = engine;
  this.animationFactory = animationFactory;
  status = Status.PENDING;
}
项目:GitHub    文件:GlideContextTest.java   
@Before
public void setUp() {
  Application app = RuntimeEnvironment.application;

  transitionOptions = new HashMap<>();
  context = new GlideContext(
      app,
      new LruArrayPool(),
      new Registry(),
      new ImageViewTargetFactory(),
      new RequestOptions(),
      transitionOptions,
      mock(Engine.class),
      Log.DEBUG);
}
项目:GitHub    文件:SingleRequestTest.java   
@Test
public void testEngineLoadCancelledOnCancel() {
  Engine.LoadStatus loadStatus = mock(Engine.LoadStatus.class);

  when(builder.engine
      .load(
          eq(builder.glideContext),
          eq(builder.model),
          eq(builder.signature),
          anyInt(),
          anyInt(),
          eq(Object.class),
          eq(List.class),
          any(Priority.class),
          any(DiskCacheStrategy.class),
          eq(builder.transformations),
          anyBoolean(),
          anyBoolean(),
          any(Options.class),
          anyBoolean(),
          anyBoolean(),
          anyBoolean(),
          anyBoolean(),
          any(ResourceCallback.class)))
      .thenReturn(loadStatus);

  SingleRequest<List> request = builder.build();
  request.begin();

  request.onSizeReady(100, 100);
  request.cancel();

  verify(loadStatus).cancel();
}
项目:saarang-iosched    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:AppDevFestSudeste2015    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:devfestnorte-app    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:saarang-iosched    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:GitHub    文件:GlideContext.java   
public Engine getEngine() {
  return engine;
}
项目:GitHub    文件:GlideBuilder.java   
GlideBuilder setEngine(Engine engine) {
  this.engine = engine;
  return this;
}
项目:GitHub    文件:GlideContext.java   
public Engine getEngine() {
  return engine;
}
项目:GitHub    文件:GlideBuilder.java   
GlideBuilder setEngine(Engine engine) {
  this.engine = engine;
  return this;
}
项目:GitHub    文件:SingleRequestTest.java   
SingleRequestBuilder setEngine(Engine engine) {
  this.engine = engine;
  return this;
}
项目:saarang-iosched    文件:GenericRequest.java   
public GenericRequest(LoadProvider<A, T, Z, R> loadProvider, A model, Context context, Priority priority,
        Target<R> target, float sizeMultiplier, Drawable placeholderDrawable, int placeholderResourceId,
        Drawable errorDrawable, int errorResourceId, RequestListener<A> requestListener, int animationId,
        Animation animation, RequestCoordinator requestCoordinator, Engine engine,
        Transformation<Z> transformation, Class<R> transcodeClass, boolean isMemoryCacheable) {
    this.loadProvider = loadProvider;
    this.model = model;
    this.context = context;
    this.priority = priority;
    this.target = target;
    this.sizeMultiplier = sizeMultiplier;
    this.placeholderDrawable = placeholderDrawable;
    this.placeholderResourceId = placeholderResourceId;
    this.errorDrawable = errorDrawable;
    this.errorResourceId = errorResourceId;
    this.requestListener = requestListener;
    this.animationId = animationId;
    this.animation = animation;
    this.requestCoordinator = requestCoordinator;
    this.engine = engine;
    this.transformation = transformation;
    this.transcodeClass = transcodeClass;
    this.isMemoryCacheable = isMemoryCacheable;

    // We allow null models by just setting an error drawable. Null models will always have empty providers, we
    // simply skip our sanity checks in that unusual case.
    if (model != null) {
        if (loadProvider.getCacheDecoder() == null) {
            throw new NullPointerException("CacheDecoder must not be null, try .cacheDecoder(ResouceDecoder)");
        }
        if (loadProvider.getSourceDecoder() == null) {
            throw new NullPointerException("SourceDecoder must not be null, try .imageDecoder(ResourceDecoder) " +
                    "and/or .videoDecoder()");
        }
        if (loadProvider.getEncoder() == null) {
            throw new NullPointerException("Encoder must not be null, try .encode(ResourceEncoder)");
        }
        if (loadProvider.getTranscoder() == null) {
            throw new NullPointerException("Transcoder must not be null, try .as(Class, ResourceTranscoder)");
        }
        if (loadProvider.getModelLoader() == null) {
            throw new NullPointerException("ModelLoader must not be null, try .using(ModelLoader)");
        }
    }
}
项目:saarang-iosched    文件:Glide.java   
Engine getEngine() {
    return engine;
}
项目:saarang-iosched    文件:GlideBuilder.java   
GlideBuilder setEngine(Engine engine) {
    this.engine = engine;
    return this;
}
项目:AppDevFestSudeste2015    文件:GenericRequest.java   
public GenericRequest(LoadProvider<A, T, Z, R> loadProvider, A model, Context context, Priority priority,
        Target<R> target, float sizeMultiplier, Drawable placeholderDrawable, int placeholderResourceId,
        Drawable errorDrawable, int errorResourceId, RequestListener<A> requestListener, int animationId,
        Animation animation, RequestCoordinator requestCoordinator, Engine engine,
        Transformation<Z> transformation, Class<R> transcodeClass, boolean isMemoryCacheable) {
    this.loadProvider = loadProvider;
    this.model = model;
    this.context = context;
    this.priority = priority;
    this.target = target;
    this.sizeMultiplier = sizeMultiplier;
    this.placeholderDrawable = placeholderDrawable;
    this.placeholderResourceId = placeholderResourceId;
    this.errorDrawable = errorDrawable;
    this.errorResourceId = errorResourceId;
    this.requestListener = requestListener;
    this.animationId = animationId;
    this.animation = animation;
    this.requestCoordinator = requestCoordinator;
    this.engine = engine;
    this.transformation = transformation;
    this.transcodeClass = transcodeClass;
    this.isMemoryCacheable = isMemoryCacheable;

    // We allow null models by just setting an error drawable. Null models will always have empty providers, we
    // simply skip our sanity checks in that unusual case.
    if (model != null) {
        if (loadProvider.getCacheDecoder() == null) {
            throw new NullPointerException("CacheDecoder must not be null, try .cacheDecoder(ResouceDecoder)");
        }
        if (loadProvider.getSourceDecoder() == null) {
            throw new NullPointerException("SourceDecoder must not be null, try .imageDecoder(ResourceDecoder) " +
                    "and/or .videoDecoder()");
        }
        if (loadProvider.getEncoder() == null) {
            throw new NullPointerException("Encoder must not be null, try .encode(ResourceEncoder)");
        }
        if (loadProvider.getTranscoder() == null) {
            throw new NullPointerException("Transcoder must not be null, try .as(Class, ResourceTranscoder)");
        }
        if (loadProvider.getModelLoader() == null) {
            throw new NullPointerException("ModelLoader must not be null, try .using(ModelLoader)");
        }
    }
}
项目:AppDevFestSudeste2015    文件:Glide.java   
Engine getEngine() {
    return engine;
}
项目:AppDevFestSudeste2015    文件:GlideBuilder.java   
GlideBuilder setEngine(Engine engine) {
    this.engine = engine;
    return this;
}
项目:devfestnorte-app    文件:GenericRequest.java   
public GenericRequest(LoadProvider<A, T, Z, R> loadProvider, A model, Context context, Priority priority,
        Target<R> target, float sizeMultiplier, Drawable placeholderDrawable, int placeholderResourceId,
        Drawable errorDrawable, int errorResourceId, RequestListener<A> requestListener, int animationId,
        Animation animation, RequestCoordinator requestCoordinator, Engine engine,
        Transformation<Z> transformation, Class<R> transcodeClass, boolean isMemoryCacheable) {
    this.loadProvider = loadProvider;
    this.model = model;
    this.context = context;
    this.priority = priority;
    this.target = target;
    this.sizeMultiplier = sizeMultiplier;
    this.placeholderDrawable = placeholderDrawable;
    this.placeholderResourceId = placeholderResourceId;
    this.errorDrawable = errorDrawable;
    this.errorResourceId = errorResourceId;
    this.requestListener = requestListener;
    this.animationId = animationId;
    this.animation = animation;
    this.requestCoordinator = requestCoordinator;
    this.engine = engine;
    this.transformation = transformation;
    this.transcodeClass = transcodeClass;
    this.isMemoryCacheable = isMemoryCacheable;

    // We allow null models by just setting an error drawable. Null models will always have empty providers, we
    // simply skip our sanity checks in that unusual case.
    if (model != null) {
        if (loadProvider.getCacheDecoder() == null) {
            throw new NullPointerException("CacheDecoder must not be null, try .cacheDecoder(ResouceDecoder)");
        }
        if (loadProvider.getSourceDecoder() == null) {
            throw new NullPointerException("SourceDecoder must not be null, try .imageDecoder(ResourceDecoder) " +
                    "and/or .videoDecoder()");
        }
        if (loadProvider.getEncoder() == null) {
            throw new NullPointerException("Encoder must not be null, try .encode(ResourceEncoder)");
        }
        if (loadProvider.getTranscoder() == null) {
            throw new NullPointerException("Transcoder must not be null, try .as(Class, ResourceTranscoder)");
        }
        if (loadProvider.getModelLoader() == null) {
            throw new NullPointerException("ModelLoader must not be null, try .using(ModelLoader)");
        }
    }
}
项目:devfestnorte-app    文件:Glide.java   
Engine getEngine() {
    return engine;
}
项目:devfestnorte-app    文件:GlideBuilder.java   
GlideBuilder setEngine(Engine engine) {
    this.engine = engine;
    return this;
}
项目:saarang-iosched    文件:GenericRequest.java   
public GenericRequest(LoadProvider<A, T, Z, R> loadProvider, A model, Context context, Priority priority,
        Target<R> target, float sizeMultiplier, Drawable placeholderDrawable, int placeholderResourceId,
        Drawable errorDrawable, int errorResourceId, RequestListener<A> requestListener, int animationId,
        Animation animation, RequestCoordinator requestCoordinator, Engine engine,
        Transformation<Z> transformation, Class<R> transcodeClass, boolean isMemoryCacheable) {
    this.loadProvider = loadProvider;
    this.model = model;
    this.context = context;
    this.priority = priority;
    this.target = target;
    this.sizeMultiplier = sizeMultiplier;
    this.placeholderDrawable = placeholderDrawable;
    this.placeholderResourceId = placeholderResourceId;
    this.errorDrawable = errorDrawable;
    this.errorResourceId = errorResourceId;
    this.requestListener = requestListener;
    this.animationId = animationId;
    this.animation = animation;
    this.requestCoordinator = requestCoordinator;
    this.engine = engine;
    this.transformation = transformation;
    this.transcodeClass = transcodeClass;
    this.isMemoryCacheable = isMemoryCacheable;

    // We allow null models by just setting an error drawable. Null models will always have empty providers, we
    // simply skip our sanity checks in that unusual case.
    if (model != null) {
        if (loadProvider.getCacheDecoder() == null) {
            throw new NullPointerException("CacheDecoder must not be null, try .cacheDecoder(ResouceDecoder)");
        }
        if (loadProvider.getSourceDecoder() == null) {
            throw new NullPointerException("SourceDecoder must not be null, try .imageDecoder(ResourceDecoder) " +
                    "and/or .videoDecoder()");
        }
        if (loadProvider.getEncoder() == null) {
            throw new NullPointerException("Encoder must not be null, try .encode(ResourceEncoder)");
        }
        if (loadProvider.getTranscoder() == null) {
            throw new NullPointerException("Transcoder must not be null, try .as(Class, ResourceTranscoder)");
        }
        if (loadProvider.getModelLoader() == null) {
            throw new NullPointerException("ModelLoader must not be null, try .using(ModelLoader)");
        }
    }
}
项目:saarang-iosched    文件:Glide.java   
Engine getEngine() {
    return engine;
}
项目:saarang-iosched    文件:GlideBuilder.java   
GlideBuilder setEngine(Engine engine) {
    this.engine = engine;
    return this;
}