Set ellipsize and horizontally scrolling state based on selected state
This commit is contained in:
parent
ce210e9683
commit
2706210cef
|
@ -381,11 +381,21 @@ abstract public class AbstractInfoFragment extends AbstractFragment
|
||||||
int lines = titleTextView.getLineCount();
|
int lines = titleTextView.getLineCount();
|
||||||
int maxLines = TextViewCompat.getMaxLines(titleTextView);
|
int maxLines = TextViewCompat.getMaxLines(titleTextView);
|
||||||
if (lines > maxLines) {
|
if (lines > maxLines) {
|
||||||
titleTextView.setHorizontallyScrolling(true);
|
titleTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
titleTextView.setClickable(true);
|
titleTextView.setClickable(true);
|
||||||
titleTextView.setOnClickListener(new View.OnClickListener() {
|
titleTextView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) { v.setSelected(!v.isSelected()); }
|
public void onClick(View v) {
|
||||||
|
v.setSelected(!v.isSelected());
|
||||||
|
TextUtils.TruncateAt ellipsize;
|
||||||
|
if (v.isSelected()) {
|
||||||
|
ellipsize = TextUtils.TruncateAt.MARQUEE;
|
||||||
|
} else {
|
||||||
|
ellipsize = TextUtils.TruncateAt.END;
|
||||||
|
}
|
||||||
|
titleTextView.setEllipsize(ellipsize);
|
||||||
|
titleTextView.setHorizontallyScrolling(v.isSelected());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -759,11 +759,21 @@ public class NowPlayingFragment extends Fragment
|
||||||
int lines = mediaTitle.getLineCount();
|
int lines = mediaTitle.getLineCount();
|
||||||
int maxLines = TextViewCompat.getMaxLines(mediaTitle);
|
int maxLines = TextViewCompat.getMaxLines(mediaTitle);
|
||||||
if (lines > maxLines) {
|
if (lines > maxLines) {
|
||||||
mediaTitle.setHorizontallyScrolling(true);
|
mediaTitle.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
mediaTitle.setClickable(true);
|
mediaTitle.setClickable(true);
|
||||||
mediaTitle.setOnClickListener(new View.OnClickListener() {
|
mediaTitle.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) { v.setSelected(!v.isSelected()); }
|
public void onClick(View v) {
|
||||||
|
v.setSelected(!v.isSelected());
|
||||||
|
TextUtils.TruncateAt ellipsize;
|
||||||
|
if (v.isSelected()) {
|
||||||
|
ellipsize = TextUtils.TruncateAt.MARQUEE;
|
||||||
|
} else {
|
||||||
|
ellipsize = TextUtils.TruncateAt.END;
|
||||||
|
}
|
||||||
|
mediaTitle.setEllipsize(ellipsize);
|
||||||
|
mediaTitle.setHorizontallyScrolling(v.isSelected());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue