This commit is contained in:
chenjuntao
2018-10-23 18:33:25 +08:00
parent 02d61989fd
commit 9118119901
37 changed files with 275 additions and 138 deletions

View File

@ -25,6 +25,8 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
private boolean mInitLayout = false;
private boolean mOpenLayout = false;
private ExpandCallback mExpandCallback;
public ExpendTextView(Context context) {
super(context);
}
@ -50,6 +52,10 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
this.mExpendText = text;
}
public void setExpandCallback(ExpandCallback callback) {
this.mExpandCallback = callback;
}
@Override
public void setText(CharSequence text, BufferType type) {
mInitLayout = true;
@ -98,6 +104,9 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
setMaxLines(Integer.MAX_VALUE);
setText(mSnapshotText);
if (mExpandCallback != null) {
mExpandCallback.onExpand();
}
}
}, length - mExpendText.length(), length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -105,4 +114,8 @@ public class ExpendTextView extends android.support.v7.widget.AppCompatTextView
setMovementMethod(CustomLinkMovementMethod.getInstance());
}
interface ExpandCallback {
void onExpand();
}
}