Find findViewById inside onDraw / onMeasure / onLayout

Proprietary

View tree-walking inside the draw/measure/layout pass costs frame budget on every pass. Cache the lookup once (in onFinishInflate or a lateinit initialized when the view attaches), or — better — migrate to ViewBinding so the cache is generated.

org.openrewrite.kotlin.android.FindFindViewByIdInHotPath$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.android.FindFindViewByIdInHotPath$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.