Skip to content

Commit

Permalink
fix: 兼容不传viewGroup的情况 (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-dhl committed Aug 11, 2022
1 parent 0041060 commit 0be23be
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions binding/src/main/java/com/hi/dhl/binding/ext/ComponentExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ inline fun <reified T : ViewBinding> ViewGroup.databind(@LayoutRes resId: Int) =
ViewGroupDataBinding(
classes = T::class.java,
resId = resId,
inflater = LayoutInflater.from(getContext()),
viewGroup = this
inflater = LayoutInflater.from(getContext())
)

inline fun <reified T : ViewBinding> ViewGroup.databind(
Expand Down Expand Up @@ -112,8 +111,7 @@ inline fun <reified T : ViewBinding> RecyclerView.ViewHolder.viewbind() =

inline fun <reified T : ViewBinding> ViewGroup.viewbind() = ViewGroupViewBinding(
classes = T::class.java,
inflater = LayoutInflater.from(getContext()),
viewGroup = this
inflater = LayoutInflater.from(getContext())
)

inline fun <reified T : ViewBinding> ViewGroup.viewbind(viewGroup: ViewGroup) =
Expand Down

0 comments on commit 0be23be

Please sign in to comment.