TextViewExpandableAnimation
TextViewExpandableAnimation copied to clipboard
Leaks OnPreDrawListener
There's a memory leak in setText(). You need to add the following line in onPreDraw():
public void setText(CharSequence charSequence) {
textContent = charSequence;
textView.setText(charSequence.toString());
textView.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
@Override
public boolean onPreDraw() {
// Add this line
textView.getViewTreeObserver().removeOnPreDrawListener(this);
if (!isInitTextView) {
return true;
}
...