update to dev07 compose

This commit is contained in:
geeksville 2020-03-29 13:38:50 -07:00
parent 5b60253e00
commit 40853723ab
11 changed files with 27 additions and 29 deletions

View file

@ -23,6 +23,7 @@ import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import androidx.annotation.LayoutRes
import androidx.compose.Composable
import androidx.ui.core.ContextAmbient
/**
* Composes an Android [View] given a layout resource [resId]. The method handles the inflation
@ -35,10 +36,11 @@ import androidx.compose.Composable
@Composable
// TODO(popam): support modifiers here
fun AndroidView(@LayoutRes resId: Int, postInflationCallback: (View) -> Unit = { _ -> }) {
AndroidViewHolder(
postInflationCallback = postInflationCallback,
resId = resId
)
val context = ContextAmbient.current
val r = AndroidViewHolder(context)
r.postInflationCallback = postInflationCallback
r.resId = resId
}
private class AndroidViewHolder(context: Context) : ViewGroup(context) {