Skip to content

Commit

Permalink
fix addOrUpdate public API. Released 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gotev committed Feb 4, 2019
1 parent 1f12731 commit 8867127
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In this way every item of the recycler view has its own set of files, resulting
## <a name="setup"></a>Setup
In your gradle dependencies add:
```groovy
implementation 'net.gotev:recycleradapter:2.0.0'
implementation 'net.gotev:recycleradapter:2.0.1'
```

## <a name="basicTutorial"></a>Basic usage tutorial
Expand Down
4 changes: 2 additions & 2 deletions manifest.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ext {
library_licenses = ["Apache-2.0"]
library_licenses_url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
library_project_group = 'net.gotev'
library_version = '2.0.0'
version_code = 2
library_version = '2.0.1'
version_code = 3
min_sdk = 18
target_sdk = 28
demo_app_id = 'net.gotev.recycleradapterdemo'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ class RecyclerAdapter : RecyclerView.Adapter<RecyclerAdapterViewHolder>(), Recyc
* @param item item to add or update
* @return [RecyclerAdapter]
*/
fun addOrUpdate(item: AdapterItem<in RecyclerAdapterViewHolder>): RecyclerAdapter {
fun addOrUpdate(item: AdapterItem<*>): RecyclerAdapter {
val itemIndex = items.indexOf(item).takeIf { it >= 0 } ?: return add(item)

if (items[itemIndex].hasToBeReplacedBy(item)) {
updateItemAtPosition(item, itemIndex)
updateItemAtPosition(item.castAsIn(), itemIndex)
}

return this
Expand Down

0 comments on commit 8867127

Please sign in to comment.