All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bumptech.glide.load.resource.UnitTransformation Maven / Gradle / Ivy

Go to download

A fast and efficient image loading library for Android focused on smooth scrolling.

There is a newer version: 5.0.0-rc01
Show newest version
package com.bumptech.glide.load.resource;

import android.content.Context;
import androidx.annotation.NonNull;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.engine.Resource;
import java.security.MessageDigest;

/**
 * A no-op Transformation that simply returns the given resource.
 *
 * @param  The type of the resource that will always be returned unmodified.
 */
public final class UnitTransformation implements Transformation {
  private static final Transformation TRANSFORMATION = new UnitTransformation<>();

  /**
   * Returns a UnitTransformation for the given type.
   *
   * @param  The type of the resource to be transformed.
   */
  @SuppressWarnings("unchecked")
  @NonNull
  public static  UnitTransformation get() {
    return (UnitTransformation) TRANSFORMATION;
  }

  private UnitTransformation() {
    // Only accessible as a singleton.
  }

  @NonNull
  @Override
  public Resource transform(
      @NonNull Context context, @NonNull Resource resource, int outWidth, int outHeight) {
    return resource;
  }

  @Override
  public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
    // Do nothing.
  }

  /* Use default implementations of equals and hashcode. */
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy