File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
ui-generator-base/src/main/java/ru/impression/ui_generator_base Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -31,18 +31,23 @@ val View.activity: AppCompatActivity?
3131internal fun KClass <out ViewDataBinding >.inflate (
3232 component : Component <* , * >,
3333 attachToRoot : Boolean
34- ) = (component.container as ? ViewGroup )? .let {
34+ ) = (component.container as ? ViewGroup ).let {
3535 (java.getMethod(
3636 " inflate" ,
3737 LayoutInflater ::class .java,
3838 ViewGroup ::class .java,
3939 Boolean ::class .javaPrimitiveType
40- ).invoke(null , LayoutInflater .from(it.context), it, attachToRoot) as ViewDataBinding ).apply {
40+ ).invoke(
41+ null ,
42+ LayoutInflater .from((component as ? Fragment )?.context ? : (component as ? View )?.context),
43+ it,
44+ attachToRoot
45+ ) as ViewDataBinding ).apply {
4146 this .lifecycleOwner = component.boundLifecycleOwner
4247 setComponent(component)
4348 setViewModel(component.viewModel)
4449 }
45- } ? : throw UnsupportedOperationException ( " Component must be ViewGroup " )
50+ }
4651
4752internal fun ViewDataBinding.setViewModel (viewModel : ComponentViewModel ) {
4853 this ::class .java.getMethod(" setViewModel" , viewModel::class .java).invoke(this , viewModel)
You can’t perform that action at this time.
0 commit comments