Skip to content

Commit

Permalink
Prepare for release 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
drakeet committed Dec 24, 2019
1 parent e1c2ada commit 2c0621b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# MultiType Releases

### Version 4.2.0 - Dec 24, 2019

- Add `ViewDelegate` that does not require `ViewHolder` (#296)

### Version 4.1.1 - Dec 11, 2019

- Fix binary incompatibility about `ItemViewBinder` (#294)
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ _In addition, since 4.0.0 we have migrated to fully build with Kotlin. If you do

```groovy
dependencies {
implementation 'com.drakeet.multitype:multitype:4.1.1'
implementation 'com.drakeet.multitype:multitype:4.2.0'
}
```

Expand Down Expand Up @@ -62,6 +62,27 @@ class FooViewDelegate: ItemViewDelegate<Foo, FooViewDelegate.ViewHolder>() {
}
```

##### Or if you are using a custom View instead of XML layout, you can use `ViewDelegate`:

> The `ViewDelegate` is a simple `ItemViewDelegate` that does not require to declare and provide a `RecyclerView.ViewHolder`.
```kotlin
class FooViewDelegate : ViewDelegate<Foo, FooView>() {

override fun onCreateView(context: Context): RichView {
return FooView(context).apply { layoutParams = LayoutParams(MATCH_PARENT, WRAP_CONTENT) }
}

override fun onBindView(view: FooView, item: Foo) {
view.imageView.setImageResource(item.imageResId)
view.textView.text = item.text
// Or bind the data in the FooView by calling view.setFoo(item)
}
}
```

(See [`RichViewDelegate`](sample/src/main/kotlin/com/drakeet/multitype/sample/normal/RichViewDelegate.kt) & [`RichView`](sample/src/main/kotlin/com/drakeet/multitype/sample/normal/RichView.kt) examples for more details)

#### Step 3. `register` your types and setup your `RecyclerView`, for example:

```kotlin
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ buildscript {
ext.annotationVersion = '1.1.0'
ext.appcompatVersion = '1.0.2'
ext.buildConfig = [
'versionCode': 411,
'versionName': "4.1.1",
'versionCode': 420,
'versionName': "4.2.0",
'compileSdkVersion': 29,
'minSdkVersion': 14,
'targetSdkVersion': 28
Expand Down

0 comments on commit 2c0621b

Please sign in to comment.