Skip to content
Snippets Groups Projects
Unverified Commit f09dde61 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Only obtain the lifeCycle owner if we actually need it. (#2922)

parent 275be0d2
No related branches found
No related tags found
No related merge requests found
...@@ -57,8 +57,6 @@ class ViewBindingProperty<ComponentT : LifecycleOwner, BindingT : ViewBinding>( ...@@ -57,8 +57,6 @@ class ViewBindingProperty<ComponentT : LifecycleOwner, BindingT : ViewBinding>(
@MainThread @MainThread
override fun getValue(thisRef: ComponentT, property: KProperty<*>): BindingT { override fun getValue(thisRef: ComponentT, property: KProperty<*>): BindingT {
val lifecycle = lifecycleOwnerProvider(thisRef).lifecycle
if (localRef == null && viewBinding != null) { if (localRef == null && viewBinding != null) {
Timber.w("Fragment.onDestroyView() was called, but the handler didn't execute our delayed reset.") Timber.w("Fragment.onDestroyView() was called, but the handler didn't execute our delayed reset.")
/** /**
...@@ -75,6 +73,8 @@ class ViewBindingProperty<ComponentT : LifecycleOwner, BindingT : ViewBinding>( ...@@ -75,6 +73,8 @@ class ViewBindingProperty<ComponentT : LifecycleOwner, BindingT : ViewBinding>(
return@getValue it return@getValue it
} }
val lifecycle = lifecycleOwnerProvider(thisRef).lifecycle
return bindingProvider(thisRef).also { return bindingProvider(thisRef).also {
viewBinding = it viewBinding = it
localRef = thisRef localRef = thisRef
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment