Android-TextViewPager icon indicating copy to clipboard operation
Android-TextViewPager copied to clipboard

Infinite layouting loop

Open saschoar opened this issue 9 years ago • 0 comments

Although released a while ago, this piece of code is exactly what I needed. Thank you for that. However, looking at logs and performance, it seems to me like it's infinitely running through the layout process, because the layout listener leads to another layouting process and never gets removed.

I fixed it by adding this line: mView.getViewTreeObserver().removeOnGlobalLayoutListener(this);

right after

https://github.com/iPaulPro/Android-TextViewPager/blob/master/TextViewPager/src/co/paulburke/android/textviewpager/PagingLayoutListener.java#L100

EDIT: I understand that your check if (lineCount > 0 && lastLineBottom > height) should have prevented multiple executions, but it did not for me, because lastLineBottom was always larger than height.

saschoar avatar Aug 18 '15 06:08 saschoar