Java 类com.bumptech.glide.Registry 实例源码

项目:leisure-glance    文件:GankGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
    OkHttpClient client = new OkHttpClient.Builder()
            .readTimeout(30, TimeUnit.SECONDS)
            .connectTimeout(30, TimeUnit.SECONDS)
            .addInterceptor(loggingInterceptor)
            .build();
    registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
项目:SubwayTooter    文件:MyAppGlideModule.java   
@Override public void registerComponents( @NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
    // デフォルト実装は何もしないらしい
    super.registerComponents( context,glide,registry );

    // App1を初期化してからOkHttp3Factoryと連動させる
    App1.Companion.prepare( context.getApplicationContext() );
    App1.Companion.registerGlideComponents(context,glide,registry);
}
项目:MVVMArms    文件:GlideConfiguration.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    super.registerComponents(context, glide, registry);
    //Glide默认使用HttpURLConnection做网络请求,在这切换成okhttp请求
    registry.replace(GlideUrl.class, InputStream.class,
            new OkHttpUrlLoader.Factory(RepositoryUtils.INSTANCE.obtainRepositoryComponent(context).okHttpClient()));
}
项目:twicalico    文件:GlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    registry.replace(
            GlideUrl.class,
            InputStream.class,
            new OkHttpUrlLoader.Factory(
                    request -> GlobalApplication.getOkHttpClient().newCall(request)
            )
    );
}
项目:Orpheus    文件:PalettizedBitmapGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
    registry.register(Bitmap.class, PalettizedBitmapDrawable.class,
            PalettizedBitmapDrawableTranscoder.create(context));
    registry.register(Bitmap.class, Palette.class,
            PaletteBitmapTranscoder.create());
}
项目:GitHub    文件:OkHttpGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:OkHttpLibraryGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:OkHttpGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:OkHttpLibraryGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:VolleyLibraryGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(context));
}
项目:GitHub    文件:VolleyGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(context));
}
项目:GitHub    文件:SvgModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.register(SVG.class, PictureDrawable.class, new SvgDrawableTranscoder())
      .append(InputStream.class, SVG.class, new SvgDecoder());
}
项目:GitHub    文件:GiphyGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.append(Api.GifResult.class, InputStream.class, new GiphyModelLoader.Factory());
}
项目:GitHub    文件:FlickrGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  registry.append(Photo.class, InputStream.class, new FlickrModelLoader.Factory());
}
项目:GitHub    文件:LibraryGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
  // Default empty impl.
}
项目:GitHub    文件:DecodeHelper.java   
List<ModelLoader<File, ?>> getModelLoaders(File file)
    throws Registry.NoModelLoaderAvailableException {
  return glideContext.getRegistry().getModelLoaders(file);
}
项目:GitHub    文件:DecodeHelper.java   
<X> Encoder<X> getSourceEncoder(X data) throws Registry.NoSourceEncoderAvailableException {
  return glideContext.getRegistry().getSourceEncoder(data);
}
项目:GitHub    文件:DecodeJob.java   
@Override
public Resource<Z> onResourceDecoded(Resource<Z> decoded) {
  Class<Z> resourceSubClass = getResourceClass(decoded);
  Transformation<Z> appliedTransformation = null;
  Resource<Z> transformed = decoded;
  if (dataSource != DataSource.RESOURCE_DISK_CACHE) {
    appliedTransformation = decodeHelper.getTransformation(resourceSubClass);
    transformed = appliedTransformation.transform(glideContext, decoded, width, height);
  }
  // TODO: Make this the responsibility of the Transformation.
  if (!decoded.equals(transformed)) {
    decoded.recycle();
  }

  final EncodeStrategy encodeStrategy;
  final ResourceEncoder<Z> encoder;
  if (decodeHelper.isResourceEncoderAvailable(transformed)) {
    encoder = decodeHelper.getResultEncoder(transformed);
    encodeStrategy = encoder.getEncodeStrategy(options);
  } else {
    encoder = null;
    encodeStrategy = EncodeStrategy.NONE;
  }

  Resource<Z> result = transformed;
  boolean isFromAlternateCacheKey = !decodeHelper.isSourceKey(currentSourceKey);
  if (diskCacheStrategy.isResourceCacheable(isFromAlternateCacheKey, dataSource,
      encodeStrategy)) {
    if (encoder == null) {
      throw new Registry.NoResultEncoderAvailableException(transformed.get().getClass());
    }
    final Key key;
    if (encodeStrategy == EncodeStrategy.SOURCE) {
      key = new DataCacheKey(currentSourceKey, signature);
    } else if (encodeStrategy == EncodeStrategy.TRANSFORMED) {
      key = new ResourceCacheKey(currentSourceKey, signature, width, height,
          appliedTransformation, resourceSubClass, options);
    } else {
      throw new IllegalArgumentException("Unknown strategy: " + encodeStrategy);
    }

    LockedResource<Z> lockedResult = LockedResource.obtain(transformed);
    deferredEncodeManager.init(key, encoder, lockedResult);
    result = lockedResult;
  }
  return result;
}
项目:GitHub    文件:ManifestParserTest.java   
@Override
public void registerComponents(Context context, Registry registry) {
}
项目:GitHub    文件:ManifestParserTest.java   
@Override
public void registerComponents(Context context, Registry registry) {
}
项目:GitHub    文件:OkHttpGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:OkHttpLibraryGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:OkHttpGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:OkHttpLibraryGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:GitHub    文件:VolleyLibraryGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(context));
}
项目:GitHub    文件:VolleyGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.replace(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(context));
}
项目:GitHub    文件:SvgModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.register(SVG.class, PictureDrawable.class, new SvgDrawableTranscoder())
      .append(InputStream.class, SVG.class, new SvgDecoder());
}
项目:GitHub    文件:GiphyGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.append(Api.GifResult.class, InputStream.class, new GiphyModelLoader.Factory());
}
项目:GitHub    文件:FlickrGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.append(Photo.class, InputStream.class, new FlickrModelLoader.Factory());
}
项目:GitHub    文件:LibraryGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  // Default empty impl.
}
项目:GitHub    文件:DecodeHelper.java   
List<ModelLoader<File, ?>> getModelLoaders(File file)
    throws Registry.NoModelLoaderAvailableException {
  return glideContext.getRegistry().getModelLoaders(file);
}
项目:GitHub    文件:DecodeHelper.java   
<X> Encoder<X> getSourceEncoder(X data) throws Registry.NoSourceEncoderAvailableException {
  return glideContext.getRegistry().getSourceEncoder(data);
}
项目:GitHub    文件:DecodeJob.java   
@Override
public Resource<Z> onResourceDecoded(Resource<Z> decoded) {
  Class<Z> resourceSubClass = getResourceClass(decoded);
  Transformation<Z> appliedTransformation = null;
  Resource<Z> transformed = decoded;
  if (dataSource != DataSource.RESOURCE_DISK_CACHE) {
    appliedTransformation = decodeHelper.getTransformation(resourceSubClass);
    transformed = appliedTransformation.transform(glideContext, decoded, width, height);
  }
  // TODO: Make this the responsibility of the Transformation.
  if (!decoded.equals(transformed)) {
    decoded.recycle();
  }

  final EncodeStrategy encodeStrategy;
  final ResourceEncoder<Z> encoder;
  if (decodeHelper.isResourceEncoderAvailable(transformed)) {
    encoder = decodeHelper.getResultEncoder(transformed);
    encodeStrategy = encoder.getEncodeStrategy(options);
  } else {
    encoder = null;
    encodeStrategy = EncodeStrategy.NONE;
  }

  Resource<Z> result = transformed;
  boolean isFromAlternateCacheKey = !decodeHelper.isSourceKey(currentSourceKey);
  if (diskCacheStrategy.isResourceCacheable(isFromAlternateCacheKey, dataSource,
      encodeStrategy)) {
    if (encoder == null) {
      throw new Registry.NoResultEncoderAvailableException(transformed.get().getClass());
    }
    final Key key;
    if (encodeStrategy == EncodeStrategy.SOURCE) {
      key = new DataCacheKey(currentSourceKey, signature);
    } else if (encodeStrategy == EncodeStrategy.TRANSFORMED) {
      key =
          new ResourceCacheKey(
              decodeHelper.getArrayPool(),
              currentSourceKey,
              signature,
              width,
              height,
              appliedTransformation,
              resourceSubClass,
              options);
    } else {
      throw new IllegalArgumentException("Unknown strategy: " + encodeStrategy);
    }

    LockedResource<Z> lockedResult = LockedResource.obtain(transformed);
    deferredEncodeManager.init(key, encoder, lockedResult);
    result = lockedResult;
  }
  return result;
}
项目:GitHub    文件:ManifestParserTest.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
}
项目:GitHub    文件:ManifestParserTest.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
}
项目:ProgressManager    文件:GlideConfiguration.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    BaseApplication application = (BaseApplication) context.getApplicationContext();
    //Glide 底层默认使用 HttpConnection 进行网络请求,这里替换为 Okhttp 后才能使用本框架,进行 Glide 的加载进度监听
    registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(application.getOkHttpClient()));
}
项目:Protein    文件:OKHttpLibraryGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
项目:KomaMusic    文件:KomaMusicGlideModule.java   
@Override
public void registerComponents(Context context, Registry registry) {
    // Default empty impl.
    registry.append(String.class, InputStream.class, new ArtworkModeLoader.Factory());
}
项目:MoligyMvpArms    文件:GlideConfiguration.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    //Glide 默认使用 HttpURLConnection 做网络请求,在这切换成 Okhttp 请求
    AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context);
    registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(appComponent.okHttpClient()));
}
项目:FireBaseTest    文件:FirebaseGlideModule.java   
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    registry.append(StorageReference.class, InputStream.class, new FirebaseImageLoader.Factory());
}