or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

caching-strategies.mderror-handling-debugging.mdindex.mdmodules-configuration.mdrequest-configuration.mdrequest-management.mdtargets-loading.mdtransformations.mdtransitions-animations.md
tile.json

tessl/maven-com-github-bumptech-glide--glide

A fast and efficient open source media management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/com.github.bumptech.glide/glide@4.16.x

To install, run

npx @tessl/cli install tessl/maven-com-github-bumptech-glide--glide@4.16.0

index.mddocs/

Glide

Glide is a comprehensive Android image loading library that provides fast and efficient media management capabilities for mobile applications. It features automatic memory and disk caching, supports multiple image formats including animated GIFs and video stills, offers seamless integration with various network stacks, and provides a fluent API for common transformations. The library is specifically optimized for smooth scrolling performance in lists and grids with built-in lifecycle management.

Package Information

  • Package Name: com.github.bumptech.glide:glide
  • Package Type: Maven/Gradle
  • Language: Java
  • Installation: implementation 'com.github.bumptech.glide:glide:4.16.0'
  • Minimum Android SDK: API 14 (Android 4.0)

Core Imports

import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;

Basic Usage

// Basic image loading into ImageView
Glide.with(context)
    .load("https://example.com/image.jpg")
    .into(imageView);

// With placeholder and error handling
Glide.with(context)
    .load(imageUrl)
    .placeholder(R.drawable.loading)
    .error(R.drawable.error)
    .into(imageView);

// With transformations
Glide.with(context)
    .load(imageUrl)
    .centerCrop()
    .transform(new RoundedCorners(16))
    .into(imageView);

Architecture

Glide is built around several key components:

  • Entry Point: Glide class provides lifecycle-aware request management
  • Request System: Fluent API through RequestManager and RequestBuilder classes
  • Target System: Flexible destination handling for images (ImageView, custom targets, etc.)
  • Transformation Pipeline: Built-in and custom image transformations (crop, resize, effects)
  • Caching Strategy: Multi-level caching (memory, disk) with configurable policies
  • Extension System: Modular architecture with custom modules, loaders, and decoders

Capabilities

Core Request Management

Essential image loading functionality with lifecycle awareness and fluent API for common use cases.

// Main entry point - lifecycle aware
public static RequestManager with(Context context);
public static RequestManager with(Activity activity);
public static RequestManager with(Fragment fragment);
public static RequestManager with(FragmentActivity activity);

// Request building
public RequestBuilder<Drawable> load(String string);
public RequestBuilder<Drawable> load(Uri uri);
public RequestBuilder<Drawable> load(File file);
public RequestBuilder<Drawable> load(Integer resourceId);
public RequestBuilder<Drawable> load(byte[] model);

Request Management

Image Targets and Loading

Flexible target system for loading images into various UI components and custom destinations.

// Primary loading methods
public ViewTarget<ImageView, TranscodeType> into(ImageView view);
public <Y extends Target<TranscodeType>> Y into(Y target);
public FutureTarget<TranscodeType> submit();
public FutureTarget<TranscodeType> submit(int width, int height);

// Request execution
public Target<TranscodeType> preload();
public Target<TranscodeType> preload(int width, int height);

Targets and Loading

Request Configuration

Comprehensive configuration options for customizing image loading behavior, including placeholders, caching, and sizing.

// Request options
public RequestBuilder<TranscodeType> placeholder(@DrawableRes int resourceId);
public RequestBuilder<TranscodeType> placeholder(@Nullable Drawable drawable);
public RequestBuilder<TranscodeType> error(@DrawableRes int resourceId);
public RequestBuilder<TranscodeType> error(@Nullable Drawable drawable);
public RequestBuilder<TranscodeType> fallback(@DrawableRes int resourceId);

// Sizing and priority
public RequestBuilder<TranscodeType> override(int width, int height);
public RequestBuilder<TranscodeType> priority(@NonNull Priority priority);
public RequestBuilder<TranscodeType> timeout(@IntRange(from = 0) int timeoutMs);

Request Configuration

Image Transformations

Built-in and custom transformations for manipulating images including cropping, scaling, effects, and custom modifications.

// Built-in transformations
public RequestBuilder<TranscodeType> centerCrop();
public RequestBuilder<TranscodeType> centerInside();
public RequestBuilder<TranscodeType> fitCenter();
public RequestBuilder<TranscodeType> circleCrop();

// Custom transformations
public RequestBuilder<TranscodeType> transform(@NonNull Transformation<Bitmap> transformation);
public RequestBuilder<TranscodeType> transform(@NonNull Transformation<Bitmap>... transformations);

Transformations

Caching Strategies

Advanced caching system with memory and disk cache control for optimal performance and resource management.

// Cache control
public RequestBuilder<TranscodeType> diskCacheStrategy(@NonNull DiskCacheStrategy strategy);
public RequestBuilder<TranscodeType> skipMemoryCache(boolean skip);
public RequestBuilder<TranscodeType> onlyRetrieveFromCache(boolean onlyRetrieveFromCache);

// Cache strategies
public enum DiskCacheStrategy {
    ALL, NONE, DATA, RESOURCE, AUTOMATIC
}

Caching Strategies

Transitions and Animations

Animation and transition effects for smooth image loading including cross-fades and custom transitions.

// Transition options
public RequestBuilder<TranscodeType> transition(@NonNull TransitionOptions<?, ? super TranscodeType> transitionOptions);

// Built-in transitions
public static DrawableTransitionOptions withCrossFade();
public static DrawableTransitionOptions withCrossFade(int duration);
public static DrawableTransitionOptions with(@NonNull TransitionFactory<? super Drawable> transitionFactory);

Transitions and Animations

Modules and Configuration

Global configuration and extension system for customizing Glide behavior, including custom loaders, decoders, and cache implementations.

// Module interfaces
public interface GlideModule {
    void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder);
    void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry);
}

// Configuration builder
public final class GlideBuilder {
    public GlideBuilder setBitmapPool(@Nullable BitmapPool bitmapPool);
    public GlideBuilder setMemoryCache(@Nullable MemoryCache memoryCache);
    public GlideBuilder setDiskCache(@Nullable DiskCache.Factory diskCacheFactory);
}

Modules and Configuration

Error Handling and Debugging

Error handling patterns, debugging utilities, and troubleshooting for image loading issues.

// Request listeners
public interface RequestListener<R> {
    boolean onLoadFailed(@Nullable GlideException e, Object model, Target<R> target, boolean isFirstResource);
    boolean onResourceReady(R resource, Object model, Target<R> target, DataSource dataSource, boolean isFirstResource);
}

// Exception handling
public RequestBuilder<TranscodeType> listener(@Nullable RequestListener<TranscodeType> requestListener);

Error Handling and Debugging

Types

// Core enums
public enum Priority {
    LOW, NORMAL, HIGH, IMMEDIATE
}

public enum DecodeFormat {
    PREFER_ARGB_8888, PREFER_RGB_565, DEFAULT  
}

// Data source information
public enum DataSource {
    LOCAL, REMOTE, DATA_DISK_CACHE, RESOURCE_DISK_CACHE, MEMORY_CACHE
}

// Exception wrapper
public final class GlideException extends Exception {
    @Nullable public Throwable getCause();
    public List<Throwable> getRootCauses();
    public void logRootCauses(@NonNull String tag);
}