Skip to content

Commit 64aea11

Browse files
authored
Add setReadMoreMaxLines method for ReadMoreTextView (#113)
1 parent de28777 commit 64aea11

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

readmore-view/api/current.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package com.webtoonscorp.android.readmore {
99
method public boolean isExpanded();
1010
method public void setExpanded(boolean expanded);
1111
method public void setOnStateChangeListener(com.webtoonscorp.android.readmore.ReadMoreTextView.OnStateChangeListener listener);
12+
method public void setReadMoreMaxLines(int maxLines);
1213
method public void toggle();
1314
field public static final int OVERFLOW_CLIP = 1; // 0x1
1415
field public static final int OVERFLOW_ELLIPSIS = 2; // 0x2

readmore-view/src/main/java/com/webtoonscorp/android/readmore/ReadMoreTextView.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ public class ReadMoreTextView @JvmOverloads constructor(
166166
)
167167
}
168168

169+
fun setReadMoreMaxLines(maxLines: Int) {
170+
if (this.readMoreMaxLines != maxLines) {
171+
this.readMoreMaxLines = maxLines
172+
173+
originalText?.let { originalText ->
174+
updateText(originalText, width)
175+
}
176+
}
177+
}
178+
169179
public fun toggle() {
170180
setExpanded(!expanded)
171181
}

0 commit comments

Comments
 (0)