GlueHome / common-android

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

Home Page:https://jitpack.io/#GlueHome/common-android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

common-android

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)
        }
    }
}

About

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

https://jitpack.io/#GlueHome/common-android


Languages

Language:Kotlin 100.0%