Skip to content

Commit

Permalink
New release 2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Hinov committed Aug 22, 2019
1 parent 3edac79 commit c6bbfe3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 30 deletions.
32 changes: 5 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ Groupie lets you treat your content as logical groups and handles change notific
# Try it out:

```gradle
implementation "com.xwray:groupie:2.5.0"
implementation "com.xwray:groupie:2.5.1"
```

Groupie includes a module for Kotlin and Kotlin Android extensions. Never write a ViewHolder again—Kotlin generates view references and Groupie uses a generic holder. [Setup here.](#kotlin)

```gradle
implementation "com.xwray:groupie:2.5.0"
implementation "com.xwray:groupie-kotlin-android-extensions:2.5.0"
implementation "com.xwray:groupie:2.5.1"
implementation "com.xwray:groupie-kotlin-android-extensions:2.5.1"
```

Groupie also supports Android's [data binding](https://developer.android.com/topic/libraries/data-binding/index.html) to generate view holders. [Setup here.](#data-binding)

```gradle
implementation "com.xwray:groupie:2.5.0"
implementation "com.xwray:groupie-databinding:2.5.0"
implementation "com.xwray:groupie:2.5.1"
implementation "com.xwray:groupie-databinding:2.5.1"
```

You can also use Groupie with Java and your existing ViewHolders.
Expand Down Expand Up @@ -77,9 +77,6 @@ Groupie abstracts away the complexity of multiple item view types. Each Item de

### Item with Kotlin:

**WARNING - there is currently a [Kotlin bug](https://youtrack.jetbrains.com/issue/KT-28617) that prevents synthetic caching from working correctly. We are tracking this under issue [#235](https://github.com/lisawray/groupie/issues/235). In order to get the
following behaviour working correctly, [look here.](#workaround-for-kotlin-synthetic-caching-bug)**

The `Item` class gives you simple callbacks to bind your model object to the generated fields. Because of Kotlin Android extensions, there's no need to write a view holder.

```kotlin
Expand Down Expand Up @@ -193,25 +190,6 @@ import kotlinx.android.synthetic.main.my_item_layout.*
```
in the corresponding Item class for generated view references.

### Workaround for Kotlin Synthetic caching bug

The current workaround is to copy the Groupie classes yourself to your project and use them rather than the Groupie ones. Look issue [#235](https://github.com/lisawray/groupie/issues/235) for more info.

```kotlin
class ViewHolder(override val containerView: View) : com.xwray.groupie.ViewHolder(containerView),
LayoutContainer

abstract class Item : Item<ViewHolder> {

constructor() : super()
constructor(id: Long) : super(id)

override fun createViewHolder(itemView: View): ViewHolder {
return ViewHolder(itemView)
}
}
```

## Data binding

Add to your app module's build.gradle:
Expand Down
2 changes: 1 addition & 1 deletion library-databinding/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ POM_DESCRIPTION=Library to help with complex RecyclerViews
POM_BINTRAY_NAME=groupie-databinding
POM_ARTIFACT_ID=groupie-databinding
POM_PACKAGING=aar
POM_VERSION=2.5.0
POM_VERSION=2.5.1
2 changes: 1 addition & 1 deletion library-kotlin-android-extensions/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ POM_DESCRIPTION=Library to help with complex RecyclerViews
POM_BINTRAY_NAME=groupie-kotlin-android-extensions
POM_ARTIFACT_ID=groupie-kotlin-android-extensions
POM_PACKAGING=aar
POM_VERSION=2.5.0
POM_VERSION=2.5.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import kotlinx.android.extensions.CacheImplementation
import kotlinx.android.extensions.ContainerOptions
import kotlinx.android.extensions.LayoutContainer

// Need to specify ContainerOptions in order for caching to work.
// See: https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FKT-28617
@ContainerOptions(cache = CacheImplementation.HASH_MAP)
class ViewHolder(override val containerView: View) : com.xwray.groupie.ViewHolder(containerView),
LayoutContainer
2 changes: 1 addition & 1 deletion library/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ POM_DESCRIPTION=Library to help with complex RecyclerViews
POM_BINTRAY_NAME=groupie
POM_ARTIFACT_ID=groupie
POM_PACKAGING=aar
POM_VERSION=2.5.0
POM_VERSION=2.5.1

0 comments on commit c6bbfe3

Please sign in to comment.