February is over, so where is that monthly app? Well, thanks to exams it took a little longer than last time, but still it’s here: TripWeather!
Some things that were fun about this app:
A (hopefully) short and simple way to input all required data, meaning from where, to where and when (we later added travel mode as well). After inputting each element we show an animated done icon to make it clear what just happened. Here is how that looks:
Here’s a new word I learned: callback hell. In TripWeather we had a brief period where we lived through something similar. It originated from the wish to update our progress bar after each succesful network request, such as:
- getting coordinates for origin and destination
- fetching the route
- the actual weather forecast
Chaining Retrofit Callback objects definitely works (it did for a brief moment anyways), but is hard to debug and maintain as hell, especially when it comes to forwarding errors, aborting requests due to device rotation or resuming old calls.
RxJava seems to be the a hot topic among android developers recently, at least judging by the number of articles published on Android Weekly. See this article for a good introduction to reactive programming.
Our final RxJava based solution can be found on GitHub, which essentially representing one big pipeline for processing all data. Because of that it can also be treated a single network request only, which by itself is awesome and is a huge help in integrating with the android lifecycle.
So, what does it actually look like?
See for yourself!