Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13d218b2 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge remote-tracking branch 'origin/lineage-23.2' into a16.2

parents f784e332 e3a7a509
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -1438,16 +1438,32 @@ private fun ContentScope.MediaObject(
        Box {
            AndroidView(
                modifier = modifier,
                factory = {
                    mediaHost.hostView.apply {
                        layoutParams =
                            FrameLayout.LayoutParams(
                factory = { ctx ->
                    FrameLayout(ctx).apply {
                        layoutParams = FrameLayout.LayoutParams(
                            FrameLayout.LayoutParams.MATCH_PARENT,
                            FrameLayout.LayoutParams.WRAP_CONTENT,
                        )
                    }
                },
                update = { view ->
                update = { container ->
                    val view = mediaHost.hostView

                    (view.parent as? ViewGroup)?.let { p ->
                        if (p !== container) p.removeView(view)
                    }

                    if (view.parent == null) {
                        container.removeAllViews()
                        container.addView(
                            view,
                            FrameLayout.LayoutParams(
                                FrameLayout.LayoutParams.MATCH_PARENT,
                                FrameLayout.LayoutParams.WRAP_CONTENT,
                            )
                        )
                    }

                    view.update()
                    if (!Flags.mediaFrameDimensionsFix()) {
                        // Update layout params if host view bounds are higher than its child.
@@ -1471,7 +1487,10 @@ private fun ContentScope.MediaObject(
                        }
                    }
                },
                onReset = {},
                onReset = { container ->
                    val view = mediaHost.hostView
                    if (view.parent === container) container.removeView(view)
                },
            )
        }
    }