Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicates paragraphs in recyclerview #5

Open
frakc opened this issue Mar 14, 2017 · 1 comment
Open

Duplicates paragraphs in recyclerview #5

frakc opened this issue Mar 14, 2017 · 1 comment

Comments

@frakc
Copy link

frakc commented Mar 14, 2017

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
Copy link
Author

frakc commented Mar 14, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant