Our great sponsors
-
In order to properly encapsulate the reaction view logic, we created a class that extends RecyclerView and has a bind method that takes in the list of reactions and updates the RecyclerView’s adapter with that list. Given that we had to support a multi-line layout, we initially looked into using GridLayoutManager to achieve this but ended up finding an open-source library by Google named flexbox-layout that provides a LayoutManager that supports laying out items in multiple flex-rows, which is exactly what we needed. Using these ingredients, we were able to get a simple version of our layout up and running. What’s next was adding custom animations and improving performance.
-
recyclerview-animators
An Android Animation library which easily add itemanimator to RecyclerView items.
Next, we looked at overriding SimpleItemAnimator but noticed that this class is missing a lot of logic required for orchestrating the animations. We realized that the Android SDK does not really allow us to easily customize RecyclerView item animations - what a shame! Doing some research on this we found two open-source libraries (here and here - note: this is no endorsement) that provide a variety of custom ItemAnimators by using a base ItemAnimator implementation that is very similar to the DefaultItemAnimator class but allows for proper customization. We ended up creating our own BaseItemAnimator by looking at DefaultItemAnimator and adapting it to our needs and then creating the actual implementation for the reaction feature. This allowed us to customize the “Add” animation like so:
-
Appwrite
Appwrite - The Open Source Firebase alternative introduces iOS support. Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!
-
Next, we looked at overriding SimpleItemAnimator but noticed that this class is missing a lot of logic required for orchestrating the animations. We realized that the Android SDK does not really allow us to easily customize RecyclerView item animations - what a shame! Doing some research on this we found two open-source libraries (here and here - note: this is no endorsement) that provide a variety of custom ItemAnimators by using a base ItemAnimator implementation that is very similar to the DefaultItemAnimator class but allows for proper customization. We ended up creating our own BaseItemAnimator by looking at DefaultItemAnimator and adapting it to our needs and then creating the actual implementation for the reaction feature. This allowed us to customize the “Add” animation like so:
Related posts
- How do you make your grid recyclerview items fit with different screen sizes?
- Am I the only one that feels Compose is a step backward?
- Is it obligatory to use sp?
- New to iOS dev, how do I create something similar to flexbox layout (from Android) in SwiftUI?
- Example where Flow widget in ConstraintLayout shines