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

[5.0.0-b6] Item does not updated after updateDataSet() #94

Closed
vverbytskyi10 opened this issue Jun 2, 2016 · 1 comment
Closed

[5.0.0-b6] Item does not updated after updateDataSet() #94

vverbytskyi10 opened this issue Jun 2, 2016 · 1 comment

Comments

@vverbytskyi10
Copy link

vverbytskyi10 commented Jun 2, 2016

Think there is an issue at the method

protected void applyAndAnimateAdditions(List<T> from, List<T> newItems) {
        int out = 0;
        for (int i = 0, count = newItems.size(); i < count; i++) {
            final T item = newItems.get(i);
            if (!from.contains(item)) {
                if (DEBUG) Log.v(TAG, "animateAdditions  add position=" + i + " item=" + item);
                from.add(i, item);
                notifyItemInserted(i);
            } else if (mNotifyChangeOfUnfilteredItems) {
                out++;
                notifyItemChanged(i, mNotifyChangeOfUnfilteredItems);
                if (DEBUG) Log.v(TAG, "animateAdditions keep position=" + i + " item=" + item);
            }
        }
        if (DEBUG) Log.v(TAG, "animateAdditions total out=" + out + " in=" + newItems.size());
}

so if old array does not contains item, you add it and notify adapter, otherwise you just notifying that item was updated, but from list does not receive that updated item. Think needs to call smth. like from.set(i, item) before calling notifyItemChanged(i, mNotifyChangeOfUnfilteredItems);

@vverbytskyi10 vverbytskyi10 changed the title Item does not updated after updateDataSet() [5.0.0-b6] Item does not updated after updateDataSet() Jun 2, 2016
@davideas davideas added the bug label Jun 2, 2016
@davideas
Copy link
Owner

davideas commented Jun 2, 2016

@vverbitskyy, at the beginning this method was used only for filtering purpose, than I saw that could be used also for any update, but I think you could be right. To be sincere I did not test updateDataSet() when items are modified from code.
I will check and eventually fix it.

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

No branches or pull requests

2 participants