Do extensions have magic to trigger a bloated performance? As far as I can see, I have to break the harmony of the code and causefindViewById
The goal was to inflate the layout layout_ongoingViewat some point and again make it hidden and visible depending on the scenario
<ViewStub
android:id="@+id/viewStubOngoing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/ongoingView"
android:layout="@layout/layout_ongoingView" />
And codes
override fun hideOngoingPanel() {
if (viewStubOngoing !is ViewStub) {
findViewById(R.id.ongoingView).visibility = View.GONE
}
}
override fun showOngoingPanel() {
if (viewStubOngoing !is ViewStub) {
findViewById(R.id.ongoingView).visibility = View.VISIBLE
} else {
viewStubOngoing.inflate()
}
}
source
share