Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
smhdk authored Dec 13, 2018
1 parent 73cac8a commit 9d6df07
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@


KM Quick Adapter with Databinding
=============
[![Release](https://jitpack.io/v/smhdk/KM-Popup-Image-Slider.svg)](https://jitpack.io/#smhdk/KM-Popup-Image-Slider "![Release](https://jitpack.io/v/smhdk/KM-Popup-Image-Slider.svg)")
[![Release](https://jitpack.io/v/smhdk/KM-Quick-Adapter.svg)](https://jitpack.io/#smhdk/KM-Quick-Adapter "![Release](https://jitpack.io/v/smhdk/KM-Quick-Adapter.svg)")

You can easyly crate RecyclerviewAdapter and PagedlistAdapter using databinding with this library.

You can take a look [here](https://developer.android.com/topic/libraries/architecture/paging/) for Android PagingLibrary. Pagedlist and PagedlistAdapter are components of PagingLibrary.

# Usage
Enable dataBinding in app build.gradle. Add the following code for it in android scope.

Create RecyclerviewAdapter or PagedlistAdapter with KmBuilder
```dsl
android {
...
dataBinding {
enabled true
}
}
```

RecyclerView Adapter:
```kotlin
Expand Down Expand Up @@ -56,7 +66,7 @@ PagedlistAdapter:
}
.setDiffCallback {
//You must return DiffUtil.ItemCallback
KmPagedlistAdapter.Companion.KmDiffItemCallback()
diffCallback
}
.build()
```
Expand All @@ -83,13 +93,13 @@ Implement createBinding method. Create ViewDataBinding object for each view type
when (viewType) {
0 -> {
binding = inflate(
LayoutInflater.from(this@SimpleAdapterSampleActivity),
LayoutInflater.from(context),
R.layout.item_adapter,
parent,
false)}
1 -> {
binding = inflate(
LayoutInflater.from(this@SimpleAdapterSampleActivity),
LayoutInflater.from(context),
R.layout.item_adapter,
parent,
false)}
Expand Down

0 comments on commit 9d6df07

Please # to comment.