implementation 'com.github.bumptech.glide:glide:version'
CIImageLoadRequest
by using CloudInfinite
and CITransformation
.CloudInfinite cloudInfinite = new CloudInfinite();CITransformation transform = new CITransformation();transform.thumbnailByScale(50).iradius(60);CIImageLoadRequest request = cloudInfinite.requestWithBaseUrlSync(url, transform);
CIImageLoadRequest
and use Glide to load it.Glide.with(activity).load(request.getUrl().toString()).into(imageview);
implementation 'com.qcloud.cos:cloud-infinite-glide:1.2.1'annotationProcessor 'com.github.bumptech.glide:compiler:version'
AppGlideModule
to implement corresponding features.// Register the custom `GlideModule`// You should create this class to register `CIImageRequestModelLoader` and `ImageAveDecoder`.<br>// If you develop class libraries, you can inherit `LibraryGlideModule` to create a similar registration class.@GlideModulepublic class MyAppGlideModule extends AppGlideModule {@Overridepublic void registerComponents(@NonNull Context context, @NonNull Glide glide, Registry registry) {// Register a loader that supports `CIImageLoadRequest`registry.prepend(CIImageLoadRequest.class, InputStream.class, new CIImageRequestModelLoader.Factory());// Register the main color decoderregistry.prepend(InputStream.class, Bitmap.class, new ImageAveDecoder(glide.getBitmapPool()));}}
// Register the main color decoder in `AppGlideModule` firstregistry.prepend(InputStream.class, Bitmap.class, new ImageAveDecoder(glide.getBitmapPool()));// Use Glide's thumbnail to preload the main colorGlide.with(context).load(imageUrl).thumbnail(CloudInfiniteGlide.getImageAveThumbnail(context, imageUrl)).into(imageview);
CIImageLoadRequest
registry.prepend(CIImageLoadRequest.class, InputStream.class, new CIImageRequestModelLoader.Factory());
implementation 'com.qcloud.cos:tpg:1.3.2'annotationProcessor 'com.github.bumptech.glide:compiler:version'
AppGlideModule
to implement corresponding features.// Register the custom `GlideModule`// You should create this class to register `TpgDecoder` and `ByteBufferTpgGifDecoder`.<br>// If you develop class libraries, you can inherit `LibraryGlideModule` to create a similar registration class.@GlideModulepublic class MyAppGlideModule extends AppGlideModule {@Overridepublic void registerComponents(@NonNull Context context, @NonNull Glide glide, Registry registry) {/*------------------Decoder start-------------------------*/// Register the static TPG image decoderregistry.prepend(InputStream.class, Bitmap.class, new TpgDecoder(glide.getBitmapPool()));// Register the animated TPG image decoderByteBufferTpgGifDecoder byteBufferTpgGifDecoder = new ByteBufferTpgGifDecoder(context, glide.getBitmapPool(), glide.getArrayPool());registry.prepend(InputStream.class, GifDrawable.class, new StreamTpgGifDecoder(byteBufferTpgGifDecoder));registry.prepend(ByteBuffer.class, GifDrawable.class, byteBufferTpgGifDecoder);/*------------------Decoder end-------------------------*/}}
registry.prepend(InputStream.class, Bitmap.class, new TpgDecoder(glide.getBitmapPool()));
ByteBufferTpgGifDecoder byteBufferTpgGifDecoder = new ByteBufferTpgGifDecoder(context, glide.getBitmapPool(), glide.getArrayPool());registry.prepend(InputStream.class, GifDrawable.class, new StreamTpgGifDecoder(byteBufferTpgGifDecoder));registry.prepend(ByteBuffer.class, GifDrawable.class, byteBufferTpgGifDecoder);
implementation 'com.qcloud.cos:avif:1.0.0'annotationProcessor 'com.github.bumptech.glide:compiler:version'
AppGlideModule
to implement corresponding features.// Register the custom `GlideModule`// You should create this class to register relevant decoders.<br>// If you develop class libraries, you can inherit `LibraryGlideModule` to create a similar registration class.@GlideModulepublic class MyAppGlideModule extends AppGlideModule {@Overridepublic void registerComponents(@NonNull Context context, @NonNull Glide glide, Registry registry) {/*------------------Decoder start-------------------------*/// Register the static AVIF image decoderregistry.prepend(Registry.BUCKET_BITMAP, InputStream.class, Bitmap.class, new StreamAvifDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(Registry.BUCKET_BITMAP, ByteBuffer.class, Bitmap.class, new ByteBufferAvifDecoder(glide.getBitmapPool()));// Register the animated AVIF image decoderregistry.prepend(InputStream.class, AvifSequenceDrawable.class, new StreamAvifSequenceDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(ByteBuffer.class, AvifSequenceDrawable.class, new ByteBufferAvifSequenceDecoder(glide.getBitmapPool()));/*------------------Decoder end-------------------------*/}}
registry.prepend(Registry.BUCKET_BITMAP, InputStream.class, Bitmap.class, new StreamAvifDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(Registry.BUCKET_BITMAP, ByteBuffer.class, Bitmap.class, new ByteBufferAvifDecoder(glide.getBitmapPool()));
registry.prepend(InputStream.class, AvifSequenceDrawable.class, new StreamAvifSequenceDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(ByteBuffer.class, AvifSequenceDrawable.class, new ByteBufferAvifSequenceDecoder(glide.getBitmapPool()));
Was this page helpful?