com.bumptech.glide.Registry Java Examples
The following examples show how to use
com.bumptech.glide.Registry.
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: MyAppGlideModule.java From nativescript-image-cache-it with Apache License 2.0 | 6 votes |
@Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { super.registerComponents(context, glide, registry); OkHttpClient okHttpClient = new OkHttpClient(); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(okHttpClient)); OkHttpClient client = new OkHttpClient.Builder() .addInterceptor(createInterceptor(progressListener)) .build(); OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(client); registry.replace(GlideUrl.class, InputStream.class, factory); for (ImageHeaderParser parser : registry.getImageHeaderParsers()) { if (parser instanceof ExifInterfaceImageHeaderParser) { registry.getImageHeaderParsers().remove(parser); } } }
Example #2
Source File: SignalGlideModule.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@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 #3
Source File: SignalGlideModule.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
@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 #4
Source File: GlideModelConfig.java From ImageLoader with Apache License 2.0 | 6 votes |
@Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { /** * 不带拦截功能,只是单纯替换通讯组件 */ OkHttpClient.Builder builder = new OkHttpClient.Builder(); setIgnoreAll(builder); OkHttpClient client=builder .addNetworkInterceptor(new ProgressInterceptor()) .connectTimeout(30, TimeUnit.SECONDS) .readTimeout(30, TimeUnit.SECONDS) .writeTimeout(30, TimeUnit.SECONDS) .build(); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client)); Log.i("glide","registerComponents---"); }
Example #5
Source File: GlideConfiguration.java From MVPArms with Apache License 2.0 | 5 votes |
@Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { //Glide 默认使用 HttpURLConnection 做网络请求,在这切换成 Okhttp 请求 AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(appComponent.okHttpClient())); BaseImageLoaderStrategy loadImgStrategy = appComponent.imageLoader().getLoadImgStrategy(); if (loadImgStrategy instanceof GlideAppliesOptions) { ((GlideAppliesOptions) loadImgStrategy).registerComponents(context, glide, registry); } }
Example #6
Source File: PandroidLibraryGlideModule.java From pandroid with Apache License 2.0 | 5 votes |
protected static void setupOkHttpClient(@NonNull Context context, @NonNull Registry registry) { if (!setupOkHttpClient) { setupOkHttpClient = true; OkHttpClient.Builder builder = PandroidApplication.getInjector(context).getBaseComponent().okHttpClientBuilder(); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(builder.build())); } }
Example #7
Source File: GlideConfiguration.java From MVVMArms with Apache License 2.0 | 5 votes |
@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())); }
Example #8
Source File: VinylGlideModule.java From VinylMusicPlayer with GNU General Public License v3.0 | 5 votes |
@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 #9
Source File: AbstractGlideModule.java From DMusic with Apache License 2.0 | 5 votes |
@Override public void registerComponents(Context context, Glide glide, Registry registry) { OkHttpClient.Builder builder = new OkHttpClient.Builder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(10, TimeUnit.SECONDS) .writeTimeout(10, TimeUnit.SECONDS); SSLSocketFactory sslSocketFactory = getSSLSocketFactory(); if (sslSocketFactory != null) { builder.sslSocketFactory(sslSocketFactory); } registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(builder.build())); }
Example #10
Source File: GlideModule.java From glide-support with The Unlicense | 5 votes |
@Override public void registerComponents( @NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { super.registerComponents(context, glide, registry); com.facebook.stetho.Stetho.initializeWithDefaults(context); okhttp3.OkHttpClient client = new okhttp3.OkHttpClient.Builder() .addNetworkInterceptor(new com.facebook.stetho.okhttp3.StethoInterceptor()) .build(); registry.replace(GlideUrl.class, InputStream.class, new com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader.Factory(client)); }
Example #11
Source File: SvgModule.java From SvgGlidePlugins with Apache License 2.0 | 5 votes |
private void registerDecoders(@NonNull Context context, @NonNull Registry registry) { registry.append(REGISTRY, InputStream.class, SVG.class, new InputStreamSvgDecoder()) .append(REGISTRY, File.class, SVG.class, new FileSvgDecoder()) .append(REGISTRY, FileDescriptor.class, SVG.class, new FileDescriptorSvgDecoder()) .append(REGISTRY, ParcelFileDescriptor.class, SVG.class, new ParcelFileDescriptorSvgDecoder()) .append(REGISTRY, SVG.class, SVG.class, new UnitSVGDecoder()) .append(REGISTRY, ByteBuffer.class, SVG.class, new ByteBufferSvgDecoder()) .append(REGISTRY, String.class, SVG.class, new StringSvgDecoder()) .append(REGISTRY, Uri.class, SVG.class, new RawResourceSvgDecoder(context)); }
Example #12
Source File: SvgModule.java From SvgGlidePlugins with Apache License 2.0 | 5 votes |
@Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { registry.register(SVG.class, BitmapDrawable.class, new SvgBitmapDrawableTranscoder(context, glide)) .append(SVG.class, SVG.class, UnitModelLoader.Factory.getInstance()) .append(String.class, String.class, StringLoader.Factory.getInstance()); registerDecoders(context, registry); }
Example #13
Source File: GlideModule.java From glide-support with The Unlicense | 5 votes |
@Override public void registerComponents( @NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { // just to see the headers actually went through, Stetho or proxy can also be used for this registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(new OkHttpClient.Builder() .addNetworkInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.HEADERS)) .build())); // override default loader with one that attaches headers registry.replace(String.class, InputStream.class, new HeaderedLoader.Factory()); }
Example #14
Source File: QuickModule.java From glide-support with The Unlicense | 5 votes |
@Override public void registerComponents( @NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { // registry.replace(GlideUrl.class, InputStream.class, new HttpGlideUrlLoader.Factory()); // OkHttpClient client = new OkHttpClient.Builder() // .connectTimeout(15, TimeUnit.SECONDS) // .readTimeout(15, TimeUnit.SECONDS) // .build(); // registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client)); }
Example #15
Source File: MyGlideModule.java From MusicPlayer with GNU General Public License v3.0 | 5 votes |
@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 #16
Source File: HomeAssistAppGlideModule.java From homeassist with Apache License 2.0 | 5 votes |
@Override public void registerComponents(Context context, Glide glide, Registry registry) { OkHttpClient client = ServiceProvider.getGlideOkHttpClientInstance(); OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(client); glide.getRegistry().replace(GlideUrl.class, InputStream.class, factory); }
Example #17
Source File: SignalGlideModule.java From bcm-android with GNU General Public License v3.0 | 5 votes |
@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 #18
Source File: MyAppGlideModule.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@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 #19
Source File: ExifGlideModule.java From Twire with GNU General Public License v3.0 | 5 votes |
@Override public void registerComponents(Context context, Glide glide, Registry registry) { List<ImageHeaderParser> headers = registry.getImageHeaderParsers(); for (ImageHeaderParser header : headers) { if (header instanceof ExifInterfaceImageHeaderParser) { headers.remove(header); } } }
Example #20
Source File: TyGlide.java From tysq-android with GNU General Public License v3.0 | 5 votes |
@Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(OkHttpHelper.getOkHttpInstance()); registry.replace(GlideUrl.class, InputStream.class, factory); }
Example #21
Source File: GlideAnimationModule.java From APNG4Android with Apache License 2.0 | 5 votes |
@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 #22
Source File: AbstractGlideModule.java From Common with Apache License 2.0 | 5 votes |
@Override public void registerComponents(Context context, Glide glide, Registry registry) { OkHttpClient.Builder builder = new OkHttpClient.Builder() .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(10, TimeUnit.SECONDS) .writeTimeout(10, TimeUnit.SECONDS); SSLSocketFactory sslSocketFactory = getSSLSocketFactory(); if (sslSocketFactory != null) { builder.sslSocketFactory(sslSocketFactory); } registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(builder.build())); }
Example #23
Source File: CustomGlideModule.java From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 | 5 votes |
@Override public void registerComponents(final Context context, final Glide glide, final Registry registry) { final OkHttpClient.Builder builder = new OkHttpClient().newBuilder(); builder.connectTimeout(15, TimeUnit.SECONDS); builder.readTimeout(30, TimeUnit.SECONDS); // Uncomment to use Stetho network debugging // if (BuildConfig.DEBUG) { // builder.addNetworkInterceptor(new com.facebook.stetho.okhttp3.StethoInterceptor()).build(); // } final OkHttpClient client = builder.build(); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client)); }
Example #24
Source File: GlideVFSModule.java From Zom-Android-XMPP with GNU General Public License v3.0 | 4 votes |
@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 #25
Source File: SingleSignOnLibraryGlideModule.java From nextcloud-notes with GNU General Public License v3.0 | 4 votes |
@Override public void registerComponents( @NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { Log.v(TAG, "Replacing default implementation for " + GlideUrl.class.getSimpleName() + "."); registry.replace(GlideUrl.class, InputStream.class, new SingleSignOnUrlLoader.Factory(context)); }
Example #26
Source File: AppGlideModule.java From glide-support with The Unlicense | 4 votes |
@Override public void registerComponents( @NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { for (com.bumptech.glide.module.GlideModule module : modules) { module.registerComponents(context, glide, registry); } }
Example #27
Source File: GlobalOkHttpGlideModule.java From glide-support with The Unlicense | 4 votes |
@Override public void registerComponents(Context context, Glide glide, Registry registry) { okhttp3.OkHttpClient client = new OkHttpClient.Builder().build(); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client)); }
Example #28
Source File: BaseGlide.java From BaseProject with Apache License 2.0 | 4 votes |
@Override public void registerComponents(Context context, Glide glide, Registry registry) { super.registerComponents(context, glide, registry); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(ProgressManager.getOkHttpClient())); }
Example #29
Source File: CustomAppGlideModule.java From nextcloud-notes with GNU General Public License v3.0 | 4 votes |
@Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { super.registerComponents(context, glide, registry); }
Example #30
Source File: CustomAppGlideModule.java From social-app-android with Apache License 2.0 | 4 votes |
@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()); }