FlexibleAdapter: Item content not updating when animating updateDataSet

Hi David, how are you 😃 ? I think I found a bug/issue that was supposed to be fixed, but still isn’t. I read in this repository issues several tickets (#210…) that resemble mine, not sure if related.

Issue: When updating the dataset with adapter.updateDataSet(new ArrayList<>(items), true), the content of the items don’t update.

Used code:

 private void initFeed() {
        /* Get recyclerView from layout */
        mRecyclerView = (RecyclerView) getView().findViewById(R.id.recyclerViewMain);

        /* Save views to cache to prevent reload of them*/
        mRecyclerView.setItemViewCacheSize(80);
        mRecyclerView.setHasFixedSize(true);

        /* Create the adapter */
        mAdapter = new FlexibleAdapter<>(new ArrayList<>(mResults));

        /* Create pre cache layout manager to load views before displayed to user */
        PreCachingLayoutManager layoutManager = new PreCachingLayoutManager(mContext, GeneralUtils.getInstance().getScreenHeight() * 2);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecyclerView.setLayoutManager(layoutManager);

        /* Set adapter */
        mRecyclerView.setAdapter(mAdapter);

        /* Set StickyHeaders */
        mAdapter.setDisplayHeadersAtStartUp(true).setStickyHeaders(true);
    }
public void onDataChange(final ArrayList<IFlexible> newResults) {

        /* Save scroll position */
        Parcelable recyclerViewState;
        recyclerViewState = mRecyclerView.getLayoutManager().onSaveInstanceState();

        mAdapter.updateDataSet(newResults, true);

        /* Restore scroll position */
        mRecyclerView.getLayoutManager().onRestoreInstanceState(recyclerViewState);

        /* Set new results to default */
        mResults = newResults;
    }

Solutions tried:

  1. I changed the dependency to your snapshots (where if I understood correctly this issue was supposed to be fixed):

repositories { jcenter() maven { url ā€˜https://maven.fabric.io/public’ } maven { url ā€œhttps://jitpack.ioā€ } maven {url = ā€œhttps://oss.sonatype.org/content/repositories/snapshots/ā€ } //For Snapshots }

dependencies { … compile ā€˜eu.davidea:flexible-adapter:5.0.0-SNAPSHOT’ } Didn’t help…

  1. Tried mAdapter.updateDataSet(newResults, true); / mAdapter.updateDataSet(new ArrayList<>(newResults), true); - didn’t work

Anything else I can do/try to solve this? Thank you

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hi David, how are you. So I have been testing everything, and so far so good. If I will encounter anything, I’ll let you know. Thank vary much for your help and time spent helping me. Much appreciated. Regards, Chen

On Jun 11, 2017 00:56, ā€œDavide Stedutoā€ notifications@github.com wrote:

Closed #377 https://github.com/davideas/FlexibleAdapter/issues/377 via 1f89245 https://github.com/davideas/FlexibleAdapter/commit/1f8924582aa3186e10b4bc1a1e9cf86794c78ac8 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davideas/FlexibleAdapter/issues/377#event-1118362983, or mute the thread https://github.com/notifications/unsubscribe-auth/AMecXKdjofyZKcOOvxEjDlMxxrlEm35Tks5sCxD9gaJpZM4NpGxk .

@henengel, thanks for your opinion.