Comments (9)
Hi.
Fine-grained events are not available because Repositories themselves don't have fine-grained events. To fire such events, either the RepositoryPresenter (client code) will be responsible for the job -- which makes it very difficult to implement, or RepositoryAdapter needs to magically discover the right sequence of events to notify the RecyclerView, which requires RepositoryPresenters to provide more information; most probably the data items' stable IDs.
However, with one single "the world has changed" event, just the stable IDs can already enable smooth animation in RV. Let all RepositoryPresenters provide stable IDs (implement RepositoryPresenter.getItemId(...)
), and then enable stable ID in the RepositoryAdapter. Some predictive animations will be "wrong" (items fading in and out rather than sliding in and out, because RV doesn't know where those newly-on-screen items come from), but items that have not changed will not "flash" (disappear and appear).
from agera.
@maxtroy Thanks for the stable IDs tip! It would be a good candidate for Agera's rvadapter documentation!
It does not completely solves the little performance hit though (but is good enough to be implemented if Agera use can improve code quality in the use case), so I'll let this issue open, if anyone have a solution to make fine grained RecyclerView Adapter notifications usable with Agera.
from agera.
It's a solution that enables client code to use DiffUtils easily. Client code doesn't need to actually use DiffUtils.
from agera.
I have a better plan for this issue. Stay tuned for Agera 1.5 (or 1.6) :)
from agera.
@maxtroy You plan to use DiffUtil, right?
from agera.
@LouisCAD please try out the new fine-grained event support and let us know what you think!
from agera.
@maxtroy How can I test it? Need to clone the repository? Is there an example in the sample?
from agera.
The sample isn't in the perfect shape to demo the fine-grained events right now. In particular there's no change and move events. It needs a bit of tweaking.
Meanwhile, you can try out by doing one of the following:
- In your subclass(es) of RepositoryPresenter, override the new getUpdates() method to provide your own fine-grained events.
- In your compiled RepositoryPresenter (
RepositoryPresenters.repositoryPresenterOf(...)
), or compiled data-binding RepositoryPresenter, add a .diffWith(...) directive to enable using DiffUtil to compute the fine-grained events.
You can now turn off stable IDs, if you like.
You can get the complete information in the documentation of RepositoryPresenter.getUpdates()
, and the compilers' diffWith()
and diff()
directives.
from agera.
This is now included in 1.4.0-alpha4
from agera.
Related Issues (20)
- Compilation problems HOT 1
- Crash when trying to remove not added updatable HOT 1
- Add the 1.2.0 release to the GitHub releases screen HOT 1
- Exception when Response is Empty HOT 4
- [Question] Usages of non main thread to register an Updatable to a BaseObservable? HOT 5
- Wish to support Kotlin language.
- crash bug HOT 3
- About IdentityMultimap query. HOT 3
- Is this library dead? HOT 2
- [question] Push Event on a high speed frequency, Pull Data will too busy to attend to all HOT 2
- Query HOT 3
- [Query]: About switch work-thread HOT 10
- Agera 是否支持线程并发再合并? HOT 1
- #44
- (gradle4.4.1, agera1.4.0) when I run proguard, I got these warnings:
- Could not find dependency "com.google.android.agera:agera:1.4.0" HOT 6
- Sample doesn't build, is this project dead? HOT 7
- Androidx支持
- Deploy the last artifact outside of jcenter HOT 1
- Security Policy violation Binary Artifacts HOT 41
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agera.