File tree Expand file tree Collapse file tree
viewbinding-ktx/src/main/java/com/dylanc/viewbinding
viewbinding-nonreflection-ktx/src/main/java/com/dylanc/viewbinding/nonreflection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ import androidx.activity.ComponentActivity
2222import androidx.databinding.ViewDataBinding
2323import androidx.viewbinding.ViewBinding
2424
25- inline fun <reified VB : ViewBinding > ComponentActivity.binding () = lazy {
25+ inline fun <reified VB : ViewBinding > ComponentActivity.binding (setContentView : Boolean = true ) = lazy {
2626 inflateBinding<VB >(layoutInflater).also { binding ->
27- setContentView(binding.root)
27+ if (setContentView) setContentView(binding.root)
2828 if (binding is ViewDataBinding ) binding.lifecycleOwner = this
2929 }
3030}
Original file line number Diff line number Diff line change @@ -21,9 +21,9 @@ import androidx.activity.ComponentActivity
2121import androidx.databinding.ViewDataBinding
2222import androidx.viewbinding.ViewBinding
2323
24- fun <VB : ViewBinding > ComponentActivity.binding (inflate : (LayoutInflater ) -> VB ) = lazy {
24+ fun <VB : ViewBinding > ComponentActivity.binding (inflate : (LayoutInflater ) -> VB , setContentView : Boolean = true ) = lazy {
2525 inflate(layoutInflater).also { binding ->
26- setContentView(binding.root)
26+ if (setContentView) setContentView(binding.root)
2727 if (binding is ViewDataBinding ) binding.lifecycleOwner = this
2828 }
2929}
You can’t perform that action at this time.
0 commit comments