https://github.com/icapps/android-template-kotlin-viewmodel
Android project template with kotlin and architecture components
https://github.com/icapps/android-template-kotlin-viewmodel
Last synced: 11 months ago
JSON representation
Android project template with kotlin and architecture components
- Host: GitHub
- URL: https://github.com/icapps/android-template-kotlin-viewmodel
- Owner: icapps
- Created: 2018-04-05T14:20:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-04T08:22:45.000Z (over 5 years ago)
- Last Synced: 2025-05-08T23:33:56.306Z (about 1 year ago)
- Language: Kotlin
- Size: 238 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# icapps Kotlin project template with LiveData, ViewModels, Dagger2 and more
### Used libraries:
- AppCompatv7
- CardView
- RecyclerView
- Architecture components: ViewModel, LiveData, Extensions, Testing
- OkHttp
- Retrofit
- Dagger2, DaggerAndroid, DaggerAndroidSupport
- Moshi + Moshi codegen
- Picasso
- Niddler
### Others
- Kotlin
- Databinding
- Custom ObservableFuture implementation (see https://github.com/icapps/androidarchitecture)
- Dependency update plugin
### ViewModel architecture
ViewModels can be injected in `BaseActivity`'s and `BaseFragment`s by using the `getOrCreateViewModel()` method. See `MainActivity` for an example.
To share a viewmodel between fragments, inject a viewmodel in the underlying activity, and use `getOrCreateActivityViewModel()` in the fragments.
You will also need to register each viewModel in `ViewModelModule.kt` so Dagger can provide the viewModel with its dependencies.