Add bounds to fragment
Summary: Previously the bounds was 0, the trick is to steel the offset from the view and then use offsetchild zero so it doesnt get applied twice Reviewed By: lblasa Differential Revision: D47915115 fbshipit-source-id: ff771470dcf1720ca265fc9017ff0ea3b0bc1ca1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6b74f66ab4
commit
1de033c157
@@ -27,10 +27,19 @@ class FragmentFrameworkDescriptor(val register: DescriptorRegister) :
|
||||
return node.javaClass.simpleName
|
||||
}
|
||||
|
||||
override fun onGetBounds(node: android.app.Fragment): Bounds? = Bounds(0, 0, 0, 0)
|
||||
override fun onGetBounds(node: android.app.Fragment): Bounds {
|
||||
return node.view?.let {
|
||||
val descriptor = register.descriptorForClassUnsafe(it.javaClass)
|
||||
return descriptor.getBounds(it)
|
||||
}
|
||||
?: Bounds(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
override fun onGetChildren(node: android.app.Fragment): List<Any> =
|
||||
node.view?.let { view -> listOf(view) } ?: listOf()
|
||||
node.view?.let { view ->
|
||||
listOf(OffsetChild.zero(view, register.descriptorForClassUnsafe(view.javaClass)))
|
||||
}
|
||||
?: listOf()
|
||||
|
||||
override fun onGetAttributes(
|
||||
node: android.app.Fragment,
|
||||
|
||||
@@ -47,12 +47,18 @@ class FragmentSupportDescriptor(val register: DescriptorRegister) :
|
||||
return node.javaClass.simpleName
|
||||
}
|
||||
|
||||
override fun onGetBounds(node: Fragment): Bounds = Bounds(0, 0, 0, 0)
|
||||
override fun onGetBounds(node: Fragment): Bounds {
|
||||
return node.view?.let {
|
||||
val descriptor = register.descriptorForClassUnsafe(it.javaClass)
|
||||
return descriptor.getBounds(it)
|
||||
}
|
||||
?: Bounds(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
override fun onGetChildren(node: androidx.fragment.app.Fragment): List<Any> {
|
||||
val view = node.view
|
||||
return if (view != null && node.isVisible) {
|
||||
listOf(view)
|
||||
listOf(OffsetChild.zero(view, register.descriptorForClassUnsafe(view.javaClass)))
|
||||
} else {
|
||||
listOf()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user