aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-08-05 16:42:42 -0700
committerScott Jackson <daneren2005@gmail.com>2014-08-05 16:42:42 -0700
commitd0a1db8fff0694835cd894b626149347d0649d2c (patch)
tree6477363d1a4f1583da4c66f89f5f2d6b742aefb7 /src
parent9baf62ec9bb6f3d7c18675a962468c3f7109ee74 (diff)
downloaddsub-d0a1db8fff0694835cd894b626149347d0649d2c.tar.gz
dsub-d0a1db8fff0694835cd894b626149347d0649d2c.tar.bz2
dsub-d0a1db8fff0694835cd894b626149347d0649d2c.zip
Try a couple of times for a entry with non-null art
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 14b83317..c26d7085 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -1149,7 +1149,14 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
final ImageLoader imageLoader = getImageLoader();
- final MusicDirectory.Entry albumRep = entries.get(random.nextInt(entries.size()));
+
+ // Try a few times to get a random cover art
+ MusicDirectory.Entry coverArt = null;
+ for(int i = 0; (i < 3) && (coverArt == null || coverArt.getCoverArt() == null); i++) {
+ coverArt = entries.get(random.nextInt(entries.size()));
+ }
+
+ final MusicDirectory.Entry albumRep = coverArt;
View coverArtView = header.findViewById(R.id.select_album_art);
coverArtView.setOnClickListener(new View.OnClickListener() {
@Override