Skip to content

Releases: sockeqwe/AdapterDelegates

4.3.2

16 Mar 15:56
Compare
Choose a tag to compare

What's Changed

  • More nullability annotations for better inter-op with Kotlin #107 . This should not be a breaking change.

4.3.1

13 Nov 17:38
Compare
Choose a tag to compare

Addition: get notified when list was committed to RecyclerView #104

4.3.0

09 Mar 16:47
Compare
Choose a tag to compare
  • Support for android ViewBinding. Use adapterDelegateViewBinding().
  • Fix #81 . LayoutContainer support for libraries.

4.2.0

05 Sep 21:54
Compare
Choose a tag to compare

Minor improvements:

  • add vararg delegate parameter to AsyncListDifferDelegationAdapter #76
  • DslListAdapterDelegate is internal no (with @PublishedApi)
  • Fixed 2 internal typos on variable names

4.1.1

21 Jul 21:00
Compare
Choose a tag to compare

Added some shortcuts / convenience functions (and properties) for kotlin DSL. Instead of calling itemView.context you now have direct access to the following fields and functions:

  • context (backed property)
  • getString(@StringRes resId: Int): String
  • getString(@StringRes resId: Int, vararg formatArgs: Any)
  • getColor(@ColorRes id: Int)
  • getDrawable(@DrawableRes id: Int)
  • getColorStateList(@ColorRes id: Int)

Overall this minor release just reduces a bit more typing for you as you now can do something like this:

fun catDelegate() = adatperDelegate<Cat, Animal>(R.layout.cat) {
   ...
   bind {
        icon.drawable = getDrawable(R.drawable.cat) // instead of itemView.context.getDrawable()
   }
}

4.1.0: Kotlin DSL

18 Jul 00:28
Compare
Choose a tag to compare

Added a Kotlin DSL to create AdapterDelegates through a fluend DSL. There are actually 2 DSL artifacts:

  • adapterdelegates4-kotlin-dsl:
fun catAdapterDelegate(itemClickedListener : (Cat) -> Unit) = adapterDelegate<Cat, Animal>(R.layout.item_cat) {
    val name : TextView = findViewById(R.id.name)
    name.setClickListener { itemClickedListener(item) }

    bind { 
        name.text = item.name 
    }
}
  • adapterdelegates4-kotlin-dsl-layoutcontainer:
    Pretty much the same as adapterDelegate but uses kotlin android extension's LayoutContainer and the generated synthetic properties. Thus, you dont have to write any findViewById().
fun catAdapterDelegate(itemClickedListener : (Cat) -> Unit) = adapterDelegateLayoutContainer<Cat, Animal>(R.layout.item_cat) {
    name.setClickListener { itemClickedListener(item) } // name is imported from kotlinx.android.synthetic.main.item_cat.name

    bind { 
        name.text = item.name 
    }
}

Read the README for more details how to use it.

4.0.0

05 Oct 12:35
Compare
Choose a tag to compare
  • Uses RecyclerView from AndroidX: androidx.recyclerview:recyclerview:1.0.0
  • Package name changed from adapterdelegates3 to adapterdelegates4

3.1.0

05 Oct 06:22
Compare
Choose a tag to compare

Added AsyncListDifferDelegationAdapter that uses DiffUtils under the hood to animate dataset changes.

3.0.1

07 Jan 19:52
Compare
Choose a tag to compare
  • Minor bugfix (kotlin null safety) that ensures that list of payloads in adapterDelegate.onBindViewHoler() is never null (empty list if payload not used) #30
  • JavaDoc update #28

3.0.0

10 Oct 17:30
Compare
Choose a tag to compare
  • AdapterDelegate is now an abstract class (was a interface formerly)
  • Added the following methods to AdapterDelegate:
    • onBindViewHolder(@NonNull T items, int position, @NonNull RecyclerView.ViewHolder holder, @NonNull List<Object> payloads);: This method will be called for both adapter.notifyItemChanged() with or without payload. In Version 2.x of this library there was only one method onBindViewHolder(@NonNull T items, int position, @NonNull RecyclerView.ViewHolder holder). This one (with additional payload parameter) replaces the old one.
    • onViewRecycled(ViewHolder holder): Called when ViewHolder has been recycled
    • onFailedToRecycleView(ViewHolder holder): Called when ViewHolder couldn't be recycled
    • onViewAttachedToWindow(ViewHolder holder): Called when View (of ViewHolder) has been attached to window
    • onViewDetachedFromWindow(ViewHolder holder): Called when View (of ViewHolder) has been detached from window
  • changed visibility modifiers of methods of AdapterDelegate to protected (formerly public before because of interface)