Open
Description
override val savedStateRegistry: SavedStateRegistry? = null
override fun contentState(loadCount: Int, attached: Boolean, uncaughtException: Throwable?) {
// Remove all child views in case the previous content state left some behind.
if (attached) children.views.clear()
// Canonicalize "java.lang.Exception(boom!)" to "kotlin.Exception(boom!)".
val exceptionString = uncaughtException?.toString()?.replace("java.lang.", "kotlin.")
// TODO(jwilson): this is a backwards-compatibility shim. Emit a simpler event.
eventLog += when {
loadCount == 0 && !attached -> "codeListener.onInitialCodeLoading()"
attached -> "codeListener.onCodeLoaded($loadCount)"
else -> "codeListener.onCodeDetached($exceptionString)"
}
}
override fun restart(restart: (() -> Unit)?) {
}
override fun toString() = name
internal class FakeChildren(
private val childrenDelegate: MutableListChildren<WidgetValue> = MutableListChildren(),
) : Widget.Children<WidgetValue> by childrenDelegate {
/** A private copy of the child views that isn't cleared by `detach()`. */
val views = mutableListOf<WidgetValue>()
override fun insert(index: Int, widget: Widget<WidgetValue>) {
views.add(index, widget.value)
childrenDelegate.insert(index, widget)
}
override fun remove(index: Int, count: Int) {
views.subList(index, index + count).clear()
childrenDelegate.remove(index, count)
}
}
}
Metadata
Metadata
Assignees
Labels
No labels