package com.android.permissioncontroller.safetycenter.ui.view import android.view.View /** Returns a lazy property wrapping a view with a given ID. */ fun View.lazyView(childViewId: Int): Lazy = lazyView { requireViewById(childViewId) } /** Returns a lazy property wrapping a view produced by the given function. */ fun lazyView(viewProducer: () -> T): Lazy = // Lazy by default uses synchronization to ensure a variable is only initialized once. This // is unnecessary and expensive for view properties, so we don't use synchronization here. lazy(LazyThreadSafetyMode.NONE) { viewProducer() }