fighting compose

pull/12/head
geeksville 2020-04-07 12:48:42 -07:00
rodzic 606dc0fd07
commit 8d5c6742be
1 zmienionych plików z 20 dodań i 4 usunięć

Wyświetl plik

@ -14,6 +14,7 @@ fun androidx.fragment.app.Fragment.setComposable(
): View? =
context?.let {
FrameLayout(it).apply {
this.isClickable = true
this.id =
id // Compose requires a unique ID for the containing view to make savedInstanceState work
@ -30,11 +31,26 @@ open class ComposeFragment(
screenName: String,
id: Int,
private val content: @Composable() () -> Unit
) :
ScreenFragment(screenName) {
) : ScreenFragment(screenName) {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? =
setComposable(id, content)
}
FrameLayout(context!!).apply {
this.isClickable = true
this.id =
id // Compose requires a unique ID for the containing view to make savedInstanceState work
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
setContent(content)
}
/* override fun onStart() {
super.onStart()
(view as ViewGroup).setContent(content)
} */
}