MCPcopy Create free account
hub / github.com/Snapchat/Valdi / insertChild

Method insertChild

valdi/src/java/com/snap/valdi/ViewRef.kt:52–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51 }
52
53 fun insertChild(childViewRef: ViewRef, viewIndex: Int) {
54 val view = get() ?: return
55 val childView = childViewRef.get() ?: return
56
57 childView.removeFromParentView()
58
59 if (view is CustomChildViewAppender) {
60 view.addValdiChildView(childView, viewIndex)
61 return
62 }
63
64 if (view !is ViewGroup) {
65 support.logger.error("Cannot add $childView into parentView $view, parentView needs to be a ViewGroup")
66 return
67 }
68
69 view.addView(childView, viewIndex)
70 }
71
72 fun removeFromParent(shouldClearViewNode: Boolean) {

Callers 2

insertChildViewMethod · 0.45
moveViewToParentMethod · 0.45

Calls 4

getMethod · 0.65
errorMethod · 0.65
getFunction · 0.50
addValdiChildViewMethod · 0.45

Tested by

no test coverage detected