diff --git a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ScreenViewFactoryFinder.kt b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ScreenViewFactoryFinder.kt index c55902c686..193428f91f 100644 --- a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ScreenViewFactoryFinder.kt +++ b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ScreenViewFactoryFinder.kt @@ -20,7 +20,6 @@ import com.squareup.workflow1.ui.container.EnvironmentScreen * by ScreenViewFactory( * buildView = { environment, context, _ -> * val view = MyBackStackContainer(context) - * .apply { layoutParams = (LayoutParams(MATCH_PARENT, MATCH_PARENT)) } * ScreenViewHolder(environment, view) { rendering, environment -> * view.update(rendering, environment) * } diff --git a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowLayout.kt b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowLayout.kt index 7ed280da40..28a518a566 100644 --- a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowLayout.kt +++ b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowLayout.kt @@ -8,8 +8,6 @@ import android.os.Parcelable.Creator import android.util.AttributeSet import android.util.SparseArray import android.view.View -import android.view.ViewGroup -import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.widget.FrameLayout import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle.State @@ -51,7 +49,7 @@ public class WorkflowLayout( private val showing: WorkflowViewStub = WorkflowViewStub(context).also { rootStub -> rootStub.updatesVisibility = false - addView(rootStub, ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)) + addView(rootStub) } private var restoredChildState: SparseArray? = null diff --git a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowViewStub.kt b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowViewStub.kt index 26e0b80604..e5ce76cbc5 100644 --- a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowViewStub.kt +++ b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/WorkflowViewStub.kt @@ -129,7 +129,7 @@ public class WorkflowViewStub @JvmOverloads constructor( public var replaceOldViewInParent: (ViewGroup, View) -> Unit = { parent, newView -> val index = parent.indexOfChild(actual) parent.removeView(actual) - actual.layoutParams + layoutParams?.takeIf { newView.layoutParams == null } ?.let { parent.addView(newView, index, it) } ?: run { parent.addView(newView, index) } } diff --git a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/BodyAndOverlaysContainer.kt b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/BodyAndOverlaysContainer.kt index ea5ef4c41c..04a1bd2ef0 100644 --- a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/BodyAndOverlaysContainer.kt +++ b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/BodyAndOverlaysContainer.kt @@ -9,7 +9,6 @@ import android.os.Parcelable.Creator import android.util.AttributeSet import android.view.KeyEvent import android.view.MotionEvent -import android.view.ViewGroup import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.widget.FrameLayout import com.squareup.workflow1.ui.Compatible @@ -43,7 +42,7 @@ internal class BodyAndOverlaysContainer @JvmOverloads constructor( private lateinit var savedStateParentKey: String private val baseViewStub: WorkflowViewStub = WorkflowViewStub(context).also { - addView(it, ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)) + addView(it) } private val dialogs = LayeredDialogSessions.forView(