Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
vivchar authored Jan 18, 2018
1 parent 3276ed5 commit c85e6ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,22 @@ public class SomeModel implements ViewModel {
```xml
<LinearLayout ... >
<TextView android:id = "@+id/title" ... />
<ImageView android:id = "@+id/image" ... />
<Button android:id = "@+id/button" ... />
</LinearLayout>
```

* Step 3. Initialize Adapter and register the ViewBinder
```java
mRecyclerViewAdapter = new RendererRecyclerViewAdapter();
mRecyclerViewAdapter = new RendererRecyclerViewAdapter(getContext());

mRecyclerViewAdapter.registerRenderer(new ViewBinder<>(
R.layout.item_layout,
SomeModel.class,
getContext(),
(model, finder, payloads) -> finder
.find(R.id.title, (ViewProvider<TextView>) textView -> { ... })
//.find(R.id.custom, (ViewProvider<CustomView>) customView -> { ... })
.setBackground(R.id.image, model.getBackground())
.setText(R.id.text, model.getText())
.setOnClickListener(R.id.button, v -> { ... })
));
mRecyclerViewAdapter.registerRenderer(...); /* you can use several types of cells */
Expand Down

0 comments on commit c85e6ef

Please sign in to comment.