private Request obtainRequest(Target<TranscodeType> target, RequestOptions requestOptions, RequestCoordinator requestCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int overrideWidth, int overrideHeight) { requestOptions.lock(); return SingleRequest.obtain( context, model, transcodeClass, requestOptions, overrideWidth, overrideHeight, priority, target, requestListener, requestCoordinator, context.getEngine(), transitionOptions.getTransitionFactory()); }
private Request obtainRequest( Target<TranscodeType> target, RequestListener<TranscodeType> targetListener, RequestOptions requestOptions, RequestCoordinator requestCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int overrideWidth, int overrideHeight) { return SingleRequest.obtain( context, glideContext, model, transcodeClass, requestOptions, overrideWidth, overrideHeight, priority, target, targetListener, requestListener, requestCoordinator, glideContext.getEngine(), transitionOptions.getTransitionFactory()); }
private Request buildRequest(Target<TranscodeType> target, float sizeMultiplier, Priority priority, RequestCoordinator requestCoordinator) { if (model == null) { return buildRequestForDataType(target, loadProvider, sizeMultiplier, priority, null); } else { return buildRequestForDataType(target, loadProvider, sizeMultiplier, priority, requestCoordinator); } }
private <Z> Request buildRequestForDataType(Target<TranscodeType> target, LoadProvider<ModelType, Z, ResourceType, TranscodeType> loadProvider, float sizeMultiplier, Priority priority, RequestCoordinator requestCoordinator) { return new GenericRequest<ModelType, Z, ResourceType, TranscodeType>(loadProvider, model, context, priority, target, sizeMultiplier, placeholderDrawable, placeholderId, errorPlaceholder, errorId, requestListener, animationId, animation, requestCoordinator, glide.getEngine(), getFinalTransformation(), transcodeClass, isCacheable); }
private Request buildRequestRecursive( Target<TranscodeType> target, @Nullable RequestListener<TranscodeType> targetListener, @Nullable RequestCoordinator parentCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int overrideWidth, int overrideHeight, RequestOptions requestOptions) { // Build the ErrorRequestCoordinator first if necessary so we can update parentCoordinator. ErrorRequestCoordinator errorRequestCoordinator = null; if (errorBuilder != null) { errorRequestCoordinator = new ErrorRequestCoordinator(parentCoordinator); parentCoordinator = errorRequestCoordinator; } Request mainRequest = buildThumbnailRequestRecursive( target, targetListener, parentCoordinator, transitionOptions, priority, overrideWidth, overrideHeight, requestOptions); if (errorRequestCoordinator == null) { return mainRequest; } int errorOverrideWidth = errorBuilder.requestOptions.getOverrideWidth(); int errorOverrideHeight = errorBuilder.requestOptions.getOverrideHeight(); if (Util.isValidDimensions(overrideWidth, overrideHeight) && !errorBuilder.requestOptions.isValidOverride()) { errorOverrideWidth = requestOptions.getOverrideWidth(); errorOverrideHeight = requestOptions.getOverrideHeight(); } Request errorRequest = errorBuilder.buildRequestRecursive( target, targetListener, errorRequestCoordinator, errorBuilder.transitionOptions, errorBuilder.requestOptions.getPriority(), errorOverrideWidth, errorOverrideHeight, errorBuilder.requestOptions); errorRequestCoordinator.setRequests(mainRequest, errorRequest); return errorRequestCoordinator; }
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)"); } } }