Java Code Examples for com.bumptech.glide.Registry#append()

The following examples show how to use com.bumptech.glide.Registry#append() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignalGlideModule.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
  AttachmentSecret attachmentSecret = AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret();
  byte[]           secret           = attachmentSecret.getModernKey();

  registry.prepend(File.class, File.class, UnitModelLoader.Factory.getInstance());
  registry.prepend(InputStream.class, new EncryptedCacheEncoder(secret, glide.getArrayPool()));
  registry.prepend(File.class, Bitmap.class, new EncryptedBitmapCacheDecoder(secret, new StreamBitmapDecoder(new Downsampler(registry.getImageHeaderParsers(), context.getResources().getDisplayMetrics(), glide.getBitmapPool(), glide.getArrayPool()), glide.getArrayPool())));
  registry.prepend(File.class, GifDrawable.class, new EncryptedGifCacheDecoder(secret, new StreamGifDecoder(registry.getImageHeaderParsers(), new ByteBufferGifDecoder(context, registry.getImageHeaderParsers(), glide.getBitmapPool(), glide.getArrayPool()), glide.getArrayPool())));

  registry.prepend(BlurHash.class, Bitmap.class, new BlurHashResourceDecoder());

  registry.prepend(Bitmap.class, new EncryptedBitmapResourceEncoder(secret));
  registry.prepend(GifDrawable.class, new EncryptedGifDrawableResourceEncoder(secret));

  registry.append(ContactPhoto.class, InputStream.class, new ContactPhotoLoader.Factory(context));
  registry.append(DecryptableUri.class, InputStream.class, new DecryptableStreamUriLoader.Factory(context));
  registry.append(AttachmentModel.class, InputStream.class, new AttachmentStreamUriLoader.Factory());
  registry.append(ChunkedImageUrl.class, InputStream.class, new ChunkedImageUrlLoader.Factory());
  registry.append(StickerRemoteUri.class, InputStream.class, new StickerRemoteUriLoader.Factory());
  registry.append(BlurHash.class, BlurHash.class, new BlurHashModelLoader.Factory());
  registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
 
Example 2
Source File: SignalGlideModule.java    From deltachat-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
  //AttachmentSecret attachmentSecret = AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret();
  //byte[]           secret           = attachmentSecret.getModernKey();

  registry.prepend(File.class, File.class, UnitModelLoader.Factory.getInstance());
  //registry.prepend(InputStream.class, new EncryptedCacheEncoder(secret, glide.getArrayPool()));
  //registry.prepend(File.class, Bitmap.class, new EncryptedBitmapCacheDecoder(secret, new StreamBitmapDecoder(new Downsampler(registry.getImageHeaderParsers(), context.getResources().getDisplayMetrics(), glide.getBitmapPool(), glide.getArrayPool()), glide.getArrayPool())));
  //registry.prepend(File.class, GifDrawable.class, new EncryptedGifCacheDecoder(secret, new StreamGifDecoder(registry.getImageHeaderParsers(), new ByteBufferGifDecoder(context, registry.getImageHeaderParsers(), glide.getBitmapPool(), glide.getArrayPool()), glide.getArrayPool())));

  //registry.prepend(Bitmap.class, new EncryptedBitmapResourceEncoder(secret));
  //registry.prepend(GifDrawable.class, new EncryptedGifDrawableResourceEncoder(secret));

  registry.append(ContactPhoto.class, InputStream.class, new ContactPhotoLoader.Factory(context));
  registry.append(DecryptableUri.class, InputStream.class, new DecryptableStreamUriLoader.Factory(context));
  //registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
 
Example 3
Source File: SignalGlideModule.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
  registry.append(ContactPhoto.class, InputStream.class, new ContactPhotoLoader.Factory(context));
  registry.append(DecryptableUri.class, InputStream.class, new DecryptableStreamUriLoader.Factory(context));
  registry.append(AttachmentModel.class, InputStream.class, new AttachmentStreamUriLoader.Factory());
  registry.replace(GlideUrl.class, InputStream.class, FileHttp.INSTANCE.getOkHttpFactory());
}
 
Example 4
Source File: MyGlideModule.java    From MusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
    super.registerComponents(context, glide, registry);
    registry.append(AudioFileCover.class,InputStream.class,new AudioFileCoverLoader.Factory());
    registry.append(ArtistImage.class,InputStream.class, new ArtistImageLoader.Factory(context));
    registry.register(Bitmap.class, BitmapPaletteWrapper.class, new BitmapPaletteTranscoder());
    registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
 
Example 5
Source File: VinylGlideModule.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide,
                               @NonNull Registry registry) {
    registry.append(AudioFileCover.class, InputStream.class, new AudioFileCoverLoader.Factory());
    registry.append(ArtistImage.class, InputStream.class, new ArtistImageLoader.Factory(context));
    registry.register(Bitmap.class, BitmapPaletteWrapper.class, new BitmapPaletteTranscoder());
}
 
Example 6
Source File: MyAppGlideModule.java    From FirebaseUI-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context,
                               @NonNull Glide glide,
                               @NonNull Registry registry) {
    // Register FirebaseImageLoader to handle StorageReference
    registry.append(StorageReference.class, InputStream.class,
            new FirebaseImageLoader.Factory());
}
 
Example 7
Source File: CustomAppGlideModule.java    From social-app-android with Apache License 2.0 4 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide, Registry registry) {
    // Register FirebaseImageLoader to handle StorageReference
    registry.append(StorageReference.class, InputStream.class,
            new FirebaseImageLoader.Factory());
}
 
Example 8
Source File: MyAppGlideModule.java    From snippets-android with Apache License 2.0 4 votes vote down vote up
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    // Register FirebaseImageLoader to handle StorageReference
    registry.append(StorageReference.class, InputStream.class,
            new FirebaseImageLoader.Factory());
}
 
Example 9
Source File: FirebaseGlideModule.java    From doorbell with Apache License 2.0 4 votes vote down vote up
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    // Register FirebaseImageLoader to handle StorageReference
    registry.append(StorageReference.class, InputStream.class,
            new FirebaseImageLoader.Factory());
}