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

The following examples show how to use com.bumptech.glide.Registry#prepend() . 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: GlideAnimationModule.java    From APNG4Android with Apache License 2.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);
    ByteBufferAnimationDecoder byteBufferAnimationDecoder = new ByteBufferAnimationDecoder();
    StreamAnimationDecoder streamAnimationDecoder = new StreamAnimationDecoder(byteBufferAnimationDecoder);
    registry.prepend(InputStream.class, Drawable.class, streamAnimationDecoder);
    registry.prepend(ByteBuffer.class, Drawable.class, byteBufferAnimationDecoder);
}
 
Example 4
Source File: AppIconGlideModule.java    From SoloPi with Apache License 2.0 4 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
    super.registerComponents(context, glide, registry);
    registry.prepend(String.class, ByteBuffer.class,new ApkModelLoaderFactory(context));
}
 
Example 5
Source File: GlideVFSModule.java    From zom-android-matrix with Apache License 2.0 4 votes vote down vote up
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    //super.registerComponents(context, glide, registry);
    registry.prepend(info.guardianproject.iocipher.FileInputStream.class, InputStream.class, new GlideVFSLoader.Factory());
}
 
Example 6
Source File: AegisGlideModule.java    From Aegis with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
    registry.prepend(VaultEntry.class, ByteBuffer.class, new IconLoader.Factory());
}
 
Example 7
Source File: GlideVFSModule.java    From Zom-Android-XMPP with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    super.registerComponents(context, glide, registry);
    registry.prepend(info.guardianproject.iocipher.FileInputStream.class, InputStream.class, new GlideVFSLoader.Factory());
}