question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Item content not updating when animating updateDataSet

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
royhenengelcommented, Jun 11, 2017

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 .

1reaction
davideascommented, May 29, 2017

@henengel, thanks for your opinion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to update RecyclerView Adapter Data - Stack Overflow
The various ways to update the adapter data are explained. ... If you use notifyDataSetChanged() , then no animation will be performed.
Read more >
Updating dataset properties | BigQuery - Google Cloud
To update dataset properties, you need the following IAM permissions: bigquery.datasets.update; bigquery.datasets.get. Each of the following predefined IAM ...
Read more >
Updating Charts | Chart.js
Sometimes when a chart updates, you may not want an animation. To achieve this you can call update with 'none' as mode. myChart.update( ......
Read more >
Updating data in an Android RecyclerView - Suragch - Medium
Instead I cleared the old items from data and then added the new ones. ... If you use notifyDataSetChanged() , then no animation...
Read more >
App Architecture: Data Layer - DataStore - Android Developers
This implementation does not require a predefined schema, and it does not provide ... an updateData() function that transactionally updates a stored object....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found