Skip to content

Commit

Permalink
fix concurrency issue surrounding lazy delegate lookup/caching and di…
Browse files Browse the repository at this point in the history
…ff util.
  • Loading branch information
trevjonez committed Apr 16, 2019
1 parent 200fe87 commit 7384f44
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

### 0.6.1
- Synchronize Fix concurrency issue due to the lazy nature of delegate caching.

### 0.6.0 - BREAKING CHANGES
- Module breakup and artifact id changes
- Move adapter configuration entirely into constructor
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ ![Download](https://api.bintray.com/packages/trevorjones141/maven/PolyAdapter-Android/images/download.svg) ](https://bintray.com/trevorjones141/maven/PolyAdapter-Android/_latestVersion)

A composable recycler view adapter.
A dagger centric recycler view adapter.

## Installation

Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/polyadapter/PolyAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.collection.SimpleArrayMap
import androidx.recyclerview.widget.AdapterListUpdateCallback
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListUpdateCallback
import androidx.recyclerview.widget.RecyclerView
import java.util.concurrent.ConcurrentHashMap
import javax.inject.Inject
import javax.inject.Provider

Expand All @@ -18,8 +18,8 @@ class PolyAdapter @Inject constructor(
private val delegateFactories: Map<Class<*>, @JvmSuppressWildcards Provider<BindingDelegate<*, *>>>
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

private val typeLookup = SimpleArrayMap<Class<*>, BindingDelegate<*, *>>()
private val layoutLookup = SimpleArrayMap<Int, BindingDelegate<*, *>>()
private val typeLookup = ConcurrentHashMap<Class<*>, BindingDelegate<*, *>>()
private val layoutLookup = ConcurrentHashMap<Int, BindingDelegate<*, *>>()

init {
itemProvider.onAttach(AdapterListUpdateCallback(this), PolyAdapterItemCallback())
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
group=com.trevjonez.polyadapter
version=0.6.0
version=0.6.1

agpVersion=3.5.0-alpha10
kotlinVersion=1.3.21
daggerVersion=2.22
agpVersion=3.5.0-alpha11
kotlinVersion=1.3.30
daggerVersion=2.22.1

org.gradle.parallel=true
org.gradle.caching=true
Expand Down

0 comments on commit 7384f44

Please sign in to comment.