-
- All Implemented Interfaces:
-
com.mobwith.imgmodule.load.Key,com.mobwith.imgmodule.load.Transformation
public class GifDrawableTransformation implements Transformation<GifDrawable>
An com.mobwith.imgmodule.load.Transformation that wraps a transformation for a and can apply it to every frame of any .
-
-
Constructor Summary
Constructors Constructor Description GifDrawableTransformation(Transformation<Bitmap> wrapped)
-
Method Summary
Modifier and Type Method Description Resource<GifDrawable>transform(@NonNull() Context context, @NonNull() Resource<GifDrawable> resource, int outWidth, int outHeight)Transforms the given resource and returns the transformed resource. booleanequals(Object o)inthashCode()voidupdateDiskCacheKey(@NonNull() MessageDigest messageDigest)Adds all uniquely identifying information to the given digest. -
-
Constructor Detail
-
GifDrawableTransformation
GifDrawableTransformation(Transformation<Bitmap> wrapped)
-
-
Method Detail
-
transform
@NonNull() Resource<GifDrawable> transform(@NonNull() Context context, @NonNull() Resource<GifDrawable> resource, int outWidth, int outHeight)
Transforms the given resource and returns the transformed resource.
If the original resource object is not returned, the original resource will be recycled andit's internal resources may be reused. This means it is not safe to rely on the originalresource or any internal state of the original resource in any new resource that is created.Usually this shouldn't occur, but if absolutely necessary either the original resource objectcan be returned with modified internal state, or the data in the original resource can becopied into the transformed resource.
If a Transformation is updated, equals, hashCode, and should all change. If you're using a simpleString key an easy way to do this is to append a version number to your key. Failing to do sowill mean users may see images loaded from cache that had the old version of the Transformationapplied. Changing the return values of those methods will ensure that the cache key has changedand therefore that any cached resources will be re-generated using the updated Transformation.
During development you may need to either using or make sure changes each time you make a change to theTransformation. Otherwise the resource you request may be loaded from disk cache and yourTransformation may not be called.
- Parameters:
context- The Application contextresource- The resource to transform.outWidth- The width of the view or target the resource will be displayed in, or to indicate the original resourcewidth.outHeight- The height of the view or target the resource will be displayed in, or to indicate the original resourceheight.
-
hashCode
int hashCode()
-
updateDiskCacheKey
void updateDiskCacheKey(@NonNull() MessageDigest messageDigest)
Adds all uniquely identifying information to the given digest.
Note - Using reset inside of this method will resultin undefined behavior.
-
-
-
-