类com.bumptech.glide.load.model.ModelLoader源码实例Demo

下面列出了怎么用com.bumptech.glide.load.model.ModelLoader的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: giffun   文件: DrawableTypeRequest.java
private static <A, Z, R> FixedLoadProvider<A, ImageVideoWrapper, Z, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Class<Z> resourceClass,
        Class<R> transcodedClass,
        ResourceTranscoder<Z, R> transcoder) {
    if (streamModelLoader == null && fileDescriptorModelLoader == null) {
        return null;
    }

    if (transcoder == null) {
        transcoder = glide.buildTranscoder(resourceClass, transcodedClass);
    }
    DataLoadProvider<ImageVideoWrapper, Z> dataLoadProvider = glide.buildDataProvider(ImageVideoWrapper.class,
            resourceClass);
    ImageVideoModelLoader<A> modelLoader = new ImageVideoModelLoader<A>(streamModelLoader,
            fileDescriptorModelLoader);
    return new FixedLoadProvider<A, ImageVideoWrapper, Z, R>(modelLoader, transcoder, dataLoadProvider);
}
 
源代码2 项目: giffun   文件: BitmapTypeRequest.java
private static <A, R> FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader,
        Class<R> transcodedClass, ResourceTranscoder<Bitmap, R> transcoder) {
    if (streamModelLoader == null && fileDescriptorModelLoader == null) {
        return null;
    }

    if (transcoder == null) {
        transcoder = glide.buildTranscoder(Bitmap.class, transcodedClass);
    }
    DataLoadProvider<ImageVideoWrapper, Bitmap> loadProvider = glide.buildDataProvider(ImageVideoWrapper.class,
            Bitmap.class);
    ImageVideoModelLoader<A> modelLoader = new ImageVideoModelLoader<A>(streamModelLoader,
            fileDescriptorModelLoader);

    return new FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R>(modelLoader, transcoder, loadProvider);
}
 
源代码3 项目: giffun   文件: FixedLoadProvider.java
public FixedLoadProvider(ModelLoader<A, T> modelLoader, ResourceTranscoder<Z, R> transcoder,
        DataLoadProvider<T, Z> dataLoadProvider) {
    if (modelLoader == null) {
        throw new NullPointerException("ModelLoader must not be null");
    }
    this.modelLoader = modelLoader;

    if (transcoder == null) {
        throw new NullPointerException("Transcoder must not be null");
    }
    this.transcoder = transcoder;

    if (dataLoadProvider == null) {
        throw new NullPointerException("DataLoadProvider must not be null");
    }
    this.dataLoadProvider = dataLoadProvider;
}
 
源代码4 项目: giffun   文件: GenericRequest.java
/**
 * A callback method that should never be invoked directly.
 */
@Override
public void onSizeReady(int width, int height) {
    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        logV("Got onSizeReady in " + LogTime.getElapsedMillis(startTime));
    }
    if (status != Status.WAITING_FOR_SIZE) {
        return;
    }
    status = Status.RUNNING;

    width = Math.round(sizeMultiplier * width);
    height = Math.round(sizeMultiplier * height);

    ModelLoader<A, T> modelLoader = loadProvider.getModelLoader();
    final DataFetcher<T> dataFetcher = modelLoader.getResourceFetcher(model, width, height);

    if (dataFetcher == null) {
        onException(new Exception("Failed to load model: \'" + model + "\'"));
        return;
    }
    ResourceTranscoder<Z, R> transcoder = loadProvider.getTranscoder();
    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        logV("finished setup for calling load in " + LogTime.getElapsedMillis(startTime));
    }
    loadedFromMemoryCache = true;
    loadStatus = engine.load(signature, width, height, dataFetcher, loadProvider, transformation, transcoder,
            priority, isMemoryCacheable, diskCacheStrategy, this);
    loadedFromMemoryCache = resource != null;
    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        logV("finished onSizeReady in " + LogTime.getElapsedMillis(startTime));
    }
}
 
源代码5 项目: giffun   文件: RequestManager.java
private <T> DrawableTypeRequest<T> loadGeneric(Class<T> modelClass) {
    ModelLoader<T, InputStream> streamModelLoader = Glide.buildStreamModelLoader(modelClass, context);
    ModelLoader<T, ParcelFileDescriptor> fileDescriptorModelLoader =
            Glide.buildFileDescriptorModelLoader(modelClass, context);
    if (modelClass != null && streamModelLoader == null && fileDescriptorModelLoader == null) {
        throw new IllegalArgumentException("Unknown type " + modelClass + ". You must provide a Model of a type for"
                + " which there is a registered ModelLoader, if you are using a custom model, you must first call"
                + " Glide#register with a ModelLoaderFactory for your custom model class");
    }

    return optionsApplier.apply(
            new DrawableTypeRequest<T>(modelClass, streamModelLoader, fileDescriptorModelLoader, context,
                    glide, requestTracker, lifecycle, optionsApplier));
}
 
源代码6 项目: giffun   文件: GenericTranscodeRequest.java
GenericTranscodeRequest(
        Class<ResourceType> transcodeClass, GenericRequestBuilder<ModelType, ?, ?, ?> other,
        ModelLoader<ModelType, DataType> modelLoader, Class<DataType> dataClass, Class<ResourceType> resourceClass,
        RequestManager.OptionsApplier optionsApplier) {
    super(build(other.glide, modelLoader, dataClass, resourceClass, UnitTranscoder.<ResourceType>get()),
            transcodeClass, other);
    this.modelLoader = modelLoader;
    this.dataClass = dataClass;
    this.resourceClass = resourceClass;
    this.optionsApplier = optionsApplier;
}
 
源代码7 项目: giffun   文件: DrawableTypeRequest.java
DrawableTypeRequest(Class<ModelType> modelClass, ModelLoader<ModelType, InputStream> streamModelLoader,
        ModelLoader<ModelType, ParcelFileDescriptor> fileDescriptorModelLoader, Context context, Glide glide,
        RequestTracker requestTracker, Lifecycle lifecycle, RequestManager.OptionsApplier optionsApplier) {
    super(context, modelClass,
            buildProvider(glide, streamModelLoader, fileDescriptorModelLoader, GifBitmapWrapper.class,
                    GlideDrawable.class, null),
            glide, requestTracker, lifecycle);
    this.streamModelLoader = streamModelLoader;
    this.fileDescriptorModelLoader = fileDescriptorModelLoader;
    this.optionsApplier = optionsApplier;
}
 
源代码8 项目: RetroMusicPlayer   文件: ArtistImageFetcher.java
public ArtistImageFetcher(Context context, LastFMRestClient lastFMRestClient, ArtistImage model, ModelLoader<GlideUrl, InputStream> urlLoader, int width, int height) {
    this.context = context;
    this.lastFMRestClient = lastFMRestClient;
    this.model = model;
    this.urlLoader = urlLoader;
    this.width = width;
    this.height = height;
}
 
源代码9 项目: giffun   文件: BitmapTypeRequest.java
BitmapTypeRequest(GenericRequestBuilder<ModelType, ?, ?, ?> other,
        ModelLoader<ModelType, InputStream> streamModelLoader,
        ModelLoader<ModelType, ParcelFileDescriptor> fileDescriptorModelLoader,
        RequestManager.OptionsApplier optionsApplier) {
    super(buildProvider(other.glide, streamModelLoader, fileDescriptorModelLoader, Bitmap.class, null),
            Bitmap.class, other);
    this.streamModelLoader = streamModelLoader;
    this.fileDescriptorModelLoader = fileDescriptorModelLoader;
    this.glide = other.glide;
    this.optionsApplier = optionsApplier;
}
 
源代码10 项目: giffun   文件: GifTypeRequest.java
private static <A, R> FixedLoadProvider<A, InputStream, GifDrawable, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader, Class<R> transcodeClass,
        ResourceTranscoder<GifDrawable, R> transcoder) {
    if (streamModelLoader == null) {
        return null;
    }

    if (transcoder == null) {
        transcoder = glide.buildTranscoder(GifDrawable.class, transcodeClass);
    }
    DataLoadProvider<InputStream, GifDrawable> dataLoadProvider = glide.buildDataProvider(InputStream.class,
            GifDrawable.class);
    return new FixedLoadProvider<A, InputStream, GifDrawable, R>(streamModelLoader, transcoder, dataLoadProvider);
}
 
源代码11 项目: giffun   文件: GifTypeRequest.java
GifTypeRequest(GenericRequestBuilder<ModelType, ?, ?, ?> other,
        ModelLoader<ModelType, InputStream> streamModelLoader, RequestManager.OptionsApplier optionsApplier) {
    super(buildProvider(other.glide, streamModelLoader, GifDrawable.class, null), GifDrawable.class, other);
    this.streamModelLoader = streamModelLoader;
    this.optionsApplier = optionsApplier;

    // Default to animating.
    crossFade();
}
 
源代码12 项目: MusicPlayer   文件: ArtistImageFetcher.java
public ArtistImageFetcher(LastFMRestClient lastFMRestClient, ArtistImage model, ModelLoader<GlideUrl, InputStream> urlLoader, int width, int height, Options options) {
    this.lastFMRestClient = lastFMRestClient;
    this.model = model;
    this.urlLoader = urlLoader;
    this.width = width;
    this.height = height;
    mOption = options;
    mLoadOriginal = model.mLoadOriginal;
    mImageNumber = model.mImageNumber;
}
 
