Item content not updating when animating updateDataSet
See original GitHub issueHi 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:
- 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…
- 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:
- Created 6 years ago
- Comments:17 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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:
@henengel, thanks for your opinion.