TextViewExpandableAnimation icon indicating copy to clipboard operation
TextViewExpandableAnimation copied to clipboard

Leaks OnPreDrawListener

Open sevar83 opened this issue 8 years ago • 0 comments

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;
                }
...

sevar83 avatar Jul 19 '17 20:07 sevar83