Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
[FIX] Change styleModel to themeModel
  • Loading branch information
manneohlund authored Feb 28, 2018
1 parent b0355ac commit e90ab76
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ Define themes in `.json` files and add it to `assets` folder

### Android Data Binding
Let the DataBinding in Android do the stitching.
Set the data model variable in your layout and bind model attributes in xml code ex: `android:background="@{styleModel.toolbarColor}"`.
Set the data model variable in your layout and bind model attributes in xml code ex: `android:background="@{themeModel.toolbarColor}"`.

```xml
<layout xmlns:android="http://schemas.android.com/apk/res/android">

<data>
<variable
name="styleModel"
name="themeModel"
type="jsonthemer.model.BaseThemeModel" />
</data>

Expand All @@ -53,12 +53,12 @@ Set the data model variable in your layout and bind model attributes in xml code
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@{styleModel.toolbarColor}" />
android:background="@{themeModel.toolbarColor}" />
</layout>
```

### Setup Json Theme in Activity
If you use or extend `BaseThemeModel` `JsonThemer` will set a `DefaultThemeLayoutInflaterFactory` that will handle the style setting on all android.support components for `accentColor`.
If you use or extend `BaseThemeModel` `JsonThemer` will set a `DefaultThemeLayoutInflaterFactory` that will handle the theme/style setting on all android.support components for `accentColor`.

```kotlin

Expand All @@ -71,7 +71,7 @@ override fun onCreate(savedInstanceState: Bundle?) {

// Setup data binding and set the theme
var binding: ActivityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main)
binding.styleModel = theme
binding.themeModel = theme
}
```

Expand Down

0 comments on commit e90ab76

Please sign in to comment.