Skip to content

Commit

Permalink
Merge pull request #9 from etiennelenhart/extension-patch
Browse files Browse the repository at this point in the history
Fix: Use factory parameter in SharedFactoryViewModel
  • Loading branch information
Etienne Lenhart authored Dec 20, 2017
2 parents ec4919d + ff7a21d commit 699b263
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Eiffel
[![Build Status](https://www.bitrise.io/app/d982833489004cbc/status.svg?token=66rf2t84v8SFdippsAWM8g&branch=master)](https://www.bitrise.io/app/d982833489004cbc)
[![](https://jitpack.io/v/etiennelenhart/Eiffel.svg)](https://jitpack.io/#etiennelenhart/Eiffel)
[![](https://jitpack.io/v/etiennelenhart/eiffel.svg)](https://jitpack.io/#etiennelenhart/eiffel)

Light-weight Android architecture library for handling immutable view states with [Architecture Components](https://developer.android.com/topic/libraries/architecture/index.html).
Light-weight Kotlin Android architecture library for handling immutable view states with [Architecture Components](https://developer.android.com/topic/libraries/architecture/index.html).

## Installation
build.gradle *(Project)*
```
```gradle
repositories {
...
maven { url 'https://jitpack.io' }
}
```

build.gradle *(Module)*
```
```gradle
dependencies {
...
implementation "android.arch.lifecycle:extensions:$architecture_version"
implementation 'com.github.etiennelenhart:Eiffel:1.0.0'
implementation 'com.github.etiennelenhart:eiffel:1.0.0'
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SharedFactoryViewModel<out T : ViewModel>(private val viewModelClass: Clas
private var value: T? = null

override fun getValue(thisRef: Fragment, property: KProperty<*>): T {
if (value == null) value = ViewModelProviders.of(thisRef.activity!!).get(viewModelClass)
if (value == null) value = ViewModelProviders.of(thisRef.activity!!, factory()).get(viewModelClass)
return value!!
}
}
Expand Down

0 comments on commit 699b263

Please sign in to comment.