aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-04 17:30:35 -0800
committerScott Jackson <daneren2005@gmail.com>2015-03-04 17:30:35 -0800
commitbd5a26c07c2fb787ef8ae430f33768a1dc09cc8a (patch)
treeaeea1d91264b7dd9c0b3c62dc8c9153db2b0cb6c
parent1faf919fcc26f894e1c8dd99a3d7c6f28a7f39a7 (diff)
downloaddsub-bd5a26c07c2fb787ef8ae430f33768a1dc09cc8a.tar.gz
dsub-bd5a26c07c2fb787ef8ae430f33768a1dc09cc8a.tar.bz2
dsub-bd5a26c07c2fb787ef8ae430f33768a1dc09cc8a.zip
Fix clicking on artist text if image is still loading
-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);