aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 85c32af0..08ccac33 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -1428,11 +1428,18 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if(artistView.getMaxLines() == minLines) {
// Use LeadingMarginSpan2 to try to make text flow around image
Display display = context.getWindowManager().getDefaultDisplay();
- View coverArtView = header.findViewById(R.id.select_album_art);
+ ImageView coverArtView = (ImageView) header.findViewById(R.id.select_album_art);
coverArtView.measure(display.getWidth(), display.getHeight());
+
+ int height, width;
ViewGroup.MarginLayoutParams vlp = (ViewGroup.MarginLayoutParams) coverArtView.getLayoutParams();
- int height = coverArtView.getMeasuredHeight() + coverArtView.getPaddingBottom();
- int width = coverArtView.getWidth() + coverArtView.getPaddingRight();
+ if(coverArtView.getDrawable() != null) {
+ height = coverArtView.getMeasuredHeight() + coverArtView.getPaddingBottom();
+ width = coverArtView.getWidth() + coverArtView.getPaddingRight();
+ } else {
+ height = coverArtView.getHeight();
+ width = coverArtView.getWidth() + coverArtView.getPaddingRight();
+ }
float textLineHeight = artistView.getPaint().getTextSize();
int lines = (int) Math.ceil(height / textLineHeight);