源代码13 项目: Orin   文件: ArtistImageFetcher.java
public ArtistImageFetcher(Context context, LastFMRestClient lastFMRestClient, ArtistImage model, ModelLoader<GlideUrl, InputStream> urlLoader, int width, int height) {
    this.context = context;
    this.lastFMRestClient = lastFMRestClient;
    this.model = model;
    this.urlLoader = urlLoader;
    this.width = width;
    this.height = height;
}
 
源代码14 项目: mollyim-android   文件: StickerRemoteUriLoader.java
@Override
public @NonNull ModelLoader<StickerRemoteUri, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
  return new StickerRemoteUriLoader(ApplicationDependencies.getSignalServiceMessageReceiver());
}
 
源代码15 项目: mollyim-android   文件: OkHttpUrlLoader.java
@Override
public @NonNull ModelLoader<GlideUrl, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
  return new OkHttpUrlLoader(client);
}
 
源代码16 项目: mollyim-android   文件: ContactPhotoLoader.java
@Override
public @NonNull ModelLoader<ContactPhoto, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
  return new ContactPhotoLoader(context);
}
 
源代码17 项目: mollyim-android   文件: ChunkedImageUrlLoader.java
@Override
public @NonNull ModelLoader<ChunkedImageUrl, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
  return new ChunkedImageUrlLoader(client);
}
 
@Override
public @NonNull ModelLoader<DecryptableUri, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
  return new DecryptableStreamUriLoader(context);
}
 
@Override
public @NonNull ModelLoader<AttachmentModel, InputStream> build(@NonNull MultiModelLoaderFactory multiFactory) {
  return new AttachmentStreamUriLoader();
}
 
源代码20 项目: mollyim-android   文件: BlurHashModelLoader.java
@Override
public @NonNull ModelLoader<BlurHash, BlurHash> build(@NonNull MultiModelLoaderFactory multiFactory) {
  return new BlurHashModelLoader();
}
 
源代码21 项目: Aurora   文件: OkHttpUrlLoader.java
@Override
public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) {
    return new OkHttpUrlLoader(client);
}
 
源代码22 项目: giffun   文件: RequestManager.java
VideoModelRequest(ModelLoader<T, ParcelFileDescriptor> loader) {
    this.loader = loader;
}
 
源代码23 项目: giffun   文件: RequestManager.java
ImageModelRequest(ModelLoader<T, InputStream> loader) {
    this.loader = loader;
}
 
源代码24 项目: giffun   文件: RequestManager.java
GenericModelRequest(ModelLoader<A, T> modelLoader, Class<T> dataClass) {
    this.modelLoader = modelLoader;
    this.dataClass = dataClass;
}
 
源代码25 项目: giffun   文件: GenericTranscodeRequest.java
private static <A, T, Z, R> LoadProvider<A, T, Z, R> build(Glide glide, ModelLoader<A, T> modelLoader,
        Class<T> dataClass, Class<Z> resourceClass, ResourceTranscoder<Z, R> transcoder) {
    DataLoadProvider<T, Z> dataLoadProvider = glide.buildDataProvider(dataClass, resourceClass);
    return new FixedLoadProvider<A, T, Z, R>(modelLoader, transcoder, dataLoadProvider);
}
 
源代码26 项目: RetroMusicPlayer   文件: ArtistImageLoader.java
public ArtistImageLoader(Context context, LastFMRestClient lastFMRestClient, ModelLoader<GlideUrl, InputStream> urlLoader) {
    this.context = context;
    this.lastFMClient = lastFMRestClient;
    this.urlLoader = urlLoader;
}
 
源代码27 项目: AndroidModulePattern   文件: OkHttpUrlLoader.java
@Override
public ModelLoader<GlideUrl, InputStream> build(Context context, GenericLoaderFactory factories) {
    return new OkHttpUrlLoader(client);
}
 
源代码28 项目: Simpler   文件: ProgressModelLoader.java
@Override
public ModelLoader<String, InputStream> build(Context context, GenericLoaderFactory factories) {
    return new ProgressModelLoader(mModelCache);
}
 
源代码29 项目: giffun   文件: HttpUrlGlideUrlLoader.java
@Override
public ModelLoader<GlideUrl, InputStream> build(Context context, GenericLoaderFactory factories) {
    return new HttpUrlGlideUrlLoader(modelCache);
}
 
源代码30 项目: giffun   文件: StreamStringLoader.java
@Override
public ModelLoader<String, InputStream> build(Context context, GenericLoaderFactory factories) {
    return new StreamStringLoader(factories.buildModelLoader(Uri.class, InputStream.class));
}
 
 类所在包
 同包方法