diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-01-19 18:19:18 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-01-19 18:19:18 -0800 |
commit | 97000f52056a2367f169f122842c5df6eedd62db (patch) | |
tree | c9fdfbf17f1384e1609a22145b8919ed1e67ba88 /src | |
parent | d5758b2ec0edfc257bab18dd7cab572e2e02dbbe (diff) | |
download | dsub-97000f52056a2367f169f122842c5df6eedd62db.tar.gz dsub-97000f52056a2367f169f122842c5df6eedd62db.tar.bz2 dsub-97000f52056a2367f169f122842c5df6eedd62db.zip |
Fix issue where url is a space instead of null, and try to do same child lookup on url failure
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/util/ImageLoader.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/github/daneren2005/dsub/util/ImageLoader.java b/src/github/daneren2005/dsub/util/ImageLoader.java index 97c7f626..a6f482eb 100644 --- a/src/github/daneren2005/dsub/util/ImageLoader.java +++ b/src/github/daneren2005/dsub/util/ImageLoader.java @@ -448,7 +448,7 @@ public class ImageLoader { String url = artistInfo.getImageUrl(); // Figure out whether we are going to get a artist image or the standard image - if(url != null) { + if(url != null && !"".equals(url.trim())) { // If getting the artist image fails for any reason, retry for the standard version subTask = new ViewUrlTask(mContext, mView, url, mSize) { @Override @@ -460,13 +460,23 @@ public class ImageLoader { subTask = null; } }; - } else if(mEntry != null && mEntry.getCoverArt() != null) { - subTask = new ViewImageTask(mContext, mEntry, mSize, mSaveSize, mIsNowPlaying, mView, mCrossfade); } else { - // If entry is null as well, we need to just set as a blank image - Bitmap bitmap = getUnknownImage(mEntry, mSize); - mDrawable = Util.createDrawableFromBitmap(mContext, bitmap); - return null; + if (mEntry != null && mEntry.getCoverArt() == null && mEntry.isDirectory() && !Util.isOffline(context)) { + // Try to lookup child cover art + MusicDirectory.Entry firstChild = FileUtil.lookupChild(context, mEntry, true); + if (firstChild != null) { + mEntry.setCoverArt(firstChild.getCoverArt()); + } + } + + if (mEntry != null && mEntry.getCoverArt() != null) { + subTask = new ViewImageTask(mContext, mEntry, mSize, mSaveSize, mIsNowPlaying, mView, mCrossfade); + } else { + // If entry is null as well, we need to just set as a blank image + Bitmap bitmap = getUnknownImage(mEntry, mSize); + mDrawable = Util.createDrawableFromBitmap(mContext, bitmap); + return null; + } } // Execute whichever way we decided to go |