Skip to content
Common android classes/utils for clean architecture with MVVM + Coroutines/RxKotlin
Kotlin
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
buildSrc
data added data package Oct 4, 2019
domain
firestore
gradle/wrapper
logger added data package Oct 4, 2019
presentation
rx-threads-android
rx-threads
sample
.gitignore
README.md
build.gradle
gradle.properties
gradlew First commit Nov 8, 2018
gradlew.bat
settings.gradle

README.md

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)
        }
    }
}
You can’t perform that action at this time.