The enviroCar app makes use of various 1st and 3rd party open source libraries to provide various functionalities along with a seamless experience to users. My goal is to update all the deprecated libraries currently implemented by replacing them with superior alternatives or updating them to their latest stable release.
Goal 1: Migration of RxJava from version 2 to 3
My first goal of GSOC 2022 was to update the RxJava library. I replaced the deprecated RxJava version 2 with RxJava version 3. There are various benefits to RxJava 3 versus 2 :
- Threading, error handling, caching and cancellation are much easier.
- Performance improvement: Parallel execution of different, independent tasks improves performance. In addition, version 3 provides a lot of powerful operators that help to make the codebase much simpler while boosting performance.
- Reducing errors: Version 3 is not just an Observer implementation, it also provides good error handling and retry mechanisms, which come in handy.
In the process, I faced many errors that also had to be fixed, such as a Gradle dependency error, class path error, importing dependencies, implicit/explicit conversion and abstract methods override errors. I successfully resolved these errors. Now the app is completely migrated to RxJava 3 and takes complete advantage of the new version.
Goal 2: Replacement of ButterKnife View Binding with Jetpack View Binding
View binding is very essential and crucial to large android projects. It helps to provide better code quality, readability and reusability of the views and components. My second goal for the period was to replace the dependency and usage of the ButterKnife view binding library with the latest and modular android released JetPack view binding technique.
The main impact of this goal is to provide a cleaner approach for separating views from models. By upgrading to Jetpack view binding, the following impacts are seen in the app.
- Jetpack view binding is compile time safe.
- It builds the app faster.
- Less boilerplate referencing.
- No more BindView annotations.
- Provides Type safety.
- Provides Null safety.
Goal 3: Implement RxJava Event Bus to replace Otto Event Bus library
My 3rd goal was to implement an RxJava/ RxAndroid based event bus library and to remove the Otto event bus library as it has been deprecated. Since the project already uses reactive components of RxJava and RxAndroid, applying the event bus implementation based on these libraries has been straightforward. Also, the RxJava based event bus is the best option for getting asynchronous data requests from APIs. It also simplifies the communication between components and avoids decoupling event senders and receivers.
A few advantages of using the RxJava based event bus versus the Otto event bus are:
- Predefined methods for functionalities like subscribe and publish events are easier.
- The team can have more control over threading techniques.
- Various operators that can be used for data manipulation if needed.
Apart from successfully achieving all of my specified and assigned goals for Phase 1, I have also added various features to provide a better user experience and seamless functionalities to users (See PR’s). One of them is a swipe-to-refresh feature.
Swipe-to-Refresh feature in My Cars and My Tracks section:
The My Cars and My Tracks sections load data automatically. It would be an improvement if the user could also trigger the data loading. For this, I have added the Swipe-to-Refresh functionality in the My Cars and My Tracks. The user interaction triggers callback methods that update the data with the help of SwipeRefreshLayout widget (see PR and PR).
Swipe-to-Refresh feature Demo
My next steps are to add new features and provide better functionalities to navigate easily through the app. Some of my proposed features are:
- Replacement of SQLBrite library.
- Update or migrate other deprecated or outdated libraries.
- Improve materialisation and theme of the app.
- Comparison between Track Statistics features.
Right now I have been able to accomplish all of my specified goals, and have had a very steep learning curve throughout the period. A special mention and a huge amount of thanks goes to my mentor Sai Karthikeya. Sai helped me step-by-step, guiding me, understanding my limitations and helping me to overcome them along with reviewing my contributions and improving my implementations. I will continue the good work and improve the enviroCar Android app.