Back to project page music-tag.
The source code is released under:
Apache License
If you think the Android project music-tag listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package binauld.pierre.musictag.io; //w w w .j a v a 2 s. c om import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.widget.ImageView; import java.lang.ref.WeakReference; public class AsyncDrawable extends BitmapDrawable { private final WeakReference<ArtworkLoader> bitmapWorkerTaskReference; public AsyncDrawable(Resources res, Bitmap bitmap, ArtworkLoader artworkLoader) { super(res, bitmap); bitmapWorkerTaskReference = new WeakReference<>(artworkLoader); } /** * Get the bitmap loader. * @return The bitmap loader. */ ArtworkLoader getBitmapLoader() { return bitmapWorkerTaskReference.get(); } /** * Retrieve bitmap loader from an ImageView. * @param imageView The image view containing the bitmap loader. * @return The bitmap loader or null if it does not exist. */ public static ArtworkLoader retrieveBitmapLoader(ImageView imageView) { if (imageView != null) { final Drawable drawable = imageView.getDrawable(); if (drawable instanceof AsyncDrawable) { final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable; return asyncDrawable.getBitmapLoader(); } } return null; } }