Retrofit - HTTP Client
Retrofit is a type-safe HTTP client that allows you to define your REST API as an interface. You can manipulate the API requests’ body, headers, query parameters and much more via annotations, which makes everything clean and simple. Retrofit also allows synchronous and asynchronous API calls execution.
To top it off, Retrofit offers a separate Rx module. If you are using Rx, this module returns your API call as an Observable so you can chain it with the rest of your application. These are just a few of the many reasons we at Infinium still love and use Retrofit.
To top it off, Retrofit offers a separate Rx module. If you are using Rx, this module returns your API call as an Observable so you can chain it with the rest of your application. These are just a few of the many reasons we at Infinium still love and use Retrofit.
Moshi
Moshi is a library that converts JSON into Java and Kotlin models. A lot of people refer to the Moshi as GSON 3.0. This library is superior to GSON in several aspects: it's faster, it includes Kotlin support, it's maintained, it throws predictable exceptions and it doesn't use broken DateTime adapter by default. Plus, converting JSON to Java model (and vice-versa) is straightforward with Moshi.
We also admire Moshi for its JSON API support. JSON API is the specification for building APIs, and a lot of APIs we work with are written using that specification. Moshi JSON API makes our life easier because it converts JSON API response into meaningful Java objects. Retrofit also has support for Moshi, and it all just clicks together.
Glide - Image Loader
As you probably know by now, Android image loading and handling API is terrible. It’s a nightmare to even resize an image without getting “OutOfMemoryException.” Glide is an image loading library that exposes a nice API, allowing you to transform your image however you want.
This library allows you to easily load a remote image into your ImageView, define fallback images, cache and scale your images and much more. Try accomplishing all this without Glide, and you will quickly understand why this has become our core library. It even supports some common transformations like a circular image out of the box.
This library allows you to easily load a remote image into your ImageView, define fallback images, cache and scale your images and much more. Try accomplishing all this without Glide, and you will quickly understand why this has become our core library. It even supports some common transformations like a circular image out of the box.
Timber
Timber is powerful, yet simple, logging library built on top of Android “Log” class. It allows you to easily turn to log on or off. It also offers nice support for logging formatted strings and exceptions. Because of all these benefits, Timber is one of the core libraries we use on almost all our Android projects.
RxJava is a Java implementation of ReactiveX API that allows you to chain asynchronous tasks and events into observable sequences. Users expect modern applications to display data in real-time. In other words, they want to see the data updated automatically. That’s where RxJava can help.
When fetching real-time data, it becomes extremely difficult to merge multiple API calls, switch threads and handle errors. This is where RxJava shines, and it is the reason why we started using this library. I will admit that RxJava is confusing and hard to learn, but it is completely worth your time. Even after we switched to Kotlin, we continued to use RxJava because of its benefits. Together with Kotlin, the API is even better thanks to the additional extension functions.
0 Comments