Skip to content

Commit

Permalink
add method. control with java code
Browse files Browse the repository at this point in the history
  • Loading branch information
aqoong authored and Han Andy committed Jun 4, 2019
1 parent 91ed163 commit 69eee19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected void onCreate(Bundle savedInstanceState) {

textView = findViewById(R.id.textView);
textView.setText("ABCDEFGHIJKfdfddf\n\n\nbyebye", "더보기");
textView.setState(ExpandableTextView.STATE.COLLAPSE);

recyclerView = findViewById(R.id.listView);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,17 @@ public boolean onPreDraw() {
if(getLineCount() > collapseLine){
isOverLine = true;
int lineEndIndex = getLayout().getLineEnd(collapseLine);
appendMoreText(lineEndIndex);
switch (state){
case COLLAPSE:
appendMoreText(lineEndIndex);
break;
case EXPAND:
if(getTag() != null)
setText(getTag().toString());
else
setText("error");
break;
}
}
return true;
}
Expand Down Expand Up @@ -127,14 +137,19 @@ public ExpandableTextView setText(String text, String moreText){
}
public ExpandableTextView setMoreText(String moreText){
this.strMore = moreText;
this.setText(getText(), strMore);

return this;
}


public ExpandableTextView setCollapseLine(int line){
this.collapseLine = line;
return this;
}
public void setState(STATE state){
this.state = state;
initView();
}
public String getText(){
return this.getTag() != null ? this.getTag().toString() : "";
Expand Down

0 comments on commit 69eee19

Please sign in to comment.