File tree 2 files changed +4
-4
lines changed
viewbinding-ktx/src/main/java/com/dylanc/viewbinding
viewbinding-nonreflection-ktx/src/main/java/com/dylanc/viewbinding/nonreflection
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ import androidx.activity.ComponentActivity
22
22
import androidx.databinding.ViewDataBinding
23
23
import androidx.viewbinding.ViewBinding
24
24
25
- inline fun <reified VB : ViewBinding > ComponentActivity.binding () = lazy {
25
+ inline fun <reified VB : ViewBinding > ComponentActivity.binding (setContentView : Boolean = true ) = lazy {
26
26
inflateBinding<VB >(layoutInflater).also { binding ->
27
- setContentView(binding.root)
27
+ if (setContentView) setContentView(binding.root)
28
28
if (binding is ViewDataBinding ) binding.lifecycleOwner = this
29
29
}
30
30
}
Original file line number Diff line number Diff line change @@ -21,9 +21,9 @@ import androidx.activity.ComponentActivity
21
21
import androidx.databinding.ViewDataBinding
22
22
import androidx.viewbinding.ViewBinding
23
23
24
- fun <VB : ViewBinding > ComponentActivity.binding (inflate : (LayoutInflater ) -> VB ) = lazy {
24
+ fun <VB : ViewBinding > ComponentActivity.binding (inflate : (LayoutInflater ) -> VB , setContentView : Boolean = true ) = lazy {
25
25
inflate(layoutInflater).also { binding ->
26
- setContentView(binding.root)
26
+ if (setContentView) setContentView(binding.root)
27
27
if (binding is ViewDataBinding ) binding.lifecycleOwner = this
28
28
}
29
29
}
You can’t perform that action at this time.
0 commit comments