
com.bumptech.glide.load.resource.SimpleResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glide Show documentation
Show all versions of glide Show documentation
A fast and efficient image loading library for Android focused on smooth scrolling.
The newest version!
package com.bumptech.glide.load.resource;
import androidx.annotation.NonNull;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.util.Preconditions;
/**
* Simple wrapper for an arbitrary object which helps to satisfy some of the glide engine's
* contracts. Suggested usages only include resource object which don't have size and cannot be
* recycled/closed.
*
* @param type of the wrapped resource
*/
// TODO: there isn't much point in caching these...
public class SimpleResource implements Resource {
protected final T data;
public SimpleResource(@NonNull T data) {
this.data = Preconditions.checkNotNull(data);
}
@NonNull
@SuppressWarnings("unchecked")
@Override
public Class getResourceClass() {
return (Class) data.getClass();
}
@NonNull
@Override
public final T get() {
return data;
}
@Override
public final int getSize() {
return 1;
}
@Override
public void recycle() {
// no op
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy