aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-28 11:28:31 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-28 11:28:31 -0700
commit24114e5fa36ede829664553525354395c1aaffe6 (patch)
tree846b2e95a255399c20e46fdf718dd4718f4f6368
parent2ca4046cd93f8a4385a2d9925fef20a407946543 (diff)
downloaddsub-24114e5fa36ede829664553525354395c1aaffe6.tar.gz
dsub-24114e5fa36ede829664553525354395c1aaffe6.tar.bz2
dsub-24114e5fa36ede829664553525354395c1aaffe6.zip
#371 ImageLoader tasks return a ImageTask if used
-rw-r--r--src/github/daneren2005/dsub/util/ImageLoader.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/github/daneren2005/dsub/util/ImageLoader.java b/src/github/daneren2005/dsub/util/ImageLoader.java
index d42fd5b9..cc85a2fb 100644
--- a/src/github/daneren2005/dsub/util/ImageLoader.java
+++ b/src/github/daneren2005/dsub/util/ImageLoader.java
@@ -115,7 +115,7 @@ public class ImageLoader {
return bitmap;
}
- public void loadImage(View view, MusicDirectory.Entry entry, boolean large, boolean crossfade) {
+ public ImageTask loadImage(View view, MusicDirectory.Entry entry, boolean large, boolean crossfade) {
if (largeUnknownImage != null && ((BitmapDrawable)largeUnknownImage).getBitmap().isRecycled()) {
createLargeUnknownImage(view.getContext());
}
@@ -129,7 +129,7 @@ public class ImageLoader {
}
if (entry == null || entry.getCoverArt() == null) {
setUnknownImage(view, large);
- return;
+ return null;
}
int size = large ? imageSizeLarge : imageSizeDefault;
@@ -140,45 +140,45 @@ public class ImageLoader {
if(large) {
nowPlaying = bitmap;
}
- return;
+ return null;
}
if (!large) {
setUnknownImage(view, large);
}
- new ViewImageTask(view.getContext(), entry, size, imageSizeLarge, large, view, crossfade).execute();
+ return new ViewImageTask(view.getContext(), entry, size, imageSizeLarge, large, view, crossfade).execute();
}
- public void loadImage(Context context, RemoteControlClient remoteControl, MusicDirectory.Entry entry) {
+ public ImageTask loadImage(Context context, RemoteControlClient remoteControl, MusicDirectory.Entry entry) {
if (largeUnknownImage != null && ((BitmapDrawable)largeUnknownImage).getBitmap().isRecycled()) {
createLargeUnknownImage(context);
}
if (entry == null || entry.getCoverArt() == null) {
setUnknownImage(remoteControl);
- return;
+ return null;
}
Bitmap bitmap = cache.get(getKey(entry.getCoverArt(), imageSizeLarge));
if (bitmap != null && !bitmap.isRecycled()) {
Drawable drawable = Util.createDrawableFromBitmap(this.context, bitmap);
setImage(remoteControl, drawable);
- return;
+ return null;
}
setUnknownImage(remoteControl);
- new RemoteControlClientImageTask(context, entry, imageSizeLarge, imageSizeLarge, false, remoteControl).execute();
+ return new RemoteControlClientImageTask(context, entry, imageSizeLarge, imageSizeLarge, false, remoteControl).execute();
}
- public void loadAvatar(Context context, ImageView view, String username) {
+ public ImageTask loadAvatar(Context context, ImageView view, String username) {
Bitmap bitmap = cache.get(username);
if (bitmap != null && !bitmap.isRecycled()) {
Drawable drawable = Util.createDrawableFromBitmap(this.context, bitmap);
view.setImageDrawable(drawable);
- return;
+ return null;
}
- new AvatarTask(context, view, username).execute();
+ return new AvatarTask(context, view, username).execute();
}
private String getKey(String coverArtId, int size) {
@@ -262,7 +262,7 @@ public class ImageLoader {
setImage(remoteControl, largeUnknownImage);
}
- private abstract class ImageTask extends SilentBackgroundTask<Void> {
+ public abstract class ImageTask extends SilentBackgroundTask<Void> {
private final Context mContext;
private final MusicDirectory.Entry mEntry;
private final int mSize;