liip/LiipAndroidTemplate

Name: LiipAndroidTemplate

Owner: Liip

Description: An Android template project with best libs and best practices

Created: 2017-01-13 11:57:44.0

Updated: 2017-05-11 07:42:00.0

Pushed: 2017-02-15 08:47:14.0

Homepage:

Size: 116

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Android template project

This project aims to group best practices and best libraries for Android development. The sample app is a shopping list creator.

It demonstrate how to instantiate fragments with parameters and automatically save their parameters as well as their DTO state using IcePick and FragmentArgs.

To make it savable/restorable, DTOs are made parcelable using ParcelablePlease library.

To associates UI components to field variable and listener methods, we use Butterknife.

In order to easily change logging system, we use Timber as a logging entry point, which is integrated with Android-Logger for pretty printing.

For API calls, we use Retrofit 2 integrated with RxJava.

Services are injected using Dagger. Dagger is configured to instanciate two different services configuration according the selection of one of the predefined flavours : mock and full. The mock configuration provide a mocked Retrofit mock proxy that simulate behaviour of the network (async delay, failures, etc) to test error handling.

A default implementation for error handling is implemented. One of the error handlers manage retrofit network errors and in case of API error, parse the error response. For that, we use a CallAdapterFactory proxying RxJavaCallAdapterFactory (RxJava - Retrofit bridge).

To be able to use Java8 lambdas and method references, the code is processed with the Retrolambda processor. We simulate Java8 streams using Annimon Stream library.

Libraries
Gradle config

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.