Skip to content

Commit a1339a5

Browse files
committed
fix(android): ellipsing fix
1 parent 38d6485 commit a1339a5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

plugin/platforms/android/java/com/nativescript/label/EllipsizingTextView.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class EllipsizingTextView extends AppCompatTextView {
2727
final static String TAG = "EllipsizingTextView";
2828

2929
private TextUtils.TruncateAt ellipsize = null;
30-
private TextUtils.TruncateAt multiLineEllipsize = null;
30+
// private TextUtils.TruncateAt multiLineEllipsize = null;
3131
private boolean isEllipsized = false;
3232
private boolean needsEllipsing = false;
3333
private boolean needsResizing = false;
@@ -380,7 +380,7 @@ public void setText(CharSequence text, BufferType type) {
380380

381381
private void updateShouldEllipsize() {
382382
// log("EllipsizingTextView updateShouldEllipsize");
383-
needsEllipsize = (ellipsize != null || multiLineEllipsize != null) && fullText != null && fullText.length() > 0;
383+
needsEllipsize = (ellipsize != null) && fullText != null && fullText.length() > 0;
384384

385385
}
386386

@@ -418,16 +418,16 @@ protected void onTextChanged(final CharSequence text, final int start, final int
418418
}
419419
}
420420

421-
public void setMultiLineEllipsize(TextUtils.TruncateAt where) {
422-
// log("EllipsizingTextView setMultiLineEllipsize");
423-
multiLineEllipsize = where;
424-
updateShouldEllipsize();
425-
updateEllipsize();
426-
}
421+
// public void setMultiLineEllipsize(TextUtils.TruncateAt where) {
422+
// // log("EllipsizingTextView setMultiLineEllipsize");
423+
// multiLineEllipsize = where;
424+
// updateShouldEllipsize();
425+
// updateEllipsize();
426+
// }
427427

428-
public TextUtils.TruncateAt getMultiLineEllipsize() {
429-
return multiLineEllipsize;
430-
}
428+
// public TextUtils.TruncateAt getMultiLineEllipsize() {
429+
// return multiLineEllipsize;
430+
// }
431431

432432
private void refitText(String text, int textWidth) {
433433
// log("EllipsizingTextView refitText");
@@ -520,7 +520,7 @@ private void ellipseText(int width, int height) {
520520

521521
if (fullText instanceof Spanned) {
522522
SpannableStringBuilder htmlWorkingText = new SpannableStringBuilder(fullText);
523-
if (this.singleline == false && multiLineEllipsize != null) {
523+
if (this.singleline == false) {
524524
SpannableStringBuilder newText = new SpannableStringBuilder();
525525
String str = htmlWorkingText.toString();
526526
String[] separated = str.split("\n");
@@ -554,7 +554,7 @@ private void ellipseText(int width, int height) {
554554

555555
CharSequence lastLine = newText.subSequence(newStart, newStart + lineSpanned.length());
556556
if (createWorkingLayout(lastLine, width).getLineCount() > 1)
557-
lastLine = getEllipsedTextForOneLine(lastLine, multiLineEllipsize, width);
557+
lastLine = getEllipsedTextForOneLine(lastLine, ellipsize, width);
558558

559559
newText.replace(newStart, newStart + lineSpanned.length(), lastLine);
560560
}
@@ -564,7 +564,7 @@ private void ellipseText(int width, int height) {
564564
newStart = newText.length();
565565
}
566566
workingText = newText;
567-
} else {
567+
} else{
568568
Layout layout = createWorkingLayout(workingText, width);
569569
int linesCount = getLinesCount(layout, height);
570570
if (layout.getLineCount() > linesCount && ellipsize != null) {
@@ -584,15 +584,15 @@ private void ellipseText(int width, int height) {
584584
}
585585
}
586586
} else {
587-
if (this.singleline == false && multiLineEllipsize != null) {
587+
if (this.singleline == false) {
588588
String str = workingText.toString();
589589
String newText = new String();
590590
String[] separated = str.split("\n");
591591
for (int i = 0; i < separated.length; i++) {
592592
String linestr = separated[i];
593593
if (linestr.length() > 0) {
594594
if (createWorkingLayout(linestr, width).getLineCount() > 1)
595-
newText += getEllipsedTextForOneLine(linestr, multiLineEllipsize, width);
595+
newText += getEllipsedTextForOneLine(linestr, ellipsize, width);
596596
else
597597
newText += linestr;
598598
}

0 commit comments

Comments
 (0)