Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinMoskala committed Mar 17, 2017
2 parents bae900e + d3488b9 commit a8b01e2
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,18 @@ And use it this way:
if(Pref.canEatPie) //...
```

Or with static import:

```kotlin
import com.projectpackage.Pref.canEatPie
```

use it this way:

```kotlin
if(canEatPie) //...
```

Here are other preference definition examples: (see [full example](https://github.com/MarcinMoskala/PreferenceHolder/blob/master/kotlinpreferences-lib/src/androidTest/java/com/marcinmoskala/kotlinpreferences/ExampleConfig.kt) and [usage](https://github.com/MarcinMoskala/PreferenceHolder/tree/master/kotlinpreferences-lib/src/androidTest/java/com/marcinmoskala/kotlinpreferences))

```kotlin
object UserPref: PreferenceHolder() {
var canEatPie: Boolean by bindToPreferenceField(true)
var allPieInTheWorld: Long by bindToPreferenceField(0)

// Properties can be aslo nullable
var isMonsterKiller: Boolean? by bindToPreferenceFieldNullable()
var monstersKilled: Int? by bindToPreferenceFieldNullable()

// Property with backup is reading stored value in the first usage,
// and saving it, in background, each time it is changed
// and saving it, in background, each time it is changed.
var experience: Float? by bindToPropertyWithBackup(-1.0F)
var className: String? by bindToPropertyWithBackupNullable()

Expand Down Expand Up @@ -81,7 +68,7 @@ To add PreferenceHolder to the project, add in build.gradle file:

```groovy
dependencies {
compile 'com.github.marcinmoskala:preferenceholder:1.10-beta.1'
compile 'com.github.MarcinMoskala:PreferenceHolder:1.1-beta.1'
}
```

Expand Down

0 comments on commit a8b01e2

Please sign in to comment.