Android Boilerplate “Ireng Jambon” as easy as create view

This a android boilerplate called “Ireng Jambon” desain for easy use and many purpose android application. Design inspire by Fernado Cejas for 2 main package core and feature, combine with easy ViewModel Android architecture implementation.

ireng jambon

4 Easy Step Usage

  1. Set Basic Url and Set Endpoint
productFlavors {
dev {
applicationIdSuffix ".dev"
versionNameSuffix "-dev"

buildConfigField "String", "BASE_URL", "\"\""
prod {

buildConfigField "String", "BASE_URL", "\"\""

Set base url in flavoring app build.gradle

interface Api {
fun login() : BaseResult

fun getContributor(): Observable<List<Contributor>>

//add endpoint here

Create Model

Api.kt interface for define endpoint, param and return result.

2. Create Model

data class BaseResult(val code:Int, val message:String)

data class Contributor(val login:String, val avatar_url:String)

create data class for data model and add Serializable for data serialization key.

3. Create View Model and Provide it in the modul

class MainViewModel @Inject constructor(val api:Api) :ViewModel() {

public var state:MutableLiveData<State> = MutableLiveData()
public var data:MutableLiveData<Pair<List<Contributor>?, Throwable>> = MutableLiveData()

public fun getData(){
asyncRxExecutor(api.getContributor(), state, {
Pair(it, Throwable("null"))
}, {
Pair(null, it)

  • Use high order function to wrap all request all request in ViewModel Extention
fun <T> ViewModel.asyncRxExecutor(heavyFunction: Observable<T>, state: MutableLiveData<State>, response : (response : T?) -> Unit, error: (error : Throwable) -> Unit) {

  • There is 2 State for flag the data process State.LOADING and State.COMPLETE
  • Use Pair<DataSuccess,DataError> and store data in MuatableLiveData for reactive update.

Build for easy and fast started kit for many purpose android application. The main concern is the developer just focus the the feature than the architecture flow.

focus on the feature

Still add more improvement. If interest just fork and contribute here