Failed to resolve: com.xwray:groupie-viewbinding:2.8.1
i have added
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
but still gradle is unable to find it
Same problem.
Failed to resolve: com.xwray:groupie-viewbinding:2.8.1
Failed to resolve: com.xwray:groupie-viewbinding:2.8.1 @ValCanBuild
Same for 2.8.0
For those curious, I ended up with these helpers for now:
abstract class GroupieItem: Item<GroupieViewHolder>()
@Suppress("UNCHECKED_CAST")
class BindingViewHolder(private val viewBinding: ViewBinding) : GroupieViewHolder(viewBinding.root) {
fun <T : ViewBinding> binding(): T = viewBinding as T
}
abstract class BindingItem : GroupieItem() {
protected abstract fun initializeViewBinding(view: View): ViewBinding
override fun createViewHolder(itemView: View): BindingViewHolder {
val binding = initializeViewBinding(itemView)
return BindingViewHolder(binding)
}
final override fun bind(viewHolder: GroupieViewHolder, position: Int) {
bind(viewHolder as BindingViewHolder, position)
}
abstract fun bind(viewHolder: BindingViewHolder, position: Int)
}
class GroupieItemAdapter : GroupAdapter<GroupieViewHolder>()
fun GroupieItemAdapter.replaceItemsWith(
recyclerView: RecyclerView,
withAnimations: Boolean = false,
block: MutableList<GroupieItem>.() -> Unit
): GroupieItemAdapter {
if (withAnimations) {
this.update(mutableListOf<GroupieItem>().apply(block))
} else {
val layoutManager = recyclerView.layoutManager
val state = layoutManager?.onSaveInstanceState()
this.clear()
this.addAll(mutableListOf<GroupieItem>().apply(block))
layoutManager?.onRestoreInstanceState(state) // fixme: Groupie should use adapter.notifyDataSetChanged() on replace instead of remove+insert -.-
}
return this
}
@Zhuinden better to go with https://github.com/lisawray/groupie/issues/333#issuecomment-607079271 imho
https://github.com/lisawray/groupie/issues/333 is now resolved and groupie-viewbinding is available on maven. Closing