common-android

Introduction: Common android classes/utils for clean architecture with MVVM + Coroutines/RxKotlin
More: Author   ReportBugs   
Tags:

Common android/poko classes/utils for clean architecture with MVVM + Coroutines/RxKotlin

Installation

main build.gradle:

allprojects { repositories { maven { url 'https://jitpack.io' } } }

main build.gradle:

dependencies {
  implementation "com.github.gluehome.common-android:data:${Versions.common}"
  implementation "com.github.gluehome.common-android:firestore:${Versions.common}"
  implementation "com.github.gluehome.common-android:domain:${Versions.common}"
  implementation "com.github.gluehome.common-android:rx-threads:${Versions.common}"
  implementation "com.github.gluehome.common-android:rx-threads-android:${Versions.common}"
  implementation "com.github.gluehome.common-android:presentation:${Versions.common}"
}

Presentation

ViewModel and Observable extensions


import com.gluehome.common.presentation.extensions.*

class HomeFragment : BaseFragment() {

    override fun layoutId() = R.layout.delivery_list_fragment

    @Inject lateinit var viewModelFactory: ViewModelProvider.Factory
    private lateinit var viewModel: HomeViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        appComponent.inject(this)

        viewModel = viewModel(viewModelFactory) {
            observe(deliveriesState, ::onDeliveriesStateChanged)
            observe(setupCompletionState, ::onSetupCompletionChanged)
            observe(failure, ::onFailure)
        }
    }
}
Apps
About Me
Google+: Trinea trinea
GitHub: Trinea