From bd5a26c07c2fb787ef8ae430f33768a1dc09cc8a Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 4 Mar 2015 17:30:35 -0800 Subject: Fix clicking on artist text if image is still loading --- .../daneren2005/dsub/fragments/SelectDirectoryFragment.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/github') 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); -- cgit v1.2.3