medium-textview icon indicating copy to clipboard operation
medium-textview copied to clipboard

Duplicates paragraphs in recyclerview

Open frakc opened this issue 7 years ago • 1 comments

Greate lib but i found that on repeating scrolling some paragraphs are duplicated. eg on fist scroll over all content (20 items) everything is ok on second each paragraph (except last one) of each item appeared twise on third run each paragraph (except last one) of each item appeared 3 times and so on

frakc avatar Mar 14 '17 12:03 frakc

fixed with removing oldviews

public class MediumTextView extends ElementView {

  public MediumTextView(Context context) {
    super(context, null);
  }

  public MediumTextView(Context context, AttributeSet attrs) {
    super(context, attrs, null);
  }

  @Override public void render() {
    setOrientation(VERTICAL);
  }

  String html = null;

  public void setText(String html) {
    if (!html.equals(this.html)) {
      this.html = html;
      removeAllViews();
      Document document = Jsoup.parse(html);
      Element element = document.body();
      setElement(element);
      Utils.appendView(this, getElement().children());
      invalidate();
    }
  }

  @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  }

  @Override protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);
  }
}

frakc avatar Mar 14 '17 13:03 frakc