Fluent modifiers
Address feedback from UX research study on Compose UI Modifiers.
This change explores moving the preferred modifier construction
mechanism to fluent extension functions acting as factories, downplaying
the use of the overloaded operator plus outside of the implementation of
these extension factories. This makes modifiers more discoverable via
autocomplete and helps emphasize the significance of modifier ordering.
Relnote: Replaced Modifier plus operator with factory extension functions
Test: existing tests refactored to use new API
Change-Id: I225e444f50956d84e15ca4f1378b7f805d54e0ca
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmark.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmark.kt
index d254644..721c467 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmark.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/ComposeBenchmark.kt
@@ -23,11 +23,12 @@
import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
-import androidx.ui.core.draw
+import androidx.ui.core.Modifier
+import androidx.ui.core.drawBehind
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import androidx.ui.unit.toRect
import org.junit.FixMethodOrder
import org.junit.Ignore
@@ -154,7 +155,7 @@
}
private fun background(paint: Paint) =
- draw { canvas, size -> canvas.drawRect(size.toRect(), paint) }
+ Modifier.drawBehind { canvas, size -> canvas.drawRect(size.toRect(), paint) }
private val redBackground = background(Paint().also { it.color = Color.Red })
private val blackBackground = background(Paint().also { it.color = Color.Black })
@@ -178,20 +179,20 @@
@Composable
fun OneRect(model: ColorModel) {
- Box(modifier = LayoutSize.Fill + model.background)
+ Box(modifier = Modifier.fillMaxSize() + model.background)
}
@Composable
fun TenRects(model: ColorModel, narrow: Boolean = false) {
if (narrow) {
Observe {
- Box(modifier = LayoutSize.Fill + model.background)
+ Box(modifier = Modifier.fillMaxSize() + model.background)
}
} else {
- Box(modifier = LayoutSize.Fill + model.background)
+ Box(modifier = Modifier.fillMaxSize() + model.background)
}
repeat(9) {
- Box(modifier = LayoutSize.Fill + defaultBackground)
+ Box(modifier = Modifier.fillMaxSize() + defaultBackground)
}
}
@@ -201,12 +202,12 @@
if (it % 10 == 0)
if (narrow) {
Observe {
- Box(modifier = LayoutSize.Fill + model.background)
+ Box(modifier = Modifier.fillMaxSize() + model.background)
}
} else {
- Box(modifier = LayoutSize.Fill + model.background)
+ Box(modifier = Modifier.fillMaxSize() + model.background)
}
else
- Box(modifier = LayoutSize.Fill + defaultBackground)
+ Box(modifier = Modifier.fillMaxSize() + defaultBackground)
}
}
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt
index c5a45e0..cf547b8 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/DbMonsterBenchmark.kt
@@ -21,8 +21,9 @@
import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
+import androidx.ui.core.Modifier
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
+import androidx.ui.layout.fillMaxHeight
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -60,7 +61,7 @@
val list = DatabaseList(count, random)
measureRecompose {
compose {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
for (db in list.databases) {
DatabaseRow(db = db)
}
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt
index edc45da..1f58e03 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/dbmonster/DbMonster.kt
@@ -18,12 +18,12 @@
import androidx.compose.Composable
import androidx.compose.Model
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
-
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
import kotlin.random.Random
private fun randomQuery(random: Random): String = random.nextDouble().let {
@@ -72,7 +72,7 @@
@Composable
fun QueryColumn(query: Query) {
// TODO: we could do some conditional styling here which would make the test better
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
Text(text = "${query.elapsed}")
Text(text = query.query)
}
@@ -83,9 +83,9 @@
println(db)
val columns = 5
val topQueries = db.topQueries(columns)
- Row(LayoutWidth.Fill) {
- Column(LayoutHeight.Fill) { Text(text = db.name) }
- Column(LayoutHeight.Fill) { Text(text = "${db.queries.size}") }
+ Row(Modifier.fillMaxWidth()) {
+ Column(Modifier.fillMaxHeight()) { Text(text = db.name) }
+ Column(Modifier.fillMaxHeight()) { Text(text = "${db.queries.size}") }
topQueries.forEach { query ->
QueryColumn(query = query)
}
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt
index b9a98f3..eab0cf5 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/deeptree/DeepTree.kt
@@ -17,20 +17,20 @@
package androidx.compose.benchmark.deeptree
import androidx.compose.Composable
-import androidx.ui.core.draw
+import androidx.ui.core.Modifier
+import androidx.ui.core.drawBehind
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
-import androidx.ui.layout.RowScope
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
import androidx.ui.unit.toRect
private fun background(paint: Paint) =
- draw { canvas, size -> canvas.drawRect(size.toRect(), paint) }
+ Modifier.drawBehind { canvas, size -> canvas.drawRect(size.toRect(), paint) }
val blueBackground = background(Paint().also { it.color = Color.Blue })
val magentaBackground = background(Paint().also { it.color = Color.Magenta })
@@ -43,15 +43,15 @@
1 -> blackBackground
else -> magentaBackground
}
- Box(modifier = LayoutSize.Fill + background)
+ Box(modifier = Modifier.fillMaxSize() + background)
}
@Composable
fun Stack(vertical: Boolean, children: @Composable() () -> Unit) {
if (vertical) {
- Column(LayoutHeight.Fill) { children() }
+ Column(Modifier.fillMaxHeight()) { children() }
} else {
- Row(LayoutWidth.Fill) { children() }
+ Row(Modifier.fillMaxWidth()) { children() }
}
}
@@ -85,7 +85,7 @@
Terminal(style = id % 3)
} else {
repeat(breadth) {
- Box(LayoutSize.Fill + blueBackground)
+ Box(Modifier.fillMaxSize() + blueBackground)
}
}
}
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt
index 6f65fba..8083e25 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/realworld4/RealWorld4_Widgets.kt
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+// TODO remove this after converting this file's use of legacy modifier construction
+@file:Suppress("DEPRECATION")
+
package androidx.compose.benchmark.realworld4
/**
diff --git a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt
index db352e5..003cdfb 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt
+++ b/compose/compose-runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/benchmark/siblings/SiblingManagement.kt
@@ -19,22 +19,23 @@
import androidx.compose.Composable
import androidx.compose.Pivotal
import androidx.compose.key
-import androidx.ui.core.draw
+import androidx.ui.core.Modifier
+import androidx.ui.core.drawBehind
import androidx.ui.foundation.Box
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
import androidx.ui.text.TextStyle
import androidx.ui.unit.toRect
import kotlin.random.Random
private fun background(paint: Paint) =
- draw { canvas, size -> canvas.drawRect(size.toRect(), paint) }
+ Modifier.drawBehind { canvas, size -> canvas.drawRect(size.toRect(), paint) }
val blackBackground = background(Paint().also { it.color = Color.Black })
val blueBackground = background(Paint().also { it.color = Color.Black })
@@ -55,8 +56,8 @@
1 -> blueStyle
else -> magentaStyle
}
- Row(LayoutWidth.Fill) {
- Box(LayoutSize.Fill + background)
+ Row(Modifier.fillMaxWidth()) {
+ Box(Modifier.fillMaxSize() + background)
Text(text = "${item.id}", style = style)
}
}
@@ -76,8 +77,8 @@
1 -> blueStyle
else -> magentaStyle
}
- Row(LayoutWidth.Fill) {
- Box(LayoutSize.Fill + background)
+ Row(Modifier.fillMaxWidth()) {
+ Box(Modifier.fillMaxSize() + background)
Text(text = "${item.id}", style = style)
}
}
@@ -125,7 +126,7 @@
@Composable
fun SiblingManagement(identity: IdentityType, items: List<Item>) {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
when (identity) {
IdentityType.Pivotal -> {
for (item in items) {
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt
index 409df52..7243f75 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt
@@ -34,12 +34,12 @@
import androidx.ui.core.Layout
import androidx.ui.core.Modifier
import androidx.ui.core.offset
-import androidx.ui.unit.Dp
-import androidx.ui.unit.dp
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.test.ComposeTestCase
import androidx.ui.integration.test.ToggleableTestCase
import androidx.ui.layout.EdgeInsets
+import androidx.ui.layout.padding
+import androidx.ui.test.ComposeTestCase
+import androidx.ui.unit.Dp
+import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.isFinite
import androidx.ui.unit.min
@@ -215,7 +215,7 @@
@Composable
override fun emitPaddedContainer(padding: Dp, child: @Composable() () -> Unit) {
- FillerContainer(LayoutPadding(padding), child)
+ FillerContainer(Modifier.padding(padding), child)
}
}
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt
index d51b0ce..ecfec28 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt
@@ -18,17 +18,18 @@
import androidx.compose.Composable
import androidx.compose.MutableState
-import androidx.test.filters.LargeTest
import androidx.compose.state
+import androidx.test.filters.LargeTest
import androidx.ui.benchmark.ComposeBenchmarkRule
import androidx.ui.benchmark.benchmarkFirstCompose
import androidx.ui.benchmark.toggleStateBenchmarkRecompose
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
-import androidx.ui.unit.dp
-import androidx.ui.layout.Column
-import androidx.ui.test.ComposeTestCase
import androidx.ui.integration.test.ToggleableTestCase
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.Column
+import androidx.ui.layout.preferredWidth
+import androidx.ui.test.ComposeTestCase
+import androidx.ui.unit.dp
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -72,7 +73,7 @@
numberState = number
val content = @Composable {
- Box(LayoutWidth(10.dp))
+ Box(Modifier.preferredWidth(10.dp))
}
Column {
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/OnPositionedBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/OnPositionedBenchmark.kt
index b1503b0..2a313d4 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/OnPositionedBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/OnPositionedBenchmark.kt
@@ -25,8 +25,8 @@
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
import androidx.ui.integration.test.ToggleableTestCase
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.test.ComposeTestCase
import androidx.ui.unit.Dp
import androidx.ui.unit.dp
@@ -60,7 +60,7 @@
val size = state { 200.dp }
this.state = size
Stack {
- Box(LayoutSize(size.value), gravity = ContentGravity.Center) {
+ Box(Modifier.preferredSize(size.value), gravity = ContentGravity.Center) {
StaticChildren(100)
}
}
@@ -70,11 +70,11 @@
private fun StaticChildren(count: Int) {
if (count > 0) {
val modifier = if (count == 1) {
- onPositioned { it.size }
+ Modifier.onPositioned { it.size }
} else {
Modifier.None
}
- Box(LayoutSize(100.dp) + modifier, gravity = ContentGravity.Center) {
+ Box(Modifier.preferredSize(100.dp) + modifier, gravity = ContentGravity.Center) {
StaticChildren(count - 1)
}
}
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/WithConstraintsBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/WithConstraintsBenchmark.kt
index 872883b..e105d473 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/WithConstraintsBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/core/WithConstraintsBenchmark.kt
@@ -27,10 +27,11 @@
import androidx.ui.core.Placeable.PlacementScope.place
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.Spacer
-import androidx.ui.test.ComposeTestCase
import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.test.ComposeTestCase
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.dp
@@ -71,8 +72,8 @@
override fun emitContent() {
val size = state { 200.dp }
this.state = size
- Box(LayoutSize(300.dp), gravity = ContentGravity.Center) {
- Spacer(LayoutSize(width = size.value, height = size.value))
+ Box(Modifier.preferredSize(300.dp), gravity = ContentGravity.Center) {
+ Spacer(Modifier.preferredSize(width = size.value, height = size.value))
}
}
@@ -90,8 +91,8 @@
val size = state { 200.dp }
this.state = size
WithConstraints { _, _ ->
- Box(LayoutSize(300.dp), gravity = ContentGravity.Center) {
- Spacer(LayoutSize(width = size.value, height = size.value))
+ Box(Modifier.preferredSize(300.dp), gravity = ContentGravity.Center) {
+ Spacer(Modifier.preferredSize(width = size.value, height = size.value))
}
}
}
@@ -111,7 +112,7 @@
this.state = size
ChangingConstraintsLayout(state) {
WithConstraints { _, _ ->
- Box(LayoutSize.Fill)
+ Box(Modifier.fillMaxSize())
}
}
}
diff --git a/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoApp.kt b/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoApp.kt
index cd23e19..68a7c86 100644
--- a/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoApp.kt
+++ b/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoApp.kt
@@ -19,17 +19,19 @@
import androidx.compose.Composable
import androidx.compose.mutableStateOf
import androidx.ui.animation.Crossfade
-import androidx.ui.foundation.Text
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.demos.common.ActivityDemo
import androidx.ui.demos.common.ComposableDemo
import androidx.ui.demos.common.Demo
import androidx.ui.demos.common.DemoCategory
import androidx.ui.demos.common.allLaunchableDemos
import androidx.ui.foundation.Icon
+import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutHeight
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.wrapContentSize
import androidx.ui.material.IconButton
import androidx.ui.material.ListItem
import androidx.ui.material.Scaffold
@@ -115,7 +117,8 @@
ListItem(
text = {
Text(
- modifier = LayoutHeight(56.dp) + LayoutAlign.Center,
+ modifier = Modifier.preferredHeight(56.dp)
+ .wrapContentSize(Alignment.Center),
text = demo.title
)
},
diff --git a/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoFilter.kt b/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoFilter.kt
index 1504a1b..625851a 100644
--- a/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoFilter.kt
+++ b/ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoFilter.kt
@@ -19,18 +19,19 @@
import androidx.compose.Composable
import androidx.compose.key
import androidx.compose.onCommit
+import androidx.ui.core.Alignment
import androidx.ui.core.FocusManagerAmbient
import androidx.ui.core.Modifier
-import androidx.ui.foundation.Text
-import androidx.ui.foundation.TextField
import androidx.ui.demos.common.Demo
import androidx.ui.foundation.Icon
+import androidx.ui.foundation.Text
+import androidx.ui.foundation.TextField
import androidx.ui.foundation.VerticalScroller
import androidx.ui.graphics.compositeOver
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
+import androidx.ui.layout.RowAlign
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.wrapContentSize
import androidx.ui.material.IconButton
import androidx.ui.material.ListItem
import androidx.ui.material.MaterialTheme
@@ -78,10 +79,10 @@
primary.copy(alpha = 0.08f).compositeOver(surface)
}
TopAppBar(color = appBarColor, contentColor = onSurface) {
- IconButton(modifier = LayoutGravity.Center, {
+ IconButton(modifier = Modifier.gravity(RowAlign.Center), {
Icon(Icons.Filled.Close)
}
- FilterField(filterText, onFilter, LayoutGravity.Center)
+ FilterField(filterText, onFilter, Modifier.gravity(RowAlign.Center))
}
}
}
@@ -142,7 +143,7 @@
ListItem(
text = {
Text(
- modifier = LayoutHeight(56.dp) + LayoutAlign.Center,
+ modifier = Modifier.preferredHeight(56.dp).wrapContentSize(Alignment.Center),
text = annotatedString
)
},
diff --git a/ui/integration-tests/test/src/androidTest/java/androidx/ui/integration/test/TableRecompositionTest.kt b/ui/integration-tests/test/src/androidTest/java/androidx/ui/integration/test/TableRecompositionTest.kt
index 2b18eae..18ae9a8 100644
--- a/ui/integration-tests/test/src/androidTest/java/androidx/ui/integration/test/TableRecompositionTest.kt
+++ b/ui/integration-tests/test/src/androidTest/java/androidx/ui/integration/test/TableRecompositionTest.kt
@@ -17,15 +17,16 @@
package androidx.ui.integration.test
import androidx.test.filters.MediumTest
-import androidx.ui.unit.dp
+import androidx.ui.core.Modifier
import androidx.ui.foundation.ColoredRect
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutPadding
import androidx.ui.layout.Table
+import androidx.ui.layout.padding
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Surface
import androidx.ui.test.createComposeRule
import androidx.ui.test.doFramesUntilNoChangesPending
+import androidx.ui.unit.dp
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -60,7 +61,7 @@
color = Color.Black,
width = 100.dp,
height = 50.dp,
- modifier = LayoutPadding(2.dp)
+ modifier = Modifier.padding(2.dp)
)
}
}
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton1TestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton1TestCase.kt
index e9d23b2..474a4a4 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton1TestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton1TestCase.kt
@@ -18,6 +18,7 @@
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
import androidx.ui.foundation.Canvas
@@ -26,14 +27,14 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.graphics.drawOutline
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
class SimpleRadioButton1TestCase : BaseSimpleRadioButtonTestCase() {
@Composable
override fun emitContent() {
Box(
- modifier = LayoutSize(48.dp),
+ modifier = Modifier.preferredSize(48.dp),
shape = CircleShape,
border = Border(1.dp, Color.Cyan),
gravity = ContentGravity.Center
@@ -42,7 +43,7 @@
Paint().apply { color = Color.Cyan }
}
val innerSize = getInnerSize().value
- Canvas(LayoutSize(innerSize)) {
+ Canvas(Modifier.preferredSize(innerSize)) {
drawOutline(CircleShape.createOutline(size, this), paint)
}
}
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton2TestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton2TestCase.kt
index 18ea8fe..c84195c 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton2TestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton2TestCase.kt
@@ -17,10 +17,11 @@
package androidx.ui.integration.test.core
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.DrawBorder
+import androidx.ui.foundation.drawBackground
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.geometry.Offset
import androidx.ui.geometry.shift
@@ -28,7 +29,7 @@
import androidx.ui.graphics.Outline
import androidx.ui.graphics.Path
import androidx.ui.graphics.Shape
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.Px
@@ -40,11 +41,12 @@
override fun emitContent() {
val padding = (48.dp - getInnerSize().value) / 2
Box(
- LayoutSize(48.dp) + DrawBorder(Border(1.dp, Color.Cyan), CircleShape) +
- DrawBackground(
- color = Color.Cyan,
- shape = (PaddingShape(padding, CircleShape))
- )
+ Modifier.preferredSize(48.dp)
+ .plus(DrawBorder(Border(1.dp, Color.Cyan), CircleShape))
+ .drawBackground(
+ color = Color.Cyan,
+ shape = (PaddingShape(padding, CircleShape))
+ )
)
}
}
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton3TestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton3TestCase.kt
index ae07149..9974a93 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton3TestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton3TestCase.kt
@@ -18,11 +18,12 @@
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Canvas
import androidx.ui.geometry.Offset
import androidx.ui.graphics.Paint
import androidx.ui.graphics.PaintingStyle
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
import androidx.ui.unit.minDimension
@@ -33,7 +34,7 @@
val innerSize = getInnerSize()
val borderPaint = remember { Paint().apply { style = PaintingStyle.stroke } }
val fillPaint = remember { Paint() }
- Canvas(LayoutSize(48.dp)) {
+ Canvas(Modifier.preferredSize(48.dp)) {
val center = Offset(size.width.value / 2f, size.height.value / 2f)
drawCircle(center, size.minDimension.value, borderPaint)
val innerRadius = innerSize.value.value / 2f
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton4TestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton4TestCase.kt
index e66ce90..1593b82 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton4TestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/SimpleRadioButton4TestCase.kt
@@ -17,14 +17,15 @@
package androidx.ui.integration.test.core
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.DrawBorder
+import androidx.ui.foundation.drawBackground
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
class SimpleRadioButton4TestCase : BaseSimpleRadioButtonTestCase() {
@@ -33,13 +34,15 @@
override fun emitContent() {
val innerSize = getInnerSize()
Box(
- LayoutSize(48.dp) +
- DrawBackground(Color.Cyan, CircleShape) +
- LayoutPadding(innerSize.value) +
+ Modifier.preferredSize(48.dp)
+ .drawBackground(Color.Cyan, CircleShape)
+ .padding(innerSize.value)
+ .plus(
DrawBorder(
border = Border(color = Color.Cyan, size = 1.dp),
shape = CircleShape
)
+ )
) {}
}
}
\ No newline at end of file
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt
index dc621a7..05025d0 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt
@@ -17,11 +17,13 @@
package androidx.ui.integration.test.core.text
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.integration.test.RandomTextGenerator
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.preferredWidth
+import androidx.ui.layout.wrapContentSize
import androidx.ui.test.ComposeTestCase
import androidx.ui.text.TextStyle
import androidx.ui.unit.dp
@@ -49,7 +51,7 @@
override fun emitContent() {
Text(
text = text, style = TextStyle(color = Color.Black, fontSize = 8.sp),
- modifier = LayoutAlign.Center + LayoutWidth(160.dp)
+ modifier = Modifier.wrapContentSize(Alignment.Center).preferredWidth(160.dp)
)
}
}
\ No newline at end of file
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextMultiStyleTestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextMultiStyleTestCase.kt
index c193ca2..2593ecc 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextMultiStyleTestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/core/text/TextMultiStyleTestCase.kt
@@ -17,11 +17,13 @@
package androidx.ui.integration.test.core.text
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.integration.test.RandomTextGenerator
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.preferredWidth
+import androidx.ui.layout.wrapContentSize
import androidx.ui.test.ComposeTestCase
import androidx.ui.text.AnnotatedString
import androidx.ui.text.TextStyle
@@ -52,7 +54,7 @@
override fun emitContent() {
Text(
text = text, style = TextStyle(color = Color.Black, fontSize = 8.sp),
- modifier = LayoutAlign.Center + LayoutWidth(160.dp)
+ modifier = Modifier.wrapContentSize(Alignment.Center).preferredWidth(160.dp)
)
}
}
\ No newline at end of file
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt
index e32b362..2c6d0fd 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt
@@ -19,6 +19,7 @@
import androidx.compose.Composable
import androidx.compose.remember
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.HorizontalScroller
import androidx.ui.foundation.ScrollerPosition
@@ -27,10 +28,10 @@
import androidx.ui.graphics.Color
import androidx.ui.integration.test.ToggleableTestCase
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Surface
import androidx.ui.test.ComposeTestCase
@@ -69,10 +70,10 @@
fun SquareRow(useScrollerPosition: Boolean) {
val playStoreColor = Color(red = 0x00, green = 0x00, blue = 0x80)
val content = @Composable {
- Row(LayoutWidth.Fill) {
+ Row(Modifier.fillMaxWidth()) {
repeat(6) {
with(DensityAmbient.current) {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
val color = remember {
val red = Random.nextInt(256)
val green = Random.nextInt(256)
@@ -88,17 +89,17 @@
text = "Some title",
style = TextStyle(Color.Black, 60.px.toSp())
)
- Row(LayoutWidth.Fill) {
+ Row(Modifier.fillMaxWidth()) {
Text(
"3.5 ★",
style = TextStyle(fontSize = 40.px.toSp()),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
)
ColoredRect(
width = 40.px.toDp(),
height = 40.px.toDp(),
color = playStoreColor,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
)
}
}
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt
index afe0658..d47ac96 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt
@@ -18,6 +18,7 @@
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Canvas
import androidx.ui.foundation.ScrollerPosition
import androidx.ui.foundation.VerticalScroller
@@ -26,8 +27,8 @@
import androidx.ui.graphics.PaintingStyle
import androidx.ui.integration.test.ToggleableTestCase
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.preferredSize
import androidx.ui.test.ComposeTestCase
import androidx.ui.unit.dp
import androidx.ui.unit.toRect
@@ -44,7 +45,7 @@
VerticalScroller(
scrollerPosition = scrollerPosition
) {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
for (green in 0..0xFF) {
ColorStripe(0xFF, green, 0)
}
@@ -74,7 +75,7 @@
@Composable
fun ColorStripe(red: Int, green: Int, blue: Int) {
val paint = remember { Paint() }
- Canvas(LayoutSize(45.dp, 5.dp)) {
+ Canvas(Modifier.preferredSize(45.dp, 5.dp)) {
paint.color = Color(red = red, green = green, blue = blue)
paint.style = PaintingStyle.fill
drawRect(size.toRect(), paint)
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/framework/VectorAssetTestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/framework/VectorAssetTestCase.kt
index 17b2167..ef4c3a6 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/framework/VectorAssetTestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/framework/VectorAssetTestCase.kt
@@ -17,10 +17,10 @@
package androidx.ui.integration.test.framework
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
+import androidx.ui.core.paint
import androidx.ui.foundation.Box
-import androidx.ui.core.asModifier
-import androidx.ui.unit.dp
import androidx.ui.graphics.Color
import androidx.ui.graphics.SolidColor
import androidx.ui.graphics.StrokeCap
@@ -29,10 +29,11 @@
import androidx.ui.graphics.vector.VectorAsset
import androidx.ui.graphics.vector.VectorAssetBuilder
import androidx.ui.graphics.vector.VectorPainter
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.res.vectorResource
import androidx.ui.semantics.Semantics
import androidx.ui.test.ComposeTestCase
+import androidx.ui.unit.dp
/**
* Generic test case for drawing a [VectorAsset].
@@ -47,8 +48,7 @@
Box {
TestTag(testTag) {
Semantics(container = true) {
- val background = VectorPainter(getVectorAsset()).asModifier()
- Box(LayoutSize(24.dp) + background)
+ Box(Modifier.preferredSize(24.dp).paint(VectorPainter(getVectorAsset())))
}
}
}
diff --git a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt
index 3fed69a..02841f5 100644
--- a/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt
+++ b/ui/integration-tests/test/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt
@@ -19,12 +19,13 @@
import androidx.compose.Composable
import androidx.compose.MutableState
import androidx.compose.state
+import androidx.ui.core.Alignment
import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.integration.test.ToggleableTestCase
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAlign
import androidx.ui.layout.Row
+import androidx.ui.layout.wrapContentSize
import androidx.ui.material.Checkbox
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Surface
@@ -48,7 +49,9 @@
repeat(amountOfCheckboxes) {
Row {
Text(text = "Check Me!")
- CheckboxWithState(LayoutWeight(1f) + LayoutAlign.CenterEnd)
+ CheckboxWithState(
+ Modifier.weight(1f).wrapContentSize(Alignment.CenterEnd)
+ )
}
}
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
index 8deb139..a16c2f3 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
@@ -39,10 +39,10 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
import androidx.ui.text.TextStyle
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -56,10 +56,10 @@
Text(
"Drag to update AnimationClock",
style = TextStyle(fontSize = 20.sp),
- modifier = LayoutPadding(40.dp)
+ modifier = Modifier.padding(40.dp)
)
- Box(LayoutPadding(start = 10.dp, end = 10.dp, bottom = 30.dp)) {
+ Box(Modifier.padding(start = 10.dp, end = 10.dp, bottom = 30.dp)) {
MovingTargetExample(clock)
}
@@ -69,7 +69,7 @@
toState = "end"
) { state ->
val paint = remember { Paint() }
- Canvas(LayoutSize(600.dp, 400.dp)) {
+ Canvas(Modifier.preferredSize(600.dp, 400.dp)) {
val rect = Rect(
0f, 0f, size.width.value * 0.2f,
size.width.value * 0.2f
@@ -127,7 +127,7 @@
@Composable
fun DrawSeekBar(modifier: Modifier = Modifier.None, x: Float, clock: ManualAnimationClock) {
val paint = remember { Paint() }
- Canvas(modifier + LayoutWidth.Fill + LayoutHeight(60.dp)) {
+ Canvas(modifier.fillMaxWidth().preferredHeight(60.dp)) {
val centerY = size.height.value / 2
val xConstraint = x.coerceIn(0f, size.width.value)
clock.clockTimeMillis = (400 * (x / size.width.value)).toLong().coerceIn(0, 399)
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/CrossfadeDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/CrossfadeDemo.kt
index 1bb60e4..45c310b 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/CrossfadeDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/CrossfadeDemo.kt
@@ -21,13 +21,14 @@
import androidx.compose.remember
import androidx.compose.state
import androidx.ui.animation.Crossfade
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.TapGestureDetector
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredHeight
import androidx.ui.unit.dp
import kotlin.random.Random
@@ -37,20 +38,20 @@
Column {
Row {
tabs.forEach {
- val pressReleased =
+ Box(
TapGestureDetector(>
Log.e("Crossfade", "Switch to $it")
current = it
})
- Box(
- pressReleased + LayoutWeight(1f) + LayoutHeight(48.dp),
+ .weight(1f, true)
+ .preferredHeight(48.dp),
backgroundColor = it.color
)
}
}
Crossfade(current = current) { tab ->
tab.lastInt = remember { Random.nextInt() }
- Box(LayoutSize.Fill, backgroundColor = tab.color)
+ Box(Modifier.fillMaxSize(), backgroundColor = tab.color)
}
}
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
index e6d7ddb..ea556f8 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
@@ -25,6 +25,7 @@
import androidx.compose.remember
import androidx.compose.state
import androidx.ui.animation.animatedFloat
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.DragObserver
import androidx.ui.core.gesture.RawDragGestureDetector
import androidx.ui.foundation.Canvas
@@ -34,9 +35,9 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.text.TextStyle
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -49,7 +50,7 @@
Text(
"<== Scroll horizontally ==>",
style = TextStyle(fontSize = 20.sp),
- modifier = LayoutPadding(40.dp)
+ modifier = Modifier.padding(40.dp)
)
val animScroll = animatedFloat(0f)
val itemWidth = state { 0f }
@@ -77,7 +78,7 @@
}
})
val paint = remember { Paint() }
- Canvas(gesture + LayoutWidth.Fill + LayoutHeight(400.dp)) {
+ Canvas(gesture.fillMaxWidth().preferredHeight(400.dp)) {
val width = size.width.value / 2f
val scroll = animScroll.value + width / 2
itemWidth.value = width
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt
index be845dc..afe6136 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt
@@ -29,7 +29,7 @@
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
private const val halfSize = 200f
@@ -74,7 +74,7 @@
@Composable
private fun ScaledColorRect(modifier: Modifier = Modifier.None, scale: Float, color: Color) {
val paint = remember { Paint() }
- Canvas(modifier + LayoutSize.Fill) {
+ Canvas(modifier.fillMaxSize()) {
val centerX = size.width.value / 2
val centerY = size.height.value / 2
paint.color = color
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/MultiDimensionalAnimationDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/MultiDimensionalAnimationDemo.kt
index 0a3a693..722c7d8 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/MultiDimensionalAnimationDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/MultiDimensionalAnimationDemo.kt
@@ -23,12 +23,13 @@
import androidx.ui.animation.ColorPropKey
import androidx.ui.animation.RectPropKey
import androidx.ui.animation.Transition
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Canvas
import androidx.ui.foundation.Clickable
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
@Composable
fun MultiDimensionalAnimationDemo() {
@@ -51,7 +52,7 @@
toState = currentState.value
) { state ->
val paint = remember { Paint() }
- Canvas(modifier = LayoutSize.Fill) {
+ Canvas(modifier = Modifier.fillMaxSize()) {
width.value = size.width.value
height.value = size.height.value
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/RepeatedRotationDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/RepeatedRotationDemo.kt
index 5362e1d..a0c5c99 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/RepeatedRotationDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/RepeatedRotationDemo.kt
@@ -22,6 +22,8 @@
import androidx.compose.Composable
import androidx.compose.state
import androidx.ui.animation.Transition
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.TapGestureDetector
import androidx.ui.foundation.Canvas
import androidx.ui.foundation.Text
@@ -29,8 +31,9 @@
import androidx.ui.graphics.Paint
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.text.TextStyle
import androidx.ui.unit.dp
import androidx.ui.unit.sp
@@ -39,7 +42,11 @@
@Composable
fun RepeatedRotationDemo() {
val state = state { RotationStates.Original }
- Column(LayoutSize.Fill + LayoutAlign.Center, arrangement = Arrangement.SpaceEvenly) {
+ Column(
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center),
+ arrangement = Arrangement.SpaceEvenly
+ ) {
val textStyle = TextStyle(fontSize = 18.sp)
Text(
modifier = TapGestureDetector( state.value = RotationStates.Rotated }),
@@ -55,7 +62,7 @@
definition = definition,
toState = state.value
) { state ->
- Canvas(modifier = LayoutSize(100.dp)) {
+ Canvas(Modifier.preferredSize(100.dp)) {
// TODO (njawad) replace with save lambda when multi children DrawNodes are supported
save()
rotate(state[rotation])
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SingleValueAnimationDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SingleValueAnimationDemo.kt
index a973d74..e0b2e8e 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SingleValueAnimationDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SingleValueAnimationDemo.kt
@@ -19,16 +19,17 @@
import androidx.compose.Composable
import androidx.compose.state
import androidx.ui.animation.animate
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Clickable
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
@Composable
fun SingleValueAnimationDemo() {
val enabled = state { true }
Clickable({ enabled.value = !enabled.value }) {
val color = animate(if (enabled.value) Color.Green else Color.Red)
- Box(LayoutSize.Fill, backgroundColor = color)
+ Box(Modifier.fillMaxSize(), backgroundColor = color)
}
}
\ No newline at end of file
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
index ee42dfa..5b2fda5 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
@@ -24,6 +24,7 @@
import androidx.compose.remember
import androidx.compose.state
import androidx.ui.animation.animatedFloat
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.DragObserver
import androidx.ui.core.gesture.RawDragGestureDetector
import androidx.ui.foundation.Canvas
@@ -33,9 +34,10 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.text.TextStyle
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -44,15 +46,15 @@
@Composable
fun SpringBackScrollingDemo() {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
Text(
"<== Scroll horizontally ==>",
style = TextStyle(fontSize = 20.sp),
- modifier = LayoutPadding(40.dp)
+ modifier = Modifier.padding(40.dp)
)
val animScroll = animatedFloat(0f)
val itemWidth = state { 0f }
- var isFlinging = state { false }
+ val isFlinging = state { false }
val gesture = RawDragGestureDetector(dragObserver = object : DragObserver {
override fun onDrag(dragDistance: PxPosition): PxPosition {
animScroll.snapTo(animScroll.targetValue + dragDistance.x.value)
@@ -67,7 +69,7 @@
}
})
val paint = remember { Paint() }
- Canvas(gesture + LayoutWidth.Fill + LayoutHeight(400.dp)) {
+ Canvas(gesture.fillMaxWidth().preferredHeight(400.dp)) {
itemWidth.value = size.width.value / 2f
if (isFlinging.value) {
// Figure out what position to spring back to
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateAnimationWithInterruptionsDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateAnimationWithInterruptionsDemo.kt
index 65ed134..380a227 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateAnimationWithInterruptionsDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateAnimationWithInterruptionsDemo.kt
@@ -25,17 +25,18 @@
import androidx.compose.Recompose
import androidx.ui.animation.ColorPropKey
import androidx.ui.animation.Transition
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Canvas
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.foundation.drawBackground
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
@Composable
fun StateAnimationWithInterruptionsDemo() {
- Box(LayoutSize.Fill) {
+ Box(Modifier.fillMaxSize()) {
ColorRect()
}
}
@@ -95,7 +96,7 @@
private fun ColorRectState(state: TransitionState) {
val color = state[background]
val scaleY = state[y]
- Canvas(LayoutSize.Fill + DrawBackground(color = color)) {
+ Canvas(Modifier.fillMaxSize().drawBackground(color = color)) {
val paint = Paint().apply {
this.color = Color(alpha = 255, red = 255, green = 255, blue = 255)
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
index 42ee22c..ab7baee 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
@@ -34,13 +34,13 @@
import androidx.ui.geometry.Offset
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@Composable
fun StateBasedRippleDemo() {
- Box(LayoutSize.Fill) {
+ Box(Modifier.fillMaxSize()) {
RippleRect()
}
}
@@ -69,7 +69,7 @@
@Composable
private fun RippleRectFromState(modifier: Modifier = Modifier.None, state: TransitionState) {
- Canvas(modifier + LayoutSize.Fill) {
+ Canvas(modifier.fillMaxSize()) {
// TODO: file bug for when "down" is not a file level val, it's not memoized correctly
val x = down.x
val y = down.y
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
index 7178294..643cad9 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
@@ -27,6 +27,7 @@
import androidx.compose.state
import androidx.ui.animation.animatedFloat
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.DragObserver
import androidx.ui.core.gesture.RawDragGestureDetector
import androidx.ui.core.onPositioned
@@ -37,9 +38,9 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.text.TextStyle
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -53,7 +54,7 @@
Text(
"Swipe up to dismiss",
style = TextStyle(fontSize = 30.sp),
- modifier = LayoutPadding(40.dp)
+ modifier = Modifier.padding(40.dp)
)
}
}
@@ -96,7 +97,7 @@
null
} else {
val animation = PhysicsBuilder<Float>(dampingRatio = 0.8f, stiffness = 300f)
- var projectedTarget = target + sign(velocity) * 0.2f * height
+ val projectedTarget = target + sign(velocity) * 0.2f * height
if (projectedTarget < 0.6 * height) {
TargetAnimation(0f, animation)
} else {
@@ -123,10 +124,13 @@
val heightDp = with(DensityAmbient.current) { height.toDp() }
val paint = remember { Paint() }
- Canvas(modifier + LayoutWidth.Fill + LayoutHeight(heightDp) +
- onPositioned { coordinates ->
+ Canvas(
+ modifier.fillMaxWidth()
+ .preferredHeight(heightDp)
+ .onPositioned { coordinates ->
itemWidth.value = coordinates.size.width.value * 2 / 3f
- }) {
+ }
+ ) {
val progress = 1 - itemBottom.value / height
// TODO: this progress can be used to drive state transitions
val alpha = 1f - FastOutSlowInEasing(progress)
diff --git a/ui/ui-animation/samples/src/main/java/androidx/ui/animation/samples/AnimatedValueSamples.kt b/ui/ui-animation/samples/src/main/java/androidx/ui/animation/samples/AnimatedValueSamples.kt
index 6b66eab..f892374 100644
--- a/ui/ui-animation/samples/src/main/java/androidx/ui/animation/samples/AnimatedValueSamples.kt
+++ b/ui/ui-animation/samples/src/main/java/androidx/ui/animation/samples/AnimatedValueSamples.kt
@@ -22,6 +22,7 @@
import androidx.compose.Composable
import androidx.compose.remember
import androidx.ui.animation.animate
+import androidx.ui.core.Modifier
import androidx.ui.core.drawOpacity
import androidx.ui.foundation.Box
import androidx.ui.foundation.ColoredRect
@@ -29,7 +30,7 @@
import androidx.ui.foundation.Text
import androidx.ui.foundation.currentTextStyle
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import androidx.ui.unit.Dp
import androidx.ui.unit.dp
@@ -41,16 +42,16 @@
@Sampled
@Composable
fun VisibilityTransition(visibility: VisibilityState) {
- Box(LayoutSize.Fill, gravity = ContentGravity.Center) {
+ Box(Modifier.fillMaxSize(), gravity = ContentGravity.Center) {
val opacity = animate(if (visibility == VisibilityState.Invisible) 0f else 1f)
- Text("Visibility Transition", modifier = drawOpacity(opacity))
+ Text("Visibility Transition", modifier = Modifier.drawOpacity(opacity))
}
}
@Sampled
@Composable
fun ColorTransition(enabled: Boolean) {
- Box(LayoutSize.Fill, gravity = ContentGravity.Center) {
+ Box(Modifier.fillMaxSize(), gravity = ContentGravity.Center) {
val textColor = animate(if (enabled) Color.Black else Color.Gray)
Text("Visibility Transition", style = currentTextStyle().copy(color = textColor))
}
diff --git a/ui/ui-animation/src/main/java/androidx/ui/animation/Crossfade.kt b/ui/ui-animation/src/main/java/androidx/ui/animation/Crossfade.kt
index 1699d78..fa97385 100644
--- a/ui/ui-animation/src/main/java/androidx/ui/animation/Crossfade.kt
+++ b/ui/ui-animation/src/main/java/androidx/ui/animation/Crossfade.kt
@@ -24,6 +24,7 @@
import androidx.compose.key
import androidx.compose.onCommit
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.core.drawOpacity
import androidx.ui.layout.Stack
@@ -58,7 +59,7 @@
}
}
)
- Stack(modifier = drawOpacity(opacity.value)) {
+ Stack(Modifier.drawOpacity(opacity.value)) {
children()
}
}
diff --git a/ui/ui-core/api/0.1.0-dev08.txt b/ui/ui-core/api/0.1.0-dev08.txt
index ff490d6e..9d7e189 100644
--- a/ui/ui-core/api/0.1.0-dev08.txt
+++ b/ui/ui-core/api/0.1.0-dev08.txt
@@ -145,7 +145,8 @@
public final class DrawLayerModifierKt {
method public static inline androidx.ui.core.TransformOrigin TransformOrigin(float pivotFractionX, float pivotFractionY);
- method public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method @Deprecated public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method public static androidx.ui.core.Modifier drawLayer(androidx.ui.core.Modifier, float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
}
public interface DrawModifier extends androidx.ui.core.Modifier.Element {
@@ -153,7 +154,8 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method @Deprecated public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method public static androidx.ui.core.Modifier drawBehind(androidx.ui.core.Modifier, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
method public static androidx.ui.core.DrawModifier drawWithContent(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
}
@@ -244,7 +246,14 @@
method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
method public default operator androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public default infix androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ field public static final androidx.ui.core.Modifier.Companion! Companion;
+ }
+
+ public static final class Modifier.Companion implements androidx.ui.core.Modifier {
+ method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
+ method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
+ method public androidx.ui.core.Modifier getNone();
+ property public final androidx.ui.core.Modifier None;
}
public static interface Modifier.Element extends androidx.ui.core.Modifier {
@@ -252,25 +261,19 @@
method public default <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
}
- public static final class Modifier.None implements androidx.ui.core.Modifier {
- method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
- method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
- field public static final androidx.ui.core.Modifier.None! INSTANCE;
- }
-
public interface OnChildPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnChildPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned;
+ method public void onChildPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public interface OnPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned;
+ method public void onPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public final class OnPositionedModifierKt {
- method public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
- method public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method public static androidx.ui.core.Modifier onChildPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method public static androidx.ui.core.Modifier onPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
diff --git a/ui/ui-core/api/current.txt b/ui/ui-core/api/current.txt
index ff490d6e..9d7e189 100644
--- a/ui/ui-core/api/current.txt
+++ b/ui/ui-core/api/current.txt
@@ -145,7 +145,8 @@
public final class DrawLayerModifierKt {
method public static inline androidx.ui.core.TransformOrigin TransformOrigin(float pivotFractionX, float pivotFractionY);
- method public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method @Deprecated public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method public static androidx.ui.core.Modifier drawLayer(androidx.ui.core.Modifier, float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
}
public interface DrawModifier extends androidx.ui.core.Modifier.Element {
@@ -153,7 +154,8 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method @Deprecated public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method public static androidx.ui.core.Modifier drawBehind(androidx.ui.core.Modifier, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
method public static androidx.ui.core.DrawModifier drawWithContent(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
}
@@ -244,7 +246,14 @@
method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
method public default operator androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public default infix androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ field public static final androidx.ui.core.Modifier.Companion! Companion;
+ }
+
+ public static final class Modifier.Companion implements androidx.ui.core.Modifier {
+ method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
+ method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
+ method public androidx.ui.core.Modifier getNone();
+ property public final androidx.ui.core.Modifier None;
}
public static interface Modifier.Element extends androidx.ui.core.Modifier {
@@ -252,25 +261,19 @@
method public default <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
}
- public static final class Modifier.None implements androidx.ui.core.Modifier {
- method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
- method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
- field public static final androidx.ui.core.Modifier.None! INSTANCE;
- }
-
public interface OnChildPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnChildPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned;
+ method public void onChildPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public interface OnPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned;
+ method public void onPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public final class OnPositionedModifierKt {
- method public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
- method public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method public static androidx.ui.core.Modifier onChildPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method public static androidx.ui.core.Modifier onPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
diff --git a/ui/ui-core/api/public_plus_experimental_0.1.0-dev08.txt b/ui/ui-core/api/public_plus_experimental_0.1.0-dev08.txt
index ff490d6e..9d7e189 100644
--- a/ui/ui-core/api/public_plus_experimental_0.1.0-dev08.txt
+++ b/ui/ui-core/api/public_plus_experimental_0.1.0-dev08.txt
@@ -145,7 +145,8 @@
public final class DrawLayerModifierKt {
method public static inline androidx.ui.core.TransformOrigin TransformOrigin(float pivotFractionX, float pivotFractionY);
- method public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method @Deprecated public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method public static androidx.ui.core.Modifier drawLayer(androidx.ui.core.Modifier, float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
}
public interface DrawModifier extends androidx.ui.core.Modifier.Element {
@@ -153,7 +154,8 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method @Deprecated public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method public static androidx.ui.core.Modifier drawBehind(androidx.ui.core.Modifier, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
method public static androidx.ui.core.DrawModifier drawWithContent(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
}
@@ -244,7 +246,14 @@
method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
method public default operator androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public default infix androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ field public static final androidx.ui.core.Modifier.Companion! Companion;
+ }
+
+ public static final class Modifier.Companion implements androidx.ui.core.Modifier {
+ method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
+ method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
+ method public androidx.ui.core.Modifier getNone();
+ property public final androidx.ui.core.Modifier None;
}
public static interface Modifier.Element extends androidx.ui.core.Modifier {
@@ -252,25 +261,19 @@
method public default <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
}
- public static final class Modifier.None implements androidx.ui.core.Modifier {
- method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
- method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
- field public static final androidx.ui.core.Modifier.None! INSTANCE;
- }
-
public interface OnChildPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnChildPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned;
+ method public void onChildPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public interface OnPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned;
+ method public void onPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public final class OnPositionedModifierKt {
- method public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
- method public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method public static androidx.ui.core.Modifier onChildPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method public static androidx.ui.core.Modifier onPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
diff --git a/ui/ui-core/api/public_plus_experimental_current.txt b/ui/ui-core/api/public_plus_experimental_current.txt
index ff490d6e..9d7e189 100644
--- a/ui/ui-core/api/public_plus_experimental_current.txt
+++ b/ui/ui-core/api/public_plus_experimental_current.txt
@@ -145,7 +145,8 @@
public final class DrawLayerModifierKt {
method public static inline androidx.ui.core.TransformOrigin TransformOrigin(float pivotFractionX, float pivotFractionY);
- method public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method @Deprecated public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method public static androidx.ui.core.Modifier drawLayer(androidx.ui.core.Modifier, float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
}
public interface DrawModifier extends androidx.ui.core.Modifier.Element {
@@ -153,7 +154,8 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method @Deprecated public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method public static androidx.ui.core.Modifier drawBehind(androidx.ui.core.Modifier, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
method public static androidx.ui.core.DrawModifier drawWithContent(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
}
@@ -244,7 +246,14 @@
method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
method public default operator androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public default infix androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ field public static final androidx.ui.core.Modifier.Companion! Companion;
+ }
+
+ public static final class Modifier.Companion implements androidx.ui.core.Modifier {
+ method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
+ method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
+ method public androidx.ui.core.Modifier getNone();
+ property public final androidx.ui.core.Modifier None;
}
public static interface Modifier.Element extends androidx.ui.core.Modifier {
@@ -252,25 +261,19 @@
method public default <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
}
- public static final class Modifier.None implements androidx.ui.core.Modifier {
- method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
- method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
- field public static final androidx.ui.core.Modifier.None! INSTANCE;
- }
-
public interface OnChildPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnChildPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned;
+ method public void onChildPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public interface OnPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned;
+ method public void onPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public final class OnPositionedModifierKt {
- method public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
- method public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method public static androidx.ui.core.Modifier onChildPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method public static androidx.ui.core.Modifier onPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
diff --git a/ui/ui-core/api/restricted_0.1.0-dev08.txt b/ui/ui-core/api/restricted_0.1.0-dev08.txt
index ff490d6e..9d7e189 100644
--- a/ui/ui-core/api/restricted_0.1.0-dev08.txt
+++ b/ui/ui-core/api/restricted_0.1.0-dev08.txt
@@ -145,7 +145,8 @@
public final class DrawLayerModifierKt {
method public static inline androidx.ui.core.TransformOrigin TransformOrigin(float pivotFractionX, float pivotFractionY);
- method public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method @Deprecated public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method public static androidx.ui.core.Modifier drawLayer(androidx.ui.core.Modifier, float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
}
public interface DrawModifier extends androidx.ui.core.Modifier.Element {
@@ -153,7 +154,8 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method @Deprecated public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method public static androidx.ui.core.Modifier drawBehind(androidx.ui.core.Modifier, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
method public static androidx.ui.core.DrawModifier drawWithContent(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
}
@@ -244,7 +246,14 @@
method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
method public default operator androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public default infix androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ field public static final androidx.ui.core.Modifier.Companion! Companion;
+ }
+
+ public static final class Modifier.Companion implements androidx.ui.core.Modifier {
+ method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
+ method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
+ method public androidx.ui.core.Modifier getNone();
+ property public final androidx.ui.core.Modifier None;
}
public static interface Modifier.Element extends androidx.ui.core.Modifier {
@@ -252,25 +261,19 @@
method public default <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
}
- public static final class Modifier.None implements androidx.ui.core.Modifier {
- method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
- method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
- field public static final androidx.ui.core.Modifier.None! INSTANCE;
- }
-
public interface OnChildPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnChildPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned;
+ method public void onChildPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public interface OnPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned;
+ method public void onPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public final class OnPositionedModifierKt {
- method public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
- method public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method public static androidx.ui.core.Modifier onChildPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method public static androidx.ui.core.Modifier onPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
diff --git a/ui/ui-core/api/restricted_current.txt b/ui/ui-core/api/restricted_current.txt
index ff490d6e..9d7e189 100644
--- a/ui/ui-core/api/restricted_current.txt
+++ b/ui/ui-core/api/restricted_current.txt
@@ -145,7 +145,8 @@
public final class DrawLayerModifierKt {
method public static inline androidx.ui.core.TransformOrigin TransformOrigin(float pivotFractionX, float pivotFractionY);
- method public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method @Deprecated public static androidx.ui.core.Modifier drawLayer(float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
+ method public static androidx.ui.core.Modifier drawLayer(androidx.ui.core.Modifier, float scaleX = 1f, float scaleY = 1f, float alpha = 1f, float translationX = 0f, float translationY = 0f, float elevation = 0f, float rotationX = 0f, float rotationY = 0f, float rotationZ = 0f, androidx.ui.core.TransformOrigin transformOrigin = TransformOrigin.Center, androidx.ui.graphics.Shape? outlineShape = null, boolean clipToBounds = true, boolean clipToOutline = true);
}
public interface DrawModifier extends androidx.ui.core.Modifier.Element {
@@ -153,7 +154,8 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method @Deprecated public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ method public static androidx.ui.core.Modifier drawBehind(androidx.ui.core.Modifier, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
method public static androidx.ui.core.DrawModifier drawWithContent(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
}
@@ -244,7 +246,14 @@
method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
method public default operator androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public default infix androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ field public static final androidx.ui.core.Modifier.Companion! Companion;
+ }
+
+ public static final class Modifier.Companion implements androidx.ui.core.Modifier {
+ method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
+ method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
+ method public androidx.ui.core.Modifier getNone();
+ property public final androidx.ui.core.Modifier None;
}
public static interface Modifier.Element extends androidx.ui.core.Modifier {
@@ -252,25 +261,19 @@
method public default <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
}
- public static final class Modifier.None implements androidx.ui.core.Modifier {
- method public <R> R! foldIn(R? initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
- method public <R> R! foldOut(R? initial, kotlin.jvm.functions.Function2<? super androidx.ui.core.Modifier.Element,? super R,? extends R> operation);
- field public static final androidx.ui.core.Modifier.None! INSTANCE;
- }
-
public interface OnChildPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnChildPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned;
+ method public void onChildPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public interface OnPositionedModifier extends androidx.ui.core.Modifier.Element {
- method public kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> getOnPositioned();
- property public abstract kotlin.jvm.functions.Function1<androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned;
+ method public void onPositioned(androidx.ui.core.LayoutCoordinates coordinates);
}
public final class OnPositionedModifierKt {
- method public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
- method public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method public static androidx.ui.core.Modifier onChildPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onChildPositioned);
+ method public static androidx.ui.core.Modifier onPositioned(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
+ method @Deprecated public static androidx.ui.core.Modifier onPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned);
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
diff --git a/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/LayerModifierSamples.kt b/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/LayerModifierSamples.kt
index f839221..e394963 100644
--- a/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/LayerModifierSamples.kt
+++ b/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/LayerModifierSamples.kt
@@ -21,13 +21,14 @@
import androidx.compose.onCommit
import androidx.ui.animation.animatedFloat
import androidx.ui.core.DrawLayerModifier
+import androidx.ui.core.Modifier
import androidx.ui.core.drawLayer
import androidx.ui.foundation.Text
@Sampled
@Composable
fun ChangeOpacity() {
- Text("Hello World", drawLayer(alpha = 0.5f))
+ Text("Hello World", Modifier.drawLayer(alpha = 0.5f))
}
@Sampled
diff --git a/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/ModifierSamples.kt b/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/ModifierSamples.kt
index 627213b..a11340c 100644
--- a/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/ModifierSamples.kt
+++ b/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/ModifierSamples.kt
@@ -22,18 +22,43 @@
import androidx.compose.Composable
import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
+import androidx.ui.foundation.drawBackground
+import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
import androidx.ui.layout.Row
+import androidx.ui.layout.padding
import androidx.ui.material.Button
import androidx.ui.unit.dp
@Sampled
@Composable
+fun ModifierUsageSample() {
+ Text(
+ "Hello, World!",
+ Modifier.padding(16.dp) // Outer padding; outside background
+ .drawBackground(Color.Green) // Solid element background color
+ .padding(16.dp) // Inner padding; inside background, around text
+ )
+}
+
+@Sampled
+@Composable
+fun ModifierFactorySample() {
+ class FancyModifier(val level: Float) : Modifier.Element
+
+ fun Modifier.fancy(level: Float) = this + FancyModifier(level)
+
+ Row(Modifier.fancy(1f).padding(10.dp)) {
+ // content
+ }
+}
+
+@Sampled
+@Composable
fun ModifierParameterSample() {
@Composable
fun PaddedColumn(modifier: Modifier = Modifier.None) {
- Column(modifier + LayoutPadding(10.dp)) {
+ Column(modifier.padding(10.dp)) {
// ...
}
}
@@ -59,5 +84,3 @@
}
}
}
-
-private val defaultFooModifier = Modifier.None
diff --git a/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/OnPositionedSamples.kt b/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/OnPositionedSamples.kt
index 3032ef3..d8571f1 100644
--- a/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/OnPositionedSamples.kt
+++ b/ui/ui-core/samples/src/main/java/androidx/ui/core/samples/OnPositionedSamples.kt
@@ -18,6 +18,7 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.core.globalPosition
import androidx.ui.core.onChildPositioned
import androidx.ui.core.onPositioned
@@ -25,13 +26,13 @@
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@Composable
fun OnPositionedSample() {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates ->
// This will be the size of the Column.
coordinates.size
// The position of the Column relative to the application window.
@@ -43,15 +44,15 @@
// This will a LayoutCoordinates instance corresponding to the parent of Column.
coordinates.parentCoordinates
}) {
- Box(LayoutSize(20.dp), backgroundColor = Color.Green)
- Box(LayoutSize(20.dp), backgroundColor = Color.Blue)
+ Box(Modifier.preferredSize(20.dp), backgroundColor = Color.Green)
+ Box(Modifier.preferredSize(20.dp), backgroundColor = Color.Blue)
}
}
@Sampled
@Composable
fun OnChildPositionedSample() {
- Column(onChildPositioned { coordinates ->
+ Column(Modifier.onChildPositioned { coordinates ->
// This will be the size of the child SizedRectangle.
coordinates.size
// The position of the SizedRectangle relative to the application window.
@@ -63,6 +64,6 @@
// This will a LayoutCoordinates instance corresponding to the Column.
coordinates.parentCoordinates
}) {
- Box(LayoutSize(20.dp), backgroundColor = Color.Green)
+ Box(Modifier.preferredSize(20.dp), backgroundColor = Color.Green)
}
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/DrawLayerModifier.kt b/ui/ui-core/src/main/java/androidx/ui/core/DrawLayerModifier.kt
index afd89a0..cdc43aa 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/DrawLayerModifier.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/DrawLayerModifier.kt
@@ -194,6 +194,15 @@
* @param clipToBounds [DrawLayerModifier.clipToBounds]
* @param clipToOutline [DrawLayerModifier.clipToOutline]
*/
+@Deprecated(
+ "Use Modifier.drawLayer",
+ replaceWith = ReplaceWith(
+ "Modifier.drawLayer(scaleX, scaleY, alpha, elevation, rotationX, rotationY, rotationZ, " +
+ "transformOrigin, outlineShape, clipToBounds, clipToOutline)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.drawLayer"
+ )
+)
fun drawLayer(
scaleX: Float = 1f,
scaleY: Float = 1f,
@@ -222,4 +231,50 @@
outlineShape = outlineShape,
clipToBounds = clipToBounds,
clipToOutline = clipToOutline
+)
+
+/**
+ * Draw the content into a layer. This permits applying special effects and transformations:
+ *
+ * @sample androidx.ui.core.samples.ChangeOpacity
+ *
+ * @param scaleX [DrawLayerModifier.scaleX]
+ * @param scaleY [DrawLayerModifier.scaleY]
+ * @param alpha [DrawLayerModifier.alpha]
+ * @param elevation [DrawLayerModifier.elevation]
+ * @param rotationX [DrawLayerModifier.rotationX]
+ * @param rotationY [DrawLayerModifier.rotationY]
+ * @param rotationZ [DrawLayerModifier.rotationZ]
+ * @param outlineShape [DrawLayerModifier.outlineShape]
+ * @param clipToBounds [DrawLayerModifier.clipToBounds]
+ * @param clipToOutline [DrawLayerModifier.clipToOutline]
+ */
+fun Modifier.drawLayer(
+ scaleX: Float = 1f,
+ scaleY: Float = 1f,
+ alpha: Float = 1f,
+ translationX: Float = 0f,
+ translationY: Float = 0f,
+ elevation: Float = 0f,
+ rotationX: Float = 0f,
+ rotationY: Float = 0f,
+ rotationZ: Float = 0f,
+ transformOrigin: TransformOrigin = TransformOrigin.Center,
+ outlineShape: Shape? = null,
+ clipToBounds: Boolean = true,
+ clipToOutline: Boolean = true
+) = this + SimpleDrawLayerModifier(
+ scaleX = scaleX,
+ scaleY = scaleY,
+ alpha = alpha,
+ translationX = translationX,
+ translationY = translationY,
+ elevation = elevation,
+ rotationX = rotationX,
+ rotationY = rotationY,
+ rotationZ = rotationZ,
+ transformOrigin = transformOrigin,
+ outlineShape = outlineShape,
+ clipToBounds = clipToBounds,
+ clipToOutline = clipToOutline
)
\ No newline at end of file
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/DrawModifier.kt b/ui/ui-core/src/main/java/androidx/ui/core/DrawModifier.kt
index f3b5445..7f37e21 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/DrawModifier.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/DrawModifier.kt
@@ -33,14 +33,30 @@
}
/**
+ * Draw into a [Canvas] behind the modified content.
+ */
+fun Modifier.drawBehind(
+ onDraw: Density.(canvas: Canvas, size: PxSize) -> Unit
+) = this + DrawBackgroundModifier(onDraw)
+
+/**
* Creates a [DrawModifier] that calls [onDraw] before the contents of the layout.
*/
+@Deprecated(
+ "Replaced by Modifier.drawBehind",
+ replaceWith = ReplaceWith(
+ "Modifier.drawBehind(onDraw)",
+ "androidx.ui.core.drawBehind",
+ "androidx.ui.core.Modifier"
+ )
+)
fun draw(
onDraw: Density.(canvas: Canvas, size: PxSize) -> Unit
-): DrawModifier = object : DrawModifier, Density {
- private var _density: Density? = null
- override val density: Float get() = _density!!.density
- override val fontScale: Float get() = _density!!.fontScale
+): DrawModifier = DrawBackgroundModifier(onDraw)
+
+private class DrawBackgroundModifier(
+ val onDraw: Density.(canvas: Canvas, size: PxSize) -> Unit
+) : DrawModifier {
override fun draw(
density: Density,
@@ -48,11 +64,9 @@
canvas: Canvas,
size: PxSize
) {
- _density = density
try {
- this.onDraw(canvas, size)
+ density.onDraw(canvas, size)
} finally {
- _density = null
drawContent()
}
}
@@ -64,6 +78,7 @@
*/
// TODO(mount): DrawReceiver should accept a Canvas for drawChildren()
// TODO(mount): drawChildren() should be drawContent()
+// TODO Current implementation is not thread-safe
fun drawWithContent(
onDraw: DrawReceiver.(canvas: Canvas, size: PxSize) -> Unit
): DrawModifier = object : DrawModifier, DrawReceiver {
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/Modifier.kt b/ui/ui-core/src/main/java/androidx/ui/core/Modifier.kt
index 3671ecf..4aa04b8 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/Modifier.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/Modifier.kt
@@ -19,24 +19,28 @@
import androidx.compose.Stable
/**
- * An immutable chain of [modifier elements][Modifier.Element] for use with Composables.
- * A Composable that has a `Modifier` can be considered decorated or wrapped by that `Modifier`.
+ * An ordered, immutable collection of [modifier elements][Modifier.Element] that decorate or add
+ * behavior to Compose UI elements. For example, backgrounds, padding and click event listeners
+ * decorate or add behavior to rows, text or buttons.
*
- * Modifiers may be compared for equality provided that all of their [elements][Element] are
- * `object`s, `data class`es or otherwise implement [equals][Any.equals]. A correct implementation
- * of an [Element] must meet this requirement.
+ * @sample androidx.ui.core.samples.ModifierUsageSample
*
- * Modifier elements may be combined using `+` Order is significant; modifier elements to the left
- * are applied before modifier elements to the right.
+ * Modifier implementations should offer a fluent factory extension function on [Modifier] for
+ * creating combined modifiers by starting from existing modifiers:
+ *
+ * @sample androidx.ui.core.samples.ModifierFactorySample
+ *
+ * Modifier elements may be combined using [the + operator][plus]. Order is significant; modifier
+ * elements that appear first will be applied first.
*
* Composables that accept a [Modifier] as a parameter to be applied to the whole component
* represented by the composable function should name the parameter `modifier` and
* assign the parameter a default value of [Modifier.None]. It should appear as the first
* optional parameter in the parameter list; after all required parameters (except for trailing
* lambda parameters) but before any other parameters with default values. Any default modifiers
- * desired by a composable function should be concatenated to the right or left of the `modifier`
- * parameter's value in the composable function's implementation, keeping [Modifier.None] as the
- * default parameter value. For example:
+ * desired by a composable function should come after the `modifier` parameter's value in the
+ * composable function's implementation, keeping [Modifier.None] as the default parameter value.
+ * For example:
*
* @sample androidx.ui.core.samples.ModifierParameterSample
*
@@ -76,32 +80,14 @@
fun <R> foldOut(initial: R, operation: (Element, R) -> R): R
/**
- * Wraps another [Modifier] with this one, returning the new chain.
- */
- @Deprecated(
- "use + instead",
- replaceWith = ReplaceWith("this + other")
- )
- infix fun wraps(other: Modifier): Modifier = this + other
-
- /**
* Concatenates this modifier with another.
*
* Returns a [Modifier] representing this modifier followed by [other] in sequence.
*/
operator fun plus(other: Modifier): Modifier =
- if (other === None) this else foldOut(other, ::CombinedModifier)
-
- /**
- * An empty [Modifier] that contains no [elements][Element].
- * Suitable for use as a sentinel or default parameter.
- */
- object None : Modifier {
- override fun <R> foldIn(initial: R, operation: (R, Element) -> R): R = initial
- override fun <R> foldOut(initial: R, operation: (Element, R) -> R): R = initial
- override operator fun plus(other: Modifier): Modifier = other
- override fun toString() = "Modifier.None"
- }
+ if (other === None) this else foldOut(other) { element, wrapped ->
+ CombinedModifier(element, wrapped)
+ }
/**
* A single element contained within a [Modifier] chain.
@@ -113,6 +99,21 @@
override fun <R> foldOut(initial: R, operation: (Element, R) -> R): R =
operation(this, initial)
}
+
+ // The companion object implements `Modifier` so that it may be used as the start of a
+ // modifier extension factory expression.
+ companion object : Modifier {
+ override fun <R> foldIn(initial: R, operation: (R, Element) -> R): R = initial
+ override fun <R> foldOut(initial: R, operation: (Element, R) -> R): R = initial
+ override operator fun plus(other: Modifier): Modifier = other
+ override fun toString() = "Modifier.None"
+
+ /**
+ * An empty [Modifier] that contains no [elements][Element].
+ * Suitable for use as a sentinel or default parameter.
+ */
+ val None: Modifier get() = this
+ }
}
/**
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/OnPositionedModifier.kt b/ui/ui-core/src/main/java/androidx/ui/core/OnPositionedModifier.kt
index e7030ab..665758f 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/OnPositionedModifier.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/OnPositionedModifier.kt
@@ -17,6 +17,39 @@
package androidx.ui.core
/**
+ * Invoke [onPositioned] with the [LayoutCoordinates] of the element after positioning.
+ * Note that it will be called **after** a composition when the coordinates are finalized.
+ *
+ * Usage example:
+ * @sample androidx.ui.core.samples.OnPositionedSample
+ */
+// TODO inline me!
+fun Modifier.onPositioned(
+ onPositioned: (LayoutCoordinates) -> Unit
+) = this + object : OnPositionedModifier {
+ override fun onPositioned(coordinates: LayoutCoordinates) {
+ onPositioned(coordinates)
+ }
+}
+
+/**
+ * Invoke [onChildPositioned] with the [LayoutCoordinates] of each child element after each one
+ * is positioned.
+ * Note that it will be called **after** a composition when the coordinates are finalized.
+ *
+ * Usage example:
+ * @sample androidx.ui.core.samples.OnChildPositionedSample
+ */
+// TODO inline me!
+fun Modifier.onChildPositioned(
+ onChildPositioned: (LayoutCoordinates) -> Unit
+) = this + object : OnChildPositionedModifier {
+ override fun onChildPositioned(coordinates: LayoutCoordinates) {
+ onChildPositioned(coordinates)
+ }
+}
+
+/**
* A modifier whose [onPositioned] is called with the final LayoutCoordinates of the Layout
* after measuring.
* Note that it will be called after a composition when the coordinates are finalized.
@@ -31,7 +64,7 @@
* The position in the modifier chain makes no difference in either
* the [LayoutCoordinates] argument or when the [onPositioned] is called.
*/
- val onPositioned: (LayoutCoordinates) -> Unit
+ fun onPositioned(coordinates: LayoutCoordinates)
}
/**
@@ -50,7 +83,7 @@
* the [LayoutCoordinates] argument or when the [onChildPositioned] is called.
* The [onChildPositioned] will be called for each positioned child Layout.
*/
- val onChildPositioned: (LayoutCoordinates) -> Unit
+ fun onChildPositioned(coordinates: LayoutCoordinates)
}
/**
@@ -61,8 +94,16 @@
* Usage example:
* @sample androidx.ui.core.samples.OnPositionedSample
*/
+@Deprecated(
+ "use Modifier.onPositioned",
+ replaceWith = ReplaceWith(
+ "Modifier.onPositioned(onPositioned)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.onPositioned"
+ )
+)
fun onPositioned(onPositioned: (LayoutCoordinates) -> Unit): Modifier =
- SimpleOnPositionedModifier(onPositioned)
+ Modifier.onPositioned(onPositioned)
/**
* Returns a modifier whose [onChildPositioned] is called with the final LayoutCoordinates of the
@@ -72,13 +113,13 @@
* Usage example:
* @sample androidx.ui.core.samples.OnChildPositionedSample
*/
+@Deprecated(
+ "use Modifier.onChildPositioned",
+ replaceWith = ReplaceWith(
+ "Modifier.onChildPositioned(onChildPositioned)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.onChildPositioned"
+ )
+)
fun onChildPositioned(onChildPositioned: (LayoutCoordinates) -> Unit): Modifier =
- SimpleOnChildPositionedModifier(onChildPositioned)
-
-private data class SimpleOnPositionedModifier(
- override val onPositioned: (LayoutCoordinates) -> Unit
-) : OnPositionedModifier
-
-private data class SimpleOnChildPositionedModifier(
- override val onChildPositioned: (LayoutCoordinates) -> Unit
-) : OnChildPositionedModifier
\ No newline at end of file
+ Modifier.onChildPositioned(onChildPositioned)
diff --git a/ui/ui-foundation/api/0.1.0-dev08.txt b/ui/ui-foundation/api/0.1.0-dev08.txt
index 49e9270..c8bb322 100644
--- a/ui/ui-foundation/api/0.1.0-dev08.txt
+++ b/ui/ui-foundation/api/0.1.0-dev08.txt
@@ -70,8 +70,11 @@
}
public final class DrawBackgroundKt {
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Paint paint, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
}
public final class DrawBorder implements androidx.ui.core.DrawModifier {
diff --git a/ui/ui-foundation/api/current.txt b/ui/ui-foundation/api/current.txt
index 49e9270..c8bb322 100644
--- a/ui/ui-foundation/api/current.txt
+++ b/ui/ui-foundation/api/current.txt
@@ -70,8 +70,11 @@
}
public final class DrawBackgroundKt {
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Paint paint, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
}
public final class DrawBorder implements androidx.ui.core.DrawModifier {
diff --git a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev08.txt b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev08.txt
index 49e9270..c8bb322 100644
--- a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev08.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev08.txt
@@ -70,8 +70,11 @@
}
public final class DrawBackgroundKt {
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Paint paint, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
}
public final class DrawBorder implements androidx.ui.core.DrawModifier {
diff --git a/ui/ui-foundation/api/public_plus_experimental_current.txt b/ui/ui-foundation/api/public_plus_experimental_current.txt
index 49e9270..c8bb322 100644
--- a/ui/ui-foundation/api/public_plus_experimental_current.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_current.txt
@@ -70,8 +70,11 @@
}
public final class DrawBackgroundKt {
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Paint paint, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
}
public final class DrawBorder implements androidx.ui.core.DrawModifier {
diff --git a/ui/ui-foundation/api/restricted_0.1.0-dev08.txt b/ui/ui-foundation/api/restricted_0.1.0-dev08.txt
index 49e9270..c8bb322 100644
--- a/ui/ui-foundation/api/restricted_0.1.0-dev08.txt
+++ b/ui/ui-foundation/api/restricted_0.1.0-dev08.txt
@@ -70,8 +70,11 @@
}
public final class DrawBackgroundKt {
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Paint paint, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
}
public final class DrawBorder implements androidx.ui.core.DrawModifier {
diff --git a/ui/ui-foundation/api/restricted_current.txt b/ui/ui-foundation/api/restricted_current.txt
index 49e9270..c8bb322 100644
--- a/ui/ui-foundation/api/restricted_current.txt
+++ b/ui/ui-foundation/api/restricted_current.txt
@@ -70,8 +70,11 @@
}
public final class DrawBackgroundKt {
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
- method public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method @Deprecated public static androidx.ui.foundation.DrawBackground DrawBackground(androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Paint paint, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Color color, androidx.ui.graphics.Shape shape = RectangleShape);
+ method public static androidx.ui.core.Modifier drawBackground(androidx.ui.core.Modifier, androidx.ui.graphics.Brush brush, androidx.ui.graphics.Shape shape = RectangleShape);
}
public final class DrawBorder implements androidx.ui.core.DrawModifier {
diff --git a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/BoxDemo.kt b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/BoxDemo.kt
index 24fb0b5..bb9f3c3 100644
--- a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/BoxDemo.kt
+++ b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/BoxDemo.kt
@@ -17,6 +17,7 @@
package androidx.ui.foundation.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
@@ -26,26 +27,27 @@
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Composable
fun BoxDemo() {
- Column(LayoutPadding(10.dp)) {
+ Column(Modifier.padding(10.dp)) {
SimpleCircleBox()
- Spacer(LayoutHeight(30.dp))
+ Spacer(Modifier.preferredHeight(30.dp))
Box(
- modifier = LayoutSize(200.dp, 100.dp),
+ modifier = Modifier.preferredSize(200.dp, 100.dp),
shape = RoundedCornerShape(10.dp),
border = Border(5.dp, Color.Gray),
paddingStart = 20.dp,
backgroundColor = Color.White
) {
Box(
- modifier = LayoutPadding(10.dp) + LayoutSize.Fill,
+ modifier = Modifier.padding(10.dp).fillMaxSize(),
backgroundColor = Color.DarkGray,
shape = CutCornerShape(10.dp),
border = Border(10.dp, Color.LightGray),
diff --git a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/DrawModifiersDemo.kt b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/DrawModifiersDemo.kt
index 3093206..5bc8405 100644
--- a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/DrawModifiersDemo.kt
+++ b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/DrawModifiersDemo.kt
@@ -17,31 +17,32 @@
package androidx.ui.foundation.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.samples.BorderSample
import androidx.ui.foundation.samples.BorderSampleWithBrush
import androidx.ui.foundation.samples.BorderSampleWithDataClass
import androidx.ui.foundation.samples.DrawBackgroundColor
import androidx.ui.foundation.samples.DrawBackgroundShapedBrush
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.unit.dp
@Composable
fun DrawModifiersDemo() {
Row {
- Column(LayoutWeight(1f) + LayoutPadding(10.dp)) {
+ Column(Modifier.weight(1f, true).padding(10.dp)) {
BorderSample()
- Spacer(LayoutHeight(30.dp))
+ Spacer(Modifier.preferredHeight(30.dp))
BorderSampleWithBrush()
- Spacer(LayoutHeight(30.dp))
+ Spacer(Modifier.preferredHeight(30.dp))
BorderSampleWithDataClass()
}
- Column(LayoutWeight(1f) + LayoutPadding(10.dp)) {
+ Column(Modifier.weight(1f).padding(10.dp)) {
DrawBackgroundColor()
- Spacer(LayoutHeight(30.dp))
+ Spacer(Modifier.preferredHeight(30.dp))
DrawBackgroundShapedBrush()
}
}
diff --git a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/HighLevelGesturesDemo.kt b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/HighLevelGesturesDemo.kt
index d60c44f..4380bb7 100644
--- a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/HighLevelGesturesDemo.kt
+++ b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/HighLevelGesturesDemo.kt
@@ -17,21 +17,22 @@
package androidx.ui.foundation.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.samples.AnchoredDraggableSample
import androidx.ui.foundation.samples.DraggableSample
import androidx.ui.foundation.samples.ScrollableSample
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
import androidx.ui.layout.Spacer
+import androidx.ui.layout.preferredHeight
import androidx.ui.unit.dp
@Composable
fun HighLevelGesturesDemo() {
Column {
DraggableSample()
- Spacer(LayoutHeight(100.dp))
+ Spacer(Modifier.preferredHeight(100.dp))
AnchoredDraggableSample()
- Spacer(LayoutHeight(100.dp))
+ Spacer(Modifier.preferredHeight(100.dp))
ScrollableSample()
}
}
\ No newline at end of file
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BorderSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BorderSamples.kt
index f66d6cf..441a4b0 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BorderSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BorderSamples.kt
@@ -26,7 +26,7 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.HorizontalGradient
import androidx.ui.graphics.TileMode
-import androidx.ui.layout.LayoutPadding
+import androidx.ui.layout.padding
import androidx.ui.unit.dp
import androidx.ui.unit.px
@@ -35,8 +35,7 @@
fun BorderSample() {
Text(
"Text with square border",
- modifier = DrawBorder(color = Color.Magenta, size = 4.dp) +
- LayoutPadding(10.dp)
+ modifier = DrawBorder(color = Color.Magenta, size = 4.dp).padding(10.dp)
)
}
@@ -51,8 +50,8 @@
)
Text(
"Text with gradient border",
- modifier = DrawBorder(size = 2.dp, brush = gradientBrush, shape = CircleShape) +
- LayoutPadding(10.dp)
+ modifier = DrawBorder(size = 2.dp, brush = gradientBrush, shape = CircleShape)
+ .padding(10.dp)
)
}
@@ -61,7 +60,7 @@
fun BorderSampleWithDataClass() {
Text(
"Text with gradient border",
- modifier = DrawBorder(shape = CutCornerShape(8.dp), border = Border(2.dp, Color.Blue)) +
- LayoutPadding(10.dp)
+ modifier = DrawBorder(shape = CutCornerShape(8.dp), border = Border(2.dp, Color.Blue))
+ .padding(10.dp)
)
}
\ No newline at end of file
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BoxSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BoxSamples.kt
index 6b020b7..2cbf184 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BoxSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/BoxSamples.kt
@@ -18,20 +18,21 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.Text
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@Composable
fun SimpleCircleBox() {
Box(
- modifier = LayoutSize(100.dp),
+ modifier = Modifier.preferredSize(100.dp),
backgroundColor = Color.Cyan,
border = Border(10.dp, Color.Red),
shape = CircleShape,
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt
index 9d64029..cd44ebc 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt
@@ -19,10 +19,11 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Canvas
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
import androidx.ui.unit.toRect
@@ -30,7 +31,7 @@
@Composable
fun CanvasSample() {
val paint = remember { Paint().apply { color = Color.Magenta } }
- Canvas(modifier = LayoutSize(100.dp)) {
+ Canvas(modifier = Modifier.preferredSize(100.dp)) {
drawRect(size.toRect(), paint)
}
}
\ No newline at end of file
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DialogSample.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DialogSample.kt
index 95141ce..18d2666 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DialogSample.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DialogSample.kt
@@ -19,10 +19,11 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Dialog
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@@ -35,7 +36,7 @@
if (openDialog.value) {
Dialog( openDialog.value = false }) {
// Draw a rectangle shape with rounded corners inside the dialog
- Box(LayoutSize(dialogWidth, dialogHeight), backgroundColor = Color.White)
+ Box(Modifier.preferredSize(dialogWidth, dialogHeight), backgroundColor = Color.White)
}
}
}
\ No newline at end of file
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt
index 000492a..ed6a6fd 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt
@@ -21,15 +21,16 @@
import androidx.compose.state
import androidx.ui.animation.animatedFloat
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.animation.AnchorsFlingConfig
import androidx.ui.foundation.animation.fling
import androidx.ui.foundation.gestures.DragDirection
import androidx.ui.foundation.gestures.draggable
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.offset
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.dp
@Sampled
@@ -55,12 +56,12 @@
// seekbar itself
Box(
- modifier = LayoutWidth(max + squareSize) + draggable,
+ modifier = Modifier.preferredWidth(max + squareSize) + draggable,
backgroundColor = Color.Black
) {
val xOffset = with(DensityAmbient.current) { position.toDp() }
Box(
- LayoutOffset(x = xOffset, y = 0.dp) + LayoutSize(squareSize),
+ Modifier.offset(x = xOffset, y = 0.dp).preferredSize(squareSize),
backgroundColor = Color.Red
)
}
@@ -98,12 +99,12 @@
}
// seekbar itself
Box(
- modifier = LayoutWidth(max + squareSize) + draggable,
+ modifier = Modifier.preferredWidth(max + squareSize) + draggable,
backgroundColor = Color.Black
) {
val xOffset = with(DensityAmbient.current) { position.value.toDp() }
Box(
- LayoutOffset(x = xOffset, y = 0.dp) + LayoutSize(squareSize),
+ Modifier.offset(x = xOffset, y = 0.dp).preferredSize(squareSize),
backgroundColor = Color.Red
)
}
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DrawBackgroundSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DrawBackgroundSamples.kt
index d1463d89..6a8edb4 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DrawBackgroundSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/DrawBackgroundSamples.kt
@@ -18,12 +18,14 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
+import androidx.ui.foundation.drawBackground
+import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.foundation.shape.corner.CutCornerShape
import androidx.ui.graphics.Color
import androidx.ui.graphics.HorizontalGradient
-import androidx.ui.layout.LayoutPadding
+import androidx.ui.layout.padding
import androidx.ui.unit.dp
import androidx.ui.unit.px
@@ -32,7 +34,7 @@
fun DrawBackgroundColor() {
Text(
"Text with background",
- modifier = DrawBackground(color = Color.Magenta) + LayoutPadding(10.dp)
+ Modifier.drawBackground(Color.Magenta, RectangleShape).padding(10.dp)
)
}
@@ -46,7 +48,7 @@
)
Text(
"Text with gradient back",
- modifier = DrawBackground(shape = CutCornerShape(8.dp), brush = gradientBrush) +
- LayoutPadding(10.dp)
+ Modifier.drawBackground(brush = gradientBrush, shape = CutCornerShape(8.dp))
+ .padding(10.dp)
)
}
\ No newline at end of file
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ImageSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ImageSamples.kt
index 929b7f2..f030178 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ImageSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ImageSamples.kt
@@ -19,6 +19,7 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Image
import androidx.ui.geometry.Offset
import androidx.ui.geometry.Rect
@@ -29,7 +30,7 @@
import androidx.ui.graphics.Paint
import androidx.ui.graphics.ScaleFit
import androidx.ui.graphics.painter.Painter
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.res.loadVectorResource
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
@@ -50,7 +51,7 @@
vectorAsset.resource.resource?.let {
Image(
asset = it,
- modifier = LayoutSize(200.dp, 200.dp),
+ modifier = Modifier.preferredSize(200.dp, 200.dp),
scaleFit = ScaleFit.FillMinDimension,
colorFilter = ColorFilter.tint(Color.Cyan)
)
@@ -77,7 +78,7 @@
}
}
- Image(painter = customPainter, modifier = LayoutSize(100.dp, 100.dp))
+ Image(painter = customPainter, modifier = Modifier.preferredSize(100.dp, 100.dp))
}
/**
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollableSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollableSamples.kt
index a3b4844..f6121ec 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollableSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollableSamples.kt
@@ -19,14 +19,15 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.Text
import androidx.ui.foundation.gestures.DragDirection
-import androidx.ui.foundation.gestures.scrollable
import androidx.ui.foundation.gestures.ScrollableState
+import androidx.ui.foundation.gestures.scrollable
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.text.TextStyle
import androidx.ui.unit.dp
import androidx.ui.unit.sp
@@ -47,7 +48,7 @@
val scroll =
scrollable(dragDirection = DragDirection.Vertical, scrollableState = scrollableState)
Box(
- LayoutSize(200.dp) + scroll,
+ Modifier.preferredSize(200.dp) + scroll,
backgroundColor = Color.LightGray,
gravity = ContentGravity.Center
) {
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollerSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollerSamples.kt
index e646a8c..1d5662e 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollerSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/ScrollerSamples.kt
@@ -21,21 +21,23 @@
import androidx.compose.MutableState
import androidx.compose.state
import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.PressIndicatorGestureDetector
import androidx.ui.foundation.Box
import androidx.ui.foundation.Clickable
import androidx.ui.foundation.ContentGravity
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.HorizontalScroller
import androidx.ui.foundation.ScrollerPosition
import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
+import androidx.ui.foundation.drawBackground
+import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
import androidx.ui.layout.Table
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.text.TextStyle
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -88,7 +90,7 @@
val style = TextStyle(fontSize = 30.sp)
// Scroller will be clipped to this padding
VerticalScroller {
- Column(modifier = LayoutPadding(20.dp)) {
+ Column(Modifier.padding(20.dp)) {
phrases.forEach { phrase ->
Text(phrase, style)
}
@@ -133,7 +135,7 @@
@Composable
private fun Square(index: Int) {
Box(
- modifier = LayoutSize(75.dp, 200.dp),
+ Modifier.preferredSize(75.dp, 200.dp),
backgroundColor = colors[index % colors.size],
gravity = ContentGravity.Center
) {
@@ -177,7 +179,7 @@
private fun SquareButton(text: String, color: Color = Color.LightGray, onClick: () -> Unit) {
Clickable( {
Box(
- modifier = LayoutPadding(5.dp) + LayoutSize(120.dp, 60.dp),
+ Modifier.padding(5.dp).preferredSize(120.dp, 60.dp),
backgroundColor = color,
gravity = ContentGravity.Center
) {
@@ -205,5 +207,5 @@
val gestureModifier =
PressIndicatorGestureDetector( >
- Text(text, modifier = gestureModifier + DrawBackground(color = color.value), style = textStyle)
+ Text(text, gestureModifier.drawBackground(color.value, RectangleShape), style = textStyle)
}
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/TableBordersSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/TableBordersSamples.kt
index fd336b9..433bc78 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/TableBordersSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/TableBordersSamples.kt
@@ -18,13 +18,14 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.drawBorders
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutPadding
import androidx.ui.layout.Table
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.padding
import androidx.ui.unit.dp
@Sampled
@@ -47,7 +48,7 @@
repeat(8) {
ColoredRect(
color = Color.Magenta,
- modifier = LayoutPadding(2.dp) + LayoutAspectRatio(1f)
+ modifier = Modifier.padding(2.dp).aspectRatio(1f)
)
}
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt
index ade9918..307b18f 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt
@@ -21,6 +21,7 @@
import androidx.test.filters.MediumTest
import androidx.test.filters.SdkSuppress
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.foundation.shape.corner.CircleShape
@@ -28,8 +29,8 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shape
import androidx.ui.graphics.SolidColor
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.assertShape
import androidx.ui.test.captureToBitmap
@@ -65,9 +66,9 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- modifier = LayoutSize(40.px.toDp(), 40.px.toDp()) +
- DrawBackground(Color.Blue, shape) +
- DrawBorder(Border(10.px.toDp(), Color.Red), shape)
+ Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ .drawBackground(Color.Blue, shape)
+ .plus(DrawBorder(Border(10.px.toDp(), Color.Red), shape))
) {}
}
@@ -90,9 +91,9 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- modifier = LayoutSize(40.px.toDp(), 40.px.toDp()) +
- DrawBackground(Color.Blue, shape) +
- DrawBorder(Border(10.px.toDp(), SolidColor(Color.Red)), shape)
+ Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ .drawBackground(Color.Blue, shape)
+ .plus(DrawBorder(Border(10.px.toDp(), SolidColor(Color.Red)), shape))
) {}
}
}
@@ -114,10 +115,9 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- modifier = LayoutSize(40.px.toDp(), 40.px.toDp()) +
- DrawBackground(Color.Blue, shape) +
- DrawBorder(Border(1500.px.toDp(), Color.Red), shape)
-
+ Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ .drawBackground(Color.Blue, shape)
+ .plus(DrawBorder(Border(1500.px.toDp(), Color.Red), shape))
) {}
}
}
@@ -137,10 +137,9 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- modifier = LayoutSize(40.px.toDp(), 40.px.toDp()) +
- DrawBackground(Color.Blue, shape) +
- DrawBorder(Border(-5.px.toDp(), Color.Red), shape)
-
+ Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ .drawBackground(Color.Blue, shape)
+ .plus(DrawBorder(Border(-5.px.toDp(), Color.Red), shape))
) {}
}
}
@@ -159,10 +158,13 @@
fun border_zeroSizeLayout_drawsNothing() {
composeTestRule.setContent {
SemanticParent {
- Box(LayoutSize(40.px.toDp(), 40.px.toDp()), backgroundColor = Color.White) {
+ Box(
+ Modifier.preferredSize(40.px.toDp(), 40.px.toDp()),
+ backgroundColor = Color.White
+ ) {
Stack(
- modifier = LayoutSize(0.px.toDp(), 40.px.toDp()) +
- DrawBorder(Border(4.px.toDp(), Color.Red), shape)
+ Modifier.preferredSize(0.px.toDp(), 40.px.toDp())
+ .plus(DrawBorder(Border(4.px.toDp(), Color.Red), shape))
) {}
}
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
index 9de1463..032bdc3 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
@@ -20,16 +20,19 @@
import androidx.compose.Composable
import androidx.test.filters.MediumTest
import androidx.test.filters.SdkSuppress
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.core.onPositioned
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.rtl
+import androidx.ui.layout.wrapContentSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.assertShape
import androidx.ui.test.captureToBitmap
@@ -63,8 +66,8 @@
val padding = 20.dp
composeTestRule.setContent {
SemanticsParent {
- Box(LayoutSize(size), padding = padding) {
- Box(LayoutSize.Fill + onPositioned { childSize = it.size })
+ Box(Modifier.preferredSize(size), padding = padding) {
+ Box(Modifier.fillMaxSize().onPositioned { childSize = it.size })
}
}
}
@@ -87,13 +90,13 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(size),
+ Modifier.preferredSize(size),
paddingStart = start,
paddingEnd = end,
paddingTop = top,
paddingBottom = bottom
) {
- Box(LayoutSize.Fill + onPositioned {
+ Box(Modifier.fillMaxSize().onPositioned {
childSize = it.size
childPosition = it.localToGlobal(PxPosition.Origin)
})
@@ -123,13 +126,13 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(size) + LayoutDirectionModifier.Rtl,
+ Modifier.preferredSize(size).rtl,
paddingStart = start,
paddingEnd = end,
paddingTop = top,
paddingBottom = bottom
) {
- Box(LayoutSize.Fill + onPositioned {
+ Box(Modifier.fillMaxSize().onPositioned {
childSize = it.size
childPosition = it.localToGlobal(PxPosition.Origin)
})
@@ -158,13 +161,13 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(size),
+ Modifier.preferredSize(size),
padding = padding,
paddingStart = left,
paddingTop = top,
paddingBottom = bottom
) {
- Box(LayoutSize.Fill + onPositioned { childSize = it.size })
+ Box(Modifier.fillMaxSize().onPositioned { childSize = it.size })
}
}
}
@@ -182,7 +185,7 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(50.dp),
+ Modifier.preferredSize(50.dp),
backgroundColor = Color.Red
)
}
@@ -198,11 +201,11 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(size),
+ Modifier.preferredSize(size),
backgroundColor = Color.Red,
padding = padding
) {
- Box(LayoutSize.Fill, backgroundColor = Color.Blue)
+ Box(Modifier.fillMaxSize(), backgroundColor = Color.Blue)
}
}
}
@@ -226,11 +229,11 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(size),
+ Modifier.preferredSize(size),
backgroundColor = Color.Red,
padding = padding
) {
- Box(LayoutSize.Fill, backgroundColor = Color.Blue, shape = CircleShape)
+ Box(Modifier.fillMaxSize(), backgroundColor = Color.Blue, shape = CircleShape)
}
}
}
@@ -255,7 +258,7 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(size),
+ Modifier.preferredSize(size),
backgroundColor = Color.Blue,
border = Border(borderSize, Color.Red)
)
@@ -282,11 +285,11 @@
composeTestRule.setContent {
SemanticsParent {
Box(
- LayoutSize(size),
+ Modifier.preferredSize(size),
backgroundColor = Color.Red
) {
Box(
- LayoutSize.Fill,
+ Modifier.fillMaxSize(),
backgroundColor = Color.Blue,
shape = CircleShape,
border = Border(borderSize, Color.Blue)
@@ -313,8 +316,8 @@
val borderSize = 10.dp
composeTestRule.setContent {
SemanticsParent {
- Box(LayoutSize(size), border = Border(borderSize, Color.Red)) {
- Box(LayoutSize.Fill + onPositioned { childSize = it.size })
+ Box(Modifier.preferredSize(size), border = Border(borderSize, Color.Red)) {
+ Box(Modifier.fillMaxSize().onPositioned { childSize = it.size })
}
}
}
@@ -328,7 +331,7 @@
@Composable
private fun SemanticsParent(children: @Composable Density.() -> Unit) {
- Stack(LayoutAlign.TopStart) {
+ Stack(Modifier.wrapContentSize(Alignment.TopStart)) {
TestTag(contentTag) {
Semantics(container = true) {
DensityAmbient.current.children()
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
index 609206d..c4ed557 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
@@ -28,8 +28,8 @@
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.assertShape
import androidx.ui.test.captureToBitmap
@@ -75,8 +75,10 @@
var canvasSize: IntPxSize? = null
composeTestRule.setContentAndCollectSizes {
SemanticParent {
- Canvas(modifier = LayoutSize(100.dp) +
- onPositioned { position -> canvasSize = position.size }) {
+ Canvas(
+ Modifier.preferredSize(100.dp)
+ .onPositioned { position -> canvasSize = position.size }
+ ) {
drawRect(size.toRect(), Paint().apply { color = Color.Red })
}
}
@@ -101,13 +103,16 @@
var canvasSize: IntPxSize? = null
composeTestRule.setContentAndCollectSizes {
SemanticParent {
- Canvas(modifier = LayoutSize(100.dp) +
- onPositioned { position -> canvasSize = position.size }) {
+ Canvas(
+ Modifier.preferredSize(100.dp)
+ .onPositioned { position -> canvasSize = position.size }
+ ) {
drawRect(size.toRect(), Paint().apply { color = Color.Red })
drawCircle(
size.center().toOffset(),
10f,
- Paint().apply { color = Color.Blue })
+ Paint().apply { color = Color.Blue }
+ )
}
}
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
index 2ff84c6..417b5f1 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
@@ -23,8 +23,8 @@
import androidx.ui.core.TestTag
import androidx.ui.foundation.gestures.DragDirection
import androidx.ui.foundation.gestures.draggable
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.center
import androidx.ui.test.createComposeRule
@@ -179,7 +179,7 @@
@Test
fun draggable_disabledWontCallLambda() {
var total = 0f
- var enabled = mutableStateOf(true)
+ val enabled = mutableStateOf(true)
setDraggableContent {
draggable(
dragDirection = DragDirection.Horizontal,
@@ -308,14 +308,14 @@
TestTag(draggableBoxTag) {
Semantics(container = true) {
Box(gravity = ContentGravity.Center,
- modifier = LayoutSize(300.dp) + draggable(
+ modifier = Modifier.preferredSize(300.dp) + draggable(
dragDirection = DragDirection.Horizontal,
delta ->
outerDrag += delta
delta
}
)) {
- Box(modifier = LayoutSize(300.dp) + draggable(
+ Box(modifier = Modifier.preferredSize(300.dp) + draggable(
dragDirection = DragDirection.Horizontal,
delta ->
innerDrag += delta / 2
@@ -348,7 +348,7 @@
val draggable = draggableFactory()
TestTag(draggableBoxTag) {
Semantics(container = true) {
- Box(modifier = LayoutSize(100.dp) + draggable)
+ Box(modifier = Modifier.preferredSize(100.dp) + draggable)
}
}
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt
index 79966f7..a1e29eb 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt
@@ -21,13 +21,14 @@
import androidx.test.filters.MediumTest
import androidx.test.filters.SdkSuppress
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
import androidx.ui.graphics.SolidColor
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.assertShape
import androidx.ui.test.captureToBitmap
@@ -55,10 +56,10 @@
composeTestRule.setContent {
SemanticParent {
Box(
- LayoutSize(40.px.toDp()) + DrawBackground(Color.Magenta),
+ Modifier.preferredSize(40.px.toDp()).drawBackground(Color.Magenta),
gravity = ContentGravity.Center
) {
- Box(LayoutSize(20.px.toDp()) + DrawBackground(Color.White))
+ Box(Modifier.preferredSize(20.px.toDp()).drawBackground(Color.White))
}
}
}
@@ -78,10 +79,13 @@
composeTestRule.setContent {
SemanticParent {
Box(
- LayoutSize(40.px.toDp()) + DrawBackground(Color.Magenta),
+ Modifier.preferredSize(40.px.toDp()).drawBackground(Color.Magenta),
gravity = ContentGravity.Center
) {
- Box(LayoutSize(20.px.toDp()) + DrawBackground(SolidColor(Color.White)))
+ Box(
+ Modifier.preferredSize(20.px.toDp())
+ .drawBackground(SolidColor(Color.White))
+ )
}
}
}
@@ -101,9 +105,9 @@
composeTestRule.setContent {
SemanticParent {
Box(
- LayoutSize(40.px.toDp()) +
- DrawBackground(Color.Magenta) +
- DrawBackground(shape = CircleShape, color = Color.White)
+ Modifier.preferredSize(40.px.toDp())
+ .drawBackground(Color.Magenta)
+ .drawBackground(color = Color.White, shape = CircleShape)
)
}
}
@@ -122,12 +126,12 @@
composeTestRule.setContent {
SemanticParent {
Box(
- LayoutSize(40.px.toDp()) +
- DrawBackground(Color.Magenta) +
- DrawBackground(
- shape = CircleShape,
- brush = SolidColor(Color.White)
- )
+ Modifier.preferredSize(40.px.toDp())
+ .drawBackground(Color.Magenta)
+ .drawBackground(
+ brush = SolidColor(Color.White),
+ shape = CircleShape
+ )
)
}
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ImageTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ImageTest.kt
index 9071bf2..715a636 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ImageTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ImageTest.kt
@@ -17,13 +17,13 @@
package androidx.ui.foundation
import android.os.Build
-import androidx.test.filters.SdkSuppress
import androidx.test.filters.MediumTest
+import androidx.test.filters.SdkSuppress
import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.foundation.test.R
-import androidx.ui.test.createComposeRule
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Canvas
import androidx.ui.graphics.Color
@@ -32,10 +32,12 @@
import androidx.ui.graphics.Path
import androidx.ui.graphics.ScaleFit
import androidx.ui.graphics.toArgb
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredSizeIn
+import androidx.ui.layout.wrapContentSize
import androidx.ui.res.loadVectorResource
import androidx.ui.test.captureToBitmap
+import androidx.ui.test.createComposeRule
import androidx.ui.test.findByTag
import androidx.ui.unit.dp
import org.junit.Assert
@@ -92,7 +94,11 @@
fun testImage() {
rule.setContent {
val size = (containerSize / DensityAmbient.current.density).dp
- Box(modifier = LayoutSize(size) + DrawBackground(Color.White) + LayoutAlign.Center) {
+ Box(
+ Modifier.preferredSize(size)
+ .drawBackground(Color.White)
+ .wrapContentSize(Alignment.Center)
+ ) {
TestTag(contentTag) {
Image(asset = createImageAsset())
}
@@ -122,13 +128,17 @@
rule.setContent {
val density = DensityAmbient.current.density
val size = (containerSize * 2 / density).dp
- Box(modifier = LayoutSize(size) + DrawBackground(Color.White) + LayoutAlign.Center) {
+ Box(
+ Modifier.preferredSize(size)
+ .drawBackground(Color.White)
+ .wrapContentSize(Alignment.Center)
+ ) {
TestTag(contentTag) {
// The resultant Image composable should be twice the size of the underlying
// ImageAsset that is to be drawn and will stretch the content to fit
// the bounds
Image(asset = createImageAsset(),
- modifier = LayoutSize(
+ modifier = Modifier.preferredSize(
(imageComposableWidth / density).dp,
(imageComposableHeight / density).dp
),
@@ -161,12 +171,16 @@
rule.setContent {
val density = DensityAmbient.current.density
val size = (containerSize * 2 / density).dp
- Box(modifier = LayoutSize(size) + DrawBackground(Color.White) + LayoutAlign.Center) {
+ Box(
+ Modifier.preferredSize(size)
+ .drawBackground(Color.White)
+ .wrapContentSize(Alignment.Center)
+ ) {
TestTag(contentTag) {
// The resultant Image composable should be twice the size of the underlying
// ImageAsset that is to be drawn in the bottom end section of the composable
Image(asset = createImageAsset(),
- modifier = LayoutSize(
+ modifier = Modifier.preferredSize(
(imageComposableWidth / density).dp,
(imageComposableHeight / density).dp
),
@@ -203,12 +217,19 @@
val size = (boxWidth * 2 / density).dp
val minWidth = (boxWidth / density).dp
val minHeight = (boxHeight / density).dp
- Box(modifier = LayoutSize(size) + DrawBackground(Color.White) + LayoutAlign.Center) {
+ Box(
+ Modifier.preferredSize(size)
+ .drawBackground(Color.White)
+ .wrapContentSize(Alignment.Center)
+ ) {
TestTag(contentTag) {
loadVectorResource(R.drawable.ic_vector_asset_test).resource.resource?.let {
Image(
it,
- modifier = LayoutSize.Min(minWidth, minHeight),
+ modifier = Modifier.preferredSizeIn(
+ minWidth = minWidth,
+ minHeight = minHeight
+ ),
scaleFit = ScaleFit.FillMinDimension
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
index 4dff0e4..08f9211 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
@@ -29,8 +29,8 @@
import androidx.ui.foundation.gestures.DragDirection
import androidx.ui.foundation.gestures.ScrollableState
import androidx.ui.foundation.gestures.scrollable
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.center
import androidx.ui.test.createComposeRule
@@ -530,13 +530,13 @@
Semantics(container = true) {
Box(
gravity = ContentGravity.Center,
- modifier = LayoutSize(300.dp) + scrollable(
+ modifier = Modifier.preferredSize(300.dp) + scrollable(
scrollableState = outerState,
dragDirection = DragDirection.Horizontal
)
) {
Box(
- modifier = LayoutSize(300.dp) + scrollable(
+ modifier = Modifier.preferredSize(300.dp) + scrollable(
scrollableState = innerState,
dragDirection = DragDirection.Horizontal
)
@@ -574,7 +574,7 @@
val scrollable = scrollableModifierFactory()
TestTag(scrollableBoxTag) {
Semantics(container = true) {
- Box(modifier = LayoutSize(100.dp) + scrollable)
+ Box(modifier = Modifier.preferredSize(100.dp) + scrollable)
}
}
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollerTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollerTest.kt
index 8943158..39f99e9 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollerTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollerTest.kt
@@ -23,13 +23,14 @@
import androidx.compose.Composable
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.foundation.animation.FlingConfig
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.GestureScope
import androidx.ui.test.SemanticsNodeInteraction
@@ -442,12 +443,12 @@
TestTag(scrollerTag) {
VerticalScroller(
scrollerPosition = scrollerPosition,
- modifier = LayoutSize(width.toDp(), height.toDp())
+ modifier = Modifier.preferredSize(width.toDp(), height.toDp())
) {
Column {
colors.forEach { color ->
Box(
- LayoutSize(width.toDp(), rowHeight.toDp()),
+ Modifier.preferredSize(width.toDp(), rowHeight.toDp()),
backgroundColor = color
)
}
@@ -475,12 +476,12 @@
TestTag(scrollerTag) {
HorizontalScroller(
scrollerPosition = scrollerPosition,
- modifier = LayoutSize(width.toDp(), height.toDp())
+ modifier = Modifier.preferredSize(width.toDp(), height.toDp())
) {
Row {
colors.forEach { color ->
Box(
- LayoutSize(columnWidth.toDp(), height.toDp()),
+ Modifier.preferredSize(columnWidth.toDp(), height.toDp()),
backgroundColor = color
)
}
@@ -541,7 +542,7 @@
}
}
Stack {
- Box(LayoutSize(width, height), backgroundColor = Color.White) {
+ Box(Modifier.preferredSize(width, height), backgroundColor = Color.White) {
TestTag(scrollerTag) {
Semantics(container = true) {
if (isVertical) {
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt
index 6fde7b9..af9a283 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt
@@ -26,17 +26,17 @@
import androidx.ui.core.Constraints
import androidx.ui.core.ContextAmbient
import androidx.ui.core.LayoutDirection
-import androidx.ui.core.DrawClipToBounds
import androidx.ui.core.LayoutNode
import androidx.ui.core.Measurable
import androidx.ui.core.MeasureScope
import androidx.ui.core.MeasuringIntrinsicsMeasureBlocks
import androidx.ui.core.Modifier
import androidx.ui.core.Ref
+import androidx.ui.core.clipToBounds
import androidx.ui.core.subcomposeInto
import androidx.ui.foundation.gestures.DragDirection
-import androidx.ui.foundation.gestures.scrollable
import androidx.ui.foundation.gestures.ScrollableState
+import androidx.ui.foundation.gestures.scrollable
import androidx.ui.unit.IntPx
import androidx.ui.unit.ipx
import androidx.ui.unit.px
@@ -482,7 +482,7 @@
)
)
androidx.ui.core.LayoutNode(
- modifier = modifier + scroll + DrawClipToBounds,
+ modifier = modifier.plus(scroll).clipToBounds(),
ref = state.rootNodeRef,
measureBlocks = state.measureBlocks
)
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt
index dcadb84..23f351eb 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt
@@ -83,7 +83,7 @@
if (backgroundColor == Color.Transparent) {
Modifier.None
} else {
- DrawBackground(backgroundColor, shape)
+ Modifier.drawBackground(backgroundColor, shape)
}
// TODO(malkov): support ContentColor prorogation (b/148129218)
// TODO(popam): there should be no custom layout, use Column instead (b/148809177)
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Canvas.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Canvas.kt
index ba7d91d..ab0dbefd 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Canvas.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Canvas.kt
@@ -18,10 +18,9 @@
import androidx.compose.Composable
import androidx.ui.core.Modifier
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.graphics.Canvas
import androidx.ui.layout.ColumnScope
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Spacer
import androidx.ui.unit.Density
import androidx.ui.unit.PxSize
@@ -57,8 +56,8 @@
@Composable
fun Canvas(modifier: Modifier, onCanvas: CanvasScope.() -> Unit) {
Spacer(
- modifier + draw( canvas, size ->
+ modifier.drawBehind { canvas, size ->
CanvasScopeImpl(canvas, this, size).onCanvas()
- })
+ }
)
}
\ No newline at end of file
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/ColoredRect.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/ColoredRect.kt
index 8249c5c..ab2fdc0 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/ColoredRect.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/ColoredRect.kt
@@ -20,8 +20,10 @@
import androidx.ui.core.Modifier
import androidx.ui.graphics.Brush
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.Dp
/**
@@ -46,9 +48,11 @@
width: Dp? = null,
height: Dp? = null
) {
- val widthModifier = if (width != null) LayoutWidth(width) else LayoutWidth.Fill
- val heightModifier = if (height != null) LayoutHeight(height) else LayoutHeight.Fill
- Box(modifier + widthModifier + heightModifier + DrawBackground(brush))
+ val widthModifier =
+ if (width != null) Modifier.preferredWidth(width) else Modifier.fillMaxWidth()
+ val heightModifier =
+ if (height != null) Modifier.preferredHeight(height) else Modifier.fillMaxHeight()
+ Box(modifier + widthModifier + heightModifier + Modifier.drawBackground(brush))
}
/**
@@ -67,7 +71,9 @@
width: Dp? = null,
height: Dp? = null
) {
- val widthModifier = if (width != null) LayoutWidth(width) else LayoutWidth.Fill
- val heightModifier = if (height != null) LayoutHeight(height) else LayoutHeight.Fill
- Box(modifier + widthModifier + heightModifier + DrawBackground(color))
+ val widthModifier =
+ if (width != null) Modifier.preferredWidth(width) else Modifier.fillMaxWidth()
+ val heightModifier =
+ if (height != null) Modifier.preferredHeight(height) else Modifier.fillMaxHeight()
+ Box(modifier + widthModifier + heightModifier + Modifier.drawBackground(color))
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/DrawBackground.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/DrawBackground.kt
index cc7ab5a..96d0309 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/DrawBackground.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/DrawBackground.kt
@@ -19,6 +19,7 @@
import androidx.compose.Composable
import androidx.compose.remember
import androidx.ui.core.DrawModifier
+import androidx.ui.core.Modifier
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.graphics.Brush
import androidx.ui.graphics.Canvas
@@ -41,6 +42,16 @@
* @param color color to paint background with
* @param shape desired shape of the background
*/
+@Suppress("DEPRECATION")
+@Deprecated(
+ "Use Modifier.drawBackground",
+ replaceWith = ReplaceWith(
+ "Modifier.drawBackground(color, shape)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.foundation.drawBackground",
+ "androidx.ui.foundation.shape.RectangleShape"
+ )
+)
@Composable
fun DrawBackground(color: Color, shape: Shape = RectangleShape): DrawBackground =
DrawBackground(SolidColor(color), shape)
@@ -54,6 +65,15 @@
* @param brush brush to paint background with
* @param shape desired shape of the background
*/
+@Deprecated(
+ "Use Modifier.drawBackground",
+ replaceWith = ReplaceWith(
+ "Modifier.drawBackground(brush, shape)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.foundation.drawBackground",
+ "androidx.ui.foundation.shape.RectangleShape"
+ )
+)
@Composable
fun DrawBackground(brush: Brush, shape: Shape = RectangleShape): DrawBackground {
return remember(shape, brush) {
@@ -64,6 +84,38 @@
}
}
+/**
+ * Draws [shape] with [paint] behind the content.
+ */
+fun Modifier.drawBackground(
+ paint: Paint,
+ shape: Shape
+) = this + DrawBackground(paint, shape)
+
+/**
+ * Draws [shape] with a solid [color] behind the content.
+ *
+ * @param color color to paint background with
+ * @param shape desired shape of the background
+ */
+@Composable
+fun Modifier.drawBackground(
+ color: Color,
+ shape: Shape = RectangleShape
+) = drawBackground(SolidColor(color), shape)
+
+/**
+ * Draws [shape] with [brush] behind the content.
+ *
+ * @param brush brush to paint background with
+ * @param shape desired shape of the background
+ */
+@Composable
+fun Modifier.drawBackground(
+ brush: Brush,
+ shape: Shape = RectangleShape
+) = drawBackground(remember(brush) { Paint().also { brush.applyTo(it) } }, shape)
+
data class DrawBackground internal constructor(
private val paint: Paint,
private val shape: Shape
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Icon.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Icon.kt
index 8d953c2..dc33236 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Icon.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Icon.kt
@@ -20,7 +20,7 @@
import androidx.compose.emptyContent
import androidx.compose.remember
import androidx.ui.core.Modifier
-import androidx.ui.core.asModifier
+import androidx.ui.core.paint
import androidx.ui.graphics.Color
import androidx.ui.graphics.ColorFilter
import androidx.ui.graphics.ImageAsset
@@ -28,7 +28,7 @@
import androidx.ui.graphics.painter.Painter
import androidx.ui.graphics.vector.VectorAsset
import androidx.ui.graphics.vector.VectorPainter
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
@@ -86,22 +86,21 @@
modifier: Modifier = Modifier.None,
tint: Color = contentColor()
) {
- val iconModifier = painter.asModifier(colorFilter = ColorFilter.tint(tint))
-
// TODO: consider allowing developers to override the intrinsic size, and specify their own
// size that this icon will be forced to take up.
- val layoutModifier = if (painter.intrinsicSize == PxSize.UnspecifiedSize) {
+ // TODO: b/149735981 semantics for content description
+ Box(
+ modifier.defaultSizeFor(painter).paint(painter, colorFilter = ColorFilter.tint(tint)),
+ children = emptyContent()
+ )
+}
+
+private fun Modifier.defaultSizeFor(painter: Painter) =
+ this + if (painter.intrinsicSize == PxSize.UnspecifiedSize) {
DefaultIconSizeModifier
} else {
Modifier.None
}
- // TODO: b/149735981 semantics for content description
- Box(
- modifier = modifier + layoutModifier + iconModifier,
- children = emptyContent()
- )
-}
-
// Default icon size, for icons with no intrinsic size information
-private val DefaultIconSizeModifier = LayoutSize(24.dp)
+private val DefaultIconSizeModifier = Modifier.preferredSize(24.dp)
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Image.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Image.kt
index d50d21e..f77a843 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Image.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Image.kt
@@ -20,9 +20,9 @@
import androidx.compose.remember
import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
-import androidx.ui.core.DrawClipToBounds
import androidx.ui.core.Modifier
-import androidx.ui.core.asModifier
+import androidx.ui.core.clipToBounds
+import androidx.ui.core.paint
import androidx.ui.graphics.BlendMode
import androidx.ui.graphics.Color
import androidx.ui.graphics.ColorFilter
@@ -34,7 +34,7 @@
import androidx.ui.graphics.painter.Painter
import androidx.ui.graphics.vector.VectorAsset
import androidx.ui.graphics.vector.VectorPainter
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
/**
* A composable that lays out and draws a given [ImageAsset]. This will attempt to
@@ -147,14 +147,15 @@
alpha: Float = DefaultAlpha,
colorFilter: ColorFilter? = null
) {
- val painterModifier = painter.asModifier(
- alignment = alignment,
- scaleFit = scaleFit,
- alpha = alpha,
- colorFilter = colorFilter
+ Box(
+ modifier.clipToBounds().paint(
+ painter,
+ alignment = alignment,
+ scaleFit = scaleFit,
+ alpha = alpha,
+ colorFilter = colorFilter
+ )
)
-
- Box(modifier + DrawClipToBounds + painterModifier)
}
/**
@@ -181,14 +182,14 @@
tint: Color? = null
) {
with(DensityAmbient.current) {
- val imageModifier = ImagePainter(image).asModifier(
- scaleFit = ScaleFit.FillMaxDimension,
- colorFilter = tint?.let { ColorFilter(it, BlendMode.srcIn) }
- )
Box(
- LayoutSize(image.width.toDp(), image.height.toDp()) +
- DrawClipToBounds +
- imageModifier
+ Modifier.preferredSize(image.width.toDp(), image.height.toDp())
+ .clipToBounds()
+ .paint(
+ ImagePainter(image),
+ scaleFit = ScaleFit.FillMaxDimension,
+ colorFilter = tint?.let { ColorFilter(it, BlendMode.srcIn) }
+ )
)
}
}
\ No newline at end of file
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
index 73e4eb8..8ae84db 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
@@ -23,9 +23,9 @@
import androidx.compose.remember
import androidx.ui.core.AnimationClockAmbient
import androidx.ui.core.Constraints
-import androidx.ui.core.DrawClipToBounds
import androidx.ui.core.Layout
import androidx.ui.core.Modifier
+import androidx.ui.core.clipToBounds
import androidx.ui.core.drawLayer
import androidx.ui.foundation.animation.FlingConfig
import androidx.ui.foundation.gestures.DragDirection
@@ -257,10 +257,10 @@
child: @Composable() () -> Unit
) {
Layout(
- modifier = modifier + DrawClipToBounds,
+ modifier = modifier.clipToBounds(),
children = {
Box(
- modifier = drawLayer(),
+ modifier = Modifier.drawLayer(),
children = child
)
},
diff --git a/ui/ui-framework/api/0.1.0-dev08.txt b/ui/ui-framework/api/0.1.0-dev08.txt
index c6d345b..3d39543 100644
--- a/ui/ui-framework/api/0.1.0-dev08.txt
+++ b/ui/ui-framework/api/0.1.0-dev08.txt
@@ -10,8 +10,10 @@
package androidx.ui.core {
public final class ClipKt {
- method public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
- method public static androidx.ui.core.Modifier getDrawClipToBounds();
+ method public static androidx.ui.core.Modifier clip(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier clipToBounds(androidx.ui.core.Modifier);
+ method @Deprecated public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
+ method @Deprecated public static androidx.ui.core.Modifier getDrawClipToBounds();
}
public final class CoreTextFieldKt {
@@ -30,7 +32,8 @@
}
public final class DrawShadowKt {
- method public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method @Deprecated public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method public static androidx.ui.core.Modifier drawShadow(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
}
public enum DropDownAlignment {
@@ -48,7 +51,7 @@
}
public final class LayoutTag implements androidx.ui.core.LayoutTagParentData androidx.ui.core.ParentDataModifier {
- ctor public LayoutTag(Object tag);
+ ctor @Deprecated public LayoutTag(Object tag);
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
@@ -57,6 +60,7 @@
public final class LayoutTagKt {
method public static Object? getTag(androidx.ui.core.Measurable);
+ method public static androidx.ui.core.Modifier tag(androidx.ui.core.Modifier, Object tag);
}
public interface LayoutTagParentData {
@@ -65,11 +69,13 @@
}
public final class OpacityKt {
- method public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
+ method public static androidx.ui.core.Modifier drawOpacity(androidx.ui.core.Modifier, @FloatRange(from=0.0, to=1.0) float opacity);
+ method @Deprecated public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
}
public final class PainterModifierKt {
- method public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method @Deprecated public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method public static androidx.ui.core.Modifier paint(androidx.ui.core.Modifier, androidx.ui.graphics.painter.Painter painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
}
public final class ParentDataKt {
@@ -394,7 +400,8 @@
method public static void Group(androidx.ui.graphics.vector.VectorScope, String name = "", float rotation = 0.0f, float pivotX = 0.0f, float pivotY = 0.0f, float scaleX = 1.0f, float scaleY = 1.0f, float translationX = 0.0f, float translationY = 0.0f, java.util.List<? extends androidx.ui.graphics.vector.PathNode> clipPathData = EmptyPath, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.vector.VectorScope,kotlin.Unit> children);
method public static void Path(androidx.ui.graphics.vector.VectorScope, java.util.List<? extends androidx.ui.graphics.vector.PathNode> pathData, String name = "", androidx.ui.graphics.Brush? fill = null, float fillAlpha = 1.0f, androidx.ui.graphics.Brush? stroke = null, float strokeAlpha = 1.0f, float strokeLineWidth = 0.0f, androidx.ui.graphics.StrokeCap strokeLineCap = DefaultStrokeLineCap, androidx.ui.graphics.StrokeJoin strokeLineJoin = DefaultStrokeLineJoin, float strokeLineMiter = 4.0f);
method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Dp defaultWidth, androidx.ui.unit.Dp defaultHeight, float viewportWidth = -1.0f, float viewportHeight = -1.0f, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
- method public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method public static androidx.ui.core.Modifier drawVector(androidx.ui.core.Modifier, androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
}
public final class VectorGroup extends androidx.ui.graphics.vector.VectorNode implements java.lang.Iterable<androidx.ui.graphics.vector.VectorNode> kotlin.jvm.internal.markers.KMappedMarker {
diff --git a/ui/ui-framework/api/current.txt b/ui/ui-framework/api/current.txt
index c6d345b..3d39543 100644
--- a/ui/ui-framework/api/current.txt
+++ b/ui/ui-framework/api/current.txt
@@ -10,8 +10,10 @@
package androidx.ui.core {
public final class ClipKt {
- method public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
- method public static androidx.ui.core.Modifier getDrawClipToBounds();
+ method public static androidx.ui.core.Modifier clip(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier clipToBounds(androidx.ui.core.Modifier);
+ method @Deprecated public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
+ method @Deprecated public static androidx.ui.core.Modifier getDrawClipToBounds();
}
public final class CoreTextFieldKt {
@@ -30,7 +32,8 @@
}
public final class DrawShadowKt {
- method public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method @Deprecated public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method public static androidx.ui.core.Modifier drawShadow(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
}
public enum DropDownAlignment {
@@ -48,7 +51,7 @@
}
public final class LayoutTag implements androidx.ui.core.LayoutTagParentData androidx.ui.core.ParentDataModifier {
- ctor public LayoutTag(Object tag);
+ ctor @Deprecated public LayoutTag(Object tag);
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
@@ -57,6 +60,7 @@
public final class LayoutTagKt {
method public static Object? getTag(androidx.ui.core.Measurable);
+ method public static androidx.ui.core.Modifier tag(androidx.ui.core.Modifier, Object tag);
}
public interface LayoutTagParentData {
@@ -65,11 +69,13 @@
}
public final class OpacityKt {
- method public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
+ method public static androidx.ui.core.Modifier drawOpacity(androidx.ui.core.Modifier, @FloatRange(from=0.0, to=1.0) float opacity);
+ method @Deprecated public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
}
public final class PainterModifierKt {
- method public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method @Deprecated public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method public static androidx.ui.core.Modifier paint(androidx.ui.core.Modifier, androidx.ui.graphics.painter.Painter painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
}
public final class ParentDataKt {
@@ -394,7 +400,8 @@
method public static void Group(androidx.ui.graphics.vector.VectorScope, String name = "", float rotation = 0.0f, float pivotX = 0.0f, float pivotY = 0.0f, float scaleX = 1.0f, float scaleY = 1.0f, float translationX = 0.0f, float translationY = 0.0f, java.util.List<? extends androidx.ui.graphics.vector.PathNode> clipPathData = EmptyPath, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.vector.VectorScope,kotlin.Unit> children);
method public static void Path(androidx.ui.graphics.vector.VectorScope, java.util.List<? extends androidx.ui.graphics.vector.PathNode> pathData, String name = "", androidx.ui.graphics.Brush? fill = null, float fillAlpha = 1.0f, androidx.ui.graphics.Brush? stroke = null, float strokeAlpha = 1.0f, float strokeLineWidth = 0.0f, androidx.ui.graphics.StrokeCap strokeLineCap = DefaultStrokeLineCap, androidx.ui.graphics.StrokeJoin strokeLineJoin = DefaultStrokeLineJoin, float strokeLineMiter = 4.0f);
method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Dp defaultWidth, androidx.ui.unit.Dp defaultHeight, float viewportWidth = -1.0f, float viewportHeight = -1.0f, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
- method public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method public static androidx.ui.core.Modifier drawVector(androidx.ui.core.Modifier, androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
}
public final class VectorGroup extends androidx.ui.graphics.vector.VectorNode implements java.lang.Iterable<androidx.ui.graphics.vector.VectorNode> kotlin.jvm.internal.markers.KMappedMarker {
diff --git a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev08.txt b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev08.txt
index c6d345b..3d39543 100644
--- a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev08.txt
+++ b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev08.txt
@@ -10,8 +10,10 @@
package androidx.ui.core {
public final class ClipKt {
- method public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
- method public static androidx.ui.core.Modifier getDrawClipToBounds();
+ method public static androidx.ui.core.Modifier clip(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier clipToBounds(androidx.ui.core.Modifier);
+ method @Deprecated public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
+ method @Deprecated public static androidx.ui.core.Modifier getDrawClipToBounds();
}
public final class CoreTextFieldKt {
@@ -30,7 +32,8 @@
}
public final class DrawShadowKt {
- method public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method @Deprecated public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method public static androidx.ui.core.Modifier drawShadow(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
}
public enum DropDownAlignment {
@@ -48,7 +51,7 @@
}
public final class LayoutTag implements androidx.ui.core.LayoutTagParentData androidx.ui.core.ParentDataModifier {
- ctor public LayoutTag(Object tag);
+ ctor @Deprecated public LayoutTag(Object tag);
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
@@ -57,6 +60,7 @@
public final class LayoutTagKt {
method public static Object? getTag(androidx.ui.core.Measurable);
+ method public static androidx.ui.core.Modifier tag(androidx.ui.core.Modifier, Object tag);
}
public interface LayoutTagParentData {
@@ -65,11 +69,13 @@
}
public final class OpacityKt {
- method public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
+ method public static androidx.ui.core.Modifier drawOpacity(androidx.ui.core.Modifier, @FloatRange(from=0.0, to=1.0) float opacity);
+ method @Deprecated public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
}
public final class PainterModifierKt {
- method public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method @Deprecated public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method public static androidx.ui.core.Modifier paint(androidx.ui.core.Modifier, androidx.ui.graphics.painter.Painter painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
}
public final class ParentDataKt {
@@ -394,7 +400,8 @@
method public static void Group(androidx.ui.graphics.vector.VectorScope, String name = "", float rotation = 0.0f, float pivotX = 0.0f, float pivotY = 0.0f, float scaleX = 1.0f, float scaleY = 1.0f, float translationX = 0.0f, float translationY = 0.0f, java.util.List<? extends androidx.ui.graphics.vector.PathNode> clipPathData = EmptyPath, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.vector.VectorScope,kotlin.Unit> children);
method public static void Path(androidx.ui.graphics.vector.VectorScope, java.util.List<? extends androidx.ui.graphics.vector.PathNode> pathData, String name = "", androidx.ui.graphics.Brush? fill = null, float fillAlpha = 1.0f, androidx.ui.graphics.Brush? stroke = null, float strokeAlpha = 1.0f, float strokeLineWidth = 0.0f, androidx.ui.graphics.StrokeCap strokeLineCap = DefaultStrokeLineCap, androidx.ui.graphics.StrokeJoin strokeLineJoin = DefaultStrokeLineJoin, float strokeLineMiter = 4.0f);
method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Dp defaultWidth, androidx.ui.unit.Dp defaultHeight, float viewportWidth = -1.0f, float viewportHeight = -1.0f, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
- method public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method public static androidx.ui.core.Modifier drawVector(androidx.ui.core.Modifier, androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
}
public final class VectorGroup extends androidx.ui.graphics.vector.VectorNode implements java.lang.Iterable<androidx.ui.graphics.vector.VectorNode> kotlin.jvm.internal.markers.KMappedMarker {
diff --git a/ui/ui-framework/api/public_plus_experimental_current.txt b/ui/ui-framework/api/public_plus_experimental_current.txt
index c6d345b..3d39543 100644
--- a/ui/ui-framework/api/public_plus_experimental_current.txt
+++ b/ui/ui-framework/api/public_plus_experimental_current.txt
@@ -10,8 +10,10 @@
package androidx.ui.core {
public final class ClipKt {
- method public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
- method public static androidx.ui.core.Modifier getDrawClipToBounds();
+ method public static androidx.ui.core.Modifier clip(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier clipToBounds(androidx.ui.core.Modifier);
+ method @Deprecated public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
+ method @Deprecated public static androidx.ui.core.Modifier getDrawClipToBounds();
}
public final class CoreTextFieldKt {
@@ -30,7 +32,8 @@
}
public final class DrawShadowKt {
- method public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method @Deprecated public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method public static androidx.ui.core.Modifier drawShadow(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
}
public enum DropDownAlignment {
@@ -48,7 +51,7 @@
}
public final class LayoutTag implements androidx.ui.core.LayoutTagParentData androidx.ui.core.ParentDataModifier {
- ctor public LayoutTag(Object tag);
+ ctor @Deprecated public LayoutTag(Object tag);
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
@@ -57,6 +60,7 @@
public final class LayoutTagKt {
method public static Object? getTag(androidx.ui.core.Measurable);
+ method public static androidx.ui.core.Modifier tag(androidx.ui.core.Modifier, Object tag);
}
public interface LayoutTagParentData {
@@ -65,11 +69,13 @@
}
public final class OpacityKt {
- method public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
+ method public static androidx.ui.core.Modifier drawOpacity(androidx.ui.core.Modifier, @FloatRange(from=0.0, to=1.0) float opacity);
+ method @Deprecated public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
}
public final class PainterModifierKt {
- method public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method @Deprecated public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method public static androidx.ui.core.Modifier paint(androidx.ui.core.Modifier, androidx.ui.graphics.painter.Painter painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
}
public final class ParentDataKt {
@@ -394,7 +400,8 @@
method public static void Group(androidx.ui.graphics.vector.VectorScope, String name = "", float rotation = 0.0f, float pivotX = 0.0f, float pivotY = 0.0f, float scaleX = 1.0f, float scaleY = 1.0f, float translationX = 0.0f, float translationY = 0.0f, java.util.List<? extends androidx.ui.graphics.vector.PathNode> clipPathData = EmptyPath, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.vector.VectorScope,kotlin.Unit> children);
method public static void Path(androidx.ui.graphics.vector.VectorScope, java.util.List<? extends androidx.ui.graphics.vector.PathNode> pathData, String name = "", androidx.ui.graphics.Brush? fill = null, float fillAlpha = 1.0f, androidx.ui.graphics.Brush? stroke = null, float strokeAlpha = 1.0f, float strokeLineWidth = 0.0f, androidx.ui.graphics.StrokeCap strokeLineCap = DefaultStrokeLineCap, androidx.ui.graphics.StrokeJoin strokeLineJoin = DefaultStrokeLineJoin, float strokeLineMiter = 4.0f);
method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Dp defaultWidth, androidx.ui.unit.Dp defaultHeight, float viewportWidth = -1.0f, float viewportHeight = -1.0f, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
- method public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method public static androidx.ui.core.Modifier drawVector(androidx.ui.core.Modifier, androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
}
public final class VectorGroup extends androidx.ui.graphics.vector.VectorNode implements java.lang.Iterable<androidx.ui.graphics.vector.VectorNode> kotlin.jvm.internal.markers.KMappedMarker {
diff --git a/ui/ui-framework/api/restricted_0.1.0-dev08.txt b/ui/ui-framework/api/restricted_0.1.0-dev08.txt
index f7061a6..640aed0 100644
--- a/ui/ui-framework/api/restricted_0.1.0-dev08.txt
+++ b/ui/ui-framework/api/restricted_0.1.0-dev08.txt
@@ -10,8 +10,10 @@
package androidx.ui.core {
public final class ClipKt {
- method public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
- method public static androidx.ui.core.Modifier getDrawClipToBounds();
+ method public static androidx.ui.core.Modifier clip(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier clipToBounds(androidx.ui.core.Modifier);
+ method @Deprecated public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
+ method @Deprecated public static androidx.ui.core.Modifier getDrawClipToBounds();
}
public final class CoreTextFieldKt {
@@ -30,7 +32,8 @@
}
public final class DrawShadowKt {
- method public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method @Deprecated public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method public static androidx.ui.core.Modifier drawShadow(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
}
public enum DropDownAlignment {
@@ -48,7 +51,7 @@
}
public final class LayoutTag implements androidx.ui.core.LayoutTagParentData androidx.ui.core.ParentDataModifier {
- ctor public LayoutTag(Object tag);
+ ctor @Deprecated public LayoutTag(Object tag);
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
@@ -57,6 +60,7 @@
public final class LayoutTagKt {
method public static Object? getTag(androidx.ui.core.Measurable);
+ method public static androidx.ui.core.Modifier tag(androidx.ui.core.Modifier, Object tag);
}
public interface LayoutTagParentData {
@@ -65,11 +69,13 @@
}
public final class OpacityKt {
- method public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
+ method public static androidx.ui.core.Modifier drawOpacity(androidx.ui.core.Modifier, @FloatRange(from=0.0, to=1.0) float opacity);
+ method @Deprecated public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
}
public final class PainterModifierKt {
- method public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method @Deprecated public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method public static androidx.ui.core.Modifier paint(androidx.ui.core.Modifier, androidx.ui.graphics.painter.Painter painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
}
public final class ParentDataKt {
@@ -394,7 +400,8 @@
method public static void Group(androidx.ui.graphics.vector.VectorScope, String name = "", float rotation = 0.0f, float pivotX = 0.0f, float pivotY = 0.0f, float scaleX = 1.0f, float scaleY = 1.0f, float translationX = 0.0f, float translationY = 0.0f, java.util.List<? extends androidx.ui.graphics.vector.PathNode> clipPathData = EmptyPath, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.vector.VectorScope,kotlin.Unit> children);
method public static void Path(androidx.ui.graphics.vector.VectorScope, java.util.List<? extends androidx.ui.graphics.vector.PathNode> pathData, String name = "", androidx.ui.graphics.Brush? fill = null, float fillAlpha = 1.0f, androidx.ui.graphics.Brush? stroke = null, float strokeAlpha = 1.0f, float strokeLineWidth = 0.0f, androidx.ui.graphics.StrokeCap strokeLineCap = DefaultStrokeLineCap, androidx.ui.graphics.StrokeJoin strokeLineJoin = DefaultStrokeLineJoin, float strokeLineMiter = 4.0f);
method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Dp defaultWidth, androidx.ui.unit.Dp defaultHeight, float viewportWidth = -1.0f, float viewportHeight = -1.0f, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
- method public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method public static androidx.ui.core.Modifier drawVector(androidx.ui.core.Modifier, androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
}
public final class VectorGroup extends androidx.ui.graphics.vector.VectorNode implements java.lang.Iterable<androidx.ui.graphics.vector.VectorNode> kotlin.jvm.internal.markers.KMappedMarker {
diff --git a/ui/ui-framework/api/restricted_current.txt b/ui/ui-framework/api/restricted_current.txt
index f7061a6..640aed0 100644
--- a/ui/ui-framework/api/restricted_current.txt
+++ b/ui/ui-framework/api/restricted_current.txt
@@ -10,8 +10,10 @@
package androidx.ui.core {
public final class ClipKt {
- method public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
- method public static androidx.ui.core.Modifier getDrawClipToBounds();
+ method public static androidx.ui.core.Modifier clip(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape);
+ method public static androidx.ui.core.Modifier clipToBounds(androidx.ui.core.Modifier);
+ method @Deprecated public static androidx.ui.core.Modifier drawClip(androidx.ui.graphics.Shape shape);
+ method @Deprecated public static androidx.ui.core.Modifier getDrawClipToBounds();
}
public final class CoreTextFieldKt {
@@ -30,7 +32,8 @@
}
public final class DrawShadowKt {
- method public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method @Deprecated public static androidx.ui.core.Modifier drawShadow(androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
+ method public static androidx.ui.core.Modifier drawShadow(androidx.ui.core.Modifier, androidx.ui.graphics.Shape shape, androidx.ui.unit.Dp elevation, boolean clipToOutline = true, @FloatRange(from=0.0, to=1.0) float opacity = 1f);
}
public enum DropDownAlignment {
@@ -48,7 +51,7 @@
}
public final class LayoutTag implements androidx.ui.core.LayoutTagParentData androidx.ui.core.ParentDataModifier {
- ctor public LayoutTag(Object tag);
+ ctor @Deprecated public LayoutTag(Object tag);
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
@@ -57,6 +60,7 @@
public final class LayoutTagKt {
method public static Object? getTag(androidx.ui.core.Measurable);
+ method public static androidx.ui.core.Modifier tag(androidx.ui.core.Modifier, Object tag);
}
public interface LayoutTagParentData {
@@ -65,11 +69,13 @@
}
public final class OpacityKt {
- method public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
+ method public static androidx.ui.core.Modifier drawOpacity(androidx.ui.core.Modifier, @FloatRange(from=0.0, to=1.0) float opacity);
+ method @Deprecated public static androidx.ui.core.Modifier drawOpacity(@FloatRange(from=0.0, to=1.0) float opacity);
}
public final class PainterModifierKt {
- method public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method @Deprecated public static androidx.ui.core.DrawModifier asModifier(androidx.ui.graphics.painter.Painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
+ method public static androidx.ui.core.Modifier paint(androidx.ui.core.Modifier, androidx.ui.graphics.painter.Painter painter, boolean sizeToIntrinsics = true, androidx.ui.core.Alignment alignment = Alignment.Center, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, boolean rtl = false);
}
public final class ParentDataKt {
@@ -394,7 +400,8 @@
method public static void Group(androidx.ui.graphics.vector.VectorScope, String name = "", float rotation = 0.0f, float pivotX = 0.0f, float pivotY = 0.0f, float scaleX = 1.0f, float scaleY = 1.0f, float translationX = 0.0f, float translationY = 0.0f, java.util.List<? extends androidx.ui.graphics.vector.PathNode> clipPathData = EmptyPath, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.vector.VectorScope,kotlin.Unit> children);
method public static void Path(androidx.ui.graphics.vector.VectorScope, java.util.List<? extends androidx.ui.graphics.vector.PathNode> pathData, String name = "", androidx.ui.graphics.Brush? fill = null, float fillAlpha = 1.0f, androidx.ui.graphics.Brush? stroke = null, float strokeAlpha = 1.0f, float strokeLineWidth = 0.0f, androidx.ui.graphics.StrokeCap strokeLineCap = DefaultStrokeLineCap, androidx.ui.graphics.StrokeJoin strokeLineJoin = DefaultStrokeLineJoin, float strokeLineMiter = 4.0f);
method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Dp defaultWidth, androidx.ui.unit.Dp defaultHeight, float viewportWidth = -1.0f, float viewportHeight = -1.0f, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
- method public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method @Deprecated public static androidx.ui.core.Modifier drawVector(androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
+ method public static androidx.ui.core.Modifier drawVector(androidx.ui.core.Modifier, androidx.ui.unit.Px defaultWidth, androidx.ui.unit.Px defaultHeight, float viewportWidth = defaultWidth.value, float viewportHeight = defaultHeight.value, androidx.ui.graphics.Color tintColor = DefaultTintColor, androidx.ui.graphics.BlendMode tintBlendMode = DefaultTintBlendMode, androidx.ui.core.Alignment alignment = androidx.ui.graphics.vector.VectorComposeKt.DefaultAlignment, androidx.ui.graphics.ScaleFit scaleFit = ScaleFit.Fit, String name = "", kotlin.jvm.functions.Function3<? super androidx.ui.graphics.vector.VectorScope,? super java.lang.Float,? super java.lang.Float,kotlin.Unit> children);
}
public final class VectorGroup extends androidx.ui.graphics.vector.VectorNode implements java.lang.Iterable<androidx.ui.graphics.vector.VectorNode> kotlin.jvm.internal.markers.KMappedMarker {
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/AnimationGestureSemanticsDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/AnimationGestureSemanticsDemo.kt
index be3ae5c..6b543dd 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/AnimationGestureSemanticsDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/AnimationGestureSemanticsDemo.kt
@@ -28,7 +28,7 @@
import androidx.ui.geometry.Offset
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.min
@@ -197,7 +197,7 @@
Transition(definition = transitionDefinition, toState = animationEndState) { state ->
val color = state[colorKey]
val sizeRatio = state[sizeKey]
- Canvas(modifier = modifier + LayoutSize.Fill) {
+ Canvas(modifier = modifier.fillMaxSize()) {
drawCircle(
center = Offset(size.width.value / 2, size.height.value / 2),
radius = min(size.height, size.width).value * sizeRatio / 2,
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/MultipleCollect.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/MultipleCollect.kt
index f7891f1..fa9b768 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/MultipleCollect.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/MultipleCollect.kt
@@ -21,11 +21,11 @@
import androidx.compose.Composable
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
+import androidx.ui.core.Modifier
import androidx.ui.core.tag
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import androidx.ui.unit.ipx
@Composable
@@ -35,8 +35,8 @@
content: @Composable() () -> Unit
) {
Layout({
- Box(LayoutTag("header"), children = header)
- Box(LayoutTag("footer"), children = footer)
+ Box(Modifier.tag("header"), children = header)
+ Box(Modifier.tag("footer"), children = footer)
content()
}) { measurables, constraints, _ ->
val headerPlaceable = measurables.first { it.tag == "header" }.measure(
@@ -70,13 +70,13 @@
@Composable
fun MultipleCollectTest() {
val header = @Composable {
- Box(LayoutSize.Fill, backgroundColor = Color(android.graphics.Color.GRAY))
+ Box(Modifier.fillMaxSize(), backgroundColor = Color(android.graphics.Color.GRAY))
}
val footer = @Composable {
- Box(LayoutSize.Fill, backgroundColor = Color(android.graphics.Color.BLUE))
+ Box(Modifier.fillMaxSize(), backgroundColor = Color(android.graphics.Color.BLUE))
}
HeaderFooterLayout(header = header, footer = footer) {
- Box(LayoutSize.Fill, backgroundColor = Color(android.graphics.Color.GREEN))
- Box(LayoutSize.Fill, backgroundColor = Color(android.graphics.Color.YELLOW))
+ Box(Modifier.fillMaxSize(), backgroundColor = Color(android.graphics.Color.GREEN))
+ Box(Modifier.fillMaxSize(), backgroundColor = Color(android.graphics.Color.YELLOW))
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/PopupDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/PopupDemo.kt
index 8fba8dd6..c1c2e25 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/PopupDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/PopupDemo.kt
@@ -28,22 +28,24 @@
import androidx.ui.foundation.Box
import androidx.ui.foundation.Clickable
import androidx.ui.foundation.ContentGravity
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
+import androidx.ui.foundation.drawBackground
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
import androidx.ui.input.ImeAction
import androidx.ui.input.KeyboardType
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.ColumnScope
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.text.TextStyle
import androidx.ui.text.style.TextAlign
import androidx.ui.unit.Dp
@@ -56,7 +58,7 @@
Column {
Row(
- LayoutWidth.Fill + LayoutGravity.Center,
+ Modifier.fillMaxWidth().gravity(ColumnAlign.Center),
arrangement = Arrangement.SpaceBetween
) {
this@Column.ClickableTextWithBackground(
@@ -73,7 +75,7 @@
)
Box(
- modifier = LayoutWeight(1f),
+ modifier = Modifier.weight(1f),
gravity = ContentGravity.Center
) {
val description: String = {
@@ -131,12 +133,12 @@
private fun ColumnScope.PopupToggle() {
val showPopup = state { true }
- Column(LayoutGravity.Center) {
- Box(LayoutSize(100.dp)) {
+ Column(Modifier.gravity(ColumnAlign.Center)) {
+ Box(Modifier.preferredSize(100.dp)) {
if (showPopup.value) {
Popup(alignment = Alignment.Center) {
Box(
- LayoutSize(70.dp),
+ Modifier.preferredSize(70.dp),
backgroundColor = Color.Green,
shape = CircleShape,
gravity = ContentGravity.Center
@@ -162,14 +164,14 @@
@Composable
private fun ColumnScope.PopupWithChangingContent() {
- Column(LayoutGravity.Center) {
+ Column(Modifier.gravity(ColumnAlign.Center)) {
val heightSize = 120.dp
val widthSize = 160.dp
val popupContentState = state { 0 }
val totalContentExamples = 2
val popupCounter = state { 0 }
- Box(LayoutSize(widthSize, heightSize), backgroundColor = Color.Gray) {
+ Box(Modifier.preferredSize(widthSize, heightSize), backgroundColor = Color.Gray) {
Popup(Alignment.Center) {
when (popupContentState.value % totalContentExamples) {
0 -> ClickableTextWithBackground(
@@ -180,7 +182,7 @@
}
)
1 -> Box(
- LayoutSize(60.dp, 40.dp),
+ Modifier.preferredSize(60.dp, 40.dp),
backgroundColor = Color.Blue,
shape = CircleShape
)
@@ -188,7 +190,7 @@
}
}
- Spacer(LayoutHeight(10.dp))
+ Spacer(Modifier.preferredHeight(10.dp))
ClickableTextWithBackground(
text = "Change content",
color = Color.Cyan,
@@ -208,15 +210,21 @@
val parentHeight = state { 60.dp }
val parentSizeChanged = state { false }
- Column(LayoutGravity.Center) {
- Box(LayoutSize(containerWidth, containerHeight), gravity = parentGravity.value) {
- Box(LayoutSize(parentWidth.value, parentHeight.value), backgroundColor = Color.Blue) {
+ Column(Modifier.gravity(ColumnAlign.Center)) {
+ Box(
+ Modifier.preferredSize(containerWidth, containerHeight),
+ gravity = parentGravity.value
+ ) {
+ Box(
+ Modifier.preferredSize(parentWidth.value, parentHeight.value),
+ backgroundColor = Color.Blue
+ ) {
Popup(Alignment.BottomCenter) {
- Text("Popup", modifier = DrawBackground(color = Color.Green))
+ Text("Popup", modifier = Modifier.drawBackground(color = Color.Green))
}
}
}
- Spacer(LayoutHeight(10.dp))
+ Spacer(Modifier.preferredHeight(10.dp))
ClickableTextWithBackground(
text = "Change parent's position",
color = Color.Cyan,
@@ -228,7 +236,7 @@
ContentGravity.TopStart
}
)
- Spacer(LayoutHeight(10.dp))
+ Spacer(Modifier.preferredHeight(10.dp))
ClickableTextWithBackground(
text = "Change parent's size",
color = Color.Cyan,
@@ -248,7 +256,7 @@
@Composable
private fun ColumnScope.PopupDropdownAlignment() {
- Column(LayoutGravity.Center) {
+ Column(Modifier.gravity(ColumnAlign.Center)) {
val heightSize = 120.dp
val widthSize = 160.dp
val dropDownAlignment = state { DropDownAlignment.Left }
@@ -266,11 +274,11 @@
}
)
- Spacer(LayoutHeight(10.dp))
+ Spacer(Modifier.preferredHeight(10.dp))
- Box(LayoutSize(widthSize, heightSize), backgroundColor = Color.Gray) {
+ Box(Modifier.preferredSize(widthSize, heightSize), backgroundColor = Color.Gray) {
DropdownPopup(dropDownAlignment = dropDownAlignment.value) {
- Box(LayoutSize(40.dp, 70.dp), backgroundColor = Color.Blue)
+ Box(Modifier.preferredSize(40.dp, 70.dp), backgroundColor = Color.Blue)
}
}
}
@@ -278,13 +286,13 @@
@Composable
private fun ColumnScope.PopupAlignmentDemo() {
- Column(LayoutGravity.Center) {
+ Column(Modifier.gravity(ColumnAlign.Center)) {
val heightSize = 200.dp
val widthSize = 400.dp
val counter = state { 0 }
val popupAlignment = state { Alignment.TopStart }
Box(
- modifier = LayoutSize(widthSize, heightSize),
+ modifier = Modifier.preferredSize(widthSize, heightSize),
backgroundColor = Color.Red,
gravity = ContentGravity.BottomCenter
) {
@@ -310,9 +318,9 @@
}
}
- Spacer(LayoutHeight(10.dp))
+ Spacer(Modifier.preferredHeight(10.dp))
Text(
- modifier = LayoutGravity.Center + DrawBackground(color = Color.White),
+ modifier = Modifier.gravity(ColumnAlign.Center).drawBackground(color = Color.White),
text = "Alignment : " + popupAlignment.value.toString()
)
}
@@ -320,7 +328,7 @@
@Composable
private fun ColumnScope.PopupWithEditText() {
- Column(LayoutGravity.Center) {
+ Column(Modifier.gravity(ColumnAlign.Center)) {
val widthSize = 190.dp
val heightSize = 120.dp
val editLineSize = 150.dp
@@ -333,7 +341,7 @@
Text(text = showEmail.value)
Box(
- modifier = LayoutSize(widthSize, heightSize) + LayoutGravity.Center,
+ modifier = Modifier.preferredSize(widthSize, heightSize).gravity(ColumnAlign.Center),
backgroundColor = Color.Red
) {
if (showPopup.value) {
@@ -348,7 +356,7 @@
)
) {
EditLine(
- modifier = LayoutWidth(editLineSize),
+ modifier = Modifier.preferredWidth(editLineSize),
initialText = "",
color = Color.White,
>
@@ -363,30 +371,30 @@
@Composable
private fun ColumnScope.PopupWithChangingSize() {
- Column(LayoutGravity.Center) {
+ Column(Modifier.gravity(ColumnAlign.Center)) {
val showPopup = state { true }
val heightSize = 120.dp
val widthSize = 160.dp
val rectangleState = state { 0 }
- Spacer(LayoutHeight(15.dp))
+ Spacer(Modifier.preferredHeight(15.dp))
Box(
- modifier = LayoutSize(widthSize, heightSize),
+ modifier = Modifier.preferredSize(widthSize, heightSize),
backgroundColor = Color.Magenta
) {
if (showPopup.value) {
Popup(Alignment.Center) {
val size = when (rectangleState.value % 4) {
- 0 -> LayoutSize(30.dp)
- 1 -> LayoutSize(100.dp)
- 2 -> LayoutSize(30.dp, 90.dp)
- else -> LayoutSize(90.dp, 30.dp)
+ 0 -> Modifier.preferredSize(30.dp)
+ 1 -> Modifier.preferredSize(100.dp)
+ 2 -> Modifier.preferredSize(30.dp, 90.dp)
+ else -> Modifier.preferredSize(90.dp, 30.dp)
}
Box(modifier = size, backgroundColor = Color.Gray)
}
}
}
- Spacer(LayoutHeight(25.dp))
+ Spacer(Modifier.preferredHeight(25.dp))
ClickableTextWithBackground(
text = "Change size",
color = Color.Cyan,
@@ -399,10 +407,12 @@
@Composable
private fun ColumnScope.PopupInsideScroller() {
- VerticalScroller(modifier = LayoutSize(200.dp, 400.dp) + LayoutGravity.Center) {
- Column(LayoutHeight.Fill) {
+ VerticalScroller(
+ modifier = Modifier.preferredSize(200.dp, 400.dp).gravity(ColumnAlign.Center)
+ ) {
+ Column(Modifier.fillMaxHeight()) {
Box(
- modifier = LayoutWidth(80.dp) + LayoutHeight(160.dp),
+ modifier = Modifier.preferredSize(80.dp, 160.dp),
backgroundColor = Color(0xFF00FF00)
) {
Popup(alignment = Alignment.Center) {
@@ -411,7 +421,7 @@
}
for (i in 0..30) {
- Text(text = "Scroll #$i", modifier = LayoutGravity.Center)
+ Text(text = "Scroll #$i", modifier = Modifier.gravity(ColumnAlign.Center))
}
}
}
@@ -423,10 +433,10 @@
val widthSize = 190.dp
val heightSize = 120.dp
- Spacer(LayoutHeight(350.dp))
+ Spacer(Modifier.preferredHeight(350.dp))
Text("Start typing in the EditText below the parent(Red rectangle)")
Box(
- modifier = LayoutWidth(widthSize) + LayoutHeight(heightSize) + LayoutGravity.Center,
+ modifier = Modifier.preferredSize(widthSize, heightSize).gravity(ColumnAlign.Center),
backgroundColor = Color.Red
) {
Popup(Alignment.Center) {
@@ -438,7 +448,7 @@
EditLine(initialText = "Continue typing...", color = Color.Gray)
- Spacer(LayoutHeight(24.dp))
+ Spacer(Modifier.preferredHeight(24.dp))
}
}
@@ -450,7 +460,7 @@
padding: Dp = 0.dp
) {
Clickable( ?: {}, enabled = onClick != null) {
- Box(LayoutGravity.Center, backgroundColor = color, padding = padding) {
+ Box(Modifier.gravity(ColumnAlign.Center), backgroundColor = color, padding = padding) {
Text(text)
}
}
@@ -468,7 +478,7 @@
val state = state { initialText }
TextField(
value = state.value,
- modifier = modifier + DrawBackground(color = color),
+ modifier = modifier.drawBackground(color = color),
keyboardType = keyboardType,
imeAction = imeAction,
>
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt
index 95ff299..fedc87e 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/SemanticsL1.kt
@@ -18,17 +18,18 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.PressIndicatorGestureDetector
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.Text
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredSize
import androidx.ui.material.Button
import androidx.ui.material.MaterialTheme
import androidx.ui.unit.PxPosition
@@ -163,7 +164,7 @@
actions: Set<SemanticAction<out Any?>> = setOf(),
children: @Composable() () -> Unit
) {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
MaterialTheme {
Collapsable {
InvokeActionsByType(actions)
@@ -172,9 +173,9 @@
InvokeActionsByParameters(actions)
}
}
- Row(LayoutWidth.Fill, arrangement = Arrangement.Center) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.Center) {
Box(
- LayoutGravity.Center + LayoutSize(500.dp, 300.dp),
+ Modifier.gravity(RowAlign.Center).preferredSize(500.dp, 300.dp),
gravity = ContentGravity.Center,
children = children
)
@@ -191,7 +192,7 @@
val secondary =
actions.firstOrNull { it.types.contains(AccessibilityAction.Secondary) }
Text(text = "Accessibility Actions By Type", style = MaterialTheme.typography.h6)
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
Button( primary?.invoke(ActionCaller.Accessibility) }) {
Text("Primary")
}
@@ -210,7 +211,7 @@
text = "Accessibility Actions By Phrase",
style = MaterialTheme.typography.h6
)
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
actions.forEach {
Button( it.invoke(ActionCaller.Accessibility) }) {
Text(it.phrase)
@@ -227,7 +228,7 @@
val positive = actions.firstOrNull { it.types.contains(PolarityAction.Positive) }
val negative = actions.firstOrNull { it.types.contains(PolarityAction.Negative) }
Text(text = "Assistant Actions", style = MaterialTheme.typography.h6)
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
Button( negative?.invoke(ActionCaller.Assistant) }) {
Text("Negative")
}
@@ -251,7 +252,7 @@
val unitAction =
actions.firstOrNull { it.defaultParam is Unit } as SemanticAction<Unit>?
Text(text = "Actions using Parameters", style = MaterialTheme.typography.h6)
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
Button( pxPositionAction?.invoke(param = PxPosition(1.px, 1.px)) }) {
Text("IntAction")
}
@@ -275,7 +276,7 @@
val collapsedState = state { CollapseMode.Collapsed }
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
Button(>
collapsedState.value = when (collapsedState.value) {
CollapseMode.Collapsed -> CollapseMode.Visible
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsDemo.kt
index d1307a0..1827cce 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsDemo.kt
@@ -17,6 +17,8 @@
package androidx.ui.framework.demos
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Image
import androidx.ui.graphics.Color
import androidx.ui.graphics.HorizontalGradient
@@ -33,8 +35,8 @@
import androidx.ui.graphics.vector.VectorPainter
import androidx.ui.graphics.vector.VectorScope
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.res.loadVectorResource
import androidx.ui.unit.Dp
import androidx.ui.unit.Px
@@ -42,19 +44,19 @@
@Composable
fun VectorGraphicsDemo() {
- Column(modifier = LayoutAlign.Center) {
+ Column(modifier = Modifier.wrapContentSize(Alignment.Center)) {
val vectorAsset = loadVectorResource(R.drawable.ic_crane)
vectorAsset.resource.resource?.let {
Image(
asset = it,
- modifier = LayoutSize(200.dp, 200.dp),
+ modifier = Modifier.preferredSize(200.dp, 200.dp),
scaleFit = ScaleFit.FillMinDimension
)
}
Image(
painter = vectorShape(120.dp, 120.dp),
- modifier = LayoutSize(200.dp, 150.dp)
+ modifier = Modifier.preferredSize(200.dp, 150.dp)
)
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/autofill/ExplicitAutofillTypesDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/autofill/ExplicitAutofillTypesDemo.kt
index 80be702..af2aea6 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/autofill/ExplicitAutofillTypesDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/autofill/ExplicitAutofillTypesDemo.kt
@@ -24,14 +24,15 @@
import androidx.ui.core.AutofillAmbient
import androidx.ui.core.AutofillTreeAmbient
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.OnChildPositioned
import androidx.ui.foundation.TextField
import androidx.ui.foundation.Text
import androidx.ui.input.ImeAction
import androidx.ui.input.KeyboardType
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
import androidx.ui.layout.Spacer
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.MaterialTheme
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -61,7 +62,7 @@
)
}
- Spacer(LayoutHeight(40.dp))
+ Spacer(Modifier.preferredHeight(40.dp))
Text("Email", style = labelStyle)
Autofill(
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/focus/FocusableDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/focus/FocusableDemo.kt
index 3816a22..e5466dd 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/focus/FocusableDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/focus/FocusableDemo.kt
@@ -17,6 +17,7 @@
package androidx.ui.framework.demos.focus
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.PressIndicatorGestureDetector
import androidx.ui.focus.FocusState.Focused
import androidx.ui.focus.FocusState.NotFocusable
@@ -26,9 +27,9 @@
import androidx.ui.graphics.Color
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.RowScope
+import androidx.ui.layout.fillMaxWidth
import androidx.ui.text.TextStyle
@Composable
@@ -70,5 +71,5 @@
@Composable
private fun CenteredRow(children: @Composable() RowScope.() -> Unit) {
- Row(modifier = LayoutWidth.Fill, arrangement = Arrangement.Center, children = children)
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.Center, children = children)
}
\ No newline at end of file
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DoubleTapGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DoubleTapGestureDetectorDemo.kt
index 6672bff..121e5a0 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DoubleTapGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DoubleTapGestureDetectorDemo.kt
@@ -18,11 +18,14 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.DoubleTapGestureDetector
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -38,10 +41,10 @@
}
Box(
- LayoutSize.Fill +
- LayoutAlign.Center +
- DoubleTapGestureDetector(onDoubleTap) +
- LayoutSize(192.dp),
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(DoubleTapGestureDetector(onDoubleTap))
+ .preferredSize(192.dp),
backgroundColor = color.value,
border = Border(2.dp, BorderColor)
)
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DragScaleGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DragScaleGestureDetectorDemo.kt
index eb0a2f25..8bca91f 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DragScaleGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/DragScaleGestureDetectorDemo.kt
@@ -18,7 +18,9 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.DragGestureDetector
import androidx.ui.core.gesture.DragObserver
import androidx.ui.core.gesture.ScaleGestureDetector
@@ -26,9 +28,10 @@
import androidx.ui.core.gesture.TapGestureDetector
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.offset
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -74,9 +77,11 @@
with(DensityAmbient.current) { offset.value.x.toDp() to offset.value.y.toDp() }
Box(
- LayoutOffset(offsetX, offsetY) +
- LayoutSize.Fill + LayoutAlign.Center + gestures +
- LayoutSize(size.value),
+ Modifier.offset(offsetX, offsetY)
+ .fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(gestures)
+ .preferredSize(size.value),
backgroundColor = Color(0xFFf44336.toInt())
)
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressDragGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressDragGestureDetectorDemo.kt
index faa9dfa..5594a0b 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressDragGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressDragGestureDetectorDemo.kt
@@ -16,17 +16,20 @@
package androidx.ui.framework.demos.gestures
+import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.LongPressDragGestureDetector
import androidx.ui.core.gesture.LongPressDragObserver
import androidx.ui.foundation.Box
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.offset
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
-import androidx.compose.Composable
/**
* Simple demo that shows off TouchSlopDragGestureDetector.
@@ -63,10 +66,11 @@
with(DensityAmbient.current) { offset.value.x.toDp() to offset.value.y.toDp() }
Box(
- LayoutOffset(offsetX, offsetY) +
- LayoutSize.Fill + LayoutAlign.Center +
- LongPressDragGestureDetector(longPressDragObserver) +
- LayoutSize(96.dp),
+ Modifier.offset(offsetX, offsetY)
+ .fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(LongPressDragGestureDetector(longPressDragObserver))
+ .preferredSize(96.dp),
backgroundColor = color.value
)
}
\ No newline at end of file
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressGestureDetectorDemo.kt
index 356dca2..e45282d 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/LongPressGestureDetectorDemo.kt
@@ -18,11 +18,14 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.LongPressGestureDetector
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -38,10 +41,10 @@
}
Box(
- LayoutSize.Fill +
- LayoutAlign.Center +
- LongPressGestureDetector(onLongPress) +
- LayoutSize(192.dp),
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(LongPressGestureDetector(onLongPress))
+ .preferredSize(192.dp),
backgroundColor = color.value,
border = Border(2.dp, BorderColor)
)
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedLongPressDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedLongPressDemo.kt
index 2f084ff..bcc1342 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedLongPressDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedLongPressDemo.kt
@@ -24,8 +24,8 @@
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
import androidx.ui.graphics.compositeOver
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.padding
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -34,9 +34,9 @@
*/
@Composable
fun NestedLongPressDemo() {
- LongPressableContainer(LayoutSize.Fill) {
- LongPressableContainer(LayoutPadding(48.dp) + LayoutSize.Fill) {
- LongPressableContainer(LayoutPadding(48.dp) + LayoutSize.Fill) {}
+ LongPressableContainer(Modifier.fillMaxSize()) {
+ LongPressableContainer(Modifier.padding(48.dp).fillMaxSize()) {
+ LongPressableContainer(Modifier.padding(48.dp).fillMaxSize()) {}
}
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt
index 908d501..632dfbf 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedPressDemo.kt
@@ -27,8 +27,8 @@
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
import androidx.ui.graphics.compositeOver
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.padding
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -37,9 +37,9 @@
*/
@Composable
fun NestedPressDemo() {
- PressableContainer(LayoutSize.Fill) {
- PressableContainer(LayoutPadding(48.dp) + LayoutSize.Fill) {
- PressableContainer(LayoutPadding(48.dp) + LayoutSize.Fill)
+ PressableContainer(Modifier.fillMaxSize()) {
+ PressableContainer(Modifier.padding(48.dp).fillMaxSize()) {
+ PressableContainer(Modifier.padding(48.dp).fillMaxSize())
}
}
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScalingDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScalingDemo.kt
index 8e8284b..f15d578 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScalingDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScalingDemo.kt
@@ -18,12 +18,14 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
import androidx.ui.core.Layout
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.RawScaleGestureDetector
import androidx.ui.core.gesture.RawScaleObserver
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.foundation.drawBackground
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.IntPx
/**
@@ -72,9 +74,9 @@
Layout(
children = children,
- modifier = LayoutAlign.Center +
- RawScaleGestureDetector(outerScaleObserver) +
- DrawBackground(color = color),
+ modifier = Modifier.wrapContentSize(Alignment.Center)
+ .plus(RawScaleGestureDetector(outerScaleObserver))
+ .drawBackground(color = color),
measureBlock = { measurables, constraints, _ ->
val newConstraints =
constraints.copy(
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScrollingDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScrollingDemo.kt
index 13b842b..785e889 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScrollingDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/NestedScrollingDemo.kt
@@ -30,13 +30,13 @@
import androidx.ui.core.gesture.TapGestureDetector
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.DrawBorder
+import androidx.ui.foundation.drawBackground
import androidx.ui.graphics.Canvas
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
@@ -56,7 +56,7 @@
// Outer composable that scrollsAll mea
Draggable {
RepeatingList(repetitions = 3) {
- Box(LayoutHeight(398.dp), padding = 72.dp) {
+ Box(Modifier.preferredHeight(398.dp), padding = 72.dp) {
// Inner composable that scrolls
Draggable {
RepeatingList(repetitions = 5) {
@@ -171,11 +171,11 @@
DoubleTapGestureDetector(onDoubleTap) +
LongPressGestureDetector(onLongPress)
- val layout = LayoutWidth.Fill + LayoutHeight(height)
+ val layout = Modifier.fillMaxWidth().preferredHeight(height)
val pressOverlay =
- if (showPressed.value) DrawBackground(pressedColor) else Modifier.None
- Box(gestureDetectors + layout + DrawBackground(color = color.value) + pressOverlay)
+ if (showPressed.value) Modifier.drawBackground(pressedColor) else Modifier.None
+ Box(gestureDetectors.plus(layout).drawBackground(color.value).plus(pressOverlay))
}
/**
@@ -189,7 +189,7 @@
row()
if (i != repetitions) {
Box(
- LayoutWidth.Fill + LayoutHeight(1.dp),
+ Modifier.fillMaxWidth().preferredHeight(1.dp),
backgroundColor = Color(0f, 0f, 0f, .12f)
)
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PopupDragDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PopupDragDemo.kt
index b997436..6a1841a 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PopupDragDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PopupDragDemo.kt
@@ -20,6 +20,7 @@
import androidx.compose.remember
import androidx.compose.state
import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.Popup
import androidx.ui.core.gesture.DragObserver
import androidx.ui.core.gesture.RawDragGestureDetector
@@ -28,8 +29,8 @@
import androidx.ui.foundation.Text
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.text.TextStyle
import androidx.ui.text.style.TextAlign
import androidx.ui.unit.PxPosition
@@ -54,7 +55,7 @@
Popup(alignment = Alignment.TopStart, offset = offset.value.round()) {
Stack {
Box(
- RawDragGestureDetector(observer) + LayoutSize(70.dp),
+ RawDragGestureDetector(observer) + Modifier.preferredSize(70.dp),
shape = CircleShape,
backgroundColor = Color.Green,
gravity = ContentGravity.Center
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PressIndicatorGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PressIndicatorGestureDetectorDemo.kt
index 5b326b5..65d7214 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PressIndicatorGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/PressIndicatorGestureDetectorDemo.kt
@@ -18,12 +18,15 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.PressIndicatorGestureDetector
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
import androidx.ui.graphics.compositeOver
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -50,10 +53,10 @@
}
Box(
- LayoutSize.Fill +
- LayoutAlign.Center +
- PressIndicatorGestureDetector(onStart, onStop, onStop) +
- LayoutSize(192.dp),
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(PressIndicatorGestureDetector(onStart, onStop, onStop))
+ .preferredSize(192.dp),
backgroundColor = color,
border = Border(2.dp, BorderColor)
)
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/RawDragGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/RawDragGestureDetectorDemo.kt
index 2296397..4f7ae54 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/RawDragGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/RawDragGestureDetectorDemo.kt
@@ -18,13 +18,16 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.DragObserver
import androidx.ui.core.gesture.RawDragGestureDetector
import androidx.ui.foundation.Box
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.offset
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -46,11 +49,11 @@
with(DensityAmbient.current) { offset.value.x.toDp() to offset.value.y.toDp() }
Box(
- LayoutOffset(offsetX, offsetY) +
- LayoutSize.Fill +
- LayoutAlign.Center +
- RawDragGestureDetector(dragObserver) +
- LayoutSize(96.dp),
+ Modifier.offset(offsetX, offsetY)
+ .fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(RawDragGestureDetector(dragObserver))
+ .preferredSize(96.dp),
backgroundColor = Grey
)
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/ScaleGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/ScaleGestureDetectorDemo.kt
index 7b53d83..d8935e0 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/ScaleGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/ScaleGestureDetectorDemo.kt
@@ -18,12 +18,15 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.ScaleGestureDetector
import androidx.ui.core.gesture.ScaleObserver
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.dp
/**
@@ -40,10 +43,10 @@
}
Box(
- LayoutSize.Fill +
- LayoutAlign.Center +
- ScaleGestureDetector(scaleObserver) +
- LayoutSize(size.value),
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(ScaleGestureDetector(scaleObserver))
+ .preferredSize(size.value),
backgroundColor = Color(0xFF9e9e9e.toInt())
)
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TapGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TapGestureDetectorDemo.kt
index 5060e9a..40be1ff 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TapGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TapGestureDetectorDemo.kt
@@ -18,11 +18,14 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.TapGestureDetector
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.dp
/**
@@ -37,7 +40,10 @@
}
Box(
- LayoutSize.Fill + LayoutAlign.Center + TapGestureDetector(onTap) + LayoutSize(192.dp),
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(TapGestureDetector(onTap))
+ .preferredSize(192.dp),
backgroundColor = color.value,
border = Border(2.dp, BorderColor)
)
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopDragGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopDragGestureDetectorDemo.kt
index 8223fe20..5a9360b 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopDragGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopDragGestureDetectorDemo.kt
@@ -18,15 +18,18 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
import androidx.ui.core.Direction
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.DragGestureDetector
import androidx.ui.core.gesture.DragObserver
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.offset
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@@ -101,10 +104,11 @@
with(DensityAmbient.current) { offset.value.x.toDp() to offset.value.y.toDp() }
Box(
- LayoutOffset(offsetX, offsetY) +
- LayoutSize.Fill + LayoutAlign.Center +
- DragGestureDetector(dragObserver, canDrag) +
- LayoutSize(96.dp),
+ Modifier.offset(offsetX, offsetY)
+ .fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(DragGestureDetector(dragObserver, canDrag))
+ .preferredSize(96.dp),
backgroundColor = color
)
}
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopExceededGestureDetectorDemo.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopExceededGestureDetectorDemo.kt
index 3ca9284..e0d2775 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopExceededGestureDetectorDemo.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/gestures/TouchSlopExceededGestureDetectorDemo.kt
@@ -18,12 +18,15 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Alignment
import androidx.ui.core.Direction
+import androidx.ui.core.Modifier
import androidx.ui.core.gesture.TouchSlopExceededGestureDetector
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.dp
/**
@@ -74,10 +77,10 @@
}
Box(
- LayoutSize.Fill +
- LayoutAlign.Center +
- TouchSlopExceededGestureDetector(onTouchSlopExceeded, canDrag) +
- LayoutSize(96.dp),
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .plus(TouchSlopExceededGestureDetector(onTouchSlopExceeded, canDrag))
+ .preferredSize(96.dp),
backgroundColor = color
)
}
diff --git a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/DrawShadowSample.kt b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/DrawShadowSample.kt
index 40be66a..2bbb644 100644
--- a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/DrawShadowSample.kt
+++ b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/DrawShadowSample.kt
@@ -18,14 +18,18 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.core.drawShadow
import androidx.ui.foundation.Box
import androidx.ui.foundation.shape.RectangleShape
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@Composable
fun DrawShadowSample() {
- Box(drawShadow(shape = RectangleShape, elevation = 12.dp) + LayoutSize(100.dp, 100.dp))
+ Box(
+ Modifier.drawShadow(RectangleShape, 12.dp, true, 1f)
+ .preferredSize(100.dp, 100.dp)
+ )
}
diff --git a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/LayoutSample.kt b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/LayoutSample.kt
index cc56696..e6a20e0 100644
--- a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/LayoutSample.kt
+++ b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/LayoutSample.kt
@@ -20,7 +20,7 @@
import androidx.compose.Composable
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
+import androidx.ui.core.Modifier
import androidx.ui.core.tag
import androidx.ui.foundation.Box
import androidx.ui.unit.ipx
@@ -102,8 +102,8 @@
Layout({
// Here the Containers are only needed to apply the modifiers. You could use the
// modifier on header and footer directly if they are composables accepting modifiers.
- Box(LayoutTag("header"), children = header)
- Box(LayoutTag("footer"), children = footer)
+ Box(Modifier.tag("header"), children = header)
+ Box(Modifier.tag("footer"), children = footer)
}) { measurables, constraints, _ ->
val placeables = measurables.map { measurable ->
when (measurable.tag) {
diff --git a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OnPositionedSample.kt b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OnPositionedSample.kt
index 57840b5..4e7bc95 100644
--- a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OnPositionedSample.kt
+++ b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OnPositionedSample.kt
@@ -20,12 +20,13 @@
import androidx.compose.Composable
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
+import androidx.ui.core.Modifier
import androidx.ui.core.OnChildPositioned
import androidx.ui.core.globalPosition
import androidx.ui.core.positionInRoot
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -33,7 +34,7 @@
@Composable
fun OnChildPositionedSample() {
Column {
- Box(LayoutSize(20.dp), backgroundColor = Color.Green)
+ Box(Modifier.preferredSize(20.dp), backgroundColor = Color.Green)
OnChildPositioned( coordinates ->
// This will be the size of the child SizedRectangle.
coordinates.size
@@ -46,7 +47,7 @@
// This will a LayoutCoordinates instance corresponding to the Column.
coordinates.parentCoordinates
}) {
- Box(LayoutSize(20.dp), backgroundColor = Color.Blue)
+ Box(Modifier.preferredSize(20.dp), backgroundColor = Color.Blue)
}
}
}
diff --git a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OpacitySample.kt b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OpacitySample.kt
index 0175759..87ab781 100644
--- a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OpacitySample.kt
+++ b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/OpacitySample.kt
@@ -18,14 +18,15 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.core.drawOpacity
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@Composable
fun OpacitySample() {
- Box(LayoutSize(100.dp) + drawOpacity(opacity = 0.5f), backgroundColor = Color.Red)
+ Box(Modifier.preferredSize(100.dp).drawOpacity(opacity = 0.5f), backgroundColor = Color.Red)
}
diff --git a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PainterSample.kt b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PainterSample.kt
index d5e7f39..1cdbe60 100644
--- a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PainterSample.kt
+++ b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PainterSample.kt
@@ -18,9 +18,10 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
-import androidx.ui.core.asModifier
+import androidx.ui.core.Modifier
+import androidx.ui.core.paint
import androidx.ui.foundation.Box
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.foundation.drawBackground
import androidx.ui.geometry.Offset
import androidx.ui.graphics.BlendMode
import androidx.ui.graphics.Canvas
@@ -28,8 +29,8 @@
import androidx.ui.graphics.ColorFilter
import androidx.ui.graphics.Paint
import androidx.ui.graphics.painter.Painter
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
@@ -65,13 +66,14 @@
}
Box(
- LayoutSize(300.dp) +
- DrawBackground(Color.Gray) +
- LayoutPadding(30.dp) +
- DrawBackground(Color.Yellow) +
- CustomPainter().asModifier(
- alpha = 0.5f,
- colorFilter = ColorFilter(Color.Cyan, BlendMode.srcIn)
- )
+ Modifier.preferredSize(300.dp)
+ .drawBackground(Color.Gray)
+ .padding(30.dp)
+ .drawBackground(Color.Yellow)
+ .paint(
+ CustomPainter(),
+ alpha = 0.5f,
+ colorFilter = ColorFilter(Color.Cyan, BlendMode.srcIn)
+ )
)
}
\ No newline at end of file
diff --git a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PopupSample.kt b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PopupSample.kt
index 5842f5f..499fec0 100644
--- a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PopupSample.kt
+++ b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/PopupSample.kt
@@ -21,11 +21,12 @@
import androidx.ui.core.Alignment
import androidx.ui.core.DropDownAlignment
import androidx.ui.core.DropdownPopup
+import androidx.ui.core.Modifier
import androidx.ui.core.Popup
import androidx.ui.foundation.Box
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@@ -39,7 +40,7 @@
Popup(alignment = Alignment.Center) {
// Draw a rectangle shape with rounded corners inside the popup
Box(
- LayoutSize(popupWidth, popupHeight),
+ Modifier.preferredSize(popupWidth, popupHeight),
shape = RoundedCornerShape(cornerSize),
backgroundColor = Color.White
)
@@ -50,7 +51,7 @@
@Sampled
@Composable
fun DropdownPopupSample() {
- Box(LayoutSize(400.dp, 200.dp)) {
+ Box(Modifier.preferredSize(400.dp, 200.dp)) {
val popupWidth = 200.dp
val popupHeight = 50.dp
val cornerSize = 16.dp
@@ -59,7 +60,7 @@
DropdownPopup(dropDownAlignment = DropDownAlignment.Left) {
// Draw a rectangle shape with rounded corners inside the popup
Box(
- LayoutSize(popupWidth, popupHeight),
+ Modifier.preferredSize(popupWidth, popupHeight),
shape = RoundedCornerShape(cornerSize),
backgroundColor = Color.White
)
diff --git a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt
index dae7fb2..dfe40f8 100644
--- a/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt
+++ b/ui/ui-framework/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt
@@ -19,10 +19,11 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.WithConstraints
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@@ -32,11 +33,11 @@
val rectangleHeight = 100.dp
val threshold = with(DensityAmbient.current) { (rectangleHeight * 2).toIntPx() }
if (constraints.maxHeight < threshold) {
- Box(LayoutSize(50.dp, rectangleHeight), backgroundColor = Color.Blue)
+ Box(Modifier.preferredSize(50.dp, rectangleHeight), backgroundColor = Color.Blue)
} else {
Column {
- Box(LayoutSize(50.dp, rectangleHeight), backgroundColor = Color.Blue)
- Box(LayoutSize(50.dp, rectangleHeight), backgroundColor = Color.Gray)
+ Box(Modifier.preferredSize(50.dp, rectangleHeight), backgroundColor = Color.Blue)
+ Box(Modifier.preferredSize(50.dp, rectangleHeight), backgroundColor = Color.Gray)
}
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/PainterModifierTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/PainterModifierTest.kt
index d48f201..cba0662 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/PainterModifierTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/PainterModifierTest.kt
@@ -25,7 +25,6 @@
import androidx.ui.core.test.AtLeastSize
import androidx.ui.core.test.Padding
import androidx.ui.core.test.background
-
import androidx.ui.core.test.runOnUiThreadIR
import androidx.ui.core.test.waitAndScreenShot
import androidx.ui.framework.test.TestActivity
@@ -44,8 +43,8 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.Px
-import androidx.ui.unit.ipx
import androidx.ui.unit.PxSize
+import androidx.ui.unit.ipx
import androidx.ui.unit.max
import org.junit.Assert
import org.junit.Assert.assertEquals
@@ -170,11 +169,16 @@
// it is to be drawn into
Padding(containerWidth.roundToInt().ipx) {
AtLeastSize(size = containerWidth.roundToInt().ipx,
- modifier = LatchPainter(
- containerWidth * 2,
- containerHeight * 2,
- paintLatch
- ).asModifier(alignment = Alignment.Center, scaleFit = ScaleFit.Fit)) {
+ modifier = Modifier.paint(
+ LatchPainter(
+ containerWidth * 2,
+ containerHeight * 2,
+ paintLatch
+ ),
+ alignment = Alignment.Center,
+ scaleFit = ScaleFit.Fit
+ )
+ ) {
}
}
}
@@ -206,14 +210,16 @@
rule.runOnUiThreadIR {
activity.setContent {
AtLeastSize(size = containerWidth.roundToInt().ipx * 2,
- modifier = background(Color.White) + LatchPainter(
- containerWidth,
- containerHeight,
- paintLatch
- ).asModifier(
+ modifier = background(Color.White).paint(
+ LatchPainter(
+ containerWidth,
+ containerHeight,
+ paintLatch
+ ),
alignment = Alignment.BottomEnd,
- scaleFit = ScaleFit.Fit)
- ) {
+ scaleFit = ScaleFit.Fit
+ )
+ ) {
// Intentionally empty
}
}
@@ -248,7 +254,7 @@
activity.setContent {
NoMinSizeContainer {
NoIntrinsicSizeContainer(
- LatchPainter(containerWidth, containerHeight, paintLatch).asModifier()
+ Modifier.paint(LatchPainter(containerWidth, containerHeight, paintLatch))
) {
// Intentionally empty
}
@@ -285,12 +291,14 @@
FixedSizeModifier(containerWidth.roundToInt().ipx)
) {
NoIntrinsicSizeContainer(
- FixedSizeModifier(containerSize.ipx) +
+ FixedSizeModifier(containerSize.ipx).paint(
LatchPainter(
containerWidth,
containerHeight,
paintLatch
- ).asModifier(alignment = Alignment.TopStart)
+ ),
+ alignment = Alignment.TopStart
+ )
) {
// Intentionally empty
}
@@ -331,13 +339,13 @@
FixedSizeModifier(containerSize.ipx)
) {
NoIntrinsicSizeContainer(
- FixedSizeModifier(containerSize.ipx) +
- LatchPainter
- (
- containerWidth,
- containerHeight,
- paintLatch
- ).asModifier(sizeToIntrinsics = false, alignment = Alignment.TopStart)
+ FixedSizeModifier(containerSize.ipx).paint(
+ LatchPainter(
+ containerWidth,
+ containerHeight,
+ paintLatch
+ ),
+ sizeToIntrinsics = false, alignment = Alignment.TopStart)
) {
// Intentionally empty
}
@@ -372,9 +380,8 @@
with(DensityAmbient.current) {
val p = LatchPainter(containerWidth, containerHeight, latch, rtl)
AtLeastSize(
- modifier = background(Color.White) +
- p.asModifier(alpha = alpha, colorFilter =
- colorFilter, rtl = rtl),
+ modifier = background(Color.White)
+ .paint(p, alpha = alpha, colorFilter = colorFilter, rtl = rtl),
size = containerWidth.roundToInt().ipx
) {
// Intentionally empty
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt
index da7207e..e099314 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt
@@ -27,7 +27,7 @@
import androidx.test.filters.FlakyTest
import androidx.test.filters.MediumTest
import androidx.ui.core.selection.SimpleContainer
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.test.createComposeRule
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
@@ -94,7 +94,7 @@
SimpleContainer(
width = popupWidthDp,
height = popupHeightDp,
- modifier = onPositioned { measureLatch.countDown() },
+ modifier = Modifier.onPositioned { measureLatch.countDown() },
children = emptyContent()
)
}
@@ -131,7 +131,7 @@
SimpleContainer {
PopupTestTag(testTag) {
Popup(alignment = Alignment.Center) {
- SimpleContainer(LayoutSize(50.dp), children = emptyContent())
+ SimpleContainer(Modifier.preferredSize(50.dp), children = emptyContent())
}
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/TextLayoutTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/TextLayoutTest.kt
index 6c89608..45f01c4 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/TextLayoutTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/TextLayoutTest.kt
@@ -72,13 +72,13 @@
show {
TestingText(
"aa",
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
textSize.value = coordinates.size
layoutLatch.countDown()
}
)
TestingText("aaaa",
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
doubleTextSize.value = coordinates.size
layoutLatch.countDown()
}
@@ -100,13 +100,13 @@
val doubleTextSize = Ref<IntPxSize>()
show {
TestingText("aa ",
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
textSize.value = coordinates.size
layoutLatch.countDown()
}
)
TestingText("aa aa ",
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
doubleTextSize.value = coordinates.size
layoutLatch.countDown()
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
index 8d92cdb5..ac4740a 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
@@ -53,7 +53,7 @@
import androidx.ui.core.PassThroughLayout
import androidx.ui.core.Ref
import androidx.ui.core.VerticalAlignmentLine
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.core.drawLayer
import androidx.ui.core.drawWithContent
import androidx.ui.core.globalPosition
@@ -367,7 +367,7 @@
}
}
- val paddingContent = draw { canvas, parentSize ->
+ val paddingContent = Modifier.drawBehind { canvas, parentSize ->
// Fill top half with innerColor -- should be clipped
drawLatch.countDown()
val paint = Paint()
@@ -417,17 +417,17 @@
Layout(measureBlock = { _, constraints, _ ->
assertEquals(childConstraints[0], constraints)
layout(0.ipx, 0.ipx) {}
- }, children = emptyContent(), modifier = LayoutTag("header"))
+ }, children = emptyContent(), modifier = Modifier.tag("header"))
}
val footer = @Composable {
Layout(measureBlock = { _, constraints, _ ->
assertEquals(childConstraints[1], constraints)
layout(0.ipx, 0.ipx) {}
- }, children = emptyContent(), modifier = LayoutTag("footer"))
+ }, children = emptyContent(), modifier = Modifier.tag("footer"))
Layout(measureBlock = { _, constraints, _ ->
assertEquals(childConstraints[2], constraints)
layout(0.ipx, 0.ipx) {}
- }, children = emptyContent(), modifier = LayoutTag("footer"))
+ }, children = emptyContent(), modifier = Modifier.tag("footer"))
}
Layout({ header(); footer() }) { measurables, _, _ ->
@@ -463,18 +463,21 @@
activityTestRule.runOnUiThreadIR {
activity.setContent {
Layout(
- modifier = draw { canvas, size ->
+ modifier = Modifier.drawBehind { canvas, size ->
val paint = Paint()
paint.color = model.outerColor
canvas.drawRect(size.toRect(), paint)
},
children = {
- AtLeastSize(size = model.size, modifier = draw { canvas, size ->
- drawLatch.countDown()
- val paint = Paint()
- paint.color = model.innerColor
- canvas.drawRect(size.toRect(), paint)
- })
+ AtLeastSize(
+ size = model.size,
+ modifier = Modifier.drawBehind { canvas, size ->
+ drawLatch.countDown()
+ val paint = Paint()
+ paint.color = model.innerColor
+ canvas.drawRect(size.toRect(), paint)
+ }
+ )
}, measureBlock = { measurables, constraints, _ ->
measureCalls++
layout(30.ipx, 30.ipx) {
@@ -546,7 +549,7 @@
) {
Layout(
children = {},
- modifier = draw { _, _ ->
+ modifier = Modifier.drawBehind { _, _ ->
drawn.value = true
latch.countDown()
},
@@ -636,7 +639,7 @@
AtLeastSize(size = 10.ipx) {
AtLeastSize(
size = 10.ipx,
- modifier = drawLayer() + fillColor(Color.Cyan)
+ modifier = Modifier.drawLayer() + fillColor(Color.Cyan)
) {
}
}
@@ -676,7 +679,7 @@
val innerColor = Color(0xFFFFFFFF)
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- AtLeastSize(size = 30.ipx, modifier = draw { canvas, size ->
+ AtLeastSize(size = 30.ipx, modifier = Modifier.drawBehind { canvas, size ->
drawLatch.countDown()
val paint = Paint()
paint.color = outerColor
@@ -685,12 +688,15 @@
AtLeastSize(size = 30.ipx) {
if (drawChild.value) {
Padding(size = 10.ipx) {
- AtLeastSize(size = 10.ipx, modifier = draw { canvas, size ->
- drawLatch.countDown()
- val paint = Paint()
- paint.color = innerColor
- canvas.drawRect(size.toRect(), paint)
- })
+ AtLeastSize(
+ size = 10.ipx,
+ modifier = Modifier.drawBehind { canvas, size ->
+ drawLatch.countDown()
+ val paint = Paint()
+ paint.color = innerColor
+ canvas.drawRect(size.toRect(), paint)
+ }
+ )
}
}
}
@@ -717,7 +723,7 @@
val innerColor = Color(0xFFFFFFFF)
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- AtLeastSize(size = 30.ipx, modifier = draw { canvas, size ->
+ AtLeastSize(size = 30.ipx, modifier = Modifier.drawBehind { canvas, size ->
drawLatch.countDown()
val paint = Paint()
paint.color = outerColor
@@ -725,12 +731,15 @@
}) {
Padding(size = 20.ipx) {
if (drawChild.value) {
- AtLeastSize(size = 20.ipx, modifier = draw { canvas, size ->
- drawLatch.countDown()
- val paint = Paint()
- paint.color = innerColor
- canvas.drawRect(size.toRect(), paint)
- })
+ AtLeastSize(
+ size = 20.ipx,
+ modifier = Modifier.drawBehind { canvas, size ->
+ drawLatch.countDown()
+ val paint = Paint()
+ paint.color = innerColor
+ canvas.drawRect(size.toRect(), paint)
+ }
+ )
}
}
}
@@ -1434,7 +1443,7 @@
// This assumes a layout was done before the draw pass.
Layout(
children = {},
- modifier = draw { _, _ ->
+ modifier = Modifier.drawBehind { _, _ ->
assertTrue(laidOut)
latch.countDown()
}
@@ -1467,7 +1476,7 @@
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
Layout(children = {
- AtLeastSize(30.ipx, modifier = draw { _, _ -> drawn = true })
+ AtLeastSize(30.ipx, modifier = Modifier.drawBehind { _, _ -> drawn = true })
}, modifier = drawLatchModifier()) { _, _, _ ->
// don't measure or place the AtLeastSize
latch.countDown()
@@ -1544,7 +1553,7 @@
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
Layout(children = {
- Layout(modifier = drawLayer(), children = emptyContent()) { _, _, _ ->
+ Layout(modifier = Modifier.drawLayer(), children = emptyContent()) { _, _, _ ->
latch.countDown()
layout(model.size, model.size) {}
}
@@ -1570,7 +1579,7 @@
val latch = CountDownLatch(1)
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- val drawnContent = draw { _, parentSize ->
+ val drawnContent = Modifier.drawBehind { _, parentSize ->
assertEquals(100.px, parentSize.width)
assertEquals(100.px, parentSize.height)
latch.countDown()
@@ -1587,12 +1596,15 @@
val latch = CountDownLatch(1)
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- AtLeastSize(100.ipx, PaddingModifier(10.ipx) + drawLayer() +
- draw { _, parentSize ->
+ AtLeastSize(
+ 100.ipx,
+ PaddingModifier(10.ipx).drawLayer()
+ .drawBehind { _, parentSize ->
assertEquals(100.px, parentSize.width)
assertEquals(100.px, parentSize.height)
latch.countDown()
- }) {
+ }
+ ) {
}
}
}
@@ -1640,14 +1652,14 @@
for (i in 0 until 2) {
if (model.offset.value == i) {
Wrap(minWidth = size, minHeight = size,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
wrap1Position = coordinates.globalPosition.x
latch.countDown()
}) {
}
} else {
Wrap(minWidth = size, minHeight = size,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
wrap2Position = coordinates.globalPosition.x
latch.countDown()
}) {
@@ -1750,7 +1762,7 @@
FixedSize(30.ipx, background(Color.Green)) {
FixedSize(
10.ipx,
- drawLayer() + PaddingModifier(10.ipx) + background(model, true) +
+ Modifier.drawLayer() + PaddingModifier(10.ipx) + background(model, true) +
drawLatchModifier()
)
}
@@ -1771,7 +1783,7 @@
val innerColor = Color.White
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- val colorModifier = draw { canvas, size ->
+ val colorModifier = Modifier.drawBehind { canvas, size ->
val paint = Paint()
paint.style = PaintingStyle.fill
paint.color = outerColor
@@ -1793,7 +1805,7 @@
val innerColor = Color.White
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- val countDownModifier = draw { _, _ ->
+ val countDownModifier = Modifier.drawBehind { _, _ ->
drawLatch.countDown()
}
FixedSize(
@@ -1868,16 +1880,19 @@
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- FixedSize(30.ipx, modifier = draw { canvas, size ->
+ FixedSize(30.ipx, modifier = Modifier.drawBehind { canvas, size ->
canvas.drawRect(size.toRect(), Paint().apply { color = green })
}) {
- FixedSize(model.offset, modifier = AlignTopLeft + drawLayer() +
- draw { canvas, parentSize ->
+ FixedSize(
+ model.offset,
+ modifier = AlignTopLeft.drawLayer()
+ .drawBehind { canvas, parentSize ->
drawLatch.countDown()
canvas.drawRect(
parentSize.toRect(),
Paint().apply { color = blue })
- }) {
+ }
+ ) {
}
}
}
@@ -1948,7 +1963,7 @@
Layout(children = {
val state = state { false }
var lastLayoutValue: Boolean = false
- Layout(children = {}, modifier = draw { _, _ ->
+ Layout(children = {}, modifier = Modifier.drawBehind { _, _ ->
// this verifies the layout was remeasured before being drawn
assertTrue(lastLayoutValue)
drawlatch.countDown()
@@ -2055,19 +2070,17 @@
) {
FixedSize(
size = 10.ipx,
- modifier = PaddingModifier(10.ipx) +
- drawLayer(
- clipToOutline = false, outlineShape = triangleShape,
- clipToBounds = false
- ) +
- draw { canvas, _ ->
- val paint = Paint().apply {
- color = Color.Blue
- style = PaintingStyle.fill
- }
- canvas.drawRect(Rect(-10f, -10f, 20f, 20f), paint)
- } +
- background(Color.Red) + latch(drawLatch)
+ modifier = PaddingModifier(10.ipx).drawLayer(
+ outlineShape = triangleShape,
+ clipToBounds = false,
+ clipToOutline = false
+ ).drawBehind { canvas, _ ->
+ val paint = Paint().apply {
+ color = Color.Blue
+ style = PaintingStyle.fill
+ }
+ canvas.drawRect(Rect(-10f, -10f, 20f, 20f), paint)
+ } + background(Color.Red) + latch(drawLatch)
) {}
}
}
@@ -2083,7 +2096,7 @@
activity.setContentInFrameLayout {
val children: @Composable() () -> Unit = remember {
@Composable() {
- val modifier = drawLayer() + PaddingModifier(10.ipx) +
+ val modifier = Modifier.drawLayer() + PaddingModifier(10.ipx) +
background(innerColor.value) + latch(drawLatch)
FixedSize(
size = 10.ipx,
@@ -2093,11 +2106,11 @@
}
FixedSize(
size = 30.ipx,
- modifier = drawLayer() + background(Color.Blue)
+ modifier = Modifier.drawLayer() + background(Color.Blue)
) {
FixedSize(
size = 30.ipx,
- modifier = drawLayer(),
+ modifier = Modifier.drawLayer(),
children = children
)
}
@@ -2120,8 +2133,11 @@
var outerLatch = CountDownLatch(1)
activityTestRule.runOnUiThread {
activity.setContent {
- FixedSize(30.ipx, draw { _, _ -> outerLatch.countDown() } + drawLayer()) {
- FixedSize(10.ipx, draw { canvas, _ ->
+ FixedSize(
+ 30.ipx,
+ Modifier.drawBehind { _, _ -> outerLatch.countDown() }.drawLayer()
+ ) {
+ FixedSize(10.ipx, Modifier.drawBehind { canvas, _ ->
val paint = Paint().apply {
color = Color.Blue
}
@@ -2194,7 +2210,7 @@
fun detachChildWithLayer() {
activityTestRule.runOnUiThread {
val composition = activity.setContent {
- FixedSize(10.ipx, drawLayer()) {
+ FixedSize(10.ipx, Modifier.drawLayer()) {
FixedSize(8.ipx)
}
}
@@ -2213,9 +2229,10 @@
FixedSize(
size = 30.ipx
) {
- FixedSize(10.ipx, PaddingModifier(10.ipx) + drawLayer(elevation = 1f) +
+ FixedSize(10.ipx, PaddingModifier(10.ipx) + Modifier.drawLayer(elevation = 1f) +
background(Color.White))
- FixedSize(30.ipx, drawLayer() + background(Color.Red) + drawLatchModifier())
+ FixedSize(30.ipx, Modifier.drawLayer() + background(Color.Red) +
+ drawLatchModifier())
}
}
}
@@ -2230,7 +2247,7 @@
FixedSize(
size = 30.ipx
) {
- FixedSize(10.ipx, PaddingModifier(10.ipx) + drawLayer(elevation = 1f) +
+ FixedSize(10.ipx, PaddingModifier(10.ipx) + Modifier.drawLayer(elevation = 1f) +
background(Color.White))
FixedSize(30.ipx, background(Color.Red) + drawLatchModifier())
}
@@ -2248,7 +2265,8 @@
size = 30.ipx
) {
FixedSize(10.ipx, PaddingModifier(10.ipx)) {
- FixedSize(10.ipx, drawLayer(elevation = 1f) + background(Color.Green))
+ FixedSize(10.ipx, Modifier.drawLayer(elevation = 1f) +
+ background(Color.Green))
}
FixedSize(30.ipx, background(Color.Red))
FixedSize(10.ipx, PaddingModifier(10.ipx)) {
@@ -2270,7 +2288,8 @@
size = 30.ipx
) {
FixedSize(10.ipx, PaddingModifier(10.ipx)) {
- FixedSize(10.ipx, drawLayer(elevation = 1f) + background(Color.Green))
+ FixedSize(10.ipx, Modifier.drawLayer(elevation = 1f) +
+ background(Color.Green))
}
FixedSize(30.ipx, background(Color.Red) + drawLatchModifier())
}
@@ -2377,7 +2396,7 @@
) {
FixedSize(
size,
- PaddingModifier(10.ipx) + drawLayer(elevation = 1f) +
+ PaddingModifier(10.ipx).drawLayer(elevation = 1f) +
background(Color.White)
)
FixedSize(30.ipx, background(Color.Red) + drawLatchModifier())
@@ -2411,7 +2430,7 @@
FixedSize(size = 30.ipx) {
FixedSize(
10.ipx,
- PaddingModifier(10.ipx) + drawLayer(elevation = 1f) +
+ PaddingModifier(10.ipx).drawLayer(elevation = 1f) +
background(Color.White)
)
FixedSize(30.ipx, background(color.value) + drawLatchModifier())
@@ -2443,12 +2462,12 @@
private fun composeSquares(model: SquareModel) {
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- Padding(size = model.size, modifier = draw { canvas, size ->
+ Padding(size = model.size, modifier = Modifier.drawBehind { canvas, size ->
val paint = Paint()
paint.color = model.outerColor
canvas.drawRect(size.toRect(), paint)
}) {
- AtLeastSize(size = model.size, modifier = draw { canvas, size ->
+ AtLeastSize(size = model.size, modifier = Modifier.drawBehind { canvas, size ->
drawLatch.countDown()
val paint = Paint()
paint.color = model.innerColor
@@ -2464,12 +2483,11 @@
activity.setContentInFrameLayout {
Padding(
size = model.size,
- modifier = fillColor(model, isInner = false, doCountDown = false) +
- drawLayer()
+ modifier = fillColor(model, isInner = false, doCountDown = false).drawLayer()
) {
AtLeastSize(
size = model.size,
- modifier = drawLayer() + fillColor(model, isInner = true)
+ modifier = Modifier.drawLayer() + fillColor(model, isInner = true)
) {
}
}
@@ -2487,7 +2505,7 @@
) {
AtLeastSize(
size = model.size,
- modifier = drawLayer() + fillColor(model, isInner = true)
+ modifier = Modifier.drawLayer() + fillColor(model, isInner = true)
) {
}
}
@@ -2513,7 +2531,7 @@
private fun composeNestedSquares(model: SquareModel) {
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
- val fillColorModifier = draw { canvas, size ->
+ val fillColorModifier = Modifier.drawBehind { canvas, size ->
canvas.drawRect(size.toRect(), Paint().apply {
this.color = model.innerColor
})
@@ -2568,7 +2586,7 @@
@Composable
private fun fillColor(color: Color, doCountDown: Boolean = true): Modifier =
- draw { canvas, parentSize ->
+ Modifier.drawBehind { canvas, parentSize ->
canvas.drawRect(parentSize.toRect(), Paint().apply {
this.color = color
})
@@ -2582,7 +2600,7 @@
squareModel: SquareModel,
isInner: Boolean,
doCountDown: Boolean = true
- ): Modifier = draw { canvas, parentSize ->
+ ): Modifier = Modifier.drawBehind { canvas, parentSize ->
canvas.drawRect(parentSize.toRect(), Paint().apply {
this.color = if (isInner) squareModel.innerColor else squareModel.outerColor
})
@@ -2591,7 +2609,7 @@
}
}
- fun drawLatchModifier() = draw { _, _ -> drawLatch.countDown() }
+ fun drawLatchModifier() = Modifier.drawBehind { _, _ -> drawLatch.countDown() }
}
fun Bitmap.assertRect(
@@ -3088,12 +3106,12 @@
frameLayout.setContent(children)
}
-fun background(color: Color) = draw { canvas, size ->
+fun background(color: Color) = Modifier.drawBehind { canvas, size ->
val paint = Paint().apply { this.color = color }
canvas.drawRect(size.toRect(), paint)
}
-fun background(model: SquareModel, isInner: Boolean) = draw { canvas, size ->
+fun background(model: SquareModel, isInner: Boolean) = Modifier.drawBehind { canvas, size ->
val paint = Paint().apply {
this.color = if (isInner) model.innerColor else model.outerColor
}
@@ -3137,7 +3155,7 @@
}
}
-fun scale(scale: Float) = LayoutScale(scale) + drawLayer(scaleX = scale, scaleY = scale)
+fun scale(scale: Float) = LayoutScale(scale).drawLayer(scaleX = scale, scaleY = scale)
class LayoutScale(val scale: Float) : LayoutModifier {
override fun Density.modifyConstraints(
@@ -3161,6 +3179,6 @@
}
}
-fun latch(countDownLatch: CountDownLatch) = draw { _, _ ->
+fun latch(countDownLatch: CountDownLatch) = Modifier.drawBehind { _, _ ->
countDownLatch.countDown()
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt
index e8f2fa6..eb80d5b 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt
@@ -22,8 +22,8 @@
import android.graphics.Rect
import android.os.Build
import android.view.View
-import android.view.ViewGroup
import android.view.View.MeasureSpec
+import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import androidx.compose.Composable
@@ -37,7 +37,6 @@
import androidx.ui.core.Layout
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
-import androidx.ui.unit.Density
import androidx.ui.core.Modifier
import androidx.ui.core.Owner
import androidx.ui.core.Ref
@@ -51,6 +50,7 @@
import androidx.ui.test.captureToBitmap
import androidx.ui.test.createComposeRule
import androidx.ui.test.findByTag
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.ipx
import junit.framework.TestCase.assertNotNull
@@ -136,7 +136,7 @@
composeTestRule.setContent {
TestTag("content") {
Semantics {
- Container(modifier = drawLayer(clipToBounds = false)) {
+ Container(modifier = Modifier.drawLayer(clipToBounds = false)) {
ColoredSquareView(color = colorModel.color, ref = squareRef)
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ClipTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ClipTest.kt
index f80e1ab..ffa5ea4 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ClipTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ClipTest.kt
@@ -21,11 +21,11 @@
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
import androidx.test.rule.ActivityTestRule
-import androidx.ui.core.DrawClipToBounds
import androidx.ui.core.DrawLayerModifier
import androidx.ui.core.Modifier
-import androidx.ui.core.draw
-import androidx.ui.core.drawClip
+import androidx.ui.core.clip
+import androidx.ui.core.clipToBounds
+import androidx.ui.core.drawBehind
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.geometry.RRect
@@ -102,7 +102,7 @@
Padding(size = 10.ipx, modifier = FillColor(Color.Green)) {
AtLeastSize(
size = 10.ipx,
- modifier = drawClip(rectShape) + FillColor(Color.Cyan)
+ modifier = Modifier.clip(rectShape) + FillColor(Color.Cyan)
) {
}
}
@@ -123,7 +123,7 @@
Padding(size = 10.ipx, modifier = FillColor(Color.Green)) {
AtLeastSize(
size = 10.ipx,
- modifier = DrawClipToBounds + FillColor(Color.Cyan)
+ modifier = Modifier.clipToBounds() + FillColor(Color.Cyan)
) {
}
}
@@ -144,7 +144,7 @@
AtLeastSize(
size = 10.ipx,
modifier = FillColor(Color.Green) + PaddingModifier(10.ipx) +
- drawClip(rectShape) + FillColor(Color.Cyan)
+ Modifier.clip(rectShape) + FillColor(Color.Cyan)
) {
}
}
@@ -167,7 +167,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = FillColor(Color.Green) + drawClip(shape) + FillColor(Color.Cyan)
+ modifier = FillColor(Color.Green) + Modifier.clip(shape) + FillColor(Color.Cyan)
) {
}
}
@@ -206,7 +206,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = FillColor(Color.Green) + drawClip(shape) + FillColor(Color.Cyan)) {
+ modifier = FillColor(Color.Green).clip(shape) + FillColor(Color.Cyan)) {
}
}
}
@@ -229,7 +229,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = FillColor(Color.Green) + drawClip(triangleShape) +
+ modifier = FillColor(Color.Green) + Modifier.clip(triangleShape) +
FillColor(Color.Cyan)) {
}
}
@@ -260,7 +260,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = FillColor(Color.Green) + drawClip(concaveShape) +
+ modifier = FillColor(Color.Green) + Modifier.clip(concaveShape) +
FillColor(Color.Cyan)) {
}
}
@@ -281,7 +281,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = FillColor(Color.Green) + drawClip(model.value) +
+ modifier = FillColor(Color.Green) + Modifier.clip(model.value) +
FillColor(Color.Cyan)) {
}
}
@@ -316,7 +316,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = FillColor(Color.Green) + drawClip(model.value) +
+ modifier = FillColor(Color.Green) + Modifier.clip(model.value) +
FillColor(Color.Cyan)) {
}
}
@@ -343,7 +343,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = FillColor(Color.Green) + drawClip(model.value) +
+ modifier = FillColor(Color.Green) + Modifier.clip(model.value) +
FillColor(Color.Cyan)) {
}
}
@@ -389,7 +389,7 @@
activity.setContent {
AtLeastSize(
size = 30.ipx,
- modifier = background(Color.Green) + clip + draw(drawCallback)
+ modifier = background(Color.Green) + clip + Modifier.drawBehind(drawCallback)
) {
}
}
@@ -416,7 +416,7 @@
activity.setContent {
Padding(size = 10.ipx, modifier = FillColor(Color.Green)) {
val modifier = if (model.value) {
- drawClip(rectShape) + FillColor(Color.Cyan)
+ Modifier.clip(rectShape) + FillColor(Color.Cyan)
} else {
Modifier.None
}
@@ -439,7 +439,7 @@
}
private fun FillColor(color: Color): Modifier {
- return draw { canvas, parentSize ->
+ return Modifier.drawBehind { canvas, parentSize ->
canvas.drawRect(
Rect(
-100f,
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
index cdd0045..e6d00f4 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
@@ -19,6 +19,7 @@
import androidx.test.filters.SmallTest
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.TransformOrigin
import androidx.ui.core.boundsInRoot
import androidx.ui.core.drawLayer
@@ -56,7 +57,7 @@
private lateinit var positionLatch: CountDownLatch
private lateinit var layoutCoordinates: LayoutCoordinates
- private val positioner = onPositioned {
+ private val positioner = Modifier.onPositioned {
layoutCoordinates = it
positionLatch.countDown()
}
@@ -72,7 +73,7 @@
fun testLayerBoundsPosition() {
activityTestRule.runOnUiThreadIR {
activity.setContent {
- FixedSize(30.ipx, PaddingModifier(10.ipx) + drawLayer() + positioner) {
+ FixedSize(30.ipx, PaddingModifier(10.ipx).drawLayer() + positioner) {
}
}
}
@@ -98,7 +99,7 @@
Padding(10.ipx) {
FixedSize(
10.ipx,
- drawLayer(scaleX = 2f, scaleY = 3f) + positioner
+ Modifier.drawLayer(scaleX = 2f, scaleY = 3f) + positioner
) {
}
}
@@ -120,7 +121,7 @@
Padding(10.ipx) {
FixedSize(
10.ipx,
- drawLayer(scaleY = 3f, rotationZ = 90f) + positioner
+ Modifier.drawLayer(scaleY = 3f, rotationZ = 90f) + positioner
) {
}
}
@@ -141,7 +142,7 @@
activity.setContent {
Padding(10.ipx) {
FixedSize(10.ipx,
- drawLayer(
+ Modifier.drawLayer(
rotationZ = 90f,
transformOrigin = TransformOrigin(1.0f, 1.0f)
) + positioner
@@ -164,7 +165,7 @@
activity.setContent {
Padding(10.ipx) {
FixedSize(10.ipx,
- drawLayer(
+ Modifier.drawLayer(
translationX = 5.0f,
translationY = 8.0f
) + positioner
@@ -186,10 +187,10 @@
activityTestRule.runOnUiThreadIR {
activity.setContent {
Padding(10.ipx) {
- FixedSize(10.ipx, drawLayer(clipToBounds = true)) {
+ FixedSize(10.ipx, Modifier.drawLayer(clipToBounds = true)) {
FixedSize(
10.ipx,
- drawLayer(scaleX = 2f) + positioner
+ Modifier.drawLayer(scaleX = 2f) + positioner
) {
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawShadowTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawShadowTest.kt
index 51665b0..3b0b12a 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawShadowTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/DrawShadowTest.kt
@@ -25,7 +25,7 @@
import androidx.test.filters.SmallTest
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.Modifier
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.core.drawLayer
import androidx.ui.core.drawShadow
import androidx.ui.core.setContent
@@ -94,7 +94,7 @@
fun shadowDrawnInsideRenderNode() {
rule.runOnUiThreadIR {
activity.setContent {
- ShadowContainer(modifier = drawLayer(clipToBounds = false))
+ ShadowContainer(modifier = Modifier.drawLayer(clipToBounds = false))
}
}
@@ -132,7 +132,7 @@
rule.runOnUiThreadIR {
activity.setContent {
- ShadowContainer(elevation, modifier = drawLayer())
+ ShadowContainer(elevation, modifier = Modifier.drawLayer())
}
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
@@ -154,7 +154,7 @@
AtLeastSize(size = 12.ipx, modifier = background(Color.White)) {
AtLeastSize(
size = 10.ipx,
- modifier = drawShadow(rectShape, 4.dp, opacity = 0.5f)
+ modifier = Modifier.drawShadow(rectShape, 4.dp, opacity = 0.5f)
) {
}
}
@@ -181,7 +181,7 @@
activity.setContent {
AtLeastSize(size = 12.ipx, modifier = background(Color.White)) {
val shadow = if (model.value) {
- drawShadow(rectShape, 8.dp)
+ Modifier.drawShadow(rectShape, 8.dp)
} else {
Modifier.None
}
@@ -210,7 +210,7 @@
AtLeastSize(size = 12.ipx, modifier = modifier + background(Color.White)) {
AtLeastSize(
size = 10.ipx,
- modifier = drawShadow(shape = rectShape, elevation = elevation.value)
+ modifier = Modifier.drawShadow(shape = rectShape, elevation = elevation.value)
) {
}
}
@@ -220,7 +220,7 @@
assertNotEquals(color(width / 2, height - 1), Color.White)
}
- private fun background(color: Color) = draw { canvas, size ->
+ private fun background(color: Color) = Modifier.drawBehind { canvas, size ->
canvas.drawRect(size.toRect(), Paint().apply {
this.color = color
})
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/LayoutTagTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/LayoutTagTest.kt
index 5584799..448ca22 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/LayoutTagTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/LayoutTagTest.kt
@@ -20,7 +20,7 @@
import androidx.test.filters.SmallTest
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
+import androidx.ui.core.Modifier
import androidx.ui.core.setContent
import androidx.ui.core.tag
import androidx.ui.framework.test.TestActivity
@@ -55,14 +55,14 @@
activity.setContent {
Layout(
{
- AtLeastSize(0.ipx, LayoutTag("first"), children = emptyContent())
- Stack(LayoutTag("second")) {
+ AtLeastSize(0.ipx, Modifier.tag("first"), children = emptyContent())
+ Stack(Modifier.tag("second")) {
AtLeastSize(
0.ipx,
children = emptyContent()
)
}
- Stack(LayoutTag("third")) {
+ Stack(Modifier.tag("third")) {
AtLeastSize(0.ipx, children = emptyContent())
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ModelReadsTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ModelReadsTest.kt
index d503ac0..f9cd45e 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ModelReadsTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ModelReadsTest.kt
@@ -20,7 +20,7 @@
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.Layout
import androidx.ui.core.Modifier
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.framework.test.TestActivity
import androidx.ui.unit.ipx
import org.junit.Assert.assertFalse
@@ -56,7 +56,7 @@
var positionLatch = CountDownLatch(1)
rule.runOnUiThread {
activity.setContentInFrameLayout {
- Layout({}, modifier = draw { _, _ ->
+ Layout({}, modifier = Modifier.drawBehind { _, _ ->
// read from the model
model.offset
drawLatch.countDown()
@@ -99,7 +99,7 @@
var positionLatch = CountDownLatch(1)
rule.runOnUiThread {
activity.setContentInFrameLayout {
- Layout({}, modifier = draw { _, _ ->
+ Layout({}, modifier = Modifier.drawBehind { _, _ ->
// read from the model
drawModel.offset
drawLatch.countDown()
@@ -141,7 +141,7 @@
var drawLatch = CountDownLatch(1)
rule.runOnUiThread {
activity.setContentInFrameLayout {
- Layout({}, modifier = draw { _, _ ->
+ Layout({}, modifier = Modifier.drawBehind { _, _ ->
// read from the model
model.offset
drawLatch.countDown()
@@ -222,7 +222,7 @@
val model = ValueModel(0)
rule.runOnUiThread {
activity.setContentInFrameLayout {
- AtLeastSize(10.ipx, modifier = draw { _, _ ->
+ AtLeastSize(10.ipx, modifier = Modifier.drawBehind { _, _ ->
if (enabled.value) {
// read the model
model.value
@@ -285,7 +285,7 @@
rule.runOnUiThread {
activity.setContentInFrameLayout {
val modifier = if (enabled.value) {
- draw { _, _ ->
+ Modifier.drawBehind { _, _ ->
// read the model
model.value
latch.countDown()
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/OpacityTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/OpacityTest.kt
index 303076b..3e03ce1 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/OpacityTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/OpacityTest.kt
@@ -25,7 +25,7 @@
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.Layout
import androidx.ui.core.Modifier
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.core.drawOpacity
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
@@ -50,7 +50,7 @@
val rule = ActivityTestRule<TestActivity>(TestActivity::class.java)
private lateinit var activity: TestActivity
private lateinit var drawLatch: CountDownLatch
- private val unlatch = draw { _, _ -> drawLatch.countDown() }
+ private val unlatch = Modifier.drawBehind { _, _ -> drawLatch.countDown() }
@Before
fun setup() {
@@ -67,7 +67,7 @@
activity.setContent {
AtLeastSize(size = 10.ipx,
modifier = background(Color.White) +
- drawOpacity(1f) +
+ Modifier.drawOpacity(1f) +
background(color) +
unlatch) {
}
@@ -87,7 +87,7 @@
activity.setContent {
AtLeastSize(size = 10.ipx,
modifier = background(Color.White) +
- drawOpacity(0f) +
+ Modifier.drawOpacity(0f) +
background(color) +
unlatch
) {
@@ -109,7 +109,7 @@
Row(background(Color.White)) {
AtLeastSize(size = 10.ipx,
modifier = background(Color.White) +
- drawOpacity(0.5f) +
+ Modifier.drawOpacity(0.5f) +
background(color) +
unlatch
) {
@@ -137,7 +137,7 @@
activity.setContent {
AtLeastSize(size = 10.ipx,
modifier = background(Color.White) +
- drawOpacity(model.value) +
+ Modifier.drawOpacity(model.value) +
unlatch +
background(color)
) {
@@ -165,8 +165,8 @@
activity.setContent {
AtLeastSize(size = 10.ipx,
modifier = background(Color.White) +
- drawOpacity(1f) +
- drawOpacity(opacity) +
+ Modifier.drawOpacity(1f) +
+ Modifier.drawOpacity(opacity) +
unlatch +
background(color)
) {
@@ -194,7 +194,7 @@
AtLeastSize(size = 10.ipx,
modifier = background(Color.White) +
if (model.value) {
- drawOpacity(0f) +
+ Modifier.drawOpacity(0f) +
background(Color.Green)
} else {
Modifier.None
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ParentDataModifierTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ParentDataModifierTest.kt
index acfa01c..dd25865 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ParentDataModifierTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/ParentDataModifierTest.kt
@@ -20,11 +20,12 @@
import androidx.test.filters.SmallTest
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
import androidx.ui.core.LayoutTagParentData
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.core.setContent
+import androidx.ui.core.tag
import androidx.ui.framework.test.TestActivity
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
@@ -89,7 +90,7 @@
runOnUiThread {
activity.setContent {
Layout(
- modifier = LayoutTag("Hello"),
+ modifier = Modifier.tag("Hello"),
children = {
SimpleDrawChild(drawLatch = drawLatch)
},
@@ -115,13 +116,13 @@
activity.setContent {
val header = @Composable {
Layout(
- modifier = LayoutTag(0),
+ modifier = Modifier.tag(0),
children = emptyContent()
) { _, _, _ -> layout(0.ipx, 0.ipx) {} }
}
val footer = @Composable {
Layout(
- modifier = LayoutTag(1),
+ modifier = Modifier.tag(1),
children = emptyContent()
) { _, _, _ -> layout(0.ipx, 0.ipx) {} }
}
@@ -148,7 +149,7 @@
@Composable
fun SimpleDrawChild(drawLatch: CountDownLatch) {
- AtLeastSize(size = 10.ipx, modifier = draw { canvas, size ->
+ AtLeastSize(size = 10.ipx, modifier = Modifier.drawBehind { canvas, size ->
val paint = Paint()
paint.color = Color(0xFF008000)
canvas.drawRect(size.toRect(), paint)
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt
index 417a19f..0187340 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt
@@ -170,7 +170,7 @@
private fun saveLayoutInfo(
position: Ref<PxPosition>,
countDownLatch: CountDownLatch
- ): Modifier = onPositioned {
+ ): Modifier = Modifier.onPositioned {
position.value = it.localToGlobal(PxPosition(0.ipx, 0.ipx))
countDownLatch.countDown()
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt
index 2c1bb77..45209b0 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt
@@ -33,9 +33,9 @@
import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.WithConstraints
-import androidx.ui.core.asModifier
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.core.onPositioned
+import androidx.ui.core.paint
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.graphics.Color
@@ -93,7 +93,7 @@
WithConstraints { constraints, _ ->
topConstraints.value = constraints
Padding(size = size) {
- val drawModifier = draw { _, _ ->
+ val drawModifier = Modifier.drawBehind { _, _ ->
countDownLatch.countDown()
}
WithConstraints(drawModifier) { constraints, _ ->
@@ -135,13 +135,13 @@
rule.runOnUiThreadIR {
activity.setContentInFrameLayout {
WithConstraints { constraints, _ ->
- val outerModifier = draw { canvas, size ->
+ val outerModifier = Modifier.drawBehind { canvas, size ->
val paint = Paint()
paint.color = model.outerColor
canvas.drawRect(size.toRect(), paint)
}
Layout(children = {
- val innerModifier = draw { canvas, size ->
+ val innerModifier = Modifier.drawBehind { canvas, size ->
drawLatch.countDown()
val paint = Paint()
paint.color = model.innerColor
@@ -225,11 +225,13 @@
// current frame and opens a new one. our model reads during measure()
// wasn't possible to survide Frames swicth previously so the model read
// within the child Layout wasn't recorded
- val background = VectorPainter(
- name = "testPainter",
- defaultWidth = 10.dp,
- defaultHeight = 10.dp) { _, _ -> /* intentionally empty */
- }.asModifier()
+ val background = Modifier.paint(
+ VectorPainter(
+ name = "testPainter",
+ defaultWidth = 10.dp,
+ defaultHeight = 10.dp) { _, _ -> /* intentionally empty */
+ }
+ )
Layout(modifier = background, children = {}) { _, _, _ ->
// read the model
model.value
@@ -313,7 +315,7 @@
rule.runOnUiThreadIR {
activity.setContentInFrameLayout {
Container(width = 200.ipx, height = 200.ipx) {
- WithConstraints(modifier = onPositioned {
+ WithConstraints(modifier = Modifier.onPositioned {
// OnPositioned can be fired multiple times with the same value
// for example when requestLayout() was triggered on ComposeView.
// if we called twice, let's make sure we got the correct values.
@@ -322,7 +324,7 @@
withConstLatch.countDown()
}) { _, _ ->
Container(width = size.value, height = size.value,
- modifier = onPositioned {
+ modifier = Modifier.onPositioned {
// OnPositioned can be fired multiple times with the same value
// for example when requestLayout() was triggered on ComposeView.
// if we called twice, let's make sure we got the correct values.
@@ -485,7 +487,7 @@
activity.setContent {
val state = state { false }
var lastLayoutValue: Boolean = false
- val drawModifier = draw { _, _ ->
+ val drawModifier = Modifier.drawBehind { _, _ ->
// this verifies the layout was remeasured before being drawn
assertTrue(lastLayoutValue)
drawlatch.countDown()
@@ -688,13 +690,13 @@
return bitmap
}
- private fun countdownLatchBackgroundModifier(color: Color) = draw {
- canvas, size ->
- val paint = Paint()
- paint.color = color
- canvas.drawRect(size.toRect(), paint)
- drawLatch.countDown()
- }
+ private fun countdownLatchBackgroundModifier(color: Color) =
+ Modifier.drawBehind { canvas, size ->
+ val paint = Paint()
+ paint.color = color
+ canvas.drawRect(size.toRect(), paint)
+ drawLatch.countDown()
+ }
private fun layoutDirectionModifier(ld: LayoutDirection) = object : LayoutModifier {
override fun Density.modifyLayoutDirection(layoutDirection: LayoutDirection) = ld
@@ -783,7 +785,7 @@
}
}
-fun backgroundModifier(color: Color) = draw { canvas, size ->
+fun backgroundModifier(color: Color) = Modifier.drawBehind { canvas, size ->
val paint = Paint()
paint.color = color
canvas.drawRect(size.toRect(), paint)
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorInvalidationTestCase.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorInvalidationTestCase.kt
index 0df4e8c..8ca57fa 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorInvalidationTestCase.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorInvalidationTestCase.kt
@@ -20,8 +20,9 @@
import androidx.compose.MutableState
import androidx.compose.state
import androidx.ui.core.DensityAmbient
-import androidx.ui.core.asModifier
-import androidx.ui.core.draw
+import androidx.ui.core.Modifier
+import androidx.ui.core.drawBehind
+import androidx.ui.core.paint
import androidx.ui.core.test.AtLeastSize
import androidx.ui.framework.test.R
import androidx.ui.geometry.Rect
@@ -53,14 +54,14 @@
vectorSize = width.toIntPx().value
AtLeastSize(
size = width.toIntPx(),
- modifier = WhiteBackground + VectorPainter(it).asModifier()) {
+ modifier = WhiteBackground.paint(VectorPainter(it))) {
latch.countDown()
}
}
}
}
- val WhiteBackground = draw { canvas, size ->
+ val WhiteBackground = Modifier.drawBehind { canvas, size ->
canvas.drawRect(
Rect.fromLTWH(
0.0f,
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorTest.kt
index be49f82..d95f0f8 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/graphics/vector/VectorTest.kt
@@ -24,7 +24,8 @@
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
-import androidx.ui.core.asModifier
+import androidx.ui.core.Modifier
+import androidx.ui.core.paint
import androidx.ui.core.setContent
import androidx.ui.core.test.AtLeastSize
import androidx.ui.core.test.runOnUiThreadIR
@@ -134,21 +135,25 @@
) {
val sizePx = size.toPx()
val sizeDp = (size.value / DensityAmbient.current.density).dp
- val background = VectorPainter(
- defaultWidth = sizeDp,
- defaultHeight = sizeDp) { _, _ ->
- Path(
- pathData = PathData {
- lineTo(sizePx.value, 0.0f)
- lineTo(sizePx.value, sizePx.value)
- lineTo(0.0f, sizePx.value)
- close()
- },
- fill = SolidColor(Color.Black)
- )
+ val background = Modifier.paint(
+ VectorPainter(
+ defaultWidth = sizeDp,
+ defaultHeight = sizeDp) { _, _ ->
+ Path(
+ pathData = PathData {
+ lineTo(sizePx.value, 0.0f)
+ lineTo(sizePx.value, sizePx.value)
+ lineTo(0.0f, sizePx.value)
+ close()
+ },
+ fill = SolidColor(Color.Black)
+ )
- drawLatch.countDown()
- }.asModifier(colorFilter = ColorFilter.tint(Color.Cyan), alignment = alignment)
+ drawLatch.countDown()
+ },
+ colorFilter = ColorFilter.tint(Color.Cyan),
+ alignment = alignment
+ )
AtLeastSize(size = minimumSize, modifier = background) {
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Clip.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Clip.kt
index 72e3ee0..a6343b2 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Clip.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Clip.kt
@@ -21,10 +21,38 @@
/**
* Clips the content to the bounds of the layer.
*/
-val DrawClipToBounds: Modifier = drawLayer(clipToBounds = true)
+@Deprecated(
+ "Use Modifier.clipToBounds",
+ replaceWith = ReplaceWith(
+ "Modifier.clipToBounds()",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.clipToBounds"
+ )
+)
+val DrawClipToBounds: Modifier = Modifier.drawLayer(clipToBounds = true)
+
+/**
+ * Clip the content to the bounds of a layer defined at this modifier.
+ */
+@Suppress("DEPRECATION")
+fun Modifier.clipToBounds() = this + DrawClipToBounds
/**
* Clips the content to [shape].
*/
+@Deprecated(
+ "Use Modifier.clip",
+ replaceWith = ReplaceWith(
+ "Modifier.clip(shape)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.clip"
+ )
+)
fun drawClip(shape: Shape): Modifier =
- drawLayer(clipToBounds = false, clipToOutline = true, outlineShape = shape)
+ Modifier.drawLayer(clipToBounds = false, clipToOutline = true, outlineShape = shape)
+
+/**
+ * Clip the content to [shape].
+ */
+fun Modifier.clip(shape: Shape) =
+ this + Modifier.drawLayer(clipToBounds = false, clipToOutline = true, outlineShape = shape)
\ No newline at end of file
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/CoreText.kt b/ui/ui-framework/src/main/java/androidx/ui/core/CoreText.kt
index 6ba6950..cde0125 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/CoreText.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/CoreText.kt
@@ -107,46 +107,44 @@
maxLines = maxLines
)
- val textDrawModifier = draw { canvas, _ ->
- state.layoutResult?.let { layoutResult ->
- state.selectionRange?.let {
- state.textDelegate.paintBackground(
- it.min,
- it.max,
- DefaultSelectionColor,
- canvas,
- layoutResult
- )
+ Layout(
+ children = emptyContent(),
+ modifier = modifier.drawBehind { canvas, _ ->
+ state.layoutResult?.let { layoutResult ->
+ state.selectionRange?.let {
+ state.textDelegate.paintBackground(
+ it.min,
+ it.max,
+ DefaultSelectionColor,
+ canvas,
+ layoutResult
+ )
+ }
+ state.textDelegate.paint(canvas, layoutResult)
}
- state.textDelegate.paint(canvas, layoutResult)
- }
- }
- // Get the layout coordinates of the text composable. This is for hit test of
- // cross-composable selection.
- val {
- val oldLayoutCoordinates = state.layoutCoordinates
- state.layoutCoordinates = it
+ }.onPositioned {
+ // Get the layout coordinates of the text composable. This is for hit test of
+ // cross-composable selection.
+ val oldLayoutCoordinates = state.layoutCoordinates
+ state.layoutCoordinates = it
- if ((oldLayoutCoordinates == null || !oldLayoutCoordinates.isAttached) &&
- it.isAttached
- ) {
- selectionRegistrar?.onPositionChange()
- }
-
- if (oldLayoutCoordinates != null && oldLayoutCoordinates.isAttached &&
- it.isAttached
- ) {
- if (
- oldLayoutCoordinates.localToGlobal(PxPosition.Origin) !=
- it.localToGlobal(PxPosition.Origin)
+ if ((oldLayoutCoordinates == null || !oldLayoutCoordinates.isAttached) &&
+ it.isAttached
) {
selectionRegistrar?.onPositionChange()
}
- }
- }
- Layout(
- children = emptyContent(),
- modifier = modifier + textDrawModifier + onPositioned,
+
+ if (oldLayoutCoordinates != null && oldLayoutCoordinates.isAttached &&
+ it.isAttached
+ ) {
+ if (
+ oldLayoutCoordinates.localToGlobal(PxPosition.Origin) !=
+ it.localToGlobal(PxPosition.Origin)
+ ) {
+ selectionRegistrar?.onPositionChange()
+ }
+ }
+ },
minIntrinsicWidthMeasureBlock = { _, _, _ ->
state.textDelegate.layoutIntrinsics()
state.textDelegate.minIntrinsicWidth
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/CoreTextField.kt b/ui/ui-framework/src/main/java/androidx/ui/core/CoreTextField.kt
index 15de732..7d59dd4 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/CoreTextField.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/CoreTextField.kt
@@ -157,52 +157,49 @@
}
}
) {
- val textDrawModifier = draw { canvas, _ ->
- state.layoutResult?.let { layoutResult ->
- TextFieldDelegate.draw(
- canvas,
- value,
- offsetMap,
- layoutResult,
- state.hasFocus,
- DefaultSelectionColor
- )
- }
- }
Layout(
- modifier = modifier + textDrawModifier +
- onPositioned {
- if (textInputService != null) {
- state.layoutCoordinates = it
- state.layoutResult?.let { layoutResult ->
- TextFieldDelegate.notifyFocusedRect(
- value,
- state.textDelegate,
- layoutResult,
- it,
- textInputService,
- state.inputSession,
- state.hasFocus,
- offsetMap
- )
- }
- }
- },
- children = emptyContent(),
- measureBlock = { _, constraints, _ ->
- TextFieldDelegate.layout(
- state.textDelegate,
- constraints,
- state.layoutResult
- ).let { (width, height, result) ->
- if (state.layoutResult != result) {
- state.layoutResult = result
- onTextLayout(result)
+ emptyContent(),
+ modifier.drawBehind { canvas, _ ->
+ state.layoutResult?.let { layoutResult ->
+ TextFieldDelegate.draw(
+ canvas,
+ value,
+ offsetMap,
+ layoutResult,
+ state.hasFocus,
+ DefaultSelectionColor
+ )
+ }
+ }.onPositioned {
+ if (textInputService != null) {
+ state.layoutCoordinates = it
+ state.layoutResult?.let { layoutResult ->
+ TextFieldDelegate.notifyFocusedRect(
+ value,
+ state.textDelegate,
+ layoutResult,
+ it,
+ textInputService,
+ state.inputSession,
+ state.hasFocus,
+ offsetMap
+ )
}
- layout(width, height) {}
}
}
- )
+ ) { _, constraints, _ ->
+ TextFieldDelegate.layout(
+ state.textDelegate,
+ constraints,
+ state.layoutResult
+ ).let { (width, height, result) ->
+ if (state.layoutResult != result) {
+ state.layoutResult = result
+ onTextLayout(result)
+ }
+ layout(width, height) {}
+ }
+ }
}
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/DrawShadow.kt b/ui/ui-framework/src/main/java/androidx/ui/core/DrawShadow.kt
index ba42bd6..518f1d0 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/DrawShadow.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/DrawShadow.kt
@@ -34,20 +34,47 @@
* @param clipToOutline When active, the content drawing clips to the outline.
* @param opacity The opacity of the layer, including the shadow.
*/
+@Deprecated(
+ "Use Modifier.drawShadow",
+ replaceWith = ReplaceWith(
+ "Modifier.drawShadow(shape, elevation, clipToOutline, opacity)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.drawShadow"
+ )
+)
@Composable
fun drawShadow(
shape: Shape,
elevation: Dp,
clipToOutline: Boolean = true,
@FloatRange(from = 0.0, to = 1.0) opacity: Float = 1f
-): Modifier {
- with(DensityAmbient.current) {
- return drawLayer(
- outlineShape = shape,
- elevation = elevation.toPx().value,
- clipToOutline = clipToOutline,
- alpha = opacity,
- clipToBounds = false
- )
- }
-}
+) = Modifier.drawShadow(shape, elevation, clipToOutline, opacity)
+
+/**
+ * Creates a [DrawLayerModifier] that draws the shadow. The [elevation] defines the visual depth of
+ * the physical object. The physical object has a shape specified by [shape].
+ *
+ * Example usage:
+ *
+ * @sample androidx.ui.framework.samples.DrawShadowSample
+ *
+ * @param elevation The z-coordinate at which to place this physical object.
+ * @param shape Defines a shape of the physical object
+ * @param clipToOutline When active, the content drawing clips to the outline.
+ * @param opacity The opacity of the layer, including the shadow.
+ */
+@Composable
+fun Modifier.drawShadow(
+ shape: Shape,
+ elevation: Dp,
+ clipToOutline: Boolean = true,
+ @FloatRange(from = 0.0, to = 1.0) opacity: Float = 1f
+) = this + with(DensityAmbient.current) {
+ Modifier.drawLayer(
+ alpha = opacity,
+ elevation = elevation.toPx().value,
+ outlineShape = shape,
+ clipToBounds = false,
+ clipToOutline = clipToOutline
+ )
+}
\ No newline at end of file
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/LayoutTag.kt b/ui/ui-framework/src/main/java/androidx/ui/core/LayoutTag.kt
index e39fed5..78afdf9 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/LayoutTag.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/LayoutTag.kt
@@ -20,6 +20,12 @@
import androidx.ui.unit.Density
/**
+ * Tag the element with [tag] to identify the element within its parent.
+ */
+@Suppress("DEPRECATION")
+fun Modifier.tag(tag: Any) = this + LayoutTag(tag)
+
+/**
* A [ParentDataModifier] which tags the target with the given [tag]. The provided tag
* will act as parent data, and can be used for example by parent layouts to associate
* composable children to [Measurable]s when doing layout, as shown below.
@@ -28,7 +34,16 @@
* @sample androidx.ui.framework.samples.LayoutTagChildrenUsage
*/
@Immutable
-data class LayoutTag(override val tag: Any) : ParentDataModifier, LayoutTagParentData {
+data class LayoutTag
+@Deprecated(
+ "Use Modifier.tag",
+ replaceWith = ReplaceWith(
+ "Modifier.tag(tag)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.tag"
+ )
+)
+constructor(override val tag: Any) : ParentDataModifier, LayoutTagParentData {
override fun Density.modifyParentData(parentData: Any?): Any? {
return this@LayoutTag
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Opacity.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Opacity.kt
index 3891d92..8b9a6d1 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Opacity.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Opacity.kt
@@ -19,6 +19,18 @@
import androidx.annotation.FloatRange
/**
+ * Draw content with modified opacity (alpha) that may be less than 1.
+ *
+ * Example usage:
+ * @sample androidx.ui.framework.samples.OpacitySample
+ *
+ * @param opacity the fraction of children's alpha value.
+ */
+fun Modifier.drawOpacity(
+ @FloatRange(from = 0.0, to = 1.0) opacity: Float
+) = this + drawLayer(alpha = opacity)
+
+/**
* Makes its children partially transparent.
*
* Example usage:
@@ -27,7 +39,14 @@
*
* @param opacity the fraction of children's alpha value.
*/
+@Deprecated(
+ "Use Modifier.drawOpacity",
+ replaceWith = ReplaceWith(
+ "Modifier.drawOpacity(opacity)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.drawOpacity"
+ )
+)
fun drawOpacity(
@FloatRange(from = 0.0, to = 1.0) opacity: Float
-): Modifier =
- drawLayer(alpha = opacity)
+): Modifier = Modifier.drawOpacity(opacity)
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/PainterModifier.kt b/ui/ui-framework/src/main/java/androidx/ui/core/PainterModifier.kt
index 37628e9..b0f1e1e 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/PainterModifier.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/PainterModifier.kt
@@ -59,6 +59,14 @@
*
* @sample androidx.ui.framework.samples.PainterModifierSample
*/
+@Deprecated(
+ "Use Modifier.paint",
+ replaceWith = ReplaceWith(
+ "Modifier.paint(this, sizeToIntrinsics, alignment, scaleFit, alpha, colorFilter, rtl)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.paint"
+ )
+)
@Composable
fun Painter.asModifier(
sizeToIntrinsics: Boolean = true,
@@ -76,17 +84,45 @@
}
/**
+ * Paint the content using [painter].
+ *
+ * @param sizeToIntrinsics `true` to size the element relative to [Painter.intrinsicSize]
+ * @param alignment specifies alignment of the [painter] relative to content
+ * @param scaleFit strategy for scaling [painter] if its size does not match the content size
+ * @param alpha opacity of [painter]
+ * @param colorFilter optional [ColorFilter] to apply to [painter]
+ * @param rtl layout direction to report to [painter] when drawing
+ */
+fun Modifier.paint(
+ painter: Painter,
+ sizeToIntrinsics: Boolean = true,
+ alignment: Alignment = Alignment.Center,
+ scaleFit: ScaleFit = ScaleFit.Fit,
+ alpha: Float = DefaultAlpha,
+ colorFilter: ColorFilter? = null,
+ rtl: Boolean = false
+) = this + PainterModifier(
+ painter = painter,
+ sizeToIntrinsics = sizeToIntrinsics,
+ alignment = alignment,
+ scaleFit = scaleFit,
+ alpha = alpha,
+ colorFilter = colorFilter,
+ rtl = rtl
+)
+
+/**
* [DrawModifier] used to draw the provided [Painter] followed by the contents
* of the component itself
*/
private data class PainterModifier(
val painter: Painter,
- var sizeToIntrinsics: Boolean,
- var alignment: Alignment = Alignment.Center,
- var scaleFit: ScaleFit = ScaleFit.Fit,
- var alpha: Float = DefaultAlpha,
- var colorFilter: ColorFilter? = null,
- var rtl: Boolean = false
+ val sizeToIntrinsics: Boolean,
+ val alignment: Alignment = Alignment.Center,
+ val scaleFit: ScaleFit = ScaleFit.Fit,
+ val alpha: Float = DefaultAlpha,
+ val colorFilter: ColorFilter? = null,
+ val rtl: Boolean = false
) : LayoutModifier, DrawModifier {
override fun Density.modifyConstraints(
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt
index b170b32..867389b 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt
@@ -16,6 +16,7 @@
package androidx.ui.core
+import android.annotation.SuppressLint
import android.content.Context
import android.graphics.PixelFormat
import android.view.Gravity
@@ -28,6 +29,7 @@
import androidx.compose.Immutable
import androidx.compose.Providers
import androidx.compose.ambientOf
+import androidx.compose.emptyContent
import androidx.compose.escapeCompose
import androidx.compose.onCommit
import androidx.compose.onDispose
@@ -116,12 +118,10 @@
)
}
-private val DefaultTestTag = "DEFAULT_TEST_TAG"
-
// TODO(b/142431825): This is a hack to work around Popups not using Semantics for test tags
// We should either remove it, or come up with an abstracted general solution that isn't specific
// to Popup
-private val PopupTestTagAmbient = ambientOf { DefaultTestTag }
+private val PopupTestTagAmbient = ambientOf { "DEFAULT_TEST_TAG" }
@Composable
internal fun PopupTestTag(tag: String, children: @Composable() () -> Unit) {
@@ -159,7 +159,7 @@
// TODO(soboleva): Look at module arrangement so that Box can be
// used instead of this custom Layout
// Get the parent's global position and size
- Layout(children = {}, modifier = onPositioned { childCoordinates ->
+ Layout(children = emptyContent(), modifier = Modifier.onPositioned { childCoordinates ->
val coordinates = childCoordinates.parentCoordinates!!
// Get the global position of the parent
val layoutPosition = coordinates.localToGlobal(PxPosition.Origin)
@@ -174,7 +174,7 @@
onCommit {
composition = popupLayout.setContent {
- SimpleStack(onPositioned {
+ SimpleStack(Modifier.onPositioned {
// Get the size of the content
popupLayout.popupPositionProperties.childrenSize = it.size.toPxSize()
@@ -233,6 +233,7 @@
* @param popupProperties Properties of the popup.
* @param calculatePopupPosition The logic of positioning the popup relative to its parent.
*/
+@SuppressLint("ViewConstructor")
private class PopupLayout(
context: Context,
val composeView: View,
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionContainer.kt b/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionContainer.kt
index 8b073a59..b2e95c6 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionContainer.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionContainer.kt
@@ -85,7 +85,7 @@
Providers(SelectionRegistrarAmbient provides registrarImpl) {
// Get the layout coordinates of the selection container. This is for hit test of
// cross-composable selection.
- Wrap(gestureModifiers + onPositioned { manager.containerLayoutCoordinates = it }) {
+ Wrap(gestureModifiers.onPositioned { manager.containerLayoutCoordinates = it }) {
children()
addHandles(
manager = manager,
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionHandles.kt b/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionHandles.kt
index 8dc392a..e04641f 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionHandles.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/selection/SelectionHandles.kt
@@ -17,9 +17,11 @@
package androidx.ui.core.selection
import androidx.compose.Composable
+import androidx.compose.emptyContent
import androidx.compose.remember
import androidx.ui.core.Layout
-import androidx.ui.core.draw
+import androidx.ui.core.Modifier
+import androidx.ui.core.drawBehind
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Canvas
import androidx.ui.graphics.Color
@@ -81,8 +83,7 @@
height: Dp,
onCanvas: Density.(Canvas, PxSize) -> Unit
) {
- val modifier = draw(onCanvas)
- Layout({}, modifier) { _, _, _ ->
+ Layout(emptyContent(), Modifier.drawBehind(onCanvas)) { _, _, _ ->
// take width and height space of the screen and allow draw modifier to draw inside of it
layout(width.toIntPx(), height.toIntPx()) {
// this layout has no children, only draw modifier.
diff --git a/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorAsset.kt b/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorAsset.kt
index 1e1f29d..2dc9aa9 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorAsset.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorAsset.kt
@@ -19,7 +19,7 @@
import androidx.compose.Composable
import androidx.ui.core.Alignment
import androidx.ui.core.Modifier
-import androidx.ui.core.asModifier
+import androidx.ui.core.paint
import androidx.ui.graphics.BlendMode
import androidx.ui.graphics.Brush
import androidx.ui.graphics.Color
@@ -244,9 +244,7 @@
* @param[tintColor] Optional color used to tint this vector graphic
* @param[tintBlendMode] Optional blend mode used with [tintColor], default is [BlendMode.srcIn]
*/
-@Deprecated("Use VectorPainter instead",
- ReplaceWith("VectorPainter(vectorAsset)")
-)
+@Deprecated("Use VectorPainter and Modifier.paint instead")
@Composable
fun drawVector(
vectorImage: VectorAsset,
@@ -254,11 +252,13 @@
tintBlendMode: BlendMode = DefaultTintBlendMode,
alignment: Alignment = Alignment.Center,
fit: ScaleFit = ScaleFit.Fit
-): Modifier = VectorPainter(vectorImage).asModifier(
+) = Modifier.paint(
+ VectorPainter(vectorImage),
alignment = alignment,
scaleFit = fit,
colorFilter = if (tintColor != Color.Transparent) {
ColorFilter(tintColor, tintBlendMode)
} else {
null
- })
\ No newline at end of file
+ }
+)
diff --git a/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorCompose.kt b/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorCompose.kt
index f0cd782..aa9a721 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorCompose.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/graphics/vector/VectorCompose.kt
@@ -23,7 +23,7 @@
import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
import androidx.ui.core.Modifier
-import androidx.ui.core.draw
+import androidx.ui.core.drawBehind
import androidx.ui.graphics.BlendMode
import androidx.ui.graphics.Brush
import androidx.ui.graphics.Color
@@ -90,7 +90,7 @@
val vpWidth = if (viewportWidth == unset) widthPx.value else viewportWidth
val vpHeight = if (viewportHeight == unset) heightPx.value else viewportHeight
- return drawVector(
+ return Modifier.drawVector(
defaultWidth = widthPx,
defaultHeight = heightPx,
viewportWidth = vpWidth,
@@ -119,6 +119,7 @@
* @param[alignment] Specifies the placement of the vector within the drawing bounds
* @param[scaleFit] Specifies how the vector is to be scaled within the parent bounds
*/
+@Deprecated("use Modifier.drawVector")
@Composable
fun drawVector(
defaultWidth: Px,
@@ -131,6 +132,46 @@
scaleFit: ScaleFit = ScaleFit.Fit,
name: String = "",
children: @Composable() VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
+): Modifier = Modifier.drawVector(
+ defaultWidth = defaultWidth,
+ defaultHeight = defaultHeight,
+ viewportWidth = viewportWidth,
+ viewportHeight = viewportHeight,
+ tintColor = tintColor,
+ tintBlendMode = tintBlendMode,
+ alignment = alignment,
+ scaleFit = scaleFit,
+ name = name,
+ children = children
+)
+
+/**
+ * Modifier to draw a vector graphic with the provided width, height and viewport dimensions
+ * @param[defaultWidth] Intrinsic width of the Vector in [Px]
+ * @param[defaultHeight] Intrinsic height of hte Vector in [Px]
+ * @param[viewportWidth] Width of the viewport space. The viewport is the virtual canvas
+ * where paths are drawn on. This parameter is optional. Not providing it will use the
+ * [defaultWidth]
+ * @param[viewportHeight] Height of hte viewport space. The viewport is the virtual canvas
+ * where paths are drawn on. This parameter is optional. Not providing it will use the
+ * [defaultHeight]
+ * @param[tintColor] Optional color used to tint this vector graphic
+ * @param[tintBlendMode] Optional blend mode used with [tintColor], default is [BlendMode.srcIn]
+ * @param[alignment] Specifies the placement of the vector within the drawing bounds
+ * @param[scaleFit] Specifies how the vector is to be scaled within the parent bounds
+ */
+@Composable
+fun Modifier.drawVector(
+ defaultWidth: Px,
+ defaultHeight: Px,
+ viewportWidth: Float = defaultWidth.value,
+ viewportHeight: Float = defaultHeight.value,
+ tintColor: Color = DefaultTintColor,
+ tintBlendMode: BlendMode = DefaultTintBlendMode,
+ alignment: Alignment = DefaultAlignment,
+ scaleFit: ScaleFit = ScaleFit.Fit,
+ name: String = "",
+ children: @Composable() VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
): Modifier {
val vector =
remember(name, viewportWidth, viewportHeight) {
@@ -155,7 +196,7 @@
val vectorHeight = defaultHeight.value
val vectorPxSize = PxSize(Px(vectorWidth), Px(vectorHeight))
- return draw { canvas, parentSize ->
+ return this.drawBehind { canvas, parentSize ->
val parentWidth = parentSize.width.value
val parentHeight = parentSize.height.value
val scale = scaleFit.scale(vectorPxSize, parentSize)
diff --git a/ui/ui-framework/src/main/java/androidx/ui/node/ViewInterop.kt b/ui/ui-framework/src/main/java/androidx/ui/node/ViewInterop.kt
index 1dd0440..9e2bd29 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/node/ViewInterop.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/node/ViewInterop.kt
@@ -26,6 +26,8 @@
import androidx.ui.core.LayoutNode
import androidx.ui.core.Measurable
import androidx.ui.core.MeasureScope
+import androidx.ui.core.Modifier
+import androidx.ui.core.drawBehind
import androidx.ui.unit.IntPx
import androidx.ui.unit.ipx
import androidx.ui.unit.isFinite
@@ -93,7 +95,7 @@
// TODO(popam): forward pointer input, accessibility, focus
// Prepare layout node that proxies measure and layout passes to the View.
val layoutNode = LayoutNode()
- layoutNode.modifier = androidx.ui.core.draw { canvas, _ ->
+ layoutNode.modifier = Modifier.drawBehind { canvas, _ ->
draw(canvas.nativeCanvas)
}
layoutNode. owner ->
diff --git a/ui/ui-layout/api/0.1.0-dev08.txt b/ui/ui-layout/api/0.1.0-dev08.txt
index 153b6c8..77d284a 100644
--- a/ui/ui-layout/api/0.1.0-dev08.txt
+++ b/ui/ui-layout/api/0.1.0-dev08.txt
@@ -57,25 +57,35 @@
public static interface Arrangement.Vertical extends androidx.ui.layout.Arrangement {
}
+ public enum ColumnAlign {
+ enum_constant public static final androidx.ui.layout.ColumnAlign Center;
+ enum_constant public static final androidx.ui.layout.ColumnAlign End;
+ enum_constant public static final androidx.ui.layout.ColumnAlign Start;
+ }
+
public final class ColumnKt {
method public static void Column(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.layout.Arrangement.Vertical arrangement = Arrangement.Top, kotlin.jvm.functions.Function1<? super androidx.ui.layout.ColumnScope,kotlin.Unit> children);
}
@androidx.ui.layout.LayoutScopeMarker public final class ColumnScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier End;
- property public final androidx.ui.core.ParentDataModifier Start;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.ColumnAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier End;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Start;
field public static final androidx.ui.layout.ColumnScope! INSTANCE;
}
public final class ConstraintLayoutKt {
- method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ConstraintSet {
@@ -313,36 +323,36 @@
}
public final class LayoutAlign {
- method public androidx.ui.core.LayoutModifier getBottom();
- method public androidx.ui.core.LayoutModifier getBottomCenter();
- method public androidx.ui.core.LayoutModifier getBottomEnd();
- method public androidx.ui.core.LayoutModifier getBottomStart();
- method public androidx.ui.core.LayoutModifier getCenter();
- method public androidx.ui.core.LayoutModifier getCenterEnd();
- method public androidx.ui.core.LayoutModifier getCenterHorizontally();
- method public androidx.ui.core.LayoutModifier getCenterStart();
- method public androidx.ui.core.LayoutModifier getCenterVertically();
- method public androidx.ui.core.LayoutModifier getEnd();
- method public androidx.ui.core.LayoutModifier getStart();
- method public androidx.ui.core.LayoutModifier getTop();
- method public androidx.ui.core.LayoutModifier getTopCenter();
- method public androidx.ui.core.LayoutModifier getTopEnd();
- method public androidx.ui.core.LayoutModifier getTopStart();
- property public final androidx.ui.core.LayoutModifier Bottom;
- property public final androidx.ui.core.LayoutModifier BottomCenter;
- property public final androidx.ui.core.LayoutModifier BottomEnd;
- property public final androidx.ui.core.LayoutModifier BottomStart;
- property public final androidx.ui.core.LayoutModifier Center;
- property public final androidx.ui.core.LayoutModifier CenterEnd;
- property public final androidx.ui.core.LayoutModifier CenterHorizontally;
- property public final androidx.ui.core.LayoutModifier CenterStart;
- property public final androidx.ui.core.LayoutModifier CenterVertically;
- property public final androidx.ui.core.LayoutModifier End;
- property public final androidx.ui.core.LayoutModifier Start;
- property public final androidx.ui.core.LayoutModifier Top;
- property public final androidx.ui.core.LayoutModifier TopCenter;
- property public final androidx.ui.core.LayoutModifier TopEnd;
- property public final androidx.ui.core.LayoutModifier TopStart;
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottom();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterHorizontally();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterVertically();
+ method @Deprecated public androidx.ui.core.LayoutModifier getEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTop();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopStart();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Bottom;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Center;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterHorizontally;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterVertically;
+ property @Deprecated public final androidx.ui.core.LayoutModifier End;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Start;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Top;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopStart;
field public static final androidx.ui.layout.LayoutAlign! INSTANCE;
}
@@ -351,7 +361,7 @@
}
public final class LayoutAspectRatio implements androidx.ui.core.LayoutModifier {
- ctor public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
+ ctor @Deprecated public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
@@ -363,22 +373,28 @@
}
public final class LayoutAspectRatioKt {
+ method public static androidx.ui.core.Modifier aspectRatio(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio);
}
public final class LayoutDirectionModifier {
- method public androidx.ui.core.LayoutModifier getLtr();
- method public androidx.ui.core.LayoutModifier getRtl();
- property public final androidx.ui.core.LayoutModifier Ltr;
- property public final androidx.ui.core.LayoutModifier Rtl;
+ method @Deprecated public androidx.ui.core.LayoutModifier getLtr();
+ method @Deprecated public androidx.ui.core.LayoutModifier getRtl();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Ltr;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Rtl;
field public static final androidx.ui.layout.LayoutDirectionModifier! INSTANCE;
}
+ public final class LayoutDirectionsKt {
+ method public static androidx.ui.core.Modifier getLtr(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier getRtl(androidx.ui.core.Modifier);
+ }
+
public final class LayoutGravity {
field public static final androidx.ui.layout.LayoutGravity! INSTANCE;
}
public final class LayoutHeight implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight(androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutHeight(androidx.ui.unit.Dp height);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight copy(androidx.ui.unit.Dp height);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -389,11 +405,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutHeight.Constrain copy(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
@@ -406,16 +421,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
+ @Deprecated public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
public static final class LayoutHeight.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Max copy(androidx.ui.unit.Dp maxHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -426,11 +440,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Min copy(androidx.ui.unit.Dp minHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -441,11 +454,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public final class LayoutOffset implements androidx.ui.core.LayoutModifier {
- ctor public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ ctor @Deprecated public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutOffset copy(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
@@ -454,9 +466,13 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
}
+ public final class LayoutOffsetKt {
+ method public static androidx.ui.core.Modifier offset(androidx.ui.core.Modifier, androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ }
+
public final class LayoutPadding implements androidx.ui.core.LayoutModifier {
- ctor public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
- ctor public LayoutPadding();
+ ctor @Deprecated public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPadding();
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -471,16 +487,36 @@
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
}
+ public final class LayoutPaddingAbsolute implements androidx.ui.core.LayoutModifier {
+ ctor @Deprecated public LayoutPaddingAbsolute(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPaddingAbsolute();
+ method public androidx.ui.unit.Dp component1();
+ method public androidx.ui.unit.Dp component2();
+ method public androidx.ui.unit.Dp component3();
+ method public androidx.ui.unit.Dp component4();
+ method public androidx.ui.layout.LayoutPaddingAbsolute copy(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ method public androidx.ui.unit.Dp getBottom();
+ method public androidx.ui.unit.Dp getLeft();
+ method public androidx.ui.unit.Dp getRight();
+ method public androidx.ui.unit.Dp getTop();
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
+ }
+
public final class LayoutPaddingKt {
- method public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method @Deprecated public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method public static androidx.ui.core.Modifier absolutePadding(androidx.ui.core.Modifier, androidx.ui.unit.Dp left = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp right = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp start = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp end = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp all);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
}
public final class LayoutSize implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
- ctor public LayoutSize(androidx.ui.unit.Dp size);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp size);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize copy(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
@@ -493,12 +529,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -515,17 +550,16 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
+ @Deprecated public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
public static final class LayoutSize.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Max copy(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
@@ -538,12 +572,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minSize);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Min copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
@@ -556,11 +589,27 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ }
+
+ public final class LayoutSizeKt {
+ method public static androidx.ui.core.Modifier fillMaxHeight(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxSize(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxWidth(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier preferredHeight(androidx.ui.core.Modifier, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredHeightIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp size);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.layout.DpConstraints constraints);
+ method public static androidx.ui.core.Modifier preferredWidth(androidx.ui.core.Modifier, androidx.ui.unit.Dp width);
+ method public static androidx.ui.core.Modifier preferredWidthIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier wrapContentHeight(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentSize(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentWidth(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
}
public final class LayoutWidth implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth(androidx.ui.unit.Dp width);
+ ctor @Deprecated public LayoutWidth(androidx.ui.unit.Dp width);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth copy(androidx.ui.unit.Dp width);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -571,11 +620,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutWidth.Constrain copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
@@ -588,16 +636,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
+ @Deprecated public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
public static final class LayoutWidth.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Max copy(androidx.ui.unit.Dp maxWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -608,11 +655,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
+ ctor @Deprecated public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Min copy(androidx.ui.unit.Dp minWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -623,7 +669,6 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public enum MainAxisAlignment {
@@ -635,6 +680,12 @@
enum_constant public static final androidx.ui.layout.MainAxisAlignment Start;
}
+ public enum RowAlign {
+ enum_constant public static final androidx.ui.layout.RowAlign Bottom;
+ enum_constant public static final androidx.ui.layout.RowAlign Center;
+ enum_constant public static final androidx.ui.layout.RowAlign Top;
+ }
+
public final class RowColumnImplKt {
}
@@ -643,15 +694,19 @@
}
@androidx.ui.layout.LayoutScopeMarker public final class RowScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Bottom;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier Top;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.RowAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Bottom;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Top;
field public static final androidx.ui.layout.RowScope! INSTANCE;
}
@@ -670,26 +725,28 @@
@androidx.ui.layout.LayoutScopeMarker public final class StackScope {
ctor public StackScope();
- method public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier BottomCenter;
- property public final androidx.ui.core.ParentDataModifier BottomEnd;
- property public final androidx.ui.core.ParentDataModifier BottomStart;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier CenterEnd;
- property public final androidx.ui.core.ParentDataModifier CenterStart;
- property public final androidx.ui.core.ParentDataModifier Stretch;
- property public final androidx.ui.core.ParentDataModifier TopCenter;
- property public final androidx.ui.core.ParentDataModifier TopEnd;
- property public final androidx.ui.core.ParentDataModifier TopStart;
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.core.Alignment align);
+ method public androidx.ui.core.Modifier matchParent(androidx.ui.core.Modifier);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Stretch;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopStart;
}
@androidx.ui.layout.LayoutScopeMarker public final class TableChildren {
diff --git a/ui/ui-layout/api/current.txt b/ui/ui-layout/api/current.txt
index 153b6c8..77d284a 100644
--- a/ui/ui-layout/api/current.txt
+++ b/ui/ui-layout/api/current.txt
@@ -57,25 +57,35 @@
public static interface Arrangement.Vertical extends androidx.ui.layout.Arrangement {
}
+ public enum ColumnAlign {
+ enum_constant public static final androidx.ui.layout.ColumnAlign Center;
+ enum_constant public static final androidx.ui.layout.ColumnAlign End;
+ enum_constant public static final androidx.ui.layout.ColumnAlign Start;
+ }
+
public final class ColumnKt {
method public static void Column(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.layout.Arrangement.Vertical arrangement = Arrangement.Top, kotlin.jvm.functions.Function1<? super androidx.ui.layout.ColumnScope,kotlin.Unit> children);
}
@androidx.ui.layout.LayoutScopeMarker public final class ColumnScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier End;
- property public final androidx.ui.core.ParentDataModifier Start;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.ColumnAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier End;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Start;
field public static final androidx.ui.layout.ColumnScope! INSTANCE;
}
public final class ConstraintLayoutKt {
- method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ConstraintSet {
@@ -313,36 +323,36 @@
}
public final class LayoutAlign {
- method public androidx.ui.core.LayoutModifier getBottom();
- method public androidx.ui.core.LayoutModifier getBottomCenter();
- method public androidx.ui.core.LayoutModifier getBottomEnd();
- method public androidx.ui.core.LayoutModifier getBottomStart();
- method public androidx.ui.core.LayoutModifier getCenter();
- method public androidx.ui.core.LayoutModifier getCenterEnd();
- method public androidx.ui.core.LayoutModifier getCenterHorizontally();
- method public androidx.ui.core.LayoutModifier getCenterStart();
- method public androidx.ui.core.LayoutModifier getCenterVertically();
- method public androidx.ui.core.LayoutModifier getEnd();
- method public androidx.ui.core.LayoutModifier getStart();
- method public androidx.ui.core.LayoutModifier getTop();
- method public androidx.ui.core.LayoutModifier getTopCenter();
- method public androidx.ui.core.LayoutModifier getTopEnd();
- method public androidx.ui.core.LayoutModifier getTopStart();
- property public final androidx.ui.core.LayoutModifier Bottom;
- property public final androidx.ui.core.LayoutModifier BottomCenter;
- property public final androidx.ui.core.LayoutModifier BottomEnd;
- property public final androidx.ui.core.LayoutModifier BottomStart;
- property public final androidx.ui.core.LayoutModifier Center;
- property public final androidx.ui.core.LayoutModifier CenterEnd;
- property public final androidx.ui.core.LayoutModifier CenterHorizontally;
- property public final androidx.ui.core.LayoutModifier CenterStart;
- property public final androidx.ui.core.LayoutModifier CenterVertically;
- property public final androidx.ui.core.LayoutModifier End;
- property public final androidx.ui.core.LayoutModifier Start;
- property public final androidx.ui.core.LayoutModifier Top;
- property public final androidx.ui.core.LayoutModifier TopCenter;
- property public final androidx.ui.core.LayoutModifier TopEnd;
- property public final androidx.ui.core.LayoutModifier TopStart;
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottom();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterHorizontally();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterVertically();
+ method @Deprecated public androidx.ui.core.LayoutModifier getEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTop();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopStart();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Bottom;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Center;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterHorizontally;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterVertically;
+ property @Deprecated public final androidx.ui.core.LayoutModifier End;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Start;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Top;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopStart;
field public static final androidx.ui.layout.LayoutAlign! INSTANCE;
}
@@ -351,7 +361,7 @@
}
public final class LayoutAspectRatio implements androidx.ui.core.LayoutModifier {
- ctor public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
+ ctor @Deprecated public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
@@ -363,22 +373,28 @@
}
public final class LayoutAspectRatioKt {
+ method public static androidx.ui.core.Modifier aspectRatio(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio);
}
public final class LayoutDirectionModifier {
- method public androidx.ui.core.LayoutModifier getLtr();
- method public androidx.ui.core.LayoutModifier getRtl();
- property public final androidx.ui.core.LayoutModifier Ltr;
- property public final androidx.ui.core.LayoutModifier Rtl;
+ method @Deprecated public androidx.ui.core.LayoutModifier getLtr();
+ method @Deprecated public androidx.ui.core.LayoutModifier getRtl();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Ltr;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Rtl;
field public static final androidx.ui.layout.LayoutDirectionModifier! INSTANCE;
}
+ public final class LayoutDirectionsKt {
+ method public static androidx.ui.core.Modifier getLtr(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier getRtl(androidx.ui.core.Modifier);
+ }
+
public final class LayoutGravity {
field public static final androidx.ui.layout.LayoutGravity! INSTANCE;
}
public final class LayoutHeight implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight(androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutHeight(androidx.ui.unit.Dp height);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight copy(androidx.ui.unit.Dp height);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -389,11 +405,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutHeight.Constrain copy(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
@@ -406,16 +421,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
+ @Deprecated public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
public static final class LayoutHeight.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Max copy(androidx.ui.unit.Dp maxHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -426,11 +440,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Min copy(androidx.ui.unit.Dp minHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -441,11 +454,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public final class LayoutOffset implements androidx.ui.core.LayoutModifier {
- ctor public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ ctor @Deprecated public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutOffset copy(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
@@ -454,9 +466,13 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
}
+ public final class LayoutOffsetKt {
+ method public static androidx.ui.core.Modifier offset(androidx.ui.core.Modifier, androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ }
+
public final class LayoutPadding implements androidx.ui.core.LayoutModifier {
- ctor public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
- ctor public LayoutPadding();
+ ctor @Deprecated public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPadding();
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -471,16 +487,36 @@
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
}
+ public final class LayoutPaddingAbsolute implements androidx.ui.core.LayoutModifier {
+ ctor @Deprecated public LayoutPaddingAbsolute(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPaddingAbsolute();
+ method public androidx.ui.unit.Dp component1();
+ method public androidx.ui.unit.Dp component2();
+ method public androidx.ui.unit.Dp component3();
+ method public androidx.ui.unit.Dp component4();
+ method public androidx.ui.layout.LayoutPaddingAbsolute copy(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ method public androidx.ui.unit.Dp getBottom();
+ method public androidx.ui.unit.Dp getLeft();
+ method public androidx.ui.unit.Dp getRight();
+ method public androidx.ui.unit.Dp getTop();
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
+ }
+
public final class LayoutPaddingKt {
- method public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method @Deprecated public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method public static androidx.ui.core.Modifier absolutePadding(androidx.ui.core.Modifier, androidx.ui.unit.Dp left = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp right = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp start = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp end = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp all);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
}
public final class LayoutSize implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
- ctor public LayoutSize(androidx.ui.unit.Dp size);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp size);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize copy(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
@@ -493,12 +529,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -515,17 +550,16 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
+ @Deprecated public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
public static final class LayoutSize.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Max copy(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
@@ -538,12 +572,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minSize);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Min copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
@@ -556,11 +589,27 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ }
+
+ public final class LayoutSizeKt {
+ method public static androidx.ui.core.Modifier fillMaxHeight(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxSize(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxWidth(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier preferredHeight(androidx.ui.core.Modifier, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredHeightIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp size);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.layout.DpConstraints constraints);
+ method public static androidx.ui.core.Modifier preferredWidth(androidx.ui.core.Modifier, androidx.ui.unit.Dp width);
+ method public static androidx.ui.core.Modifier preferredWidthIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier wrapContentHeight(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentSize(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentWidth(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
}
public final class LayoutWidth implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth(androidx.ui.unit.Dp width);
+ ctor @Deprecated public LayoutWidth(androidx.ui.unit.Dp width);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth copy(androidx.ui.unit.Dp width);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -571,11 +620,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutWidth.Constrain copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
@@ -588,16 +636,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
+ @Deprecated public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
public static final class LayoutWidth.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Max copy(androidx.ui.unit.Dp maxWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -608,11 +655,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
+ ctor @Deprecated public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Min copy(androidx.ui.unit.Dp minWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -623,7 +669,6 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public enum MainAxisAlignment {
@@ -635,6 +680,12 @@
enum_constant public static final androidx.ui.layout.MainAxisAlignment Start;
}
+ public enum RowAlign {
+ enum_constant public static final androidx.ui.layout.RowAlign Bottom;
+ enum_constant public static final androidx.ui.layout.RowAlign Center;
+ enum_constant public static final androidx.ui.layout.RowAlign Top;
+ }
+
public final class RowColumnImplKt {
}
@@ -643,15 +694,19 @@
}
@androidx.ui.layout.LayoutScopeMarker public final class RowScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Bottom;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier Top;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.RowAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Bottom;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Top;
field public static final androidx.ui.layout.RowScope! INSTANCE;
}
@@ -670,26 +725,28 @@
@androidx.ui.layout.LayoutScopeMarker public final class StackScope {
ctor public StackScope();
- method public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier BottomCenter;
- property public final androidx.ui.core.ParentDataModifier BottomEnd;
- property public final androidx.ui.core.ParentDataModifier BottomStart;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier CenterEnd;
- property public final androidx.ui.core.ParentDataModifier CenterStart;
- property public final androidx.ui.core.ParentDataModifier Stretch;
- property public final androidx.ui.core.ParentDataModifier TopCenter;
- property public final androidx.ui.core.ParentDataModifier TopEnd;
- property public final androidx.ui.core.ParentDataModifier TopStart;
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.core.Alignment align);
+ method public androidx.ui.core.Modifier matchParent(androidx.ui.core.Modifier);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Stretch;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopStart;
}
@androidx.ui.layout.LayoutScopeMarker public final class TableChildren {
diff --git a/ui/ui-layout/api/public_plus_experimental_0.1.0-dev08.txt b/ui/ui-layout/api/public_plus_experimental_0.1.0-dev08.txt
index 153b6c8..77d284a 100644
--- a/ui/ui-layout/api/public_plus_experimental_0.1.0-dev08.txt
+++ b/ui/ui-layout/api/public_plus_experimental_0.1.0-dev08.txt
@@ -57,25 +57,35 @@
public static interface Arrangement.Vertical extends androidx.ui.layout.Arrangement {
}
+ public enum ColumnAlign {
+ enum_constant public static final androidx.ui.layout.ColumnAlign Center;
+ enum_constant public static final androidx.ui.layout.ColumnAlign End;
+ enum_constant public static final androidx.ui.layout.ColumnAlign Start;
+ }
+
public final class ColumnKt {
method public static void Column(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.layout.Arrangement.Vertical arrangement = Arrangement.Top, kotlin.jvm.functions.Function1<? super androidx.ui.layout.ColumnScope,kotlin.Unit> children);
}
@androidx.ui.layout.LayoutScopeMarker public final class ColumnScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier End;
- property public final androidx.ui.core.ParentDataModifier Start;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.ColumnAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier End;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Start;
field public static final androidx.ui.layout.ColumnScope! INSTANCE;
}
public final class ConstraintLayoutKt {
- method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ConstraintSet {
@@ -313,36 +323,36 @@
}
public final class LayoutAlign {
- method public androidx.ui.core.LayoutModifier getBottom();
- method public androidx.ui.core.LayoutModifier getBottomCenter();
- method public androidx.ui.core.LayoutModifier getBottomEnd();
- method public androidx.ui.core.LayoutModifier getBottomStart();
- method public androidx.ui.core.LayoutModifier getCenter();
- method public androidx.ui.core.LayoutModifier getCenterEnd();
- method public androidx.ui.core.LayoutModifier getCenterHorizontally();
- method public androidx.ui.core.LayoutModifier getCenterStart();
- method public androidx.ui.core.LayoutModifier getCenterVertically();
- method public androidx.ui.core.LayoutModifier getEnd();
- method public androidx.ui.core.LayoutModifier getStart();
- method public androidx.ui.core.LayoutModifier getTop();
- method public androidx.ui.core.LayoutModifier getTopCenter();
- method public androidx.ui.core.LayoutModifier getTopEnd();
- method public androidx.ui.core.LayoutModifier getTopStart();
- property public final androidx.ui.core.LayoutModifier Bottom;
- property public final androidx.ui.core.LayoutModifier BottomCenter;
- property public final androidx.ui.core.LayoutModifier BottomEnd;
- property public final androidx.ui.core.LayoutModifier BottomStart;
- property public final androidx.ui.core.LayoutModifier Center;
- property public final androidx.ui.core.LayoutModifier CenterEnd;
- property public final androidx.ui.core.LayoutModifier CenterHorizontally;
- property public final androidx.ui.core.LayoutModifier CenterStart;
- property public final androidx.ui.core.LayoutModifier CenterVertically;
- property public final androidx.ui.core.LayoutModifier End;
- property public final androidx.ui.core.LayoutModifier Start;
- property public final androidx.ui.core.LayoutModifier Top;
- property public final androidx.ui.core.LayoutModifier TopCenter;
- property public final androidx.ui.core.LayoutModifier TopEnd;
- property public final androidx.ui.core.LayoutModifier TopStart;
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottom();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterHorizontally();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterVertically();
+ method @Deprecated public androidx.ui.core.LayoutModifier getEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTop();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopStart();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Bottom;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Center;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterHorizontally;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterVertically;
+ property @Deprecated public final androidx.ui.core.LayoutModifier End;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Start;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Top;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopStart;
field public static final androidx.ui.layout.LayoutAlign! INSTANCE;
}
@@ -351,7 +361,7 @@
}
public final class LayoutAspectRatio implements androidx.ui.core.LayoutModifier {
- ctor public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
+ ctor @Deprecated public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
@@ -363,22 +373,28 @@
}
public final class LayoutAspectRatioKt {
+ method public static androidx.ui.core.Modifier aspectRatio(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio);
}
public final class LayoutDirectionModifier {
- method public androidx.ui.core.LayoutModifier getLtr();
- method public androidx.ui.core.LayoutModifier getRtl();
- property public final androidx.ui.core.LayoutModifier Ltr;
- property public final androidx.ui.core.LayoutModifier Rtl;
+ method @Deprecated public androidx.ui.core.LayoutModifier getLtr();
+ method @Deprecated public androidx.ui.core.LayoutModifier getRtl();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Ltr;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Rtl;
field public static final androidx.ui.layout.LayoutDirectionModifier! INSTANCE;
}
+ public final class LayoutDirectionsKt {
+ method public static androidx.ui.core.Modifier getLtr(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier getRtl(androidx.ui.core.Modifier);
+ }
+
public final class LayoutGravity {
field public static final androidx.ui.layout.LayoutGravity! INSTANCE;
}
public final class LayoutHeight implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight(androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutHeight(androidx.ui.unit.Dp height);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight copy(androidx.ui.unit.Dp height);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -389,11 +405,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutHeight.Constrain copy(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
@@ -406,16 +421,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
+ @Deprecated public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
public static final class LayoutHeight.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Max copy(androidx.ui.unit.Dp maxHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -426,11 +440,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Min copy(androidx.ui.unit.Dp minHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -441,11 +454,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public final class LayoutOffset implements androidx.ui.core.LayoutModifier {
- ctor public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ ctor @Deprecated public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutOffset copy(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
@@ -454,9 +466,13 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
}
+ public final class LayoutOffsetKt {
+ method public static androidx.ui.core.Modifier offset(androidx.ui.core.Modifier, androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ }
+
public final class LayoutPadding implements androidx.ui.core.LayoutModifier {
- ctor public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
- ctor public LayoutPadding();
+ ctor @Deprecated public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPadding();
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -471,16 +487,36 @@
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
}
+ public final class LayoutPaddingAbsolute implements androidx.ui.core.LayoutModifier {
+ ctor @Deprecated public LayoutPaddingAbsolute(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPaddingAbsolute();
+ method public androidx.ui.unit.Dp component1();
+ method public androidx.ui.unit.Dp component2();
+ method public androidx.ui.unit.Dp component3();
+ method public androidx.ui.unit.Dp component4();
+ method public androidx.ui.layout.LayoutPaddingAbsolute copy(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ method public androidx.ui.unit.Dp getBottom();
+ method public androidx.ui.unit.Dp getLeft();
+ method public androidx.ui.unit.Dp getRight();
+ method public androidx.ui.unit.Dp getTop();
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
+ }
+
public final class LayoutPaddingKt {
- method public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method @Deprecated public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method public static androidx.ui.core.Modifier absolutePadding(androidx.ui.core.Modifier, androidx.ui.unit.Dp left = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp right = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp start = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp end = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp all);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
}
public final class LayoutSize implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
- ctor public LayoutSize(androidx.ui.unit.Dp size);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp size);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize copy(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
@@ -493,12 +529,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -515,17 +550,16 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
+ @Deprecated public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
public static final class LayoutSize.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Max copy(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
@@ -538,12 +572,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minSize);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Min copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
@@ -556,11 +589,27 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ }
+
+ public final class LayoutSizeKt {
+ method public static androidx.ui.core.Modifier fillMaxHeight(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxSize(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxWidth(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier preferredHeight(androidx.ui.core.Modifier, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredHeightIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp size);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.layout.DpConstraints constraints);
+ method public static androidx.ui.core.Modifier preferredWidth(androidx.ui.core.Modifier, androidx.ui.unit.Dp width);
+ method public static androidx.ui.core.Modifier preferredWidthIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier wrapContentHeight(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentSize(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentWidth(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
}
public final class LayoutWidth implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth(androidx.ui.unit.Dp width);
+ ctor @Deprecated public LayoutWidth(androidx.ui.unit.Dp width);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth copy(androidx.ui.unit.Dp width);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -571,11 +620,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutWidth.Constrain copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
@@ -588,16 +636,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
+ @Deprecated public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
public static final class LayoutWidth.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Max copy(androidx.ui.unit.Dp maxWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -608,11 +655,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
+ ctor @Deprecated public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Min copy(androidx.ui.unit.Dp minWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -623,7 +669,6 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public enum MainAxisAlignment {
@@ -635,6 +680,12 @@
enum_constant public static final androidx.ui.layout.MainAxisAlignment Start;
}
+ public enum RowAlign {
+ enum_constant public static final androidx.ui.layout.RowAlign Bottom;
+ enum_constant public static final androidx.ui.layout.RowAlign Center;
+ enum_constant public static final androidx.ui.layout.RowAlign Top;
+ }
+
public final class RowColumnImplKt {
}
@@ -643,15 +694,19 @@
}
@androidx.ui.layout.LayoutScopeMarker public final class RowScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Bottom;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier Top;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.RowAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Bottom;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Top;
field public static final androidx.ui.layout.RowScope! INSTANCE;
}
@@ -670,26 +725,28 @@
@androidx.ui.layout.LayoutScopeMarker public final class StackScope {
ctor public StackScope();
- method public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier BottomCenter;
- property public final androidx.ui.core.ParentDataModifier BottomEnd;
- property public final androidx.ui.core.ParentDataModifier BottomStart;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier CenterEnd;
- property public final androidx.ui.core.ParentDataModifier CenterStart;
- property public final androidx.ui.core.ParentDataModifier Stretch;
- property public final androidx.ui.core.ParentDataModifier TopCenter;
- property public final androidx.ui.core.ParentDataModifier TopEnd;
- property public final androidx.ui.core.ParentDataModifier TopStart;
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.core.Alignment align);
+ method public androidx.ui.core.Modifier matchParent(androidx.ui.core.Modifier);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Stretch;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopStart;
}
@androidx.ui.layout.LayoutScopeMarker public final class TableChildren {
diff --git a/ui/ui-layout/api/public_plus_experimental_current.txt b/ui/ui-layout/api/public_plus_experimental_current.txt
index 153b6c8..77d284a 100644
--- a/ui/ui-layout/api/public_plus_experimental_current.txt
+++ b/ui/ui-layout/api/public_plus_experimental_current.txt
@@ -57,25 +57,35 @@
public static interface Arrangement.Vertical extends androidx.ui.layout.Arrangement {
}
+ public enum ColumnAlign {
+ enum_constant public static final androidx.ui.layout.ColumnAlign Center;
+ enum_constant public static final androidx.ui.layout.ColumnAlign End;
+ enum_constant public static final androidx.ui.layout.ColumnAlign Start;
+ }
+
public final class ColumnKt {
method public static void Column(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.layout.Arrangement.Vertical arrangement = Arrangement.Top, kotlin.jvm.functions.Function1<? super androidx.ui.layout.ColumnScope,kotlin.Unit> children);
}
@androidx.ui.layout.LayoutScopeMarker public final class ColumnScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier End;
- property public final androidx.ui.core.ParentDataModifier Start;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.ColumnAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier End;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Start;
field public static final androidx.ui.layout.ColumnScope! INSTANCE;
}
public final class ConstraintLayoutKt {
- method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ConstraintSet {
@@ -313,36 +323,36 @@
}
public final class LayoutAlign {
- method public androidx.ui.core.LayoutModifier getBottom();
- method public androidx.ui.core.LayoutModifier getBottomCenter();
- method public androidx.ui.core.LayoutModifier getBottomEnd();
- method public androidx.ui.core.LayoutModifier getBottomStart();
- method public androidx.ui.core.LayoutModifier getCenter();
- method public androidx.ui.core.LayoutModifier getCenterEnd();
- method public androidx.ui.core.LayoutModifier getCenterHorizontally();
- method public androidx.ui.core.LayoutModifier getCenterStart();
- method public androidx.ui.core.LayoutModifier getCenterVertically();
- method public androidx.ui.core.LayoutModifier getEnd();
- method public androidx.ui.core.LayoutModifier getStart();
- method public androidx.ui.core.LayoutModifier getTop();
- method public androidx.ui.core.LayoutModifier getTopCenter();
- method public androidx.ui.core.LayoutModifier getTopEnd();
- method public androidx.ui.core.LayoutModifier getTopStart();
- property public final androidx.ui.core.LayoutModifier Bottom;
- property public final androidx.ui.core.LayoutModifier BottomCenter;
- property public final androidx.ui.core.LayoutModifier BottomEnd;
- property public final androidx.ui.core.LayoutModifier BottomStart;
- property public final androidx.ui.core.LayoutModifier Center;
- property public final androidx.ui.core.LayoutModifier CenterEnd;
- property public final androidx.ui.core.LayoutModifier CenterHorizontally;
- property public final androidx.ui.core.LayoutModifier CenterStart;
- property public final androidx.ui.core.LayoutModifier CenterVertically;
- property public final androidx.ui.core.LayoutModifier End;
- property public final androidx.ui.core.LayoutModifier Start;
- property public final androidx.ui.core.LayoutModifier Top;
- property public final androidx.ui.core.LayoutModifier TopCenter;
- property public final androidx.ui.core.LayoutModifier TopEnd;
- property public final androidx.ui.core.LayoutModifier TopStart;
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottom();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterHorizontally();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterVertically();
+ method @Deprecated public androidx.ui.core.LayoutModifier getEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTop();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopStart();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Bottom;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Center;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterHorizontally;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterVertically;
+ property @Deprecated public final androidx.ui.core.LayoutModifier End;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Start;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Top;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopStart;
field public static final androidx.ui.layout.LayoutAlign! INSTANCE;
}
@@ -351,7 +361,7 @@
}
public final class LayoutAspectRatio implements androidx.ui.core.LayoutModifier {
- ctor public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
+ ctor @Deprecated public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
@@ -363,22 +373,28 @@
}
public final class LayoutAspectRatioKt {
+ method public static androidx.ui.core.Modifier aspectRatio(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio);
}
public final class LayoutDirectionModifier {
- method public androidx.ui.core.LayoutModifier getLtr();
- method public androidx.ui.core.LayoutModifier getRtl();
- property public final androidx.ui.core.LayoutModifier Ltr;
- property public final androidx.ui.core.LayoutModifier Rtl;
+ method @Deprecated public androidx.ui.core.LayoutModifier getLtr();
+ method @Deprecated public androidx.ui.core.LayoutModifier getRtl();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Ltr;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Rtl;
field public static final androidx.ui.layout.LayoutDirectionModifier! INSTANCE;
}
+ public final class LayoutDirectionsKt {
+ method public static androidx.ui.core.Modifier getLtr(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier getRtl(androidx.ui.core.Modifier);
+ }
+
public final class LayoutGravity {
field public static final androidx.ui.layout.LayoutGravity! INSTANCE;
}
public final class LayoutHeight implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight(androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutHeight(androidx.ui.unit.Dp height);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight copy(androidx.ui.unit.Dp height);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -389,11 +405,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutHeight.Constrain copy(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
@@ -406,16 +421,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
+ @Deprecated public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
public static final class LayoutHeight.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Max copy(androidx.ui.unit.Dp maxHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -426,11 +440,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Min copy(androidx.ui.unit.Dp minHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -441,11 +454,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public final class LayoutOffset implements androidx.ui.core.LayoutModifier {
- ctor public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ ctor @Deprecated public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutOffset copy(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
@@ -454,9 +466,13 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
}
+ public final class LayoutOffsetKt {
+ method public static androidx.ui.core.Modifier offset(androidx.ui.core.Modifier, androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ }
+
public final class LayoutPadding implements androidx.ui.core.LayoutModifier {
- ctor public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
- ctor public LayoutPadding();
+ ctor @Deprecated public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPadding();
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -471,16 +487,36 @@
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
}
+ public final class LayoutPaddingAbsolute implements androidx.ui.core.LayoutModifier {
+ ctor @Deprecated public LayoutPaddingAbsolute(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPaddingAbsolute();
+ method public androidx.ui.unit.Dp component1();
+ method public androidx.ui.unit.Dp component2();
+ method public androidx.ui.unit.Dp component3();
+ method public androidx.ui.unit.Dp component4();
+ method public androidx.ui.layout.LayoutPaddingAbsolute copy(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ method public androidx.ui.unit.Dp getBottom();
+ method public androidx.ui.unit.Dp getLeft();
+ method public androidx.ui.unit.Dp getRight();
+ method public androidx.ui.unit.Dp getTop();
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
+ }
+
public final class LayoutPaddingKt {
- method public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method @Deprecated public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method public static androidx.ui.core.Modifier absolutePadding(androidx.ui.core.Modifier, androidx.ui.unit.Dp left = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp right = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp start = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp end = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp all);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
}
public final class LayoutSize implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
- ctor public LayoutSize(androidx.ui.unit.Dp size);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp size);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize copy(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
@@ -493,12 +529,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -515,17 +550,16 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
+ @Deprecated public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
public static final class LayoutSize.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Max copy(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
@@ -538,12 +572,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minSize);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Min copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
@@ -556,11 +589,27 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ }
+
+ public final class LayoutSizeKt {
+ method public static androidx.ui.core.Modifier fillMaxHeight(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxSize(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxWidth(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier preferredHeight(androidx.ui.core.Modifier, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredHeightIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp size);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.layout.DpConstraints constraints);
+ method public static androidx.ui.core.Modifier preferredWidth(androidx.ui.core.Modifier, androidx.ui.unit.Dp width);
+ method public static androidx.ui.core.Modifier preferredWidthIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier wrapContentHeight(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentSize(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentWidth(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
}
public final class LayoutWidth implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth(androidx.ui.unit.Dp width);
+ ctor @Deprecated public LayoutWidth(androidx.ui.unit.Dp width);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth copy(androidx.ui.unit.Dp width);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -571,11 +620,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutWidth.Constrain copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
@@ -588,16 +636,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
+ @Deprecated public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
public static final class LayoutWidth.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Max copy(androidx.ui.unit.Dp maxWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -608,11 +655,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
+ ctor @Deprecated public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Min copy(androidx.ui.unit.Dp minWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -623,7 +669,6 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public enum MainAxisAlignment {
@@ -635,6 +680,12 @@
enum_constant public static final androidx.ui.layout.MainAxisAlignment Start;
}
+ public enum RowAlign {
+ enum_constant public static final androidx.ui.layout.RowAlign Bottom;
+ enum_constant public static final androidx.ui.layout.RowAlign Center;
+ enum_constant public static final androidx.ui.layout.RowAlign Top;
+ }
+
public final class RowColumnImplKt {
}
@@ -643,15 +694,19 @@
}
@androidx.ui.layout.LayoutScopeMarker public final class RowScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Bottom;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier Top;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.RowAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Bottom;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Top;
field public static final androidx.ui.layout.RowScope! INSTANCE;
}
@@ -670,26 +725,28 @@
@androidx.ui.layout.LayoutScopeMarker public final class StackScope {
ctor public StackScope();
- method public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier BottomCenter;
- property public final androidx.ui.core.ParentDataModifier BottomEnd;
- property public final androidx.ui.core.ParentDataModifier BottomStart;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier CenterEnd;
- property public final androidx.ui.core.ParentDataModifier CenterStart;
- property public final androidx.ui.core.ParentDataModifier Stretch;
- property public final androidx.ui.core.ParentDataModifier TopCenter;
- property public final androidx.ui.core.ParentDataModifier TopEnd;
- property public final androidx.ui.core.ParentDataModifier TopStart;
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.core.Alignment align);
+ method public androidx.ui.core.Modifier matchParent(androidx.ui.core.Modifier);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Stretch;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopStart;
}
@androidx.ui.layout.LayoutScopeMarker public final class TableChildren {
diff --git a/ui/ui-layout/api/restricted_0.1.0-dev08.txt b/ui/ui-layout/api/restricted_0.1.0-dev08.txt
index 153b6c8..77d284a 100644
--- a/ui/ui-layout/api/restricted_0.1.0-dev08.txt
+++ b/ui/ui-layout/api/restricted_0.1.0-dev08.txt
@@ -57,25 +57,35 @@
public static interface Arrangement.Vertical extends androidx.ui.layout.Arrangement {
}
+ public enum ColumnAlign {
+ enum_constant public static final androidx.ui.layout.ColumnAlign Center;
+ enum_constant public static final androidx.ui.layout.ColumnAlign End;
+ enum_constant public static final androidx.ui.layout.ColumnAlign Start;
+ }
+
public final class ColumnKt {
method public static void Column(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.layout.Arrangement.Vertical arrangement = Arrangement.Top, kotlin.jvm.functions.Function1<? super androidx.ui.layout.ColumnScope,kotlin.Unit> children);
}
@androidx.ui.layout.LayoutScopeMarker public final class ColumnScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier End;
- property public final androidx.ui.core.ParentDataModifier Start;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.ColumnAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier End;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Start;
field public static final androidx.ui.layout.ColumnScope! INSTANCE;
}
public final class ConstraintLayoutKt {
- method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ConstraintSet {
@@ -313,36 +323,36 @@
}
public final class LayoutAlign {
- method public androidx.ui.core.LayoutModifier getBottom();
- method public androidx.ui.core.LayoutModifier getBottomCenter();
- method public androidx.ui.core.LayoutModifier getBottomEnd();
- method public androidx.ui.core.LayoutModifier getBottomStart();
- method public androidx.ui.core.LayoutModifier getCenter();
- method public androidx.ui.core.LayoutModifier getCenterEnd();
- method public androidx.ui.core.LayoutModifier getCenterHorizontally();
- method public androidx.ui.core.LayoutModifier getCenterStart();
- method public androidx.ui.core.LayoutModifier getCenterVertically();
- method public androidx.ui.core.LayoutModifier getEnd();
- method public androidx.ui.core.LayoutModifier getStart();
- method public androidx.ui.core.LayoutModifier getTop();
- method public androidx.ui.core.LayoutModifier getTopCenter();
- method public androidx.ui.core.LayoutModifier getTopEnd();
- method public androidx.ui.core.LayoutModifier getTopStart();
- property public final androidx.ui.core.LayoutModifier Bottom;
- property public final androidx.ui.core.LayoutModifier BottomCenter;
- property public final androidx.ui.core.LayoutModifier BottomEnd;
- property public final androidx.ui.core.LayoutModifier BottomStart;
- property public final androidx.ui.core.LayoutModifier Center;
- property public final androidx.ui.core.LayoutModifier CenterEnd;
- property public final androidx.ui.core.LayoutModifier CenterHorizontally;
- property public final androidx.ui.core.LayoutModifier CenterStart;
- property public final androidx.ui.core.LayoutModifier CenterVertically;
- property public final androidx.ui.core.LayoutModifier End;
- property public final androidx.ui.core.LayoutModifier Start;
- property public final androidx.ui.core.LayoutModifier Top;
- property public final androidx.ui.core.LayoutModifier TopCenter;
- property public final androidx.ui.core.LayoutModifier TopEnd;
- property public final androidx.ui.core.LayoutModifier TopStart;
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottom();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterHorizontally();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterVertically();
+ method @Deprecated public androidx.ui.core.LayoutModifier getEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTop();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopStart();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Bottom;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Center;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterHorizontally;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterVertically;
+ property @Deprecated public final androidx.ui.core.LayoutModifier End;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Start;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Top;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopStart;
field public static final androidx.ui.layout.LayoutAlign! INSTANCE;
}
@@ -351,7 +361,7 @@
}
public final class LayoutAspectRatio implements androidx.ui.core.LayoutModifier {
- ctor public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
+ ctor @Deprecated public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
@@ -363,22 +373,28 @@
}
public final class LayoutAspectRatioKt {
+ method public static androidx.ui.core.Modifier aspectRatio(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio);
}
public final class LayoutDirectionModifier {
- method public androidx.ui.core.LayoutModifier getLtr();
- method public androidx.ui.core.LayoutModifier getRtl();
- property public final androidx.ui.core.LayoutModifier Ltr;
- property public final androidx.ui.core.LayoutModifier Rtl;
+ method @Deprecated public androidx.ui.core.LayoutModifier getLtr();
+ method @Deprecated public androidx.ui.core.LayoutModifier getRtl();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Ltr;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Rtl;
field public static final androidx.ui.layout.LayoutDirectionModifier! INSTANCE;
}
+ public final class LayoutDirectionsKt {
+ method public static androidx.ui.core.Modifier getLtr(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier getRtl(androidx.ui.core.Modifier);
+ }
+
public final class LayoutGravity {
field public static final androidx.ui.layout.LayoutGravity! INSTANCE;
}
public final class LayoutHeight implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight(androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutHeight(androidx.ui.unit.Dp height);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight copy(androidx.ui.unit.Dp height);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -389,11 +405,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutHeight.Constrain copy(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
@@ -406,16 +421,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
+ @Deprecated public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
public static final class LayoutHeight.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Max copy(androidx.ui.unit.Dp maxHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -426,11 +440,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Min copy(androidx.ui.unit.Dp minHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -441,11 +454,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public final class LayoutOffset implements androidx.ui.core.LayoutModifier {
- ctor public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ ctor @Deprecated public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutOffset copy(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
@@ -454,9 +466,13 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
}
+ public final class LayoutOffsetKt {
+ method public static androidx.ui.core.Modifier offset(androidx.ui.core.Modifier, androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ }
+
public final class LayoutPadding implements androidx.ui.core.LayoutModifier {
- ctor public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
- ctor public LayoutPadding();
+ ctor @Deprecated public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPadding();
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -471,16 +487,36 @@
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
}
+ public final class LayoutPaddingAbsolute implements androidx.ui.core.LayoutModifier {
+ ctor @Deprecated public LayoutPaddingAbsolute(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPaddingAbsolute();
+ method public androidx.ui.unit.Dp component1();
+ method public androidx.ui.unit.Dp component2();
+ method public androidx.ui.unit.Dp component3();
+ method public androidx.ui.unit.Dp component4();
+ method public androidx.ui.layout.LayoutPaddingAbsolute copy(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ method public androidx.ui.unit.Dp getBottom();
+ method public androidx.ui.unit.Dp getLeft();
+ method public androidx.ui.unit.Dp getRight();
+ method public androidx.ui.unit.Dp getTop();
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
+ }
+
public final class LayoutPaddingKt {
- method public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method @Deprecated public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method public static androidx.ui.core.Modifier absolutePadding(androidx.ui.core.Modifier, androidx.ui.unit.Dp left = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp right = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp start = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp end = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp all);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
}
public final class LayoutSize implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
- ctor public LayoutSize(androidx.ui.unit.Dp size);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp size);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize copy(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
@@ -493,12 +529,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -515,17 +550,16 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
+ @Deprecated public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
public static final class LayoutSize.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Max copy(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
@@ -538,12 +572,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minSize);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Min copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
@@ -556,11 +589,27 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ }
+
+ public final class LayoutSizeKt {
+ method public static androidx.ui.core.Modifier fillMaxHeight(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxSize(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxWidth(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier preferredHeight(androidx.ui.core.Modifier, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredHeightIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp size);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.layout.DpConstraints constraints);
+ method public static androidx.ui.core.Modifier preferredWidth(androidx.ui.core.Modifier, androidx.ui.unit.Dp width);
+ method public static androidx.ui.core.Modifier preferredWidthIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier wrapContentHeight(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentSize(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentWidth(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
}
public final class LayoutWidth implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth(androidx.ui.unit.Dp width);
+ ctor @Deprecated public LayoutWidth(androidx.ui.unit.Dp width);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth copy(androidx.ui.unit.Dp width);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -571,11 +620,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutWidth.Constrain copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
@@ -588,16 +636,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
+ @Deprecated public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
public static final class LayoutWidth.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Max copy(androidx.ui.unit.Dp maxWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -608,11 +655,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
+ ctor @Deprecated public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Min copy(androidx.ui.unit.Dp minWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -623,7 +669,6 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public enum MainAxisAlignment {
@@ -635,6 +680,12 @@
enum_constant public static final androidx.ui.layout.MainAxisAlignment Start;
}
+ public enum RowAlign {
+ enum_constant public static final androidx.ui.layout.RowAlign Bottom;
+ enum_constant public static final androidx.ui.layout.RowAlign Center;
+ enum_constant public static final androidx.ui.layout.RowAlign Top;
+ }
+
public final class RowColumnImplKt {
}
@@ -643,15 +694,19 @@
}
@androidx.ui.layout.LayoutScopeMarker public final class RowScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Bottom;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier Top;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.RowAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Bottom;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Top;
field public static final androidx.ui.layout.RowScope! INSTANCE;
}
@@ -670,26 +725,28 @@
@androidx.ui.layout.LayoutScopeMarker public final class StackScope {
ctor public StackScope();
- method public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier BottomCenter;
- property public final androidx.ui.core.ParentDataModifier BottomEnd;
- property public final androidx.ui.core.ParentDataModifier BottomStart;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier CenterEnd;
- property public final androidx.ui.core.ParentDataModifier CenterStart;
- property public final androidx.ui.core.ParentDataModifier Stretch;
- property public final androidx.ui.core.ParentDataModifier TopCenter;
- property public final androidx.ui.core.ParentDataModifier TopEnd;
- property public final androidx.ui.core.ParentDataModifier TopStart;
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.core.Alignment align);
+ method public androidx.ui.core.Modifier matchParent(androidx.ui.core.Modifier);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Stretch;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopStart;
}
@androidx.ui.layout.LayoutScopeMarker public final class TableChildren {
diff --git a/ui/ui-layout/api/restricted_current.txt b/ui/ui-layout/api/restricted_current.txt
index 153b6c8..77d284a 100644
--- a/ui/ui-layout/api/restricted_current.txt
+++ b/ui/ui-layout/api/restricted_current.txt
@@ -57,25 +57,35 @@
public static interface Arrangement.Vertical extends androidx.ui.layout.Arrangement {
}
+ public enum ColumnAlign {
+ enum_constant public static final androidx.ui.layout.ColumnAlign Center;
+ enum_constant public static final androidx.ui.layout.ColumnAlign End;
+ enum_constant public static final androidx.ui.layout.ColumnAlign Start;
+ }
+
public final class ColumnKt {
method public static void Column(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.layout.Arrangement.Vertical arrangement = Arrangement.Top, kotlin.jvm.functions.Function1<? super androidx.ui.layout.ColumnScope,kotlin.Unit> children);
}
@androidx.ui.layout.LayoutScopeMarker public final class ColumnScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier End;
- property public final androidx.ui.core.ParentDataModifier Start;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.VerticalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.ColumnAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier End;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Start;
field public static final androidx.ui.layout.ColumnScope! INSTANCE;
}
public final class ConstraintLayoutKt {
- method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ConstraintLayout(androidx.ui.layout.ConstraintSet constraintSet, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ConstraintSet {
@@ -313,36 +323,36 @@
}
public final class LayoutAlign {
- method public androidx.ui.core.LayoutModifier getBottom();
- method public androidx.ui.core.LayoutModifier getBottomCenter();
- method public androidx.ui.core.LayoutModifier getBottomEnd();
- method public androidx.ui.core.LayoutModifier getBottomStart();
- method public androidx.ui.core.LayoutModifier getCenter();
- method public androidx.ui.core.LayoutModifier getCenterEnd();
- method public androidx.ui.core.LayoutModifier getCenterHorizontally();
- method public androidx.ui.core.LayoutModifier getCenterStart();
- method public androidx.ui.core.LayoutModifier getCenterVertically();
- method public androidx.ui.core.LayoutModifier getEnd();
- method public androidx.ui.core.LayoutModifier getStart();
- method public androidx.ui.core.LayoutModifier getTop();
- method public androidx.ui.core.LayoutModifier getTopCenter();
- method public androidx.ui.core.LayoutModifier getTopEnd();
- method public androidx.ui.core.LayoutModifier getTopStart();
- property public final androidx.ui.core.LayoutModifier Bottom;
- property public final androidx.ui.core.LayoutModifier BottomCenter;
- property public final androidx.ui.core.LayoutModifier BottomEnd;
- property public final androidx.ui.core.LayoutModifier BottomStart;
- property public final androidx.ui.core.LayoutModifier Center;
- property public final androidx.ui.core.LayoutModifier CenterEnd;
- property public final androidx.ui.core.LayoutModifier CenterHorizontally;
- property public final androidx.ui.core.LayoutModifier CenterStart;
- property public final androidx.ui.core.LayoutModifier CenterVertically;
- property public final androidx.ui.core.LayoutModifier End;
- property public final androidx.ui.core.LayoutModifier Start;
- property public final androidx.ui.core.LayoutModifier Top;
- property public final androidx.ui.core.LayoutModifier TopCenter;
- property public final androidx.ui.core.LayoutModifier TopEnd;
- property public final androidx.ui.core.LayoutModifier TopStart;
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottom();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getBottomStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterHorizontally();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getCenterVertically();
+ method @Deprecated public androidx.ui.core.LayoutModifier getEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getStart();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTop();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopCenter();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopEnd();
+ method @Deprecated public androidx.ui.core.LayoutModifier getTopStart();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Bottom;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Center;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterHorizontally;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.LayoutModifier CenterVertically;
+ property @Deprecated public final androidx.ui.core.LayoutModifier End;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Start;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Top;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.LayoutModifier TopStart;
field public static final androidx.ui.layout.LayoutAlign! INSTANCE;
}
@@ -351,7 +361,7 @@
}
public final class LayoutAspectRatio implements androidx.ui.core.LayoutModifier {
- ctor public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
+ ctor @Deprecated public LayoutAspectRatio(@FloatRange(from=null, fromInclusive=null) float aspectRatio);
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
@@ -363,22 +373,28 @@
}
public final class LayoutAspectRatioKt {
+ method public static androidx.ui.core.Modifier aspectRatio(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio);
}
public final class LayoutDirectionModifier {
- method public androidx.ui.core.LayoutModifier getLtr();
- method public androidx.ui.core.LayoutModifier getRtl();
- property public final androidx.ui.core.LayoutModifier Ltr;
- property public final androidx.ui.core.LayoutModifier Rtl;
+ method @Deprecated public androidx.ui.core.LayoutModifier getLtr();
+ method @Deprecated public androidx.ui.core.LayoutModifier getRtl();
+ property @Deprecated public final androidx.ui.core.LayoutModifier Ltr;
+ property @Deprecated public final androidx.ui.core.LayoutModifier Rtl;
field public static final androidx.ui.layout.LayoutDirectionModifier! INSTANCE;
}
+ public final class LayoutDirectionsKt {
+ method public static androidx.ui.core.Modifier getLtr(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier getRtl(androidx.ui.core.Modifier);
+ }
+
public final class LayoutGravity {
field public static final androidx.ui.layout.LayoutGravity! INSTANCE;
}
public final class LayoutHeight implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight(androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutHeight(androidx.ui.unit.Dp height);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight copy(androidx.ui.unit.Dp height);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -389,11 +405,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Constrain(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutHeight.Constrain copy(androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxHeight);
@@ -406,16 +421,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
+ @Deprecated public static final class LayoutHeight.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
public static final class LayoutHeight.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutHeight.Max(androidx.ui.unit.Dp maxHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Max copy(androidx.ui.unit.Dp maxHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -426,11 +440,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutHeight.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutHeight.Min(androidx.ui.unit.Dp minHeight);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutHeight.Min copy(androidx.ui.unit.Dp minHeight);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -441,11 +454,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public final class LayoutOffset implements androidx.ui.core.LayoutModifier {
- ctor public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ ctor @Deprecated public LayoutOffset(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutOffset copy(androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
@@ -454,9 +466,13 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
}
+ public final class LayoutOffsetKt {
+ method public static androidx.ui.core.Modifier offset(androidx.ui.core.Modifier, androidx.ui.unit.Dp x, androidx.ui.unit.Dp y);
+ }
+
public final class LayoutPadding implements androidx.ui.core.LayoutModifier {
- ctor public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
- ctor public LayoutPadding();
+ ctor @Deprecated public LayoutPadding(androidx.ui.unit.Dp start, androidx.ui.unit.Dp top, androidx.ui.unit.Dp end, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPadding();
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -471,16 +487,36 @@
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
}
+ public final class LayoutPaddingAbsolute implements androidx.ui.core.LayoutModifier {
+ ctor @Deprecated public LayoutPaddingAbsolute(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ ctor @Deprecated public LayoutPaddingAbsolute();
+ method public androidx.ui.unit.Dp component1();
+ method public androidx.ui.unit.Dp component2();
+ method public androidx.ui.unit.Dp component3();
+ method public androidx.ui.unit.Dp component4();
+ method public androidx.ui.layout.LayoutPaddingAbsolute copy(androidx.ui.unit.Dp left, androidx.ui.unit.Dp top, androidx.ui.unit.Dp right, androidx.ui.unit.Dp bottom);
+ method public androidx.ui.unit.Dp getBottom();
+ method public androidx.ui.unit.Dp getLeft();
+ method public androidx.ui.unit.Dp getRight();
+ method public androidx.ui.unit.Dp getTop();
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
+ }
+
public final class LayoutPaddingKt {
- method public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method @Deprecated public static androidx.ui.layout.LayoutPadding LayoutPadding(androidx.ui.unit.Dp all);
+ method public static androidx.ui.core.Modifier absolutePadding(androidx.ui.core.Modifier, androidx.ui.unit.Dp left = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp right = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp start = 0.dp, androidx.ui.unit.Dp top = 0.dp, androidx.ui.unit.Dp end = 0.dp, androidx.ui.unit.Dp bottom = 0.dp);
+ method public static androidx.ui.core.Modifier padding(androidx.ui.core.Modifier, androidx.ui.unit.Dp all);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
}
public final class LayoutSize implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
- ctor public LayoutSize(androidx.ui.unit.Dp size);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ ctor @Deprecated public LayoutSize(androidx.ui.unit.Dp size);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize copy(androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
@@ -493,12 +529,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight, androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Constrain(androidx.ui.unit.Dp minSize, androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.unit.Dp component3();
@@ -515,17 +550,16 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
+ @Deprecated public static final class LayoutSize.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
public static final class LayoutSize.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
- ctor public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
+ ctor @Deprecated public LayoutSize.Max(androidx.ui.unit.Dp maxSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Max copy(androidx.ui.unit.Dp maxWidth, androidx.ui.unit.Dp maxHeight);
@@ -538,12 +572,11 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutSize.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
- ctor public LayoutSize.Min(androidx.ui.unit.Dp minSize);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
+ ctor @Deprecated public LayoutSize.Min(androidx.ui.unit.Dp minSize);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutSize.Min copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp minHeight);
@@ -556,11 +589,27 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
+ }
+
+ public final class LayoutSizeKt {
+ method public static androidx.ui.core.Modifier fillMaxHeight(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxSize(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier fillMaxWidth(androidx.ui.core.Modifier);
+ method public static androidx.ui.core.Modifier preferredHeight(androidx.ui.core.Modifier, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredHeightIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp size);
+ method public static androidx.ui.core.Modifier preferredSize(androidx.ui.core.Modifier, androidx.ui.unit.Dp width, androidx.ui.unit.Dp height);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp minHeight = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified, androidx.ui.unit.Dp maxHeight = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier preferredSizeIn(androidx.ui.core.Modifier, androidx.ui.layout.DpConstraints constraints);
+ method public static androidx.ui.core.Modifier preferredWidth(androidx.ui.core.Modifier, androidx.ui.unit.Dp width);
+ method public static androidx.ui.core.Modifier preferredWidthIn(androidx.ui.core.Modifier, androidx.ui.unit.Dp minWidth = Dp.Unspecified, androidx.ui.unit.Dp maxWidth = Dp.Unspecified);
+ method public static androidx.ui.core.Modifier wrapContentHeight(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentSize(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
+ method public static androidx.ui.core.Modifier wrapContentWidth(androidx.ui.core.Modifier, androidx.ui.core.Alignment align = Center);
}
public final class LayoutWidth implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth(androidx.ui.unit.Dp width);
+ ctor @Deprecated public LayoutWidth(androidx.ui.unit.Dp width);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth copy(androidx.ui.unit.Dp width);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -571,11 +620,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Constrain implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Constrain(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.unit.Dp component2();
method public androidx.ui.layout.LayoutWidth.Constrain copy(androidx.ui.unit.Dp minWidth, androidx.ui.unit.Dp maxWidth);
@@ -588,16 +636,15 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
- public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
- field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
+ @Deprecated public static final class LayoutWidth.Fill implements androidx.ui.core.LayoutModifier {
+ method @Deprecated public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection);
+ field @Deprecated public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
public static final class LayoutWidth.Max implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
+ ctor @Deprecated public LayoutWidth.Max(androidx.ui.unit.Dp maxWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Max copy(androidx.ui.unit.Dp maxWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -608,11 +655,10 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public static final class LayoutWidth.Min implements androidx.ui.core.LayoutModifier {
- ctor public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
+ ctor @Deprecated public LayoutWidth.Min(androidx.ui.unit.Dp minWidth);
method public androidx.ui.unit.Dp component1();
method public androidx.ui.layout.LayoutWidth.Min copy(androidx.ui.unit.Dp minWidth);
method public <R> R! foldIn(R! initial, kotlin.jvm.functions.Function2<? super R,? super androidx.ui.core.Modifier.Element,? extends R> operation);
@@ -623,7 +669,6 @@
method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize, androidx.ui.core.LayoutDirection layoutDirection);
method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.core.LayoutDirection layoutDirection, androidx.ui.unit.IntPxSize childSize);
method public androidx.ui.core.Modifier plus(androidx.ui.core.Modifier other);
- method @Deprecated public androidx.ui.core.Modifier wraps(androidx.ui.core.Modifier other);
}
public enum MainAxisAlignment {
@@ -635,6 +680,12 @@
enum_constant public static final androidx.ui.layout.MainAxisAlignment Start;
}
+ public enum RowAlign {
+ enum_constant public static final androidx.ui.layout.RowAlign Bottom;
+ enum_constant public static final androidx.ui.layout.RowAlign Center;
+ enum_constant public static final androidx.ui.layout.RowAlign Top;
+ }
+
public final class RowColumnImplKt {
}
@@ -643,15 +694,19 @@
}
@androidx.ui.layout.LayoutScopeMarker public final class RowScope {
- method public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
- method public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
- method public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier Bottom;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier Top;
+ method @Deprecated public androidx.ui.core.ParentDataModifier LayoutWeight(@FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method @Deprecated public androidx.ui.core.ParentDataModifier RelativeToSiblings(androidx.ui.layout.LayoutGravity, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, androidx.ui.core.HorizontalAlignmentLine alignmentLine);
+ method public androidx.ui.core.Modifier alignWithSiblings(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable,androidx.ui.unit.IntPx> alignmentLineBlock);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottom(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTop(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.layout.RowAlign align);
+ method public androidx.ui.core.Modifier weight(androidx.ui.core.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, boolean fill = true);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Bottom;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Top;
field public static final androidx.ui.layout.RowScope! INSTANCE;
}
@@ -670,26 +725,28 @@
@androidx.ui.layout.LayoutScopeMarker public final class StackScope {
ctor public StackScope();
- method public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
- method public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
- property public final androidx.ui.core.ParentDataModifier BottomCenter;
- property public final androidx.ui.core.ParentDataModifier BottomEnd;
- property public final androidx.ui.core.ParentDataModifier BottomStart;
- property public final androidx.ui.core.ParentDataModifier Center;
- property public final androidx.ui.core.ParentDataModifier CenterEnd;
- property public final androidx.ui.core.ParentDataModifier CenterStart;
- property public final androidx.ui.core.ParentDataModifier Stretch;
- property public final androidx.ui.core.ParentDataModifier TopCenter;
- property public final androidx.ui.core.ParentDataModifier TopEnd;
- property public final androidx.ui.core.ParentDataModifier TopStart;
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getBottomStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getCenterStart(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getStretch(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopCenter(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopEnd(androidx.ui.layout.LayoutGravity);
+ method @Deprecated public androidx.ui.core.ParentDataModifier getTopStart(androidx.ui.layout.LayoutGravity);
+ method public androidx.ui.core.Modifier gravity(androidx.ui.core.Modifier, androidx.ui.core.Alignment align);
+ method public androidx.ui.core.Modifier matchParent(androidx.ui.core.Modifier);
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier BottomStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Center;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier CenterStart;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier Stretch;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopCenter;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopEnd;
+ property @Deprecated public final androidx.ui.core.ParentDataModifier TopStart;
}
@androidx.ui.layout.LayoutScopeMarker public final class TableChildren {
diff --git a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ComplexLayoutDemo.kt b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ComplexLayoutDemo.kt
index dd9ac88..3d00524 100644
--- a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ComplexLayoutDemo.kt
+++ b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ComplexLayoutDemo.kt
@@ -18,8 +18,9 @@
import androidx.compose.Composable
import androidx.ui.core.FirstBaseline
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
+import androidx.ui.foundation.drawBackground
import androidx.ui.graphics.Color
import androidx.ui.layout.AlignmentLineOffset
import androidx.ui.layout.Stack
@@ -29,7 +30,7 @@
private fun AlignmentLineOffsetUsage() {
AlignmentLineOffset(
FirstBaseline,
- modifier = DrawBackground(Color.Gray),
+ modifier = Modifier.drawBackground(Color.Gray),
before = 20.dp,
after = 40.dp
) {
diff --git a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ConstraintLayoutDemo.kt b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ConstraintLayoutDemo.kt
index 8dd5adc..582ad34 100644
--- a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ConstraintLayoutDemo.kt
+++ b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/ConstraintLayoutDemo.kt
@@ -17,7 +17,8 @@
package androidx.ui.layout.demos
import androidx.compose.Composable
-import androidx.ui.core.LayoutTag
+import androidx.ui.core.Modifier
+import androidx.ui.core.tag
import androidx.ui.foundation.Text
import androidx.ui.layout.ConstraintLayout
import androidx.ui.layout.ConstraintSet
@@ -64,10 +65,10 @@
text5.top constrainTo barrier
text5.centerHorizontally()
}) {
- Text(modifier = LayoutTag("text1"), text = "Text1", style = TextStyle(fontSize = 10.sp))
- Text(modifier = LayoutTag("text2"), text = "Text2", style = TextStyle(fontSize = 12.sp))
- Text(modifier = LayoutTag("text3"), text = "Text3", style = TextStyle(fontSize = 14.sp))
- Text(modifier = LayoutTag("text4"), text = "Text4", style = TextStyle(fontSize = 16.sp))
- Text(modifier = LayoutTag("text5"), text = "Text5", style = TextStyle(fontSize = 18.sp))
+ Text(modifier = Modifier.tag("text1"), text = "Text1", style = TextStyle(fontSize = 10.sp))
+ Text(modifier = Modifier.tag("text2"), text = "Text2", style = TextStyle(fontSize = 12.sp))
+ Text(modifier = Modifier.tag("text3"), text = "Text3", style = TextStyle(fontSize = 14.sp))
+ Text(modifier = Modifier.tag("text4"), text = "Text4", style = TextStyle(fontSize = 16.sp))
+ Text(modifier = Modifier.tag("text5"), text = "Text5", style = TextStyle(fontSize = 18.sp))
}
}
diff --git a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/RtlDemo.kt b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/RtlDemo.kt
index ae063c2..e3367b1 100644
--- a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/RtlDemo.kt
+++ b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/RtlDemo.kt
@@ -17,22 +17,24 @@
package androidx.ui.layout.demos
import androidx.compose.Composable
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
import androidx.ui.core.Layout
import androidx.ui.core.LayoutDirection
import androidx.ui.core.Modifier
import androidx.ui.core.WithConstraints
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.Text
+import androidx.ui.foundation.drawBackground
import androidx.ui.graphics.Color
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.ltr
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.rtl
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -40,53 +42,53 @@
@Composable
fun RtlDemo() {
Column(arrangement = Arrangement.SpaceEvenly) {
- Text("TEXT", LayoutGravity.Center)
+ Text("TEXT", Modifier.gravity(ColumnAlign.Center))
testText()
- Text("ROW", LayoutGravity.Center)
+ Text("ROW", Modifier.gravity(ColumnAlign.Center))
testRow()
- Text("ROW WITH LTR MODIFIER", LayoutGravity.Center)
+ Text("ROW WITH LTR MODIFIER", Modifier.gravity(ColumnAlign.Center))
testRow_modifier()
- Text("RELATIVE TO SIBLINGS", LayoutGravity.Center)
+ Text("RELATIVE TO SIBLINGS", Modifier.gravity(ColumnAlign.Center))
testSiblings()
- Text("PLACE WITH AUTO RTL SUPPORT IN CUSTOM LAYOUT", LayoutGravity.Center)
+ Text("PLACE WITH AUTO RTL SUPPORT IN CUSTOM LAYOUT", Modifier.gravity(ColumnAlign.Center))
CustomLayout(true)
- Text("PLACE WITHOUT RTL SUPPORT IN CUSTOM LAYOUT", LayoutGravity.Center)
+ Text("PLACE WITHOUT RTL SUPPORT IN CUSTOM LAYOUT", Modifier.gravity(ColumnAlign.Center))
CustomLayout(false)
- Text("WITH CONSTRAINTS", LayoutGravity.Center)
- LayoutWithConstraints(LayoutDirectionModifier.Ltr, "LD: LTR modifier")
- LayoutWithConstraints(LayoutDirectionModifier.Rtl, "LD: RTL modifier")
+ Text("WITH CONSTRAINTS", Modifier.gravity(ColumnAlign.Center))
+ LayoutWithConstraints(Modifier.ltr, "LD: LTR modifier")
+ LayoutWithConstraints(Modifier.rtl, "LD: RTL modifier")
LayoutWithConstraints(text = "LD: locale")
}
}
-private val boxSize = LayoutSize(50.dp, 30.dp)
-private val size = LayoutSize(10.dp, 10.dp)
+private val boxSize = Modifier.preferredSize(50.dp, 30.dp)
+private val size = Modifier.preferredSize(10.dp, 10.dp)
@Composable
private fun testRow() {
Row {
- Stack(boxSize + DrawBackground(Color.Red)) {}
- Stack(boxSize + DrawBackground(Color.Green)) {}
+ Stack(boxSize.drawBackground(Color.Red)) {}
+ Stack(boxSize.drawBackground(Color.Green)) {}
Row {
- Stack(boxSize + DrawBackground(Color.Magenta)) {}
- Stack(boxSize + DrawBackground(Color.Yellow)) {}
- Stack(boxSize + DrawBackground(Color.Cyan)) {}
+ Stack(boxSize.drawBackground(Color.Magenta)) {}
+ Stack(boxSize.drawBackground(Color.Yellow)) {}
+ Stack(boxSize.drawBackground(Color.Cyan)) {}
}
- Stack(boxSize + DrawBackground(Color.Blue)) {}
+ Stack(boxSize.drawBackground(Color.Blue)) {}
}
}
@Composable
private fun testRow_modifier() {
Row {
- Stack(boxSize + DrawBackground(Color.Red)) {}
- Stack(boxSize + DrawBackground(Color.Green)) {}
- Row(LayoutDirectionModifier.Ltr) {
- Stack(boxSize + DrawBackground(Color.Magenta)) {}
- Stack(boxSize + DrawBackground(Color.Yellow)) {}
- Stack(boxSize + DrawBackground(Color.Cyan)) {}
+ Stack(boxSize.drawBackground(Color.Red)) {}
+ Stack(boxSize.drawBackground(Color.Green)) {}
+ Row(Modifier.ltr) {
+ Stack(boxSize.drawBackground(Color.Magenta)) {}
+ Stack(boxSize.drawBackground(Color.Yellow)) {}
+ Stack(boxSize.drawBackground(Color.Cyan)) {}
}
- Stack(boxSize + DrawBackground(Color.Blue)) {}
+ Stack(boxSize.drawBackground(Color.Blue)) {}
}
}
@@ -94,33 +96,27 @@
private fun testText() {
Column {
Row {
- Stack(size + DrawBackground(Color.Red)) {}
- Stack(size + DrawBackground(Color.Green)) {}
- Stack(size + DrawBackground(Color.Blue)) {}
+ Stack(size.drawBackground(Color.Red)) {}
+ Stack(size.drawBackground(Color.Green)) {}
+ Stack(size.drawBackground(Color.Blue)) {}
}
Text("Text.")
- Text("Width filled text.", LayoutWidth.Fill)
+ Text("Width filled text.", Modifier.fillMaxWidth())
Text("שלום!")
- Text("שלום!", LayoutWidth.Fill)
+ Text("שלום!", Modifier.fillMaxWidth())
Text("-->")
- Text("-->", LayoutWidth.Fill)
+ Text("-->", Modifier.fillMaxWidth())
}
}
@Composable
private fun testSiblings() {
Column {
- Stack(boxSize +
- DrawBackground(Color.Red) +
- LayoutGravity.RelativeToSiblings { p -> p.width }
+ Stack(boxSize.drawBackground(Color.Red).alignWithSiblings { p -> p.width }
) {}
- Stack(boxSize +
- DrawBackground(Color.Green) +
- LayoutGravity.RelativeToSiblings { p -> p.width * 0.5 }
+ Stack(boxSize.drawBackground(Color.Green).alignWithSiblings { p -> p.width * 0.5 }
) {}
- Stack(boxSize +
- DrawBackground(Color.Blue) +
- LayoutGravity.RelativeToSiblings { p -> p.width / 4 }
+ Stack(boxSize.drawBackground(Color.Blue).alignWithSiblings { p -> p.width / 4 }
) {}
}
}
@@ -128,9 +124,9 @@
@Composable
private fun CustomLayout(rtlSupport: Boolean) {
Layout(children = @Composable {
- Stack(boxSize + DrawBackground(Color.Red)) {}
- Stack(boxSize + DrawBackground(Color.Green)) {}
- Stack(boxSize + DrawBackground(Color.Blue)) {}
+ Stack(boxSize.drawBackground(Color.Red)) {}
+ Stack(boxSize.drawBackground(Color.Green)) {}
+ Stack(boxSize.drawBackground(Color.Blue)) {}
}) { measurables, constraints, _ ->
val p = measurables.map { e ->
e.measure(constraints.copy(minWidth = 0.ipx, minHeight = 0.ipx))
@@ -159,8 +155,8 @@
val w = (constraints.maxWidth / 3).toDp()
val h = (constraints.maxHeight / 2).toDp()
val color = if (direction == LayoutDirection.Ltr) Color.Red else Color.Magenta
- Stack(LayoutSize(w, h) + DrawBackground(color)) {
- Text(text, LayoutGravity.Center)
+ Stack(Modifier.preferredSize(w, h).drawBackground(color)) {
+ Text(text, Modifier.gravity(Alignment.Center))
}
}
}
diff --git a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/SimpleLayoutDemo.kt b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/SimpleLayoutDemo.kt
index 773cbbb..dbd8e85 100644
--- a/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/SimpleLayoutDemo.kt
+++ b/ui/ui-layout/integration-tests/layout-demos/src/main/java/androidx/ui/layout/demos/SimpleLayoutDemo.kt
@@ -19,18 +19,21 @@
import androidx.compose.Composable
import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.Text
+import androidx.ui.foundation.drawBackground
import androidx.ui.graphics.Color
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.text.TextStyle
import androidx.ui.unit.dp
import androidx.ui.unit.sp
@@ -41,75 +44,75 @@
Column {
Text(text = "Row", style = TextStyle(fontSize = 48.sp))
- Stack(LayoutWidth(ExampleSize) + DrawBackground(color = lightGrey)) {
- Row(LayoutWidth.Fill) {
+ Stack(Modifier.preferredWidth(ExampleSize).drawBackground(color = lightGrey)) {
+ Row(Modifier.fillMaxWidth()) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutHeight(24.dp))
- Stack(LayoutWidth(ExampleSize) + DrawBackground(color = lightGrey)) {
- Row(LayoutWidth.Fill, arrangement = Arrangement.Center) {
+ Spacer(Modifier.preferredHeight(24.dp))
+ Stack(Modifier.preferredWidth(ExampleSize).drawBackground(color = lightGrey)) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.Center) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutHeight(24.dp))
- Stack(LayoutWidth(ExampleSize) + DrawBackground(color = lightGrey)) {
- Row(LayoutWidth.Fill, arrangement = Arrangement.End) {
+ Spacer(Modifier.preferredHeight(24.dp))
+ Stack(Modifier.preferredWidth(ExampleSize).drawBackground(color = lightGrey)) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.End) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutHeight(24.dp))
- Stack(LayoutWidth(ExampleSize) + DrawBackground(color = lightGrey)) {
- Row(LayoutWidth.Fill) {
+ Spacer(Modifier.preferredHeight(24.dp))
+ Stack(Modifier.preferredWidth(ExampleSize).drawBackground(color = lightGrey)) {
+ Row(Modifier.fillMaxWidth()) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutHeight(24.dp))
- Stack(LayoutWidth(ExampleSize) + DrawBackground(color = lightGrey)) {
- Row(LayoutWidth.Fill) {
- PurpleSquare(LayoutGravity.Bottom)
- CyanSquare(LayoutGravity.Bottom)
+ Spacer(Modifier.preferredHeight(24.dp))
+ Stack(Modifier.preferredWidth(ExampleSize).drawBackground(color = lightGrey)) {
+ Row(Modifier.fillMaxWidth()) {
+ PurpleSquare(Modifier.gravity(RowAlign.Bottom))
+ CyanSquare(Modifier.gravity(RowAlign.Bottom))
}
}
- Spacer(LayoutHeight(24.dp))
+ Spacer(Modifier.preferredHeight(24.dp))
Text(text = "Column", style = TextStyle(fontSize = 48.sp))
- Row(LayoutWidth.Fill) {
- Stack(LayoutHeight(ExampleSize) + DrawBackground(color = lightGrey)) {
- Column(LayoutHeight.Fill) {
+ Row(Modifier.fillMaxWidth()) {
+ Stack(Modifier.preferredHeight(ExampleSize).drawBackground(color = lightGrey)) {
+ Column(Modifier.fillMaxHeight()) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutWidth(24.dp))
- Stack(LayoutHeight(ExampleSize) + DrawBackground(color = lightGrey)) {
- Column(LayoutHeight.Fill, arrangement = Arrangement.Center) {
+ Spacer(Modifier.preferredWidth(24.dp))
+ Stack(Modifier.preferredHeight(ExampleSize).drawBackground(color = lightGrey)) {
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.Center) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutWidth(24.dp))
- Stack(LayoutHeight(ExampleSize) + DrawBackground(color = lightGrey)) {
- Column(LayoutHeight.Fill, arrangement = Arrangement.Bottom) {
+ Spacer(Modifier.preferredWidth(24.dp))
+ Stack(Modifier.preferredHeight(ExampleSize).drawBackground(color = lightGrey)) {
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.Bottom) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutWidth(24.dp))
- Stack(LayoutHeight(ExampleSize) + DrawBackground(color = lightGrey)) {
- Column(LayoutHeight.Fill) {
+ Spacer(Modifier.preferredWidth(24.dp))
+ Stack(Modifier.preferredHeight(ExampleSize).drawBackground(color = lightGrey)) {
+ Column(Modifier.fillMaxHeight()) {
PurpleSquare()
CyanSquare()
}
}
- Spacer(LayoutWidth(24.dp))
- Stack(LayoutHeight(ExampleSize) + DrawBackground(color = lightGrey)) {
- Column(LayoutHeight.Fill) {
- PurpleSquare(LayoutGravity.End)
- CyanSquare(LayoutGravity.End)
+ Spacer(Modifier.preferredWidth(24.dp))
+ Stack(Modifier.preferredHeight(ExampleSize).drawBackground(color = lightGrey)) {
+ Column(Modifier.fillMaxHeight()) {
+ PurpleSquare(Modifier.gravity(ColumnAlign.End))
+ CyanSquare(Modifier.gravity(ColumnAlign.End))
}
}
}
@@ -118,12 +121,12 @@
@Composable
private fun PurpleSquare(modifier: Modifier = Modifier.None) {
- Box(modifier + LayoutSize(48.dp), backgroundColor = Color(0xFF6200EE))
+ Box(modifier.preferredSize(48.dp), backgroundColor = Color(0xFF6200EE))
}
@Composable
private fun CyanSquare(modifier: Modifier = Modifier.None) {
- Box(modifier + LayoutSize(24.dp), backgroundColor = Color(0xFF03DAC6))
+ Box(modifier.preferredSize(24.dp), backgroundColor = Color(0xFF03DAC6))
}
private val ExampleSize = 140.dp
\ No newline at end of file
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AlignSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AlignSample.kt
index 92cbc55..481a97c 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AlignSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AlignSample.kt
@@ -18,15 +18,20 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredSizeIn
+import androidx.ui.layout.wrapContentHeight
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.dp
@Sampled
@@ -39,7 +44,9 @@
// constraints, and it will be aligned in the 40.dp x 40.dp space. Note the example would not
// work if LayoutAlign was specified before LayoutSize in the modifier chain.
Box(
- modifier = LayoutSize(20.dp) + LayoutSize.Min(40.dp, 40.dp) + LayoutAlign.TopCenter,
+ Modifier.preferredSize(20.dp)
+ .preferredSizeIn(minWidth = 40.dp, minHeight = 40.dp)
+ .wrapContentSize(Alignment.TopCenter),
backgroundColor = Color.Blue
)
}
@@ -48,16 +55,15 @@
@Composable
fun SimpleVerticallyAlignedModifier() {
// Here, the blue rectangle prefers to have a 50.dp height, subject to the incoming constraints.
- // Because of the LayoutSize.Fill modifier, if LayoutAlign was not present, the blue rectangle
- // would actually fill the available height to satisfy the min height set by the modifier.
- // However, because we also provide LayoutAlign, the blue rectangle is allowed to be smaller
+ // However, because we also wrapContentHeight, the blue rectangle is allowed to be smaller
// than the min height, and it will be centered vertically in the available height.
// The width of the rectangle will still fill the available width, because the
- // LayoutAlign.CenterVertically modifier is only concerned with vertical alignment.
- // Note the example would not work if LayoutAlign was specified before LayoutSize
+ // wrapContentHeight(Alignment.Center) modifier is only concerned with vertical alignment.
+ // Note the example would not work if wrapContentHeight was specified before preferredSize
// in the modifier chain.
Box(
- LayoutSize(50.dp) + LayoutSize.Fill + LayoutAlign.CenterVertically,
+ Modifier.preferredSize(50.dp)
+ .wrapContentHeight(Alignment.Center),
backgroundColor = Color.Blue
)
}
@@ -65,37 +71,57 @@
@Sampled
@Composable
fun SimpleGravityInRow() {
- Row(LayoutHeight.Fill) {
+ Row(Modifier.fillMaxHeight()) {
// The child with no gravity modifier is positioned by default so that its top edge is
// aligned to the top of the vertical axis.
- Box(LayoutSize(80.dp, 40.dp), backgroundColor = Color.Magenta)
+ Box(Modifier.preferredSize(80.dp, 40.dp), backgroundColor = Color.Magenta)
// Gravity.Top, the child will be positioned so that its top edge is aligned to the top
// of the vertical axis.
- Box(LayoutSize(80.dp, 40.dp) + LayoutGravity.Top, backgroundColor = Color.Red)
+ Box(Modifier.preferredSize(80.dp, 40.dp).gravity(RowAlign.Top), backgroundColor = Color.Red)
// Gravity.Center, the child will be positioned so that its center is in the middle of
// the vertical axis.
- Box(LayoutSize(80.dp, 40.dp) + LayoutGravity.Center, backgroundColor = Color.Yellow)
+ Box(
+ Modifier.preferredSize(80.dp, 40.dp)
+ .gravity(RowAlign.Center),
+ backgroundColor = Color.Yellow
+ )
// Gravity.Bottom, the child will be positioned so that its bottom edge is aligned to the
// bottom of the vertical axis.
- Box(LayoutSize(80.dp, 40.dp) + LayoutGravity.Bottom, backgroundColor = Color.Green)
+ Box(
+ Modifier.preferredSize(80.dp, 40.dp)
+ .gravity(RowAlign.Bottom),
+ backgroundColor = Color.Green
+ )
}
}
@Sampled
@Composable
fun SimpleGravityInColumn() {
- Column(LayoutWidth.Fill) {
+ Column(Modifier.fillMaxWidth()) {
// The child with no gravity modifier is positioned by default so that its start edge
// aligned with the start edge of the horizontal axis.
- Box(LayoutSize(80.dp, 40.dp), backgroundColor = Color.Magenta)
+ Box(Modifier.preferredSize(80.dp, 40.dp), backgroundColor = Color.Magenta)
// Gravity.Start, the child will be positioned so that its start edge is aligned with
// the start edge of the horizontal axis.
- Box(LayoutSize(80.dp, 40.dp) + LayoutGravity.Start, backgroundColor = Color.Red)
+ Box(
+ Modifier.preferredSize(80.dp, 40.dp)
+ .gravity(ColumnAlign.Start),
+ backgroundColor = Color.Red
+ )
// Gravity.Center, the child will be positioned so that its center is in the middle of
// the horizontal axis.
- Box(LayoutSize(80.dp, 40.dp) + LayoutGravity.Center, backgroundColor = Color.Yellow)
+ Box(
+ Modifier.preferredSize(80.dp, 40.dp)
+ .gravity(ColumnAlign.Center),
+ backgroundColor = Color.Yellow
+ )
// Gravity.End, the child will be positioned so that its end edge aligned to the end of
// the horizontal axis.
- Box(LayoutSize(80.dp, 40.dp) + LayoutGravity.End, backgroundColor = Color.Green)
+ Box(
+ Modifier.preferredSize(80.dp, 40.dp)
+ .gravity(ColumnAlign.End),
+ backgroundColor = Color.Green
+ )
}
}
\ No newline at end of file
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt
index 4301995..dffa9d9 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt
@@ -18,14 +18,15 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.dp
@Sampled
@Composable
fun SimpleAspectRatio() {
- Box(LayoutWidth(100.dp) + LayoutAspectRatio(2f), backgroundColor = Color.Green)
+ Box(Modifier.preferredWidth(100.dp).aspectRatio(2f), backgroundColor = Color.Green)
}
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlexSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlexSample.kt
index c5125b8..b63cb3a7 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlexSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlexSample.kt
@@ -19,15 +19,16 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.ui.core.FirstBaseline
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.text.TextStyle
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -37,12 +38,12 @@
fun SimpleRow() {
Row {
// The child with no weight will have the specified size.
- Box(LayoutSize(40.dp, 80.dp), backgroundColor = Color.Magenta)
+ Box(Modifier.preferredSize(40.dp, 80.dp), backgroundColor = Color.Magenta)
// Has weight, the child will occupy half of the remaining width.
- Box(LayoutHeight(40.dp) + LayoutWeight(1f), backgroundColor = Color.Yellow)
+ Box(Modifier.preferredHeight(40.dp).weight(1f), backgroundColor = Color.Yellow)
// Has weight and does not fill, the child will occupy at most half of the remaining width.
Box(
- LayoutHeight(80.dp) + LayoutWeight(1f, fill = false),
+ Modifier.preferredHeight(80.dp).weight(1f, fill = false),
backgroundColor = Color.Green
)
}
@@ -53,12 +54,13 @@
fun SimpleColumn() {
Column {
// The child with no weight will have the specified size.
- Box(LayoutSize(40.dp, 80.dp), backgroundColor = Color.Magenta)
+ Box(Modifier.preferredSize(40.dp, 80.dp), backgroundColor = Color.Magenta)
// Has weight, the child will occupy half of the remaining height.
- Box(LayoutWidth(40.dp) + LayoutWeight(1f), backgroundColor = Color.Yellow)
+ Box(Modifier.preferredWidth(40.dp).weight(1f), backgroundColor = Color.Yellow)
// Has weight and does not fill, the child will occupy at most half of the remaining height.
Box(
- LayoutHeight(80.dp) + LayoutWeight(1f, fill = false),
+ Modifier.preferredHeight(80.dp)
+ .weight(1f, fill = false),
backgroundColor = Color.Green
)
}
@@ -71,15 +73,15 @@
// Center of the first rectangle is aligned to the right edge of the second rectangle and
// left edge of the third one.
Box(
- LayoutSize(80.dp, 40.dp) + LayoutGravity.RelativeToSiblings { it.width * 0.5 },
+ Modifier.preferredSize(80.dp, 40.dp).alignWithSiblings { it.width * 0.5 },
backgroundColor = Color.Blue
)
Box(
- LayoutSize(80.dp, 40.dp) + LayoutGravity.RelativeToSiblings { it.width },
+ Modifier.preferredSize(80.dp, 40.dp).alignWithSiblings { it.width },
backgroundColor = Color.Magenta
)
Box(
- LayoutSize(80.dp, 40.dp) + LayoutGravity.RelativeToSiblings { 0.ipx },
+ Modifier.preferredSize(80.dp, 40.dp).alignWithSiblings { 0.ipx },
backgroundColor = Color.Red
)
}
@@ -88,14 +90,14 @@
@Sampled
@Composable
fun SimpleRelativeToSiblingsInRow() {
- Row(LayoutHeight.Fill) {
+ Row(Modifier.fillMaxHeight()) {
// Center of the colored rectangle is aligned to first baseline of the text.
Box(
backgroundColor = Color.Red,
- modifier = LayoutSize(80.dp, 40.dp) +
- LayoutGravity.RelativeToSiblings { it.height * 0.5 }
+ modifier = Modifier.preferredSize(80.dp, 40.dp)
+ .alignWithSiblings { it.height * 0.5 }
)
- Box(LayoutWidth(80.dp) + LayoutGravity.RelativeToSiblings(FirstBaseline)) {
+ Box(Modifier.preferredWidth(80.dp).alignWithSiblings(FirstBaseline)) {
Text(text = "Text.", style = TextStyle(background = Color.Cyan))
}
}
@@ -108,17 +110,17 @@
// Center of the first rectangle is aligned to the right edge of the second rectangle and
// left edge of the third one.
Box(
- LayoutSize(80.dp, 40.dp) + LayoutGravity.RelativeToSiblings { it.width * 0.5 },
+ Modifier.preferredSize(80.dp, 40.dp).alignWithSiblings { it.width * 0.5 },
backgroundColor = Color.Blue
)
SizedRectangleWithLines(
- LayoutGravity.RelativeToSiblings(End),
+ Modifier.alignWithSiblings(End),
color = Color.Magenta,
width = 80.dp,
height = 40.dp
)
SizedRectangleWithLines(
- LayoutGravity.RelativeToSiblings(Start),
+ Modifier.alignWithSiblings(Start),
color = Color.Red,
width = 80.dp,
height = 40.dp
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlowSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlowSample.kt
index e14f45d..648b14e 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlowSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/FlowSample.kt
@@ -18,11 +18,12 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.layout.FlowColumn
import androidx.ui.layout.FlowRow
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
val sizes = listOf(
@@ -38,7 +39,7 @@
crossAxisSpacing = 10.dp
) {
sizes.forEach { size ->
- Box(LayoutSize(size, 20.dp), backgroundColor = Color.Magenta)
+ Box(Modifier.preferredSize(size, 20.dp), backgroundColor = Color.Magenta)
}
}
}
@@ -51,7 +52,7 @@
crossAxisSpacing = 10.dp
) {
sizes.forEach { size ->
- Box(LayoutSize(20.dp, size), backgroundColor = Color.Magenta)
+ Box(Modifier.preferredSize(20.dp, size), backgroundColor = Color.Magenta)
}
}
}
\ No newline at end of file
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/IntrinsicSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/IntrinsicSample.kt
index fc1cee3..31dbad0 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/IntrinsicSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/IntrinsicSample.kt
@@ -18,20 +18,22 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.MaxIntrinsicHeight
import androidx.ui.layout.MaxIntrinsicWidth
import androidx.ui.layout.MinIntrinsicHeight
import androidx.ui.layout.MinIntrinsicWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.dp
/**
@@ -48,17 +50,17 @@
fun SameWidthBoxes() {
Stack {
MinIntrinsicWidth {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
Box(
- modifier = LayoutWidth.Fill + LayoutSize(20.dp, 10.dp),
+ modifier = Modifier.fillMaxWidth().preferredSize(20.dp, 10.dp),
backgroundColor = Color.Gray
)
Box(
- modifier = LayoutWidth.Fill + LayoutSize(30.dp, 10.dp),
+ modifier = Modifier.fillMaxWidth().preferredSize(30.dp, 10.dp),
backgroundColor = Color.Blue
)
Box(
- modifier = LayoutWidth.Fill + LayoutSize(10.dp, 10.dp),
+ modifier = Modifier.fillMaxWidth().preferredSize(10.dp, 10.dp),
backgroundColor = Color.Magenta
)
}
@@ -84,13 +86,13 @@
Row {
Text(
text = "This is a really short text",
- modifier = LayoutWeight(1f) + LayoutHeight.Fill
+ modifier = Modifier.weight(1f).fillMaxHeight()
)
- Box(LayoutWidth(1.dp) + LayoutHeight.Fill, backgroundColor = Color.Black)
+ Box(Modifier.preferredWidth(1.dp).fillMaxHeight(), backgroundColor = Color.Black)
Text(
text = "This is a much much much much much much much much much much" +
" much much much much much much longer text",
- modifier = LayoutWeight(1f) + LayoutHeight.Fill
+ modifier = Modifier.weight(1f).fillMaxHeight()
)
}
}
@@ -111,14 +113,14 @@
fun SameWidthTextBoxes() {
Stack {
MaxIntrinsicWidth {
- Column(LayoutHeight.Fill) {
- Box(LayoutWidth.Fill, backgroundColor = Color.Gray) {
+ Column(Modifier.fillMaxHeight()) {
+ Box(Modifier.fillMaxWidth(), backgroundColor = Color.Gray) {
Text("Short text")
}
- Box(LayoutWidth.Fill, backgroundColor = Color.Blue) {
+ Box(Modifier.fillMaxWidth(), backgroundColor = Color.Blue) {
Text("Extremely long text giving the width of its siblings")
}
- Box(LayoutWidth.Fill, backgroundColor = Color.Magenta) {
+ Box(Modifier.fillMaxWidth(), backgroundColor = Color.Magenta) {
Text("Medium length text")
}
}
@@ -142,10 +144,10 @@
Stack {
MaxIntrinsicHeight {
Row {
- val modifier = LayoutHeight.Fill + LayoutWeight(1f)
- Box(modifier + LayoutAspectRatio(2f), backgroundColor = Color.Gray)
- Box(LayoutWidth(1.dp) + LayoutHeight.Fill, backgroundColor = Color.Black)
- Box(modifier + LayoutAspectRatio(1f), backgroundColor = Color.Blue)
+ val modifier = Modifier.fillMaxHeight().weight(1f)
+ Box(modifier.aspectRatio(2f), backgroundColor = Color.Gray)
+ Box(Modifier.preferredWidth(1.dp).fillMaxHeight(), backgroundColor = Color.Black)
+ Box(modifier.aspectRatio(1f), backgroundColor = Color.Blue)
}
}
}
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt
index 85d79b4..f30b583 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt
@@ -18,10 +18,12 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.offset
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.dp
@Sampled
@@ -30,8 +32,8 @@
// This text will be offset (10.dp, 20.dp) from the center of the available space.
Text(
"Layout offset modifier sample",
- LayoutSize.Fill +
- LayoutAlign.Center +
- LayoutOffset(10.dp, 20.dp)
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.Center)
+ .offset(10.dp, 20.dp)
)
}
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutPaddingSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutPaddingSample.kt
index fb99b37..24600b2 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutPaddingSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutPaddingSample.kt
@@ -18,21 +18,22 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.foundation.drawBackground
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@Composable
fun LayoutPaddingModifier() {
- Stack(modifier = DrawBackground(Color.Gray)) {
+ Stack(Modifier.drawBackground(Color.Gray)) {
Box(
- LayoutPadding(start = 20.dp, top = 30.dp, end = 20.dp, bottom = 30.dp) +
- LayoutSize(50.dp),
+ Modifier.padding(start = 20.dp, top = 30.dp, end = 20.dp, bottom = 30.dp)
+ .preferredSize(50.dp),
backgroundColor = Color.Blue
)
}
@@ -41,7 +42,7 @@
@Sampled
@Composable
fun LayoutPaddingAllModifier() {
- Stack(modifier = DrawBackground(Color.Gray)) {
- Box(LayoutPadding(all = 20.dp) + LayoutSize(50.dp), backgroundColor = Color.Blue)
+ Stack(Modifier.drawBackground(Color.Gray)) {
+ Box(Modifier.padding(all = 20.dp).preferredSize(50.dp), backgroundColor = Color.Blue)
}
}
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutSample.kt
index cd79517..8374b11 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutSample.kt
@@ -20,7 +20,7 @@
import androidx.ui.core.Layout
import androidx.ui.core.Modifier
import androidx.ui.core.VerticalAlignmentLine
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.foundation.drawBackground
import androidx.ui.graphics.Color
import androidx.ui.unit.Dp
import androidx.ui.unit.ipx
@@ -40,7 +40,7 @@
) {
Layout(
children = { },
- modifier = modifier + DrawBackground(color = color)
+ modifier = modifier.drawBackground(color = color)
) { _, constraints, _ ->
val widthPx = max(width?.toIntPx() ?: constraints.maxWidth, constraints.minWidth)
val heightPx = max(height?.toIntPx() ?: constraints.maxHeight, constraints.minHeight)
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SizeModifierSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SizeModifierSample.kt
index 9244776..7b68728 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SizeModifierSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SizeModifierSample.kt
@@ -18,22 +18,26 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.ContentGravity
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Stack
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.dp
@Sampled
@Composable
fun SimpleSizeModifier() {
Stack {
- Box(LayoutSize(width = 100.dp, height = 100.dp), backgroundColor = Color.Red)
+ Box(Modifier.preferredSize(100.dp, 100.dp), backgroundColor = Color.Red)
}
}
@@ -41,7 +45,7 @@
@Composable
fun SimpleWidthModifier() {
Stack {
- Box(LayoutWidth(100.dp) + LayoutAspectRatio(1f), backgroundColor = Color.Magenta)
+ Box(Modifier.preferredWidth(100.dp).aspectRatio(1f), backgroundColor = Color.Magenta)
}
}
@@ -49,14 +53,14 @@
@Composable
fun SimpleHeightModifier() {
Stack {
- Box(LayoutHeight(100.dp) + LayoutAspectRatio(1f), backgroundColor = Color.Blue)
+ Box(Modifier.preferredHeight(100.dp).aspectRatio(1f), backgroundColor = Color.Blue)
}
}
@Sampled
@Composable
fun SimpleFillWidthModifier() {
- Box(LayoutWidth.Fill, backgroundColor = Color.Red, gravity = ContentGravity.Center) {
+ Box(Modifier.fillMaxWidth(), backgroundColor = Color.Red, gravity = ContentGravity.Center) {
ColoredRect(color = Color.Magenta, width = 100.dp, height = 100.dp)
}
}
@@ -64,7 +68,7 @@
@Sampled
@Composable
fun SimpleFillHeightModifier() {
- Box(LayoutHeight.Fill, backgroundColor = Color.Red, gravity = ContentGravity.Center) {
+ Box(Modifier.fillMaxHeight(), backgroundColor = Color.Red, gravity = ContentGravity.Center) {
ColoredRect(color = Color.Magenta, width = 100.dp, height = 100.dp)
}
}
@@ -72,7 +76,7 @@
@Sampled
@Composable
fun SimpleFillModifier() {
- Box(LayoutSize.Fill, backgroundColor = Color.Red, gravity = ContentGravity.Center) {
+ Box(Modifier.fillMaxSize(), backgroundColor = Color.Red, gravity = ContentGravity.Center) {
ColoredRect(color = Color.Magenta, width = 100.dp, height = 100.dp)
}
}
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SpacerSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SpacerSample.kt
index 59fa768..9c34b0f5 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SpacerSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/SpacerSample.kt
@@ -18,22 +18,23 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.dp
@Sampled
@Composable
fun SpacerExample() {
Row {
- Box(LayoutSize(100.dp), backgroundColor = Color.Red)
- Spacer(modifier = LayoutWidth(20.dp))
- Box(LayoutSize(100.dp), backgroundColor = Color.Magenta)
- Spacer(modifier = LayoutWeight(1f))
- Box(LayoutSize(100.dp), backgroundColor = Color.Black)
+ Box(Modifier.preferredSize(100.dp), backgroundColor = Color.Red)
+ Spacer(Modifier.preferredWidth(20.dp))
+ Box(Modifier.preferredSize(100.dp), backgroundColor = Color.Magenta)
+ Spacer(Modifier.weight(1f))
+ Box(Modifier.preferredSize(100.dp), backgroundColor = Color.Black)
}
}
\ No newline at end of file
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/StackSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/StackSample.kt
index aa4dd2e..98e48e68 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/StackSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/StackSample.kt
@@ -18,28 +18,36 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@Composable
fun SimpleStack() {
Stack {
- Box(LayoutSize.Fill, backgroundColor = Color.Cyan)
+ Box(Modifier.fillMaxSize(), backgroundColor = Color.Cyan)
Box(
- LayoutGravity.Stretch + LayoutPadding(top = 20.dp, bottom = 20.dp),
+ Modifier.matchParent().padding(top = 20.dp, bottom = 20.dp),
backgroundColor = Color.Yellow
)
- Box(LayoutGravity.Stretch + LayoutPadding(40.dp), backgroundColor = Color.Magenta)
- Box(LayoutGravity.Center + LayoutSize(300.dp, 300.dp), backgroundColor = Color.Green)
- Box(LayoutGravity.TopStart + LayoutSize(150.dp, 150.dp), backgroundColor = Color.Red)
+ Box(Modifier.matchParent().padding(40.dp), backgroundColor = Color.Magenta)
Box(
- LayoutGravity.BottomEnd + LayoutSize(150.dp, 150.dp),
+ Modifier.gravity(Alignment.Center).preferredSize(300.dp, 300.dp),
+ backgroundColor = Color.Green
+ )
+ Box(
+ Modifier.gravity(Alignment.TopStart).preferredSize(150.dp, 150.dp),
+ backgroundColor = Color.Red
+ )
+ Box(
+ Modifier.gravity(Alignment.BottomEnd).preferredSize(150.dp, 150.dp),
backgroundColor = Color.Blue
)
}
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/TableSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/TableSample.kt
index 9705af4..15af1ee 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/TableSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/TableSample.kt
@@ -18,15 +18,16 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Table
import androidx.ui.layout.TableColumnWidth
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
@Sampled
@@ -37,7 +38,7 @@
tableRow {
for (j in 0 until 8) {
Box(
- LayoutPadding(2.dp) + LayoutAspectRatio(1f),
+ Modifier.padding(2.dp).aspectRatio(1f),
backgroundColor = Color.Magenta
)
}
@@ -60,7 +61,7 @@
tableRow {
for (j in 0 until 8) {
Box(
- LayoutPadding(2.dp) + LayoutAspectRatio(1f),
+ Modifier.padding(2.dp).aspectRatio(1f),
backgroundColor = Color.Magenta
)
}
@@ -72,7 +73,7 @@
@Sampled
@Composable
fun TableWithDifferentColumnWidths() {
- val padding = LayoutPadding(2.dp)
+ val padding = Modifier.padding(2.dp)
Table(
columns = 5,
columnWidth = { columnIndex ->
@@ -87,9 +88,9 @@
) {
for (i in 0 until 8) {
tableRow {
- Box(padding + LayoutSize(25.dp, 25.dp), backgroundColor = Color.Magenta)
+ Box(padding.preferredSize(25.dp, 25.dp), backgroundColor = Color.Magenta)
for (j in 1 until 5) {
- Box(padding + LayoutHeight(25.dp), backgroundColor = Color.Magenta)
+ Box(padding.preferredHeight(25.dp), backgroundColor = Color.Magenta)
}
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
index 80f504e..96f054a 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
@@ -20,6 +20,7 @@
import androidx.ui.core.Constraints
import androidx.ui.core.HorizontalAlignmentLine
import androidx.ui.core.Layout
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.VerticalAlignmentLine
import androidx.ui.core.WithConstraints
@@ -60,11 +61,13 @@
Stack {
AlignmentLineOffset(
testLine,
- saveLayoutInfo(parentSize, Ref(), layoutLatch),
+ Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch),
before = beforeDp,
after = afterDp
) {
- Layout({ }, saveLayoutInfo(childSize, childPosition, layoutLatch)) { _, _, _ ->
+ Layout({ },
+ Modifier.saveLayoutInfo(childSize, childPosition, layoutLatch)
+ ) { _, _, _ ->
layout(childDp.toIntPx(), 0.ipx, mapOf(testLine to lineDp.toIntPx())) { }
}
}
@@ -102,12 +105,12 @@
show {
Stack {
AlignmentLineOffset(testLine,
- saveLayoutInfo(parentSize, Ref(), layoutLatch),
+ Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch),
before = beforeDp,
after = afterDp
) {
Layout(
- modifier = saveLayoutInfo(childSize, childPosition, layoutLatch),
+ modifier = Modifier.saveLayoutInfo(childSize, childPosition, layoutLatch),
children = { }) { _, _, _ ->
layout(0.ipx, childDp.toIntPx(), mapOf(testLine to lineDp.toIntPx())) { }
}
@@ -144,12 +147,12 @@
Stack {
AlignmentLineOffset(
testLine,
- saveLayoutInfo(parentSize, Ref(), layoutLatch),
+ Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch),
before = beforeDp,
after = afterDp
) {
Layout(
- modifier = saveLayoutInfo(childSize, childPosition, layoutLatch),
+ modifier = Modifier.saveLayoutInfo(childSize, childPosition, layoutLatch),
children = {}
) { _, _, _ ->
layout(childDp.toIntPx(), 0.ipx, mapOf(testLine to lineDp.toIntPx())) { }
@@ -183,11 +186,13 @@
Stack {
AlignmentLineOffset(
testLine,
- saveLayoutInfo(parentSize, Ref(), layoutLatch),
+ Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch),
before = beforeDp,
after = afterDp
) {
- Layout({ }, saveLayoutInfo(childSize, childPosition, layoutLatch)) { _, _, _ ->
+ Layout({ },
+ Modifier.saveLayoutInfo(childSize, childPosition, layoutLatch)
+ ) { _, _, _ ->
layout(0.ipx, childDp.toIntPx(), mapOf(testLine to lineDp.toIntPx())) { }
}
}
@@ -220,11 +225,15 @@
Stack {
ConstrainedBox(DpConstraints(maxWidth = maxWidth)) {
AlignmentLineOffset(testLine, before = beforeDp, after = afterDp,
- modifier = saveLayoutInfo(parentSize, Ref(), layoutLatch)
+ modifier = Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch)
) {
Layout(
children = { },
- modifier = saveLayoutInfo(childSize, childPosition, layoutLatch)
+ modifier = Modifier.saveLayoutInfo(
+ childSize,
+ childPosition,
+ layoutLatch
+ )
) { _, _, _ ->
layout(
childDp.toIntPx(),
@@ -264,11 +273,15 @@
Stack {
ConstrainedBox(DpConstraints(maxHeight = maxHeight)) {
AlignmentLineOffset(testLine, before = beforeDp, after = afterDp,
- modifier = saveLayoutInfo(parentSize, Ref(), layoutLatch)
+ modifier = Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch)
) {
Layout(
children = { },
- modifier = saveLayoutInfo(childSize, childPosition, layoutLatch)
+ modifier = Modifier.saveLayoutInfo(
+ childSize,
+ childPosition,
+ layoutLatch
+ )
) { _, _, _ ->
layout(
0.ipx,
@@ -383,8 +396,12 @@
val childPosition = Ref<PxPosition>()
show {
Layout({
- CenterAlignmentLine(testLine, saveLayoutInfo(centerSize, Ref(), layoutLatch)) {
- Layout({ }, saveLayoutInfo(Ref(), childPosition, layoutLatch)) { _, _, _ ->
+ CenterAlignmentLine(testLine,
+ Modifier.saveLayoutInfo(centerSize, Ref(), layoutLatch)
+ ) {
+ Layout({ },
+ Modifier.saveLayoutInfo(Ref(), childPosition, layoutLatch)
+ ) { _, _, _ ->
layout(
childWidth.toIntPx(),
childHeight.toIntPx(),
@@ -426,8 +443,12 @@
val childPosition = Ref<PxPosition>()
show {
Layout({
- CenterAlignmentLine(testLine, saveLayoutInfo(centerSize, Ref(), layoutLatch)) {
- Layout({ }, saveLayoutInfo(Ref(), childPosition, layoutLatch)) { _, _, _ ->
+ CenterAlignmentLine(testLine,
+ Modifier.saveLayoutInfo(centerSize, Ref(), layoutLatch)
+ ) {
+ Layout({ },
+ Modifier.saveLayoutInfo(Ref(), childPosition, layoutLatch)
+ ) { _, _, _ ->
layout(
childWidth.toIntPx(),
childHeight.toIntPx(),
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
index 09ec400..c9bef70 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
@@ -18,13 +18,15 @@
import androidx.compose.Composable
import androidx.test.filters.SmallTest
-import androidx.ui.core.LayoutTag
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.Stack
+import androidx.ui.core.tag
import androidx.ui.layout.ConstraintLayout
import androidx.ui.layout.ConstraintSet
+import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.rtl
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
@@ -78,7 +80,7 @@
val countDownLatch = CountDownLatch(3)
show {
- Stack(LayoutSize.Fill + LayoutDirectionModifier.Rtl) {
+ Stack(Modifier.fillMaxSize().rtl) {
TestLayout(size, position, countDownLatch)
}
}
@@ -134,18 +136,21 @@
}
) {
Stack(
- LayoutTag("box1") + LayoutSize(boxSize, boxSize) +
- saveLayoutInfo(size[0], position[0], countDownLatch)
+ Modifier.tag("box1")
+ .preferredSize(boxSize)
+ .saveLayoutInfo(size[0], position[0], countDownLatch)
) {
}
Stack(
- LayoutTag("box2") + LayoutSize(boxSize, boxSize) +
- saveLayoutInfo(size[1], position[1], countDownLatch)
+ Modifier.tag("box2")
+ .preferredSize(boxSize)
+ .saveLayoutInfo(size[1], position[1], countDownLatch)
) {
}
Stack(
- LayoutTag("box3") + LayoutSize(boxSize, boxSize) +
- saveLayoutInfo(size[2], position[2], countDownLatch)
+ Modifier.tag("box3")
+ .preferredSize(boxSize)
+ .saveLayoutInfo(size[2], position[2], countDownLatch)
) {
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
index 190cf88..ae6e121 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
@@ -28,10 +28,10 @@
import androidx.ui.layout.Align
import androidx.ui.layout.DpConstraints
import androidx.ui.layout.EdgeInsets
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
@@ -61,7 +61,7 @@
val containerSize = Ref<IntPxSize>()
show {
Align(alignment = Alignment.TopStart) {
- Container(onPositioned { coordinates ->
+ Container(Modifier.onPositioned { coordinates ->
containerSize.value = coordinates.size
positionedLatch.countDown()
}) {
@@ -86,15 +86,19 @@
val childPosition = Ref<PxPosition>()
show {
Align(alignment = Alignment.TopStart) {
- Container(padding = EdgeInsets(paddingDp), modifier = onPositioned { coordinates ->
- containerSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Container(
+ padding = EdgeInsets(paddingDp),
+ modifier = Modifier.onPositioned { coordinates ->
+ containerSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
EmptyBox(width = sizeDp, height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
childPosition.value = coordinates.localToGlobal(PxPosition(0.px, 0.px))
positionedLatch.countDown()
- })
+ }
+ )
}
}
}
@@ -122,20 +126,20 @@
val childSize = Array(3) { IntPxSize(0.ipx, 0.ipx) }
show {
Align(alignment = Alignment.TopStart) {
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates ->
containerSize.value = coordinates.size
positionedLatch.countDown()
}) {
Container(width = childWidthDp, height = childHeightDp) {
EmptyBox(width = sizeDp, height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
childSize[0] = coordinates.size
positionedLatch.countDown()
})
}
Container(constraints = childConstraints) {
EmptyBox(width = sizeDp, height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
childSize[1] = coordinates.size
positionedLatch.countDown()
})
@@ -147,7 +151,7 @@
height = (childHeightDp * 2)
) {
EmptyBox(width = sizeDp, height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates ->
childSize[2] = coordinates.size
positionedLatch.countDown()
})
@@ -176,18 +180,24 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Container(alignment = Alignment.TopStart, modifier = onPositioned { coordinates ->
- alignSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
- Container(expanded = true, modifier = onPositioned { coordinates ->
- containerSize.value = coordinates.size
+ Container(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
+ alignSize.value = coordinates.size
positionedLatch.countDown()
- }) {
+ }
+ ) {
+ Container(
+ expanded = true,
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
+ containerSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
EmptyBox(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize.value = coordinates.size
childPosition.value = coordinates.localToGlobal(PxPosition(0.px, 0.px))
positionedLatch.countDown()
@@ -224,7 +234,7 @@
Align(alignment = Alignment.TopStart) {
val constraints = DpConstraints(minWidth = sizeDp * 2, minHeight = sizeDp * 2)
ConstrainedBox(
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
containerSize.value = coordinates.size
positionedLatch.countDown()
},
@@ -232,7 +242,7 @@
) {
Container(alignment = Alignment.BottomEnd) {
EmptyBox(width = sizeDp, height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize.value = coordinates.size
childPosition.value =
coordinates.localToGlobal(PxPosition(0.px, 0.px))
@@ -262,7 +272,7 @@
show {
Align(alignment = Alignment.TopStart) {
Container(width = sizeDp, height = sizeDp, padding = EdgeInsets(10.dp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
containerSize.value = coordinates.size
latch.countDown()
}) {
@@ -295,13 +305,13 @@
show {
Stack {
Container(
- onPositioned { coordinates ->
+ Modifier.onPositioned { coordinates: LayoutCoordinates ->
containerSize = coordinates.size
latch.countDown()
},
padding = edgeInsets
) {
- Spacer(LayoutSize(width = childSizeDp, height = childSizeDp))
+ Spacer(Modifier.preferredSize(width = childSizeDp, height = childSizeDp))
}
}
}
@@ -322,8 +332,9 @@
show {
Stack {
Container(width = containerSize, height = containerSize, padding = edgeInsets) {
- Spacer(LayoutSize(width = childSize, height = childSize) +
- onPositioned { coordinates ->
+ Spacer(
+ Modifier.preferredSize(width = childSize, height = childSize) +
+ Modifier.onPositioned { coordinates: LayoutCoordinates ->
childCoordinates = coordinates
latch.countDown()
})
@@ -352,9 +363,11 @@
Align(alignment = Alignment.TopStart) {
Layout(children = {
Container {
- EmptyBox(width = model.size, height = 10.dp, modifier = onPositioned {
- layoutLatch.countDown()
- })
+ EmptyBox(
+ width = model.size,
+ height = 10.dp,
+ modifier = Modifier.onPositioned { layoutLatch.countDown() }
+ )
}
}) { measurables, constraints, _ ->
val placeable = measurables.first().measure(constraints)
@@ -388,9 +401,11 @@
Align(alignment = Alignment.TopStart) {
Layout(children = {
Container(expanded = true) {
- EmptyBox(width = model.size, height = 10.dp, modifier = onPositioned {
- layoutLatch.countDown()
- })
+ EmptyBox(
+ width = model.size,
+ height = 10.dp,
+ modifier = Modifier.onPositioned { layoutLatch.countDown() }
+ )
}
}) { measurables, constraints, _ ->
val placeable = measurables.first().measure(constraints)
@@ -424,9 +439,11 @@
Align(alignment = Alignment.TopStart) {
Layout(children = {
Container(width = 20.dp, height = 20.dp) {
- EmptyBox(width = model.size, height = 10.dp, modifier = onPositioned {
- layoutLatch.countDown()
- })
+ EmptyBox(
+ width = model.size,
+ height = 10.dp,
+ modifier = Modifier.onPositioned { layoutLatch.countDown() }
+ )
}
}) { measurables, constraints, _ ->
val placeable = measurables.first().measure(constraints)
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt
index 18eb8d9..c562396 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt
@@ -18,6 +18,8 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.Alignment
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.onPositioned
import androidx.ui.layout.Align
@@ -58,7 +60,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -67,10 +69,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -114,7 +116,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -122,10 +124,10 @@
FlowRow(mainAxisSize = SizeMode.Wrap) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -170,7 +172,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -179,10 +181,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -227,7 +229,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -239,10 +241,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -286,7 +288,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -298,10 +300,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -346,7 +348,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -358,10 +360,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -406,7 +408,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -418,10 +420,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -469,7 +471,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -481,10 +483,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -532,7 +534,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -544,10 +546,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -595,7 +597,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -608,10 +610,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -663,7 +665,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -676,10 +678,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -731,7 +733,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -744,10 +746,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -801,7 +803,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -810,10 +812,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -858,7 +860,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -868,10 +870,10 @@
Container(
width = sizeDp,
height = if (i % 2 == 0) sizeDp else sizeDp * 2,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -922,7 +924,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -932,10 +934,10 @@
Container(
width = sizeDp,
height = if (i % 2 == 0) sizeDp else sizeDp * 2,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -983,7 +985,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -993,10 +995,10 @@
Container(
width = sizeDp,
height = if (i % 2 == 0) sizeDp else sizeDp * 2,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1049,7 +1051,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxWidth = flowWidthDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1058,10 +1060,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1105,7 +1107,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1113,10 +1115,10 @@
FlowColumn {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1160,17 +1162,18 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
- }) {
+ }
+ ) {
FlowColumn(mainAxisSize = SizeMode.Wrap) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1214,7 +1217,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1222,10 +1225,10 @@
FlowColumn(mainAxisSize = SizeMode.Expand) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1269,7 +1272,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1280,10 +1283,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1327,7 +1330,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1338,10 +1341,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1386,7 +1389,7 @@
Align(Alignment.TopStart) {
ConstrainedBox(
constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1398,10 +1401,10 @@
for (i in 0 until numberOfSquares) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1445,7 +1448,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1456,10 +1459,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1506,7 +1509,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1517,10 +1520,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1567,7 +1570,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1578,10 +1581,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1628,7 +1631,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1640,10 +1643,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1694,7 +1697,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1706,10 +1709,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1760,7 +1763,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1772,10 +1775,10 @@
) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1828,7 +1831,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1836,10 +1839,10 @@
FlowColumn(mainAxisSpacing = spacingDp) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1883,7 +1886,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1893,10 +1896,10 @@
Container(
width = if (i % 2 == 0) sizeDp else sizeDp * 2,
height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -1946,7 +1949,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1956,10 +1959,10 @@
Container(
width = if (i % 2 == 0) sizeDp else sizeDp * 2,
height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -2003,7 +2006,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -2013,10 +2016,10 @@
Container(
width = if (i % 2 == 0) sizeDp else sizeDp * 2,
height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
@@ -2068,7 +2071,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxHeight = flowHeightDp),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
flowSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -2076,10 +2079,10 @@
FlowColumn(crossAxisSpacing = spacingDp) {
for (i in 0 until numberOfSquares) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i],
- position = childPosition[i],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i],
+ childPosition[i],
+ positionedLatch
)
) {
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
index 1885f12..bcb828b 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
@@ -20,6 +20,7 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.Alignment
import androidx.ui.core.Layout
+import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.onChildPositioned
@@ -53,13 +54,16 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- minIntrinsicWidthSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ minIntrinsicWidthSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
MinIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -83,13 +87,16 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- minIntrinsicHeightSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ minIntrinsicHeightSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
MinIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -113,13 +120,16 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- maxIntrinsicWidthSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ maxIntrinsicWidthSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
MaxIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -143,13 +153,16 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- maxIntrinsicHeightSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ maxIntrinsicHeightSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
MaxIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -174,14 +187,16 @@
val childPosition = Ref<PxPosition>()
show {
Align(alignment = Alignment.TopStart) {
- ConstrainedBox(DpConstraints(maxWidth = 5.dp), modifier = onChildPositioned {
- coordinates ->
+ ConstrainedBox(
+ DpConstraints(maxWidth = 5.dp),
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
minIntrinsicWidthSize.value = coordinates.size
positionedLatch.countDown()
- }) {
+ }
+ ) {
MinIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -209,14 +224,14 @@
Align(alignment = Alignment.TopStart) {
ConstrainedBox(
DpConstraints(minWidth = 15.dp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
minIntrinsicWidthSize.value = coordinates.size
positionedLatch.countDown()
}
) {
MinIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -241,14 +256,17 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- minIntrinsicHeightSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ minIntrinsicHeightSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
ConstrainedBox(DpConstraints(maxHeight = 35.dp)) {
MinIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -273,7 +291,9 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
minIntrinsicHeightSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -281,7 +301,7 @@
ConstrainedBox(DpConstraints(minHeight = 45.dp)) {
MinIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -306,14 +326,17 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- maxIntrinsicWidthSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ maxIntrinsicWidthSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
ConstrainedBox(DpConstraints(maxWidth = 25.dp)) {
MaxIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -338,14 +361,17 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- maxIntrinsicWidthSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ maxIntrinsicWidthSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
ConstrainedBox(DpConstraints(minWidth = 35.dp)) {
MaxIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -370,14 +396,17 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- maxIntrinsicHeightSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ maxIntrinsicHeightSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
ConstrainedBox(DpConstraints(maxHeight = 55.dp)) {
MaxIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -402,14 +431,17 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Align(alignment = Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- maxIntrinsicHeightSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ alignment = Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ maxIntrinsicHeightSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
ConstrainedBox(DpConstraints(minHeight = 65.dp)) {
MaxIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp,
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
index 8151a2d..226a041 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
@@ -21,16 +21,21 @@
import androidx.ui.core.Alignment
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.enforce
import androidx.ui.core.onPositioned
import androidx.ui.layout.Align
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Stack
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
+import androidx.ui.layout.rtl
+import androidx.ui.layout.wrapContentHeight
+import androidx.ui.layout.wrapContentSize
+import androidx.ui.layout.wrapContentWidth
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
@@ -62,19 +67,19 @@
show {
Align(
alignment = Alignment.BottomEnd,
- modifier = saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ alignSize,
+ alignPosition,
+ positionedLatch
)
) {
Container(
width = sizeDp,
height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize,
+ childPosition,
+ positionedLatch
)
) {
}
@@ -105,21 +110,12 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Container(
- saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
- )
- ) {
-
+ Container(Modifier.saveLayoutInfo(alignSize, alignPosition, positionedLatch)) {
Container(
- LayoutSize.Fill + LayoutAlign.BottomEnd + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.BottomEnd)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize, childPosition, positionedLatch)
) {
}
}
@@ -150,19 +146,17 @@
val childPosition = Ref<PxPosition>()
show {
Container(
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = alignSize,
position = alignPosition,
positionedLatch = positionedLatch
)
) {
Container(
- LayoutSize.Fill + LayoutAlign.End + LayoutWidth(sizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.fillMaxSize()
+ .wrapContentWidth(Alignment.CenterEnd)
+ .preferredWidth(sizeDp)
+ .saveLayoutInfo(childSize, childPosition, positionedLatch)
) {
}
}
@@ -187,37 +181,25 @@
val childSize = Array(3) { Ref<IntPxSize>() }
val childPosition = Array(3) { Ref<PxPosition>() }
show {
- Stack(LayoutDirectionModifier.Rtl) {
- Stack(LayoutSize.Fill + LayoutAlign.TopStart) {
+ Stack(Modifier.rtl) {
+ Stack(Modifier.fillMaxSize().wrapContentSize(Alignment.TopStart)) {
Stack(
- LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[0],
- position = childPosition[0],
- positionedLatch = positionedLatch
- )
+ Modifier.preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[0], childPosition[0], positionedLatch)
) {
}
}
- Stack(LayoutSize.Fill + LayoutAlign.CenterVertically) {
+ Stack(Modifier.fillMaxSize().wrapContentHeight(Alignment.Center)) {
Stack(
- LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[1],
- position = childPosition[1],
- positionedLatch = positionedLatch
- )
+ Modifier.preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[1], childPosition[1], positionedLatch)
) {
}
}
- Stack(LayoutSize.Fill + LayoutAlign.BottomEnd) {
+ Stack(Modifier.fillMaxSize().wrapContentSize(Alignment.BottomEnd)) {
Stack(
- LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[2],
- position = childPosition[2],
- positionedLatch = positionedLatch
- )
+ Modifier.preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[2], childPosition[2], positionedLatch)
) {
}
}
@@ -249,8 +231,11 @@
val latch = CountDownLatch(1)
show {
Container {
- Container(saveLayoutInfo(size, Ref(), latch)) {
- Container(LayoutAlign.TopStart + LayoutSize(contentSize)) {}
+ Container(Modifier.saveLayoutInfo(size, Ref(), latch)) {
+ Container(
+ Modifier.wrapContentSize(Alignment.TopStart)
+ .preferredSize(contentSize)
+ ) {}
}
}
}
@@ -274,18 +259,18 @@
children = {
Align(
alignment = Alignment.BottomEnd,
- modifier = saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ alignSize,
+ alignPosition,
+ positionedLatch
)
) {
Container(
width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize,
+ childPosition,
+ positionedLatch
)
) {
}
@@ -311,9 +296,7 @@
}
@Test
- fun testAlignedModifier_wrapsContent_whenMeasuredWithInfiniteConstraints() = with(
- density
- ) {
+ fun testAlignedModifier_wrapsContent_whenMeasuredWithInfiniteConstraints() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -326,19 +309,12 @@
Layout(
children = {
Container(
- saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.saveLayoutInfo(alignSize, alignPosition, positionedLatch)
) {
Container(
- LayoutAlign.BottomEnd + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.wrapContentSize(Alignment.BottomEnd)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize, childPosition, positionedLatch)
) {
}
}
@@ -374,20 +350,17 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Container(LayoutAlign.TopStart) {
+ Container(Modifier.wrapContentSize(Alignment.TopStart)) {
Layout(
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
wrapSize.value = coordinates.size
positionedLatch.countDown()
},
children = {
Container(
- LayoutAlign.Center + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.wrapContentSize(Alignment.Center)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize, childPosition, positionedLatch)
) {
}
},
@@ -449,7 +422,7 @@
fun testAlign_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Align(alignment = Alignment.TopStart) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -470,7 +443,7 @@
@Test
fun test2DAlignedModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutAlign.TopStart + LayoutAspectRatio(2f)) { }
+ Container(Modifier.wrapContentSize(Alignment.TopStart).aspectRatio(2f)) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
assertEquals(0.ipx, minIntrinsicWidth(0.ipx))
@@ -497,7 +470,7 @@
@Test
fun test1DAlignedModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutAlign.CenterVertically + LayoutAspectRatio(2f)) { }
+ Container(Modifier.wrapContentHeight(Alignment.Center).aspectRatio(2f)) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -561,18 +534,18 @@
Container(width = parentSize, height = parentSize) {
Align(
alignment = Alignment.BottomEnd,
- modifier = saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ alignSize,
+ alignPosition,
+ positionedLatch
)
) {
Container(
width = childSizeDp, height = childSizeDp,
- modifier = saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize,
+ childPosition,
+ positionedLatch
)
) {
}
@@ -622,21 +595,14 @@
Layout(
children = {
Container(
- LayoutSize(parentSize, parentSize) +
- saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.preferredSize(parentSize)
+ .saveLayoutInfo(alignSize, alignPosition, positionedLatch)
) {
Container(
- LayoutSize.Fill + LayoutAlign.BottomEnd +
- LayoutSize(childSizeDp, childSizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.fillMaxSize()
+ .wrapContentSize(Alignment.BottomEnd)
+ .preferredSize(childSizeDp)
+ .saveLayoutInfo(childSize, childPosition, positionedLatch)
) {
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt
index b187736..04a71bf 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt
@@ -20,8 +20,9 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
-import androidx.ui.layout.LayoutAspectRatio
+import androidx.ui.layout.aspectRatio
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxPosition
@@ -41,7 +42,7 @@
@Test
fun testAspectRatioModifier_intrinsicDimensions() = with(density) {
testIntrinsics(@Composable {
- Container(modifier = LayoutAspectRatio(2f), width = 30.dp, height = 40.dp) { }
+ Container(modifier = Modifier.aspectRatio(2f), width = 30.dp, height = 40.dp) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
assertEquals(40.ipx, minIntrinsicWidth(20.ipx))
assertEquals(40.ipx, maxIntrinsicWidth(20.ipx))
@@ -57,12 +58,12 @@
@Test(expected = IllegalArgumentException::class)
fun testAspectRatioModifier_zeroRatio() {
- LayoutAspectRatio(0f)
+ Modifier.aspectRatio(0f)
}
@Test(expected = IllegalArgumentException::class)
fun testAspectRatioModifier_negativeRatio() {
- LayoutAspectRatio(-2f)
+ Modifier.aspectRatio(-2f)
}
@Test
@@ -93,8 +94,9 @@
val position = Ref<PxPosition>()
show {
Layout(@Composable {
- Container(LayoutAspectRatio(aspectRatio) +
- saveLayoutInfo(size, position, positionedLatch)
+ Container(
+ Modifier.aspectRatio(aspectRatio) +
+ Modifier.saveLayoutInfo(size, position, positionedLatch)
) {
}
}) { measurables, incomingConstraints, _ ->
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutDirectionModifierTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutDirectionModifierTest.kt
index 2d8bf60..35387ba 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutDirectionModifierTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutDirectionModifierTest.kt
@@ -21,9 +21,10 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.Layout
import androidx.ui.core.LayoutDirectionAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
-import androidx.ui.layout.LayoutDirectionModifier
import androidx.ui.layout.MaxIntrinsicWidth
+import androidx.ui.layout.rtl
import androidx.ui.unit.ipx
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
@@ -44,7 +45,7 @@
val children = @Composable {
Layout(
children = @Composable() {},
- modifier = LayoutDirectionModifier.Rtl
+ modifier = Modifier.rtl
) { _, _, incomingLayoutDirection ->
layoutDirection.value = incomingLayoutDirection
latch.countDown()
@@ -71,7 +72,7 @@
MaxIntrinsicWidth {
Layout(
children = @Composable() {},
- modifier = LayoutDirectionModifier.Rtl,
+ modifier = Modifier.rtl,
minIntrinsicWidthMeasureBlock = { _, _, _ -> 0.ipx },
minIntrinsicHeightMeasureBlock = { _, _, _ -> 0.ipx },
maxIntrinsicWidthMeasureBlock = { _, _, incomingLayoutDirection ->
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
index 585be48f..38a6ddd 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
@@ -18,14 +18,17 @@
import android.os.Build
import androidx.test.filters.SmallTest
+import androidx.ui.core.Alignment
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.core.globalPosition
import androidx.ui.core.onPositioned
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Stack
+import androidx.ui.layout.offset
+import androidx.ui.layout.preferredWidth
+import androidx.ui.layout.rtl
+import androidx.ui.layout.wrapContentSize
import androidx.ui.test.createComposeRule
import androidx.ui.test.findByTag
import androidx.ui.unit.dp
@@ -60,8 +63,10 @@
var positionY = 0.ipx
composeTestRule.setContent {
TestTag("stack") {
- Stack(LayoutAlign.TopStart + LayoutOffset(offsetX, offsetY) +
- onPositioned { coordinates ->
+ Stack(
+ Modifier.wrapContentSize(Alignment.TopStart)
+ .offset(offsetX, offsetY)
+ .onPositioned { coordinates: LayoutCoordinates ->
positionX = coordinates.globalPosition.x.round()
positionY = coordinates.globalPosition.y.round()
}
@@ -87,15 +92,15 @@
composeTestRule.setContent {
TestTag("stack") {
Stack(
- LayoutDirectionModifier.Rtl +
- LayoutAlign.TopEnd +
- LayoutWidth(containerWidth) +
- LayoutAlign.TopStart +
- LayoutOffset(offsetX, offsetY) +
- onPositioned { coordinates ->
- positionX = coordinates.globalPosition.x.round()
- positionY = coordinates.globalPosition.y.round()
- }
+ Modifier.rtl
+ .wrapContentSize(Alignment.TopEnd)
+ .preferredWidth(containerWidth)
+ .wrapContentSize(Alignment.TopStart)
+ .offset(offsetX, offsetY)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ positionX = coordinates.globalPosition.x.round()
+ positionY = coordinates.globalPosition.y.round()
+ }
) {
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
index f92154d..873e88f 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
@@ -18,18 +18,20 @@
import androidx.compose.Composable
import androidx.test.filters.SmallTest
+import androidx.ui.core.Alignment
import androidx.ui.core.Layout
+import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.Modifier
import androidx.ui.core.onPositioned
import androidx.ui.layout.DpConstraints
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutGravity
import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
+import androidx.ui.layout.rtl
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
@@ -57,7 +59,7 @@
*/
@Test(expected = IllegalArgumentException::class)
fun negativeStartPadding_throws() {
- LayoutPadding(start = -1f.dp)
+ Modifier.padding(start = -1f.dp)
}
/**
@@ -65,7 +67,7 @@
*/
@Test(expected = IllegalArgumentException::class)
fun negativeTopPadding_throws() {
- LayoutPadding(top = -1f.dp)
+ Modifier.padding(top = -1f.dp)
}
/**
@@ -73,7 +75,7 @@
*/
@Test(expected = IllegalArgumentException::class)
fun negativeEndPadding_throws() {
- LayoutPadding(end = -1f.dp)
+ Modifier.padding(end = -1f.dp)
}
/**
@@ -81,7 +83,7 @@
*/
@Test(expected = IllegalArgumentException::class)
fun negativeBottomPadding_throws() {
- LayoutPadding(bottom = -1f.dp)
+ Modifier.padding(bottom = -1f.dp)
}
/**
@@ -90,8 +92,8 @@
@Test
fun allEqualToAbsoluteWithExplicitSides() {
Assert.assertEquals(
- LayoutPadding(10.dp, 10.dp, 10.dp, 10.dp),
- LayoutPadding(10.dp)
+ Modifier.padding(10.dp, 10.dp, 10.dp, 10.dp),
+ Modifier.padding(10.dp)
)
}
@@ -104,7 +106,7 @@
fun paddingAllAppliedToChild() = with(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
- TestBox(modifier = LayoutPadding(padding), body = child)
+ TestBox(modifier = Modifier.padding(padding), body = child)
}
}
@@ -119,7 +121,7 @@
val paddingTop = 15.dp
val paddingRight = 20.dp
val paddingBottom = 30.dp
- val padding = LayoutPadding(paddingLeft, paddingTop, paddingRight, paddingBottom)
+ val padding = Modifier.padding(paddingLeft, paddingTop, paddingRight, paddingBottom)
testPaddingWithDifferentInsetsImplementation(
paddingLeft,
paddingTop,
@@ -141,7 +143,7 @@
fun insufficientSpaceAvailable() = with(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
- TestBox(modifier = LayoutPadding(padding), body = child)
+ TestBox(modifier = Modifier.padding(padding), body = child)
}
}
@@ -152,8 +154,8 @@
val latch = CountDownLatch(1)
var error: Throwable? = null
testIntrinsics(@Composable {
- TestBox(modifier = LayoutPadding(padding)) {
- Container(LayoutAspectRatio(2f)) { }
+ TestBox(modifier = Modifier.padding(padding)) {
+ Container(Modifier.aspectRatio(2f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Spacing is applied on both sides of an axis
@@ -222,34 +224,37 @@
// ltr: P1 S P2 | S P3 | P1 S
// rtl: S P1 | P3 S | P2 S P1
show {
- Row(LayoutWidth(sizeDp * 3) + LayoutDirectionModifier.Rtl) {
+ Row(Modifier.preferredWidth(sizeDp * 3).rtl) {
Stack(
- LayoutPadding(start = padding1Dp, end = padding2Dp) +
- LayoutSize(sizeDp, sizeDp) +
- onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Modifier.padding(start = padding1Dp, end = padding2Dp)
+ .preferredSize(sizeDp, sizeDp)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
- Stack(LayoutPadding(end = padding3Dp) + LayoutSize(sizeDp, sizeDp) +
- onPositioned { coordinates ->
+ Stack(
+ Modifier.padding(end = padding3Dp)
+ .preferredSize(sizeDp, sizeDp)
+ .onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
- }) {
+ }
+ ) {
}
Stack(
- LayoutPadding(start = padding1Dp) +
- LayoutSize(sizeDp, sizeDp) +
- onPositioned { coordinates ->
- childSize[2] = coordinates.size
- childPosition[2] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Modifier.padding(start = padding1Dp)
+ .preferredSize(sizeDp, sizeDp)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[2] = coordinates.size
+ childPosition[2] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
}
@@ -291,13 +296,12 @@
Stack {
ConstrainedBox(
constraints = DpConstraints.fixed(sizeDp, sizeDp),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(Alignment.Center)
) {
val children = @Composable {
- Container(onPositioned { coordinates ->
+ Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition =
- coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
}) {
}
@@ -338,13 +342,12 @@
Stack {
ConstrainedBox(
constraints = DpConstraints.fixed(sizeDp, sizeDp),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(Alignment.Center)
) {
val children = @Composable {
- Container(onPositioned { coordinates ->
+ Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition =
- coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
}) {
}
@@ -392,10 +395,10 @@
Stack {
ConstrainedBox(
constraints = DpConstraints.fixed(sizeDp, sizeDp),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(Alignment.Center)
) {
paddingContainer {
- Container(onPositioned { coordinates ->
+ Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
childPosition = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt
index 4ecc63d..7d2b5cb 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt
@@ -21,16 +21,23 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.Alignment
import androidx.ui.core.Layout
+import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.onPositioned
import androidx.ui.layout.Align
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredHeightIn
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredSizeIn
+import androidx.ui.layout.preferredWidth
+import androidx.ui.layout.preferredWidthIn
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
@@ -38,7 +45,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.min
-import org.junit.Assert
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -63,36 +69,40 @@
Align(alignment = Alignment.TopStart) {
Column {
Container(
- LayoutWidth.Max(sizeDp * 2) +
- LayoutWidth.Min(sizeDp) + LayoutHeight(sizeDp) +
- saveLayoutInfo(size[0], position[0], positionedLatch)
+ Modifier.preferredWidthIn(minWidth = sizeDp, maxWidth = sizeDp * 2)
+ .preferredHeight(sizeDp)
+ .saveLayoutInfo(size[0], position[0], positionedLatch)
) {
}
Container(
- LayoutWidth.Max(sizeDp * 2) + LayoutHeight(sizeDp) +
- saveLayoutInfo(size[1], position[1], positionedLatch)
+ Modifier.preferredWidthIn(maxWidth = sizeDp * 2)
+ .preferredHeight(sizeDp)
+ .saveLayoutInfo(size[1], position[1], positionedLatch)
) {
}
Container(
- LayoutWidth.Min(sizeDp) + LayoutHeight(sizeDp) +
- saveLayoutInfo(size[2], position[2], positionedLatch)
+ Modifier.preferredWidthIn(minWidth = sizeDp)
+ .preferredHeight(sizeDp)
+ .saveLayoutInfo(size[2], position[2], positionedLatch)
) {
}
Container(
- LayoutWidth.Max(sizeDp) + LayoutWidth.Min(sizeDp * 2) +
- LayoutHeight(sizeDp) +
- saveLayoutInfo(size[3], position[3], positionedLatch)
+ Modifier.preferredWidthIn(maxWidth = sizeDp)
+ .preferredWidthIn(minWidth = sizeDp * 2)
+ .preferredHeight(sizeDp)
+ .saveLayoutInfo(size[3], position[3], positionedLatch)
) {
}
Container(
- LayoutWidth.Min(sizeDp * 2) + LayoutWidth.Max(sizeDp) +
- LayoutHeight(sizeDp) +
- saveLayoutInfo(size[4], position[4], positionedLatch)
+ Modifier.preferredWidthIn(minWidth = sizeDp * 2)
+ .preferredWidthIn(maxWidth = sizeDp)
+ .preferredHeight(sizeDp)
+ .saveLayoutInfo(size[4], position[4], positionedLatch)
) {
}
Container(
- LayoutWidth(sizeDp) + LayoutHeight(sizeDp) +
- saveLayoutInfo(size[5], position[5], positionedLatch)
+ Modifier.preferredSize(sizeDp)
+ .saveLayoutInfo(size[5], position[5], positionedLatch)
) {
}
}
@@ -130,37 +140,41 @@
show {
Align(alignment = Alignment.TopStart) {
Row {
- Container(LayoutHeight.Max(sizeDp * 2) + LayoutHeight.Min(sizeDp) +
- LayoutWidth(sizeDp) +
- saveLayoutInfo(size[0], position[0], positionedLatch)
+ Container(
+ Modifier.preferredHeightIn(minHeight = sizeDp, maxHeight = sizeDp * 2)
+ .preferredWidth(sizeDp)
+ .saveLayoutInfo(size[0], position[0], positionedLatch)
) {
}
Container(
- LayoutHeight.Max(sizeDp * 2) +
- LayoutWidth(sizeDp) +
- saveLayoutInfo(size[1], position[1], positionedLatch)
+ Modifier.preferredHeightIn(maxHeight = sizeDp * 2)
+ .preferredWidth(sizeDp)
+ .saveLayoutInfo(size[1], position[1], positionedLatch)
) {
}
Container(
- LayoutHeight.Min(sizeDp) + LayoutWidth(sizeDp) +
- saveLayoutInfo(size[2], position[2], positionedLatch)
+ Modifier.preferredHeightIn(minHeight = sizeDp)
+ .preferredWidth(sizeDp)
+ .saveLayoutInfo(size[2], position[2], positionedLatch)
) {
}
Container(
- LayoutHeight.Max(sizeDp) + LayoutHeight.Min(sizeDp * 2) +
- LayoutWidth(sizeDp) +
- saveLayoutInfo(size[3], position[3], positionedLatch)
+ Modifier.preferredHeightIn(maxHeight = sizeDp)
+ .preferredHeightIn(minHeight = sizeDp * 2)
+ .preferredWidth(sizeDp)
+ .saveLayoutInfo(size[3], position[3], positionedLatch)
) {
}
Container(
- LayoutHeight.Min(sizeDp * 2) + LayoutHeight.Max(sizeDp) +
- LayoutWidth(sizeDp) +
- saveLayoutInfo(size[4], position[4], positionedLatch)
+ Modifier.preferredHeightIn(minHeight = sizeDp * 2)
+ .preferredHeightIn(maxHeight = sizeDp)
+ .preferredWidth(sizeDp)
+ .saveLayoutInfo(size[4], position[4], positionedLatch)
) {
}
Container(
- LayoutHeight(sizeDp) + LayoutWidth(sizeDp) +
- saveLayoutInfo(size[5], position[5], positionedLatch)
+ Modifier.preferredHeight(sizeDp) + Modifier.preferredWidth(sizeDp) +
+ Modifier.saveLayoutInfo(size[5], position[5], positionedLatch)
) {
}
}
@@ -198,29 +212,36 @@
show {
Align(alignment = Alignment.TopStart) {
Row {
+ val maxSize = sizeDp * 2
Container(
- LayoutSize.Max(sizeDp * 2) + LayoutSize.Min(sizeDp) +
- saveLayoutInfo(size[0], position[0], positionedLatch)
+ Modifier.preferredSizeIn(maxWidth = maxSize, maxHeight = maxSize)
+ .preferredSizeIn(minWidth = sizeDp, minHeight = sizeDp)
+ .saveLayoutInfo(size[0], position[0], positionedLatch)
) {
}
Container(
- LayoutSize.Max(sizeDp) + LayoutSize.Min(sizeDp * 2, sizeDp) +
- saveLayoutInfo(size[1], position[1], positionedLatch)
+ Modifier.preferredSizeIn(maxWidth = sizeDp, maxHeight = sizeDp)
+ .preferredSizeIn(minWidth = sizeDp * 2, minHeight = sizeDp)
+ .saveLayoutInfo(size[1], position[1], positionedLatch)
+ ) {
+ }
+ val maxSize1 = sizeDp * 2
+ Container(
+ Modifier.preferredSizeIn(minWidth = sizeDp, minHeight = sizeDp)
+ .preferredSizeIn(maxWidth = maxSize1, maxHeight = maxSize1)
+ .saveLayoutInfo(size[2], position[2], positionedLatch)
+ ) {
+ }
+ val minSize = sizeDp * 2
+ Container(
+ Modifier.preferredSizeIn(minWidth = minSize, minHeight = minSize)
+ .preferredSizeIn(maxWidth = sizeDp, maxHeight = sizeDp)
+ .saveLayoutInfo(size[3], position[3], positionedLatch)
) {
}
Container(
- LayoutSize.Min(sizeDp) + LayoutSize.Max(sizeDp * 2) +
- saveLayoutInfo(size[2], position[2], positionedLatch)
- ) {
- }
- Container(
- LayoutSize.Min(sizeDp * 2) + LayoutSize.Max(sizeDp) +
- saveLayoutInfo(size[3], position[3], positionedLatch)
- ) {
- }
- Container(
- LayoutSize(sizeDp) +
- saveLayoutInfo(size[4], position[4], positionedLatch)
+ Modifier.preferredSize(sizeDp)
+ .saveLayoutInfo(size[4], position[4], positionedLatch)
) {
}
}
@@ -257,14 +278,15 @@
Align(alignment = Alignment.TopStart) {
Container(width = sizeDp, height = sizeDp) {
Container(
- LayoutWidth(sizeDp * 2) + LayoutHeight(sizeDp * 3) +
- onPositioned { coordinates ->
- constrainedBoxSize.value = coordinates.size
- positionedLatch.countDown()
- }
+ Modifier.preferredWidth(sizeDp * 2)
+ .preferredHeight(sizeDp * 3)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ constrainedBoxSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
) {
Container(expanded = true,
- modifier = saveLayoutInfo(
+ modifier = Modifier.saveLayoutInfo(
size = childSize,
position = childPosition,
positionedLatch = positionedLatch
@@ -293,27 +315,45 @@
show {
Align(alignment = Alignment.TopStart) {
Row {
- Container(LayoutWidth.Max(Dp.Infinity)) {
+ Container(Modifier.preferredWidthIn(maxWidth = Dp.Infinity)) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(size[0], position[0], positionedLatch)
+ modifier = Modifier.saveLayoutInfo(size[0], position[0],
+ positionedLatch)
) {
}
}
- Container(LayoutHeight.Max(Dp.Infinity)) {
+ Container(Modifier.preferredHeightIn(maxHeight = Dp.Infinity)) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(size[1], position[1], positionedLatch)
+ modifier = Modifier.saveLayoutInfo(
+ size[1],
+ position[1],
+ positionedLatch
+ )
) {
}
}
Container(
- LayoutWidth(sizeDp) + LayoutHeight(sizeDp) + LayoutWidth.Max(Dp.Infinity) +
- LayoutHeight.Max(Dp.Infinity) +
- saveLayoutInfo(size[2], position[2], positionedLatch)
+ Modifier.preferredWidth(sizeDp)
+ .preferredHeight(sizeDp)
+ .preferredWidthIn(maxWidth = Dp.Infinity)
+ .preferredHeightIn(maxHeight = Dp.Infinity)
+ .saveLayoutInfo(size[2], position[2], positionedLatch)
) {
}
- Container(LayoutSize.Max(Dp.Infinity)) {
- Container(width = sizeDp, height = sizeDp, modifier =
- saveLayoutInfo(size[3], position[3], positionedLatch)
+ Container(
+ Modifier.preferredSizeIn(
+ maxWidth = Dp.Infinity,
+ maxHeight = Dp.Infinity
+ )
+ ) {
+ Container(
+ width = sizeDp,
+ height = sizeDp,
+ modifier = Modifier.saveLayoutInfo(
+ size[3],
+ position[3],
+ positionedLatch
+ )
) {
}
}
@@ -331,8 +371,8 @@
@Test
fun testMinWidthModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutWidth.Min(10.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredWidthIn(minWidth = 10.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -361,8 +401,8 @@
@Test
fun testMaxWidthModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutWidth.Max(20.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredWidthIn(maxWidth = 20.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -391,8 +431,8 @@
@Test
fun testMinHeightModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutHeight.Min(30.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredHeightIn(minHeight = 30.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -421,8 +461,8 @@
@Test
fun testMaxHeightModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutHeight.Max(40.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredHeightIn(maxHeight = 40.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -451,8 +491,8 @@
@Test
fun testWidthModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutWidth(10.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredWidth(10.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -481,8 +521,8 @@
@Test
fun testHeightModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutHeight(10.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredHeight(10.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -512,10 +552,14 @@
fun testWidthHeightModifiers_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(
- LayoutWidth.Min(10.dp) + LayoutWidth.Max(20.dp) + LayoutHeight.Min(30.dp) +
- LayoutHeight.Max(40.dp)
+ Modifier.preferredSizeIn(
+ minWidth = 10.dp,
+ maxWidth = 20.dp,
+ minHeight = 30.dp,
+ maxHeight = 40.dp
+ )
) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -544,8 +588,8 @@
@Test
fun testMinSizeModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutSize.Min(20.dp, 30.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredSizeIn(minWidth = 20.dp, minHeight = 30.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -574,8 +618,8 @@
@Test
fun testMaxSizeModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutSize.Max(40.dp, 50.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredSizeIn(maxWidth = 40.dp, maxHeight = 50.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -604,8 +648,8 @@
@Test
fun testSizeModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
- Container(LayoutSize(40.dp, 50.dp)) {
- Container(LayoutAspectRatio(1f)) { }
+ Container(Modifier.preferredSize(40.dp, 50.dp)) {
+ Container(Modifier.aspectRatio(1f)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Min width.
@@ -641,16 +685,17 @@
val screenHeight = displayMetrics.heightPixels
assertEquals(IntPxSize(width.toIntPx(), height.toIntPx()), getSize())
- assertEquals(IntPxSize(screenWidth.ipx, height.toIntPx()), getSize(LayoutWidth.Fill))
- assertEquals(IntPxSize(width.toIntPx(), screenHeight.ipx), getSize(LayoutHeight.Fill))
- assertEquals(IntPxSize(screenWidth.ipx, screenHeight.ipx), getSize(LayoutSize.Fill))
+ assertEquals(IntPxSize(screenWidth.ipx, height.toIntPx()), getSize(Modifier.fillMaxWidth()))
+ assertEquals(IntPxSize(width.toIntPx(), screenHeight.ipx),
+ getSize(Modifier.fillMaxHeight()))
+ assertEquals(IntPxSize(screenWidth.ipx, screenHeight.ipx), getSize(Modifier.fillMaxSize()))
}
@Test
fun testFillModifier_noChangeIntrinsicMeasurements() = with(density) {
- verifyIntrinsicMeasurements(LayoutWidth.Fill)
- verifyIntrinsicMeasurements(LayoutHeight.Fill)
- verifyIntrinsicMeasurements(LayoutSize.Fill)
+ verifyIntrinsicMeasurements(Modifier.fillMaxWidth())
+ verifyIntrinsicMeasurements(Modifier.fillMaxHeight())
+ verifyIntrinsicMeasurements(Modifier.fillMaxSize())
}
private fun getSize(modifier: Modifier = Modifier.None): IntPxSize {
@@ -663,7 +708,7 @@
show {
Layout(@Composable {
Align(alignment = Alignment.TopStart) {
- Container(modifier + saveLayoutInfo(size, position, positionedLatch)) {
+ Container(modifier + Modifier.saveLayoutInfo(size, position, positionedLatch)) {
Container(width = width, height = height) { }
}
}
@@ -686,7 +731,7 @@
// intrinsic measurements do not change with the ExpandedModifier
testIntrinsics(@Composable {
Container(
- expandedModifier + LayoutAspectRatio(2f),
+ expandedModifier + Modifier.aspectRatio(2f),
width = 30.dp, height = 40.dp) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
// Width
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
index 7063748..438a34c 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
@@ -138,11 +138,11 @@
assertTrue(viewDrawLatch.await(1, TimeUnit.SECONDS))
}
- internal fun saveLayoutInfo(
+ internal fun Modifier.saveLayoutInfo(
size: Ref<IntPxSize>,
position: Ref<PxPosition>,
positionedLatch: CountDownLatch
- ): Modifier = onPositioned { coordinates ->
+ ): Modifier = this.onPositioned { coordinates ->
size.value = IntPxSize(coordinates.size.width, coordinates.size.height)
position.value = coordinates.localToGlobal(PxPosition(0.px, 0.px))
positionedLatch.countDown()
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
index 50c1f4b..51dfbb6 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
@@ -31,10 +31,10 @@
import androidx.ui.core.positionInRoot
import androidx.ui.core.setContent
import androidx.ui.layout.Align
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.padding
import androidx.ui.test.positionInParent
import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
@@ -64,9 +64,10 @@
val positionedLatch = CountDownLatch(1)
show {
- Container(LayoutSize.Fill +
- LayoutPadding(start = paddingLeftPx.toDp(), top = paddingTopPx.toDp()) +
- onPositioned {
+ Container(
+ Modifier.fillMaxSize()
+ .padding(start = paddingLeftPx.toDp(), top = paddingTopPx.toDp())
+ .onPositioned {
realLeft = it.positionInParent.x
realTop = it.positionInParent.y
positionedLatch.countDown()
@@ -89,16 +90,18 @@
val positionedLatch = CountDownLatch(1)
show {
- Container(onChildPositioned {
+ Container(Modifier.onChildPositioned {
realLeft = it.positionInParent.x
realTop = it.positionInParent.y
positionedLatch.countDown()
}) {
Container(
- LayoutSize.Fill + LayoutPadding(
- start = paddingLeftPx.toDp(),
- top = paddingTopPx.toDp()
- ), children = emptyContent()
+ Modifier.fillMaxSize()
+ .padding(
+ start = paddingLeftPx.toDp(),
+ top = paddingTopPx.toDp()
+ ),
+ children = emptyContent()
)
}
}
@@ -118,17 +121,22 @@
val positionedLatch = CountDownLatch(2)
show {
- Container(LayoutPadding(start = firstPaddingPx.toDp()) +
- onPositioned {
+ Container(
+ Modifier.padding(start = firstPaddingPx.toDp()) +
+ Modifier.onPositioned {
gpCoordinates = it
positionedLatch.countDown()
- }) {
- Container(LayoutPadding(start = secondPaddingPx.toDp())) {
- Container(LayoutSize.Fill + LayoutPadding(start = thirdPaddingPx.toDp()) +
- onPositioned {
+ }
+ ) {
+ Container(Modifier.padding(start = secondPaddingPx.toDp())) {
+ Container(
+ Modifier.fillMaxSize()
+ .padding(start = thirdPaddingPx.toDp())
+ .onPositioned {
childCoordinates = it
positionedLatch.countDown()
- }) {
+ }
+ ) {
}
}
}
@@ -154,7 +162,7 @@
val positionedLatch = CountDownLatch(2)
show {
- Row(onChildPositioned {
+ Row(Modifier.onChildPositioned {
if (firstCoordinates == null) {
firstCoordinates = it
} else {
@@ -189,7 +197,7 @@
frameLayout.setContent {
Container(
- onPositioned {
+ Modifier.onPositioned {
realGlobalPosition = it.localToGlobal(localPosition)
realLocalPosition = it.globalToLocal(globalPosition)
positionedLatch.countDown()
@@ -213,7 +221,7 @@
val positionedLatch = CountDownLatch(1)
show {
val modifier = if (needCallback.value) {
- onPositioned { positionedLatch.countDown() }
+ Modifier.onPositioned { positionedLatch.countDown() }
} else {
Modifier.None
}
@@ -234,10 +242,12 @@
show {
Stack {
Container(
- onPositioned {
+ Modifier.onPositioned {
realLeft = it.positionInParent.x
positionedLatch.countDown()
- } + LayoutSize.Fill + LayoutPadding(start = modelLeft.size),
+ }
+ .fillMaxSize()
+ .padding(start = modelLeft.size),
children = emptyContent()
)
}
@@ -267,7 +277,7 @@
Container(width = 10.dp, height = 10.dp) {
Container(width = 10.dp, height = 10.dp) {
Container(
- onPositioned {
+ Modifier.onPositioned {
realLeft = it.positionInRoot.x
positionedLatch.countDown()
},
@@ -297,7 +307,7 @@
val line = VerticalAlignmentLine(::min)
val lineValue = 10.ipx
show {
- val { coordinates ->
+ val { coordinates: LayoutCoordinates ->
Assert.assertEquals(1, coordinates.providedAlignmentLines.size)
Assert.assertEquals(lineValue, coordinates[line])
latch.countDown()
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
index ab06257..10c1b62 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
@@ -32,20 +32,24 @@
import androidx.ui.core.globalPosition
import androidx.ui.core.onPositioned
import androidx.ui.layout.Align
-import androidx.ui.layout.Column
-import androidx.ui.layout.DpConstraints
import androidx.ui.layout.Arrangement
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.Column
+import androidx.ui.layout.ColumnAlign
+import androidx.ui.layout.DpConstraints
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredHeightIn
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidthIn
+import androidx.ui.layout.rtl
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
@@ -86,7 +90,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
@@ -97,7 +101,7 @@
Container(
width = (sizeDp * 2),
height = (sizeDp * 2),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
@@ -133,18 +137,28 @@
show {
Container(alignment = Alignment.TopStart) {
Row {
- Container(LayoutWeight(1f) + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }, width = width, height = height) {
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
+ width = width,
+ height = height
+ ) {
}
- Container(LayoutWeight(2f) + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }, width = width, height = height) {
+ Container(
+ Modifier.weight(2f)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
+ width = width,
+ height = height
+ ) {
}
}
}
@@ -181,22 +195,24 @@
Container(alignment = Alignment.TopStart) {
Row {
Container(
- LayoutWeight(1f, fill = false) + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- },
+ Modifier.weight(1f, fill = false)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
width = width,
height = height
) {
}
Container(
- LayoutWeight(2f, fill = false) + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- },
+ Modifier.weight(2f, fill = false)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
width = width,
height = height * 2
) {
@@ -229,7 +245,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
@@ -239,7 +255,7 @@
Container(
width = (sizeDp * 2),
height = (sizeDp * 2),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
@@ -276,22 +292,24 @@
Container(alignment = Alignment.TopStart) {
Column {
Container(
- LayoutWeight(1f) + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- },
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
width = width,
height = height
) {
}
Container(
- LayoutWeight(2f) + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- },
+ Modifier.weight(2f)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
width = width,
height = height
) {
@@ -329,21 +347,23 @@
Container(alignment = Alignment.TopStart) {
Column {
Container(
- LayoutWeight(1f, fill = false) + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- },
+ Modifier.weight(1f, fill = false)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
width = width,
height = height
) {
}
Container(
- LayoutWeight(2f, fill = false) + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- },
+ Modifier.weight(2f, fill = false)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ },
width = width,
height = height
) {
@@ -374,20 +394,25 @@
val latch = CountDownLatch(2)
show {
Row(
- LayoutAlign.TopStart + LayoutPadding(start = leftPadding.toDp()) +
- LayoutWidth.Max(expectedRowWidth.toDp()) +
- onPositioned { coordinates -> rowWidth = coordinates.size.width }
+ Modifier.wrapContentSize(Alignment.TopStart)
+ .padding(start = leftPadding.toDp())
+ .preferredWidthIn(maxWidth = expectedRowWidth.toDp())
+ .onPositioned { coordinates: LayoutCoordinates ->
+ rowWidth = coordinates.size.width
+ }
) {
- Container(LayoutWeight(1f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
width[0] = coordinates.size.width
x[0] = coordinates.globalPosition.x
latch.countDown()
}
) {
}
- Container(LayoutWeight(1f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
width[1] = coordinates.size.width
x[1] = coordinates.globalPosition.x
latch.countDown()
@@ -415,28 +440,34 @@
val latch = CountDownLatch(3)
show {
Row(
- LayoutAlign.TopStart + LayoutPadding(start = leftPadding.toDp()) +
- LayoutWidth.Max(expectedRowWidth.toDp()) +
- onPositioned { coordinates -> rowWidth = coordinates.size.width }
+ Modifier.wrapContentSize(Alignment.TopStart)
+ .padding(start = leftPadding.toDp())
+ .preferredWidthIn(maxWidth = expectedRowWidth.toDp())
+ .onPositioned { coordinates: LayoutCoordinates ->
+ rowWidth = coordinates.size.width
+ }
) {
- Container(LayoutWeight(2f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(2f)
+ .onPositioned { coordinates: LayoutCoordinates ->
width[0] = coordinates.size.width
x[0] = coordinates.globalPosition.x
latch.countDown()
}
) {
}
- Container(LayoutWeight(2f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(2f)
+ .onPositioned { coordinates: LayoutCoordinates ->
width[1] = coordinates.size.width
x[1] = coordinates.globalPosition.x
latch.countDown()
}
) {
}
- Container(LayoutWeight(3f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(3f)
+ .onPositioned { coordinates: LayoutCoordinates ->
width[2] = coordinates.size.width
x[2] = coordinates.globalPosition.x
latch.countDown()
@@ -465,28 +496,34 @@
val latch = CountDownLatch(3)
show {
Column(
- LayoutAlign.TopStart + LayoutPadding(top = topPadding.toDp()) +
- LayoutHeight.Max(expectedColumnHeight.toDp()) +
- onPositioned { coordinates -> columnHeight = coordinates.size.height }
+ Modifier.wrapContentSize(Alignment.TopStart)
+ .padding(top = topPadding.toDp())
+ .preferredHeightIn(maxHeight = expectedColumnHeight.toDp())
+ .onPositioned { coordinates: LayoutCoordinates ->
+ columnHeight = coordinates.size.height
+ }
) {
- Container(LayoutWeight(1f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
height[0] = coordinates.size.height
y[0] = coordinates.globalPosition.y
latch.countDown()
}
) {
}
- Container(LayoutWeight(1f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
height[1] = coordinates.size.height
y[1] = coordinates.globalPosition.y
latch.countDown()
}
) {
}
- Container(LayoutWeight(1f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
height[2] = coordinates.size.height
y[2] = coordinates.globalPosition.y
latch.countDown()
@@ -515,20 +552,25 @@
val latch = CountDownLatch(2)
show {
Column(
- LayoutAlign.TopStart + LayoutPadding(top = topPadding.toDp()) +
- LayoutHeight.Max(expectedColumnHeight.toDp()) +
- onPositioned { coordinates -> columnHeight = coordinates.size.height }
+ Modifier.wrapContentSize(Alignment.TopStart)
+ .padding(top = topPadding.toDp())
+ .preferredHeightIn(maxHeight = expectedColumnHeight.toDp())
+ .onPositioned { coordinates: LayoutCoordinates ->
+ columnHeight = coordinates.size.height
+ }
) {
- Container(LayoutWeight(1f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
height[0] = coordinates.size.height
y[0] = coordinates.globalPosition.y
latch.countDown()
}
) {
}
- Container(LayoutWeight(1f) +
- onPositioned { coordinates ->
+ Container(
+ Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
height[1] = coordinates.size.height
y[1] = coordinates.globalPosition.y
latch.countDown()
@@ -563,22 +605,24 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutHeight.Fill + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ modifier = Modifier.fillMaxHeight()
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
Container(
width = (sizeDp * 2),
height = (sizeDp * 2),
- modifier = LayoutHeight.Fill + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ modifier = Modifier.fillMaxHeight()
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
}
@@ -608,35 +652,38 @@
val childPosition = arrayOfNulls<PxPosition>(3)
show {
Align(Alignment.TopStart) {
- Row(LayoutHeight.Fill) {
+ Row(Modifier.fillMaxHeight()) {
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.Top + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.gravity(RowAlign.Top)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.Center + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.gravity(RowAlign.Center)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.Bottom + onPositioned { coordinates ->
- childSize[2] = coordinates.size
- childPosition[2] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.gravity(RowAlign.Bottom)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[2] = coordinates.size
+ childPosition[2] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
}
@@ -675,51 +722,51 @@
val childPosition = arrayOfNulls<PxPosition>(4)
show {
Align(Alignment.TopStart) {
- Row(LayoutHeight.Fill) {
+ Row(Modifier.fillMaxHeight()) {
BaselineTestLayout(
baseline = baseline1Dp,
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.RelativeToSiblings(TestHorizontalLine) +
- onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings(TestHorizontalLine)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.RelativeToSiblings { it.height * 0.5 } +
- onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings { it.height * 0.5 }
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
BaselineTestLayout(
baseline = baseline2Dp,
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.RelativeToSiblings(TestHorizontalLine) +
- onPositioned { coordinates ->
- childSize[2] = coordinates.size
- childPosition[2] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings(TestHorizontalLine)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[2] = coordinates.size
+ childPosition[2] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.RelativeToSiblings { it.height * 0.75 } +
- onPositioned { coordinates ->
- childSize[3] = coordinates.size
- childPosition[3] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings { it.height * 0.75 }
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[3] = coordinates.size
+ childPosition[3] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
}
@@ -765,22 +812,24 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutWidth.Fill + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ modifier = Modifier.fillMaxWidth()
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
Container(
width = (sizeDp * 2),
height = (sizeDp * 2),
- modifier = LayoutWidth.Fill + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ modifier = Modifier.fillMaxWidth()
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
}
@@ -810,35 +859,38 @@
val childPosition = arrayOfNulls<PxPosition>(3)
show {
Align(Alignment.TopCenter) {
- Column(LayoutWidth.Fill) {
+ Column(Modifier.fillMaxWidth()) {
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.Start + onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.gravity(ColumnAlign.Start)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.Center + onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.gravity(ColumnAlign.Center)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.End + onPositioned { coordinates ->
- childSize[2] = coordinates.size
- childPosition[2] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.gravity(ColumnAlign.End)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[2] = coordinates.size
+ childPosition[2] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
}
@@ -875,51 +927,51 @@
val childPosition = arrayOfNulls<PxPosition>(4)
show {
Align(Alignment.TopStart) {
- Column(LayoutWidth.Fill) {
+ Column(Modifier.fillMaxWidth()) {
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.RelativeToSiblings { it.width } +
- onPositioned { coordinates ->
- childSize[0] = coordinates.size
- childPosition[0] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings { it.width }
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[0] = coordinates.size
+ childPosition[0] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
Container(
width = sizeDp,
height = sizeDp,
- modifier = LayoutGravity.RelativeToSiblings { 0.ipx } +
- onPositioned { coordinates ->
- childSize[1] = coordinates.size
- childPosition[1] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings { 0.ipx }
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[1] = coordinates.size
+ childPosition[1] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
BaselineTestLayout(
width = sizeDp,
height = sizeDp,
baseline = firstBaseline1Dp,
- modifier = LayoutGravity.RelativeToSiblings(TestVerticalLine) +
- onPositioned { coordinates ->
- childSize[2] = coordinates.size
- childPosition[2] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings(TestVerticalLine)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[2] = coordinates.size
+ childPosition[2] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
BaselineTestLayout(
width = sizeDp,
height = sizeDp,
baseline = firstBaseline2Dp,
- modifier = LayoutGravity.RelativeToSiblings(TestVerticalLine) +
- onPositioned { coordinates ->
- childSize[3] = coordinates.size
- childPosition[3] = coordinates.globalPosition
- drawLatch.countDown()
- }
+ modifier = Modifier.alignWithSiblings(TestVerticalLine)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childSize[3] = coordinates.size
+ childPosition[3] = coordinates.globalPosition
+ drawLatch.countDown()
+ }
) {
}
}
@@ -956,12 +1008,12 @@
lateinit var rowSize: IntPxSize
show {
Center {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -984,12 +1036,12 @@
lateinit var rowSize: IntPxSize
show {
Center {
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -1012,12 +1064,12 @@
lateinit var rowSize: IntPxSize
show {
Center {
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
Container(
- LayoutWeight(1f),
+ Modifier.weight(1f),
width = sizeDp,
height = sizeDp,
children = emptyContent()
@@ -1049,12 +1101,12 @@
lateinit var rowSize: IntPxSize
show {
Center {
- Row(LayoutHeight.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -1077,12 +1129,12 @@
lateinit var rowSize: IntPxSize
show {
Center {
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -1107,12 +1159,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(maxWidth = rowWidthDp)) {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1138,12 +1190,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(maxWidth = rowWidthDp)) {
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
Container(
- LayoutWeight(1f),
+ Modifier.weight(1f),
width = sizeDp,
height = sizeDp,
children = emptyContent()
@@ -1178,12 +1230,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(minWidth = rowWidthDp)) {
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1209,12 +1261,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(maxHeight = rowHeightDp)) {
- Row(LayoutHeight.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1240,12 +1292,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(minHeight = rowHeightDp)) {
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1279,15 +1331,16 @@
Center {
ConstrainedBox(constraints = DpConstraints(minWidth = rowWidthDp)) {
// TODO: add maxWidth(IntPx.Infinity) modifier
- Row(onPositioned { coordinates ->
+ Row(Modifier.onPositioned { coordinates: LayoutCoordinates ->
rowSize = coordinates.size
drawLatch.countDown()
}) {
Container(
- modifier = LayoutWeight(1f) + onPositioned { coordinates ->
- expandedChildSize = coordinates.size
- drawLatch.countDown()
- },
+ modifier = Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ expandedChildSize = coordinates.size
+ drawLatch.countDown()
+ },
width = sizeDp,
height = sizeDp
) {
@@ -1328,7 +1381,7 @@
assertEquals(Constraints(), constraints)
FixedSizeLayout(noWeightChildWidth.toIntPx(), 0.ipx, mapOf())
}
- Layout({}, LayoutWeight(1f)) { _, constraints, _ ->
+ Layout({}, Modifier.weight(1f)) { _, constraints, _ ->
assertEquals(
rowMinWidth.toIntPx() - noWeightChildWidth.toIntPx() * 2,
constraints.minWidth
@@ -1403,12 +1456,12 @@
lateinit var columnSize: IntPxSize
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -1431,12 +1484,12 @@
lateinit var columnSize: IntPxSize
show {
Center {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -1459,12 +1512,12 @@
lateinit var columnSize: IntPxSize
show {
Center {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
Container(
- LayoutWeight(1f),
+ Modifier.weight(1f),
width = sizeDp,
height = sizeDp,
children = emptyContent()
@@ -1496,12 +1549,12 @@
lateinit var columnSize: IntPxSize
show {
Center {
- Column(LayoutWidth.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -1524,12 +1577,12 @@
lateinit var columnSize: IntPxSize
show {
Center {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = (sizeDp * 2), height = (sizeDp * 2)))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = (sizeDp * 2), height = (sizeDp * 2)))
}
}
}
@@ -1554,12 +1607,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(maxHeight = columnHeightDp)) {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1585,12 +1638,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(maxHeight = columnHeightDp)) {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
Container(
- LayoutWeight(1f),
+ Modifier.weight(1f),
width = sizeDp,
height = sizeDp,
children = emptyContent()
@@ -1625,12 +1678,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(minHeight = columnHeightDp)) {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1656,12 +1709,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(maxWidth = columnWidthDp)) {
- Column(LayoutWidth.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1687,12 +1740,12 @@
show {
Center {
ConstrainedBox(constraints = DpConstraints(minWidth = columnWidthDp)) {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates: LayoutCoordinates ->
columnSize = coordinates.size
drawLatch.countDown()
}) {
- Spacer(LayoutSize(width = sizeDp, height = sizeDp))
- Spacer(LayoutSize(width = sizeDp * 2, height = sizeDp * 2))
+ Spacer(Modifier.preferredSize(width = sizeDp, height = sizeDp))
+ Spacer(Modifier.preferredSize(width = sizeDp * 2, height = sizeDp * 2))
}
}
}
@@ -1726,14 +1779,20 @@
Center {
ConstrainedBox(constraints = DpConstraints(minHeight = columnHeightDp)) {
// TODO: add maxHeight(IntPx.Infinity) modifier
- Column(LayoutHeight.Max(Dp.Infinity) + onPositioned { coordinates ->
- columnSize = coordinates.size
- drawLatch.countDown()
- }) {
- Container(LayoutWeight(1f) + onPositioned { coordinates ->
- expandedChildSize = coordinates.size
+ Column(Modifier.preferredHeightIn(maxHeight = Dp.Infinity)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ columnSize = coordinates.size
drawLatch.countDown()
- }, width = sizeDp, height = sizeDp) {
+ }
+ ) {
+ Container(Modifier.weight(1f)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ expandedChildSize = coordinates.size
+ drawLatch.countDown()
+ },
+ width = sizeDp,
+ height = sizeDp
+ ) {
}
}
}
@@ -1772,7 +1831,7 @@
assertEquals(Constraints(), constraints)
FixedSizeLayout(0.ipx, noWeightChildHeight.toIntPx(), mapOf())
}
- Layout(emptyContent(), LayoutWeight(1f)) { _, constraints, _ ->
+ Layout(emptyContent(), Modifier.weight(1f)) { _, constraints, _ ->
assertEquals(
columnMinHeight.toIntPx() - noWeightChildHeight.toIntPx() * 2,
constraints.minHeight
@@ -1851,15 +1910,17 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
- parentLayoutCoordinates = coordinates
- drawLatch.countDown()
- }) {
+ Row(Modifier.fillMaxWidth()
+ .onPositioned { coordinates: LayoutCoordinates ->
+ parentLayoutCoordinates = coordinates
+ drawLatch.countDown()
+ }
+ ) {
for (i in 0 until childPosition.size) {
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -1894,7 +1955,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.End) {
@@ -1902,7 +1963,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -1937,7 +1998,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.Center) {
@@ -1945,7 +2006,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -1981,7 +2042,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.SpaceEvenly) {
@@ -1989,7 +2050,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2025,7 +2086,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.SpaceBetween) {
@@ -2033,7 +2094,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2070,7 +2131,7 @@
show {
Center {
Row(
- LayoutWidth.Fill + onPositioned { coordinates ->
+ Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
},
@@ -2080,7 +2141,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2116,7 +2177,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Row(LayoutWidth.Fill + onPositioned { coordinates ->
+ Row(Modifier.fillMaxWidth().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = customHorizontalArrangement) {
@@ -2124,7 +2185,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2165,7 +2226,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}) {
@@ -2173,7 +2234,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2208,7 +2269,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.Bottom) {
@@ -2216,7 +2277,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2251,7 +2312,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.Center) {
@@ -2259,7 +2320,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2295,7 +2356,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.SpaceEvenly) {
@@ -2303,7 +2364,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2350,7 +2411,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.SpaceBetween) {
@@ -2358,7 +2419,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2394,7 +2455,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = Arrangement.SpaceAround) {
@@ -2402,7 +2463,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2444,7 +2505,7 @@
var parentLayoutCoordinates: LayoutCoordinates? = null
show {
Center {
- Column(LayoutHeight.Fill + onPositioned { coordinates ->
+ Column(Modifier.fillMaxHeight().onPositioned { coordinates: LayoutCoordinates ->
parentLayoutCoordinates = coordinates
drawLatch.countDown()
}, arrangement = customVerticalArrangement) {
@@ -2452,7 +2513,7 @@
Container(
width = sizeDp,
height = sizeDp,
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childLayoutCoordinates[i] = coordinates
drawLatch.countDown()
}
@@ -2492,8 +2553,9 @@
constraints = DpConstraints.fixed(sizeDp, sizeDp)
) {
Row {
- Spacer(LayoutSize(width = childSizeDp, height = childSizeDp) +
- onPositioned { coordinates ->
+ Spacer(
+ Modifier.preferredSize(width = childSizeDp, height = childSizeDp)
+ .onPositioned { coordinates: LayoutCoordinates ->
containerSize.value = coordinates.size
layoutLatch.countDown()
})
@@ -2520,8 +2582,9 @@
constraints = DpConstraints.fixed(sizeDp, sizeDp)
) {
Column {
- Spacer(LayoutSize(width = childSizeDp, height = childSizeDp) +
- onPositioned { coordinates ->
+ Spacer(
+ Modifier.preferredSize(width = childSizeDp, height = childSizeDp) +
+ Modifier.onPositioned { coordinates: LayoutCoordinates ->
containerSize.value = coordinates.size
layoutLatch.countDown()
})
@@ -2540,75 +2603,77 @@
fun testRow_withNoWeightChildren_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Row {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
- Row(LayoutWidth.Fill) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Row(Modifier.fillMaxWidth()) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
Row {
- Container(LayoutAspectRatio(2f) + LayoutGravity.Top, children = emptyContent())
+ Container(Modifier.aspectRatio(2f).gravity(RowAlign.Top), children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutGravity.Center,
+ Modifier.gravity(RowAlign.Center),
children = emptyContent()
)
}
}, @Composable {
Row {
Container(
- LayoutAspectRatio(2f) + LayoutGravity.RelativeToSiblings(FirstBaseline),
+ Modifier.aspectRatio(2f).alignWithSiblings(FirstBaseline),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutGravity.RelativeToSiblings { it.width },
+ Modifier.alignWithSiblings { it.width },
children = emptyContent()
)
}
}, @Composable {
- Row(LayoutWidth.Fill, arrangement = Arrangement.Start) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.Start) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
- Row(LayoutWidth.Fill, arrangement = Arrangement.Center) {
- Container(LayoutGravity.Center + LayoutAspectRatio(2f), children = emptyContent())
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.Center) {
+ Container(Modifier.gravity(RowAlign.Center).aspectRatio(2f),
+ children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutGravity.Center,
+ Modifier.gravity(RowAlign.Center),
children = emptyContent()
)
}
}, @Composable {
- Row(LayoutWidth.Fill, arrangement = Arrangement.End) {
- Container(LayoutGravity.Bottom + LayoutAspectRatio(2f), children = emptyContent())
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.End) {
+ Container(Modifier.gravity(RowAlign.Bottom).aspectRatio(2f),
+ children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutGravity.Bottom,
+ Modifier.gravity(RowAlign.Bottom),
children = emptyContent()
)
}
}, @Composable {
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceAround) {
- Container(LayoutHeight.Fill + LayoutAspectRatio(2f), children = emptyContent())
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceAround) {
+ Container(Modifier.fillMaxHeight().aspectRatio(2f), children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutHeight.Fill,
+ Modifier.fillMaxHeight(),
children = emptyContent()
)
}
}, @Composable {
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceBetween) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceBetween) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -2637,33 +2702,33 @@
Row {
ConstrainedBox(
DpConstraints.fixed(20.dp, 30.dp),
- LayoutWeight(3f),
+ Modifier.weight(3f),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(30.dp, 40.dp),
- LayoutWeight(2f),
+ Modifier.weight(2f),
children = emptyContent()
)
- Container(LayoutAspectRatio(2f) + LayoutWeight(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(2f).weight(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(20.dp, 30.dp), children = emptyContent())
}
}, @Composable {
Row {
ConstrainedBox(
DpConstraints.fixed(20.dp, 30.dp),
- LayoutWeight(3f) + LayoutGravity.Top,
+ Modifier.weight(3f).gravity(RowAlign.Top),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(30.dp, 40.dp),
- LayoutWeight(2f) + LayoutGravity.Center,
+ Modifier.weight(2f).gravity(RowAlign.Center),
children = emptyContent()
)
- Container(LayoutAspectRatio(2f) + LayoutWeight(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(2f).weight(2f), children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(20.dp, 30.dp),
- LayoutGravity.Bottom,
+ Modifier.gravity(RowAlign.Bottom),
children = emptyContent()
)
}
@@ -2671,37 +2736,36 @@
Row(arrangement = Arrangement.Start) {
ConstrainedBox(
DpConstraints.fixed(20.dp, 30.dp),
- LayoutWeight(3f),
+ Modifier.weight(3f),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(30.dp, 40.dp),
- LayoutWeight(2f),
+ Modifier.weight(2f),
children = emptyContent()
)
- Container(LayoutAspectRatio(2f) + LayoutWeight(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(2f).weight(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(20.dp, 30.dp), children = emptyContent())
}
}, @Composable {
Row(arrangement = Arrangement.Center) {
ConstrainedBox(
constraints = DpConstraints.fixed(20.dp, 30.dp),
- modifier = LayoutWeight(3f) + LayoutGravity.Center,
+ modifier = Modifier.weight(3f).gravity(RowAlign.Center),
children = emptyContent()
)
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 40.dp),
- modifier = LayoutWeight(2f) + LayoutGravity.Center,
+ modifier = Modifier.weight(2f).gravity(RowAlign.Center),
children = emptyContent()
)
Container(
- LayoutAspectRatio(2f) + LayoutWeight(2f) + LayoutGravity.Center,
- children =
- emptyContent()
+ Modifier.aspectRatio(2f).weight(2f).gravity(RowAlign.Center),
+ children = emptyContent()
)
ConstrainedBox(
constraints = DpConstraints.fixed(20.dp, 30.dp),
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(RowAlign.Center),
children = emptyContent()
)
}
@@ -2709,21 +2773,21 @@
Row(arrangement = Arrangement.End) {
ConstrainedBox(
constraints = DpConstraints.fixed(20.dp, 30.dp),
- modifier = LayoutWeight(3f) + LayoutGravity.Bottom,
+ modifier = Modifier.weight(3f).gravity(RowAlign.Bottom),
children = emptyContent()
)
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 40.dp),
- modifier = LayoutWeight(2f) + LayoutGravity.Bottom,
+ modifier = Modifier.weight(2f).gravity(RowAlign.Bottom),
children = emptyContent()
)
Container(
- LayoutAspectRatio(2f) + LayoutWeight(2f) + LayoutGravity.Bottom,
+ Modifier.aspectRatio(2f).weight(2f).gravity(RowAlign.Bottom),
children = emptyContent()
)
ConstrainedBox(
constraints = DpConstraints.fixed(20.dp, 30.dp),
- modifier = LayoutGravity.Bottom,
+ modifier = Modifier.gravity(RowAlign.Bottom),
children = emptyContent()
)
}
@@ -2731,22 +2795,21 @@
Row(arrangement = Arrangement.SpaceAround) {
ConstrainedBox(
constraints = DpConstraints.fixed(20.dp, 30.dp),
- modifier = LayoutWeight(3f) + LayoutHeight.Fill,
+ modifier = Modifier.weight(3f).fillMaxHeight(),
children = emptyContent()
)
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 40.dp),
- modifier = LayoutWeight(2f) + LayoutHeight.Fill,
+ modifier = Modifier.weight(2f).fillMaxHeight(),
children = emptyContent()
)
Container(
- LayoutAspectRatio(2f) + LayoutWeight(2f) + LayoutHeight.Fill,
- children =
- emptyContent()
+ Modifier.aspectRatio(2f).weight(2f).fillMaxHeight(),
+ children = emptyContent()
)
ConstrainedBox(
constraints = DpConstraints.fixed(20.dp, 30.dp),
- modifier = LayoutHeight.Fill,
+ modifier = Modifier.fillMaxHeight(),
children = emptyContent()
)
}
@@ -2754,30 +2817,30 @@
Row(arrangement = Arrangement.SpaceBetween) {
ConstrainedBox(
DpConstraints.fixed(20.dp, 30.dp),
- LayoutWeight(3f),
+ Modifier.weight(3f),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(30.dp, 40.dp),
- LayoutWeight(2f),
+ Modifier.weight(2f),
children = emptyContent()
)
- Container(LayoutAspectRatio(2f) + LayoutWeight(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(2f).weight(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(20.dp, 30.dp), children = emptyContent())
}
}, @Composable {
Row(arrangement = Arrangement.SpaceEvenly) {
ConstrainedBox(
DpConstraints.fixed(20.dp, 30.dp),
- LayoutWeight(3f),
+ Modifier.weight(3f),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(30.dp, 40.dp),
- LayoutWeight(2f),
+ Modifier.weight(2f),
children = emptyContent()
)
- Container(LayoutAspectRatio(2f) + LayoutWeight(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(2f).weight(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(20.dp, 30.dp), children = emptyContent())
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -2832,71 +2895,74 @@
fun testColumn_withNoWeightChildren_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Column {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
Column {
- Container(LayoutAspectRatio(2f) + LayoutGravity.Start, children = emptyContent())
+ Container(Modifier.aspectRatio(2f).gravity(ColumnAlign.Start),
+ children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutGravity.End,
+ Modifier.gravity(ColumnAlign.End),
children = emptyContent()
)
}
}, @Composable {
Column {
Container(
- LayoutAspectRatio(2f) + LayoutGravity.RelativeToSiblings { 0.ipx },
+ Modifier.aspectRatio(2f).alignWithSiblings { 0.ipx },
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutGravity.RelativeToSiblings(TestVerticalLine),
+ Modifier.alignWithSiblings(TestVerticalLine),
children = emptyContent()
)
}
}, @Composable {
- Column(LayoutHeight.Fill) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Column(Modifier.fillMaxHeight()) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
- Column(LayoutHeight.Fill, arrangement = Arrangement.Top) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.Top) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
- Column(LayoutHeight.Fill, arrangement = Arrangement.Center) {
- Container(LayoutGravity.Center + LayoutAspectRatio(2f), children = emptyContent())
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.Center) {
+ Container(Modifier.gravity(ColumnAlign.Center).aspectRatio(2f),
+ children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
- Column(LayoutHeight.Fill, arrangement = Arrangement.Bottom) {
- Container(LayoutGravity.End + LayoutAspectRatio(2f), children = emptyContent())
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.Bottom) {
+ Container(Modifier.gravity(ColumnAlign.End).aspectRatio(2f),
+ children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutGravity.End,
+ Modifier.gravity(ColumnAlign.End),
children = emptyContent()
)
}
}, @Composable {
- Column(LayoutHeight.Fill, arrangement = Arrangement.SpaceAround) {
- Container(LayoutWidth.Fill + LayoutAspectRatio(2f), children = emptyContent())
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.SpaceAround) {
+ Container(Modifier.fillMaxWidth().aspectRatio(2f), children = emptyContent())
ConstrainedBox(
DpConstraints.fixed(50.dp, 40.dp),
- LayoutWidth.Fill,
+ Modifier.fillMaxWidth(),
children = emptyContent()
)
}
}, @Composable {
- Column(LayoutHeight.Fill, arrangement = Arrangement.SpaceBetween) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.SpaceBetween) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}, @Composable {
- Column(LayoutHeight.Fill, arrangement = Arrangement.SpaceEvenly) {
- Container(LayoutAspectRatio(2f), children = emptyContent())
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.SpaceEvenly) {
+ Container(Modifier.aspectRatio(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(50.dp, 40.dp), children = emptyContent())
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -2925,105 +2991,106 @@
Column {
ConstrainedBox(
DpConstraints.fixed(30.dp, 20.dp),
- LayoutWeight(3f),
+ Modifier.weight(3f),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(40.dp, 30.dp),
- LayoutWeight(2f),
+ Modifier.weight(2f),
children = emptyContent()
)
- Container(LayoutAspectRatio(0.5f) + LayoutWeight(2f), children = emptyContent())
+ Container(Modifier.aspectRatio(0.5f).weight(2f), children = emptyContent())
ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), children = emptyContent())
}
}, @Composable {
Column {
ConstrainedBox(
DpConstraints.fixed(30.dp, 20.dp),
- LayoutWeight(3f) + LayoutGravity.Start,
+ Modifier.weight(3f).gravity(ColumnAlign.Start),
children = emptyContent()
)
ConstrainedBox(
DpConstraints.fixed(40.dp, 30.dp),
- LayoutWeight(2f) + LayoutGravity.Center,
+ Modifier.weight(2f).gravity(ColumnAlign.Center),
children = emptyContent()
)
- Container(LayoutAspectRatio(0.5f) + LayoutWeight(2f)) { }
- ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), LayoutGravity.End) { }
+ Container(Modifier.aspectRatio(0.5f).weight(2f)) { }
+ ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp),
+ Modifier.gravity(ColumnAlign.End)) { }
}
}, @Composable {
Column(arrangement = Arrangement.Top) {
- ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), LayoutWeight(3f)) { }
- ConstrainedBox(DpConstraints.fixed(40.dp, 30.dp), LayoutWeight(2f)) { }
- Container(LayoutAspectRatio(0.5f) + LayoutWeight(2f)) { }
+ ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), Modifier.weight(3f)) { }
+ ConstrainedBox(DpConstraints.fixed(40.dp, 30.dp), Modifier.weight(2f)) { }
+ Container(Modifier.aspectRatio(0.5f).weight(2f)) { }
ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp)) { }
}
}, @Composable {
Column(arrangement = Arrangement.Center) {
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 20.dp),
- modifier = LayoutWeight(3f) + LayoutGravity.Center
+ modifier = Modifier.weight(3f).gravity(ColumnAlign.Center)
) { }
ConstrainedBox(
constraints = DpConstraints.fixed(40.dp, 30.dp),
- modifier = LayoutWeight(2f) + LayoutGravity.Center
+ modifier = Modifier.weight(2f).gravity(ColumnAlign.Center)
) { }
Container(
- LayoutAspectRatio(0.5f) + LayoutWeight(2f) + LayoutGravity.Center
+ Modifier.aspectRatio(0.5f).weight(2f).gravity(ColumnAlign.Center)
) { }
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 20.dp),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(ColumnAlign.Center)
) { }
}
}, @Composable {
Column(arrangement = Arrangement.Bottom) {
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 20.dp),
- modifier = LayoutWeight(3f) + LayoutGravity.End
+ modifier = Modifier.weight(3f).gravity(ColumnAlign.End)
) { }
ConstrainedBox(
constraints = DpConstraints.fixed(40.dp, 30.dp),
- modifier = LayoutWeight(2f) + LayoutGravity.End
+ modifier = Modifier.weight(2f).gravity(ColumnAlign.End)
) { }
Container(
- LayoutAspectRatio(0.5f) + LayoutWeight(2f) + LayoutGravity.End
+ Modifier.aspectRatio(0.5f).weight(2f).gravity(ColumnAlign.End)
) { }
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 20.dp),
- modifier = LayoutGravity.End
+ modifier = Modifier.gravity(ColumnAlign.End)
) { }
}
}, @Composable {
Column(arrangement = Arrangement.SpaceAround) {
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 20.dp),
- modifier = LayoutWeight(3f) + LayoutWidth.Fill
+ modifier = Modifier.weight(3f).fillMaxWidth()
) { }
ConstrainedBox(
constraints = DpConstraints.fixed(40.dp, 30.dp),
- modifier = LayoutWeight(2f) + LayoutWidth.Fill
+ modifier = Modifier.weight(2f).fillMaxWidth()
) { }
Container(
- LayoutAspectRatio(0.5f) + LayoutWeight(2f) + LayoutWidth.Fill
+ Modifier.aspectRatio(0.5f).weight(2f).fillMaxWidth()
) { }
ConstrainedBox(
constraints = DpConstraints.fixed(30.dp, 20.dp),
- modifier = LayoutWidth.Fill
+ modifier = Modifier.fillMaxWidth()
) { }
}
}, @Composable {
Column(arrangement = Arrangement.SpaceBetween) {
- ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), LayoutWeight(3f)) { }
- ConstrainedBox(DpConstraints.fixed(40.dp, 30.dp), LayoutWeight(2f)) { }
- Container(LayoutAspectRatio(0.5f) + LayoutWeight(2f)) { }
+ ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), Modifier.weight(3f)) { }
+ ConstrainedBox(DpConstraints.fixed(40.dp, 30.dp), Modifier.weight(2f)) { }
+ Container(Modifier.aspectRatio(0.5f) + Modifier.weight(2f)) { }
ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp)) { }
}
}, @Composable {
Column(arrangement = Arrangement.SpaceEvenly) {
- ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), LayoutWeight(3f)) { }
- ConstrainedBox(DpConstraints.fixed(40.dp, 30.dp), LayoutWeight(2f)) { }
- Container(LayoutAspectRatio(0.5f) + LayoutWeight(2f)) { }
+ ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), Modifier.weight(3f)) { }
+ ConstrainedBox(DpConstraints.fixed(40.dp, 30.dp), Modifier.weight(2f)) { }
+ Container(Modifier.aspectRatio(0.5f) + Modifier.weight(2f)) { }
ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp)) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -3084,16 +3151,17 @@
show {
Align(Alignment.TopStart) {
- Column(LayoutHeight(columnHeight.toDp())) {
+ Column(Modifier.preferredHeight(columnHeight.toDp())) {
Container(
- LayoutWeight(2f) + LayoutWeight(1f) +
- onPositioned { coordinates ->
- containerHeight.value = coordinates.size.height
- positionedLatch.countDown()
- },
+ Modifier.weight(2f)
+ .weight(1f)
+ .onPositioned { coordinates ->
+ containerHeight.value = coordinates.size.height
+ positionedLatch.countDown()
+ },
children = emptyContent()
)
- Container(LayoutWeight(1f), children = emptyContent())
+ Container(Modifier.weight(1f), children = emptyContent())
}
}
}
@@ -3114,19 +3182,19 @@
show {
Row {
Container(
- modifier = LayoutGravity.RelativeToSiblings { it.height },
+ modifier = Modifier.alignWithSiblings { it.height },
width = size,
height = size,
children = emptyContent()
)
Container(
- modifier = LayoutGravity.RelativeToSiblings { 0.ipx } +
- LayoutGravity.RelativeToSiblings { it.height * 0.5 } +
- onPositioned { coordinates ->
- containerSize.value = coordinates.size
- containerPosition.value = coordinates.globalPosition
- positionedLatch.countDown()
- },
+ modifier = Modifier.alignWithSiblings { 0.ipx }
+ .alignWithSiblings { it.height * 0.5 }
+ .onPositioned { coordinates: LayoutCoordinates ->
+ containerSize.value = coordinates.size
+ containerPosition.value = coordinates.globalPosition
+ positionedLatch.countDown()
+ },
width = size,
height = size,
children = emptyContent()
@@ -3150,19 +3218,21 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
show {
- Row(LayoutWidth.Fill + LayoutDirectionModifier.Rtl) {
- Container(LayoutSize(sizeDp, sizeDp) + onPositioned { coordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Row(Modifier.fillMaxWidth().rtl) {
+ Container(
+ Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
Container(
- LayoutSize(sizeDp * 2, sizeDp * 2) + onPositioned { coordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Modifier.preferredSize(sizeDp * 2)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
}
@@ -3188,20 +3258,23 @@
val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
show {
Row(
- LayoutWidth.Fill + LayoutDirectionModifier.Rtl,
+ Modifier.fillMaxWidth().rtl,
arrangement = Arrangement.End
) {
- Container(LayoutSize(sizeDp, sizeDp) + onPositioned { coordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Container(
+ Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
- Container(LayoutSize(sizeDp * 2, sizeDp * 2) + onPositioned { coordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Container(
+ Modifier.preferredSize(sizeDp * 2)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
}
@@ -3221,20 +3294,23 @@
val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
show {
Row(
- LayoutWidth.Fill + LayoutDirectionModifier.Rtl,
+ Modifier.fillMaxWidth().rtl,
arrangement = customHorizontalArrangement
) {
- Container(width = sizeDp, height = sizeDp, modifier = onPositioned { coordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Container(
+ width = sizeDp,
+ height = sizeDp,
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
Container(
width = (sizeDp * 2),
height = (sizeDp * 2),
- modifier = onPositioned { coordinates ->
+ modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
}
@@ -3259,18 +3335,21 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
show {
- Column(LayoutWidth.Fill + LayoutDirectionModifier.Rtl) {
- Container(LayoutSize(sizeDp, sizeDp) + onPositioned { coordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Column(Modifier.fillMaxWidth().rtl) {
+ Container(
+ Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
- Container(LayoutSize(sizeDp * 2, sizeDp * 2) + onPositioned { coordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Container(
+ Modifier.preferredSize(sizeDp * 2)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
}
@@ -3296,9 +3375,11 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
show {
- Column(LayoutWidth.Fill + LayoutDirectionModifier.Rtl) {
- Container(LayoutSize(sizeDp, sizeDp) + LayoutGravity.End +
- onPositioned { coordinates ->
+ Column(Modifier.fillMaxWidth().rtl) {
+ Container(
+ Modifier.preferredSize(sizeDp)
+ .gravity(ColumnAlign.End)
+ .onPositioned { coordinates: LayoutCoordinates ->
childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
}
@@ -3306,11 +3387,12 @@
}
Container(
- LayoutSize(sizeDp * 2, sizeDp * 2) + LayoutGravity.End +
- onPositioned { coordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
+ Modifier.preferredSize(sizeDp * 2)
+ .gravity(ColumnAlign.End)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
) {
}
}
@@ -3330,19 +3412,21 @@
val drawLatch = CountDownLatch(2)
val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
show {
- Column(LayoutWidth.Fill + LayoutDirectionModifier.Rtl) {
- Container(LayoutSize(sizeDp, sizeDp) +
- LayoutGravity.RelativeToSiblings { it.width } +
- onPositioned { coordinates ->
+ Column(Modifier.fillMaxWidth().rtl) {
+ Container(
+ Modifier.preferredSize(sizeDp)
+ .alignWithSiblings { it.width }
+ .onPositioned { coordinates: LayoutCoordinates ->
childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
}
) {
}
- Container(LayoutSize(sizeDp, sizeDp) +
- LayoutGravity.RelativeToSiblings { it.width / 2 } +
- onPositioned { coordinates ->
+ Container(
+ Modifier.preferredSize(sizeDp)
+ .alignWithSiblings { it.width / 2 }
+ .onPositioned { coordinates: LayoutCoordinates ->
childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
drawLatch.countDown()
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacerTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacerTest.kt
index 8db4fa4..35d3b64 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacerTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SpacerTest.kt
@@ -17,13 +17,15 @@
package androidx.ui.layout.test
import androidx.test.filters.MediumTest
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.onPositioned
import androidx.ui.layout.DpConstraints
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -53,8 +55,9 @@
val drawLatch = CountDownLatch(1)
show {
Container(constraints = bigConstraints) {
- Spacer(LayoutSize(width = width, height = height) +
- onPositioned { position ->
+ Spacer(
+ Modifier.preferredSize(width = width, height = height)
+ .onPositioned { position: LayoutCoordinates ->
size = position.size
drawLatch.countDown()
}
@@ -86,8 +89,9 @@
maxHeight = containerHeight
)
) {
- Spacer(LayoutSize(width = width, height = height) +
- onPositioned { position ->
+ Spacer(
+ Modifier.preferredSize(width = width, height = height)
+ .onPositioned { position: LayoutCoordinates ->
size = position.size
drawLatch.countDown()
}
@@ -111,7 +115,7 @@
val drawLatch = CountDownLatch(1)
show {
Container(constraints = bigConstraints) {
- Spacer(LayoutWidth(width) + onPositioned { position ->
+ Spacer(Modifier.preferredWidth(width).onPositioned { position: LayoutCoordinates ->
size = position.size
drawLatch.countDown()
})
@@ -141,10 +145,11 @@
maxHeight = containerHeight
)
) {
- Spacer(LayoutWidth(width) + onPositioned { position ->
- size = position.size
- drawLatch.countDown()
- })
+ Spacer(Modifier.preferredWidth(width)
+ .onPositioned { position: LayoutCoordinates ->
+ size = position.size
+ drawLatch.countDown()
+ })
}
}
}
@@ -164,10 +169,11 @@
val drawLatch = CountDownLatch(1)
show {
Container(constraints = bigConstraints) {
- Spacer(LayoutHeight(height) + onPositioned { position ->
- size = position.size
- drawLatch.countDown()
- })
+ Spacer(Modifier.preferredHeight(height)
+ .onPositioned { position: LayoutCoordinates ->
+ size = position.size
+ drawLatch.countDown()
+ })
}
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
@@ -194,10 +200,11 @@
maxHeight = containerHeight
)
) {
- Spacer(LayoutHeight(height) + onPositioned { position ->
- size = position.size
- drawLatch.countDown()
- })
+ Spacer(Modifier.preferredHeight(height)
+ .onPositioned { position: LayoutCoordinates ->
+ size = position.size
+ drawLatch.countDown()
+ })
}
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
index bfeb645..955bbcb 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
@@ -19,17 +19,19 @@
import androidx.compose.Composable
import androidx.test.filters.SmallTest
import androidx.ui.core.Alignment
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.onPositioned
import androidx.ui.layout.Align
import androidx.ui.layout.DpConstraints
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutDirectionModifier
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.rtl
+import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxPosition
@@ -63,24 +65,25 @@
Align(alignment = Alignment.TopStart) {
Stack {
Container(
- LayoutGravity.BottomEnd + saveLayoutInfo(
- size = alignedChildSize,
- position = alignedChildPosition,
- positionedLatch = positionedLatch
- ) + onPositioned { coordinates ->
- stackSize.value = coordinates.size
- positionedLatch.countDown()
- }, width = sizeDp, height = sizeDp
+ Modifier.gravity(Alignment.BottomEnd)
+ .saveLayoutInfo(alignedChildSize, alignedChildPosition, positionedLatch)
+ .onPositioned { coordinates: LayoutCoordinates ->
+ stackSize.value = coordinates.size
+ positionedLatch.countDown()
+ },
+ width = sizeDp,
+ height = sizeDp
) {
}
Container(
- LayoutGravity.Stretch + LayoutPadding(10.dp) +
- saveLayoutInfo(
- size = positionedChildSize,
- position = positionedChildPosition,
- positionedLatch = positionedLatch
- )
+ Modifier.matchParent()
+ .padding(10.dp)
+ .saveLayoutInfo(
+ positionedChildSize,
+ positionedChildPosition,
+ positionedLatch
+ )
) {
}
}
@@ -108,28 +111,28 @@
val childPosition = arrayOf(Ref<PxPosition>(), Ref<PxPosition>())
show {
Align(alignment = Alignment.TopStart) {
- Stack(onPositioned { coordinates ->
+ Stack(Modifier.onPositioned { coordinates: LayoutCoordinates ->
stackSize.value = coordinates.size
positionedLatch.countDown()
}) {
Container(
- modifier = LayoutGravity.BottomEnd +
- saveLayoutInfo(
- size = childSize[0],
- position = childPosition[0],
- positionedLatch = positionedLatch
- ),
+ modifier = Modifier.gravity(Alignment.BottomEnd)
+ .saveLayoutInfo(
+ childSize[0],
+ childPosition[0],
+ positionedLatch
+ ),
width = sizeDp,
height = sizeDp
) {
}
Container(
- modifier = LayoutGravity.BottomEnd +
- saveLayoutInfo(
- size = childSize[1],
- position = childPosition[1],
- positionedLatch = positionedLatch
- ),
+ modifier = Modifier.gravity(Alignment.BottomEnd)
+ .saveLayoutInfo(
+ size = childSize[1],
+ position = childPosition[1],
+ positionedLatch = positionedLatch
+ ),
width = doubleSizeDp,
height = doubleSizeDp
) {
@@ -160,64 +163,48 @@
val childPosition = Array(5) { Ref<PxPosition>() }
show {
Align(alignment = Alignment.TopStart) {
- Stack(onPositioned { coordinates ->
+ Stack(Modifier.onPositioned { coordinates: LayoutCoordinates ->
stackSize.value = coordinates.size
positionedLatch.countDown()
}) {
- Container(LayoutGravity.Center + saveLayoutInfo(
- size = childSize[0],
- position = childPosition[0],
- positionedLatch = positionedLatch
- ), width = sizeDp, height = sizeDp
+ Container(
+ Modifier.gravity(Alignment.Center)
+ .saveLayoutInfo(
+ childSize[0],
+ childPosition[0],
+ positionedLatch
+ ),
+ width = sizeDp,
+ height = sizeDp
) {
}
Container(
- LayoutGravity.Stretch + LayoutPadding(
- start = insetDp,
- top = insetDp
- ) + saveLayoutInfo(
- size = childSize[1],
- position = childPosition[1],
- positionedLatch = positionedLatch
- ),
+ Modifier.matchParent()
+ .padding(start = insetDp, top = insetDp)
+ .saveLayoutInfo(childSize[1], childPosition[1], positionedLatch),
width = halfSizeDp,
height = halfSizeDp
) {
}
Container(
- LayoutGravity.Stretch + LayoutPadding(
- end = insetDp,
- bottom = insetDp
- ) + saveLayoutInfo(
- size = childSize[2],
- position = childPosition[2],
- positionedLatch = positionedLatch
- ),
+ Modifier.matchParent()
+ .padding(end = insetDp, bottom = insetDp)
+ .saveLayoutInfo(childSize[2], childPosition[2], positionedLatch),
width = halfSizeDp,
height = halfSizeDp
) {
}
Container(
- LayoutGravity.Stretch + LayoutPadding(
- start = insetDp,
- end = insetDp
- ) + saveLayoutInfo(
- size = childSize[3],
- position = childPosition[3],
- positionedLatch = positionedLatch
- ),
+ Modifier.matchParent()
+ .padding(start = insetDp, end = insetDp)
+ .saveLayoutInfo(childSize[3], childPosition[3], positionedLatch),
width = halfSizeDp,
height = halfSizeDp) {
}
Container(
- LayoutGravity.Stretch + LayoutPadding(
- top = insetDp,
- bottom = insetDp
- ) + saveLayoutInfo(
- size = childSize[4],
- position = childPosition[4],
- positionedLatch = positionedLatch
- ),
+ Modifier.matchParent()
+ .padding(top = insetDp, bottom = insetDp)
+ .saveLayoutInfo(childSize[4], childPosition[4], positionedLatch),
width = halfSizeDp,
height = halfSizeDp
) {
@@ -252,92 +239,67 @@
val childSize = Array(9) { Ref<IntPxSize>() }
val childPosition = Array(9) { Ref<PxPosition>() }
show {
- Stack(LayoutAlign.TopStart) {
- Stack(LayoutDirectionModifier.Rtl + LayoutSize(tripleSizeDp, tripleSizeDp) +
- onPositioned { coordinates ->
+ Stack(Modifier.wrapContentSize(Alignment.TopStart)) {
+ Stack(
+ Modifier.rtl
+ .preferredSize(tripleSizeDp)
+ .onPositioned { coordinates: LayoutCoordinates ->
stackSize.value = coordinates.size
positionedLatch.countDown()
}
) {
Stack(
- LayoutGravity.TopStart + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[0],
- position = childPosition[0],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.TopStart)
+ .preferredSize(sizeDp, sizeDp)
+ .saveLayoutInfo(childSize[0], childPosition[0], positionedLatch)
) {
}
Stack(
- LayoutGravity.TopCenter + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[1],
- position = childPosition[1],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.TopCenter)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[1], childPosition[1], positionedLatch)
) {
}
Stack(
- LayoutGravity.TopEnd + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[2],
- position = childPosition[2],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.TopEnd)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[2], childPosition[2], positionedLatch)
) {
}
Stack(
- LayoutGravity.CenterStart + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[3],
- position = childPosition[3],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.CenterStart)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[3], childPosition[3], positionedLatch)
) {
}
Stack(
- LayoutGravity.Center + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[4],
- position = childPosition[4],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.Center)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[4], childPosition[4], positionedLatch)
) {
}
Stack(
- LayoutGravity.CenterEnd + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[5],
- position = childPosition[5],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.CenterEnd)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[5], childPosition[5], positionedLatch)
) {
}
Stack(
- LayoutGravity.BottomStart + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[6],
- position = childPosition[6],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.BottomStart)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[6], childPosition[6], positionedLatch)
) {
}
Stack(
- LayoutGravity.BottomCenter + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[7],
- position = childPosition[7],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.BottomCenter)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[7], childPosition[7], positionedLatch)
) {
}
Stack(
- LayoutGravity.BottomEnd + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[8],
- position = childPosition[8],
- positionedLatch = positionedLatch
- )
+ Modifier.gravity(Alignment.BottomEnd)
+ .preferredSize(sizeDp)
+ .saveLayoutInfo(childSize[8], childPosition[8], positionedLatch)
) {
}
}
@@ -370,25 +332,23 @@
val childPosition = Array(2) { Ref<PxPosition>() }
show {
Align(alignment = Alignment.TopStart) {
- Container(LayoutSize(sizeDp, sizeDp) + onPositioned { coordinates ->
+ Container(
+ Modifier.preferredSize(
+ sizeDp,
+ sizeDp
+ ) + Modifier.onPositioned { coordinates: LayoutCoordinates ->
stackSize.value = coordinates.size
positionedLatch.countDown()
}) {
Stack {
- Container(LayoutSize.Fill +
- saveLayoutInfo(
- size = childSize[0],
- position = childPosition[0],
- positionedLatch = positionedLatch
- )
+ Container(
+ Modifier.fillMaxSize()
+ .saveLayoutInfo(childSize[0], childPosition[0], positionedLatch)
) {
}
Container(
- LayoutGravity.BottomEnd + saveLayoutInfo(
- size = childSize[1],
- position = childPosition[1],
- positionedLatch = positionedLatch
- ),
+ Modifier.gravity(Alignment.BottomEnd)
+ .saveLayoutInfo(childSize[1], childPosition[1], positionedLatch),
width = halfSizeDp,
height = halfSizeDp
) {
@@ -419,14 +379,14 @@
testIntrinsics(@Composable {
Stack {
- Container(LayoutGravity.TopStart + LayoutAspectRatio(2f)) { }
+ Container(Modifier.gravity(Alignment.TopStart).aspectRatio(2f)) { }
ConstrainedBox(
DpConstraints.fixed(testWidth, testHeight),
- LayoutGravity.BottomCenter
+ Modifier.gravity(Alignment.BottomCenter)
) { }
ConstrainedBox(
DpConstraints.fixed(200.dp, 200.dp),
- LayoutGravity.Stretch + LayoutPadding(10.dp)
+ Modifier.matchParent().padding(10.dp)
) { }
}
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -454,7 +414,7 @@
testIntrinsics(@Composable {
Stack {
ConstrainedBox(
- modifier = LayoutGravity.Stretch + LayoutPadding(10.dp),
+ modifier = Modifier.matchParent().padding(10.dp),
constraints = DpConstraints.fixed(200.dp, 200.dp)
) { }
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/TableTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/TableTest.kt
index ad1e449..e87053f 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/TableTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/TableTest.kt
@@ -19,14 +19,16 @@
import androidx.compose.Composable
import androidx.test.filters.SmallTest
import androidx.ui.core.Alignment
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.onChildPositioned
import androidx.ui.layout.Align
import androidx.ui.layout.DpConstraints
-import androidx.ui.layout.LayoutAspectRatio
import androidx.ui.layout.Table
import androidx.ui.layout.TableColumnWidth
import androidx.ui.layout.TableMeasurable
+import androidx.ui.layout.aspectRatio
import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
@@ -65,7 +67,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -76,10 +78,10 @@
for (j in 0 until columns) {
Container(
height = sizeDp, expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -132,7 +134,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -144,10 +146,10 @@
tableRow {
for (j in 0 until columns) {
Container(height = sizeDp, expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -193,19 +195,22 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(columns = columns, columnWidth = { TableColumnWidth.Wrap }) {
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -257,7 +262,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -269,10 +274,10 @@
tableRow {
for (j in 0 until columns) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -322,10 +327,13 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(
columns = columns,
columnWidth = { TableColumnWidth.MinIntrinsic }
@@ -334,10 +342,10 @@
tableRow {
for (j in 0 until columns) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -382,10 +390,13 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(
columns = columns,
columnWidth = { TableColumnWidth.MaxIntrinsic }
@@ -394,10 +405,10 @@
tableRow {
for (j in 0 until columns) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -442,10 +453,13 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(
columns = columns,
columnWidth = { TableColumnWidth.Fixed(width = sizeDp) }
@@ -454,10 +468,10 @@
tableRow {
for (j in 0 until columns) {
Container(height = sizeDp, expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -508,7 +522,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -520,10 +534,10 @@
tableRow {
for (j in 0 until columns) {
Container(height = sizeDp, expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -575,7 +589,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -592,10 +606,10 @@
tableRow {
for (j in 0 until columns) {
Container(height = sizeDp, expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -651,7 +665,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -668,10 +682,10 @@
tableRow {
for (j in 0 until columns) {
Container(height = sizeDp, expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -723,10 +737,13 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(columns = columns, columnWidth = {
TableColumnWidth.Min(
a = TableColumnWidth.Wrap,
@@ -737,10 +754,10 @@
tableRow {
for (j in 0 until columns) {
Container(width = halfSizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -787,10 +804,13 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(columns = columns, columnWidth = {
TableColumnWidth.Max(
a = TableColumnWidth.Wrap,
@@ -801,10 +821,10 @@
tableRow {
for (j in 0 until columns) {
Container(width = halfSizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -849,10 +869,13 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(columns = columns, columnWidth = {
TableColumnWidth.Min(TableColumnWidth.Wrap, TableColumnWidth.Wrap)
}) {
@@ -860,10 +883,10 @@
tableRow {
for (j in 0 until columns) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -908,10 +931,13 @@
val positionedLatch = CountDownLatch(rows * columns + 1)
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(columns = columns, columnWidth = {
TableColumnWidth.Max(TableColumnWidth.Wrap, TableColumnWidth.Wrap)
}) {
@@ -919,10 +945,10 @@
tableRow {
for (j in 0 until columns) {
Container(width = sizeDp, height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -979,10 +1005,13 @@
}
show {
- Align(Alignment.TopStart, modifier = onChildPositioned { coordinates ->
- tableSize.value = coordinates.size
- positionedLatch.countDown()
- }) {
+ Align(
+ Alignment.TopStart,
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
+ tableSize.value = coordinates.size
+ positionedLatch.countDown()
+ }
+ ) {
Table(columns = columns, columnWidth = { customSpec }) {
for (i in 0 until rows) {
tableRow {
@@ -990,10 +1019,10 @@
Container(
width = if (i == 0) sizeDp else halfSizeDp,
height = sizeDp,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -1044,7 +1073,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1056,10 +1085,10 @@
Container(
height = if (j % 2 == 0) sizeDp else halfSizeDp,
expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -1111,7 +1140,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
positionedLatch.countDown()
}
@@ -1132,10 +1161,10 @@
width = if (j == 0) halfSizeDp else null,
height = sizeDp,
expanded = j != 0,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = positionedLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ positionedLatch
)
) {
}
@@ -1225,7 +1254,7 @@
show {
Align(Alignment.TopStart) {
ConstrainedBox(constraints = DpConstraints(maxWidth = tableWidthDp),
- modifier = onChildPositioned { coordinates ->
+ modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
tableSize.value = coordinates.size
tableLatch.countDown()
}
@@ -1234,7 +1263,7 @@
for (i in 0 until decorations) {
tableDecoration(overlay = true) {
Container(
- saveLayoutInfo(
+ Modifier.saveLayoutInfo(
size = decorationSize[i],
position = decorationPosition[i],
positionedLatch = decorationsLatch
@@ -1247,10 +1276,10 @@
tableRow {
for (j in 0 until columns) {
Container(height = sizeDp, expanded = true,
- modifier = saveLayoutInfo(
- size = childSize[i][j],
- position = childPosition[i][j],
- positionedLatch = itemsLatch
+ modifier = Modifier.saveLayoutInfo(
+ childSize[i][j],
+ childPosition[i][j],
+ itemsLatch
)
) {
}
@@ -1310,7 +1339,7 @@
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}
}
@@ -1355,7 +1384,7 @@
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}
}
@@ -1400,7 +1429,7 @@
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}
}
@@ -1445,7 +1474,7 @@
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}
}
@@ -1490,7 +1519,7 @@
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}
}
@@ -1537,7 +1566,7 @@
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}
}
@@ -1582,7 +1611,7 @@
for (i in 0 until rows) {
tableRow {
for (j in 0 until columns) {
- Container(LayoutAspectRatio(2f)) { }
+ Container(Modifier.aspectRatio(2f)) { }
}
}
}
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Column.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Column.kt
index f937b9a..b645166 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Column.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Column.kt
@@ -71,6 +71,29 @@
children = { ColumnScope.children() }
)
}
+
+/**
+ * Horizontal alignments for use with [ColumnScope.gravity].
+ *
+ * TODO: Unify with other alignment API
+ */
+enum class ColumnAlign {
+ /**
+ * Position the element along the starting edge of the [Column]. The start edge is determined
+ * as either left or right by the column's layout direction.
+ */
+ Start,
+ /**
+ * Center the element horizontally within the [Column].
+ */
+ Center,
+ /**
+ * Position the element along the ending edge of the [Column]. The end edge is determined as
+ * either left or right by the column's layout direction.
+ */
+ End
+}
+
/**
* Scope for the children of [Column].
*/
@@ -81,21 +104,54 @@
* A layout modifier within a [Column] that positions its target component horizontally
* such that its start edge is aligned to the start edge of the [Column].
*/
+ @Deprecated(
+ "Use Modifier.gravity(ColumnAlign.Start)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(ColumnAlign.Start)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ColumnAlign"
+ )
+ )
val LayoutGravity.Start: ParentDataModifier get() = StartGravityModifier
/**
* A layout modifier within a [Column] that positions its target component horizontally
* such that its center is in the middle of the [Column].
*/
+ @Deprecated(
+ "Use Modifier.gravity(ColumnAlign.Center)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(ColumnAlign.Center)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ColumnAlign"
+ )
+ )
val LayoutGravity.Center: ParentDataModifier get() = CenterGravityModifier
/**
* A layout modifier within a [Column] that positions its target component horizontally
* such that its end edge is aligned to the end edge of the [Column].
*/
+ @Deprecated(
+ "Use Modifier.gravity(ColumnAlign.End)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(ColumnAlign.End)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ColumnAlign"
+ )
+ )
val LayoutGravity.End: ParentDataModifier get() = EndGravityModifier
/**
+ * Position the element horizontally within the [Column] according to [align].
+ */
+ fun Modifier.gravity(align: ColumnAlign) = this + when (align) {
+ ColumnAlign.Start -> StartGravityModifier
+ ColumnAlign.Center -> CenterGravityModifier
+ ColumnAlign.End -> EndGravityModifier
+ }
+
+ /**
* A layout modifier within a [Column] that positions its target component horizontally
* according to the specified [VerticalAlignmentLine], such that the position of the alignment
* line coincides vertically with the alignment lines of all other siblings having their gravity
@@ -112,10 +168,27 @@
* Example usage:
* @sample androidx.ui.layout.samples.SimpleRelativeToSiblingsInColumn
*/
+ @Deprecated(
+ "Use Modifier.alignWithSiblings",
+ replaceWith = ReplaceWith(
+ "Modifier.alignWithSiblings(alignmentLine)",
+ "androidx.ui.core.Modifier"
+ )
+ )
fun LayoutGravity.RelativeToSiblings(alignmentLine: VerticalAlignmentLine): ParentDataModifier =
SiblingsAlignedModifier.WithAlignmentLine(alignmentLine)
/**
+ * Position the element horizontally such that its [alignmentLine] aligns with sibling elements
+ * also configured to [alignWithSiblings] with the same [alignmentLine].
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleRelativeToSiblingsInColumn
+ */
+ fun Modifier.alignWithSiblings(alignmentLine: VerticalAlignmentLine) =
+ this + SiblingsAlignedModifier.WithAlignmentLine(alignmentLine)
+
+ /**
* A scoped modifier within a [Column] that sets the vertical weight of the layout.
* A [Column] child that has a weight will be assigned a space proportional to its weight,
* relative to the other siblings that have weights. This will be calculated by dividing
@@ -131,6 +204,13 @@
*
* @sample androidx.ui.layout.samples.SimpleColumn
*/
+ @Deprecated(
+ "Use Modifier.weight",
+ replaceWith = ReplaceWith(
+ "Modifier.weight(weight, fill)",
+ "androidx.ui.core.Modifier"
+ )
+ )
fun LayoutWeight(
@FloatRange(from = 0.0, fromInclusive = false) weight: Float,
fill: Boolean = true
@@ -140,6 +220,21 @@
}
/**
+ * Size the element's height proportional to its [weight] relative to other weighted sibling
+ * elements in the [Column]. The parent will divide the vertical space remaining after measuring
+ * unweighted child elements and distribute it according to this weight.
+ *
+ * @sample androidx.ui.layout.samples.SimpleColumn
+ */
+ fun Modifier.weight(
+ @FloatRange(from = 0.0, fromInclusive = false) weight: Float,
+ fill: Boolean = true
+ ): Modifier {
+ require(weight > 0.0) { "invalid weight $weight; must be greater than zero" }
+ return this + LayoutWeightImpl(weight, fill)
+ }
+
+ /**
* A layout modifier within a [Column] that positions its target component relative
* to all other elements within the container which have [LayoutGravity.RelativeToSiblings].
* The [alignmentLineBlock] accepts the [Placeable] of the targeted layout and returns the
@@ -156,10 +251,29 @@
* Example usage:
* @sample androidx.ui.layout.samples.SimpleRelativeToSiblings
*/
+ @Deprecated(
+ "Use Modifier.alignWithSiblings",
+ replaceWith = ReplaceWith(
+ "Modifier.alignWithSiblings(alignmentLineBlock)",
+ "androidx.ui.core.Modifier"
+ )
+ )
@Suppress("unused")
fun LayoutGravity.RelativeToSiblings(
alignmentLineBlock: (Placeable) -> IntPx
): ParentDataModifier = SiblingsAlignedModifier.WithAlignmentLineBlock(alignmentLineBlock)
+
+ /**
+ * Position the element horizontally such that the alignment line for the content as
+ * determined by [alignmentLineBlock] aligns with sibling elements also configured to
+ * [alignWithSiblings] with an [alignmentLineBlock].
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleRelativeToSiblings
+ */
+ fun Modifier.alignWithSiblings(
+ alignmentLineBlock: (Placeable) -> IntPx
+ ) = this + SiblingsAlignedModifier.WithAlignmentLineBlock(alignmentLineBlock)
}
private val StartGravityModifier = GravityModifier(CrossAxisAlignment.Start)
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/ConstraintLayout.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/ConstraintLayout.kt
index b560d12..97062b5 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/ConstraintLayout.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/ConstraintLayout.kt
@@ -35,6 +35,7 @@
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
import androidx.ui.core.Measurable
+import androidx.ui.core.Modifier
import androidx.ui.core.ParentDataModifier
import androidx.ui.core.Placeable
import androidx.ui.core.Placeable.PlacementScope.place
@@ -52,9 +53,13 @@
* Layout that positions its children according to the constraints between them.
*/
@Composable
-fun ConstraintLayout(constraintSet: ConstraintSet, children: @Composable() () -> Unit) {
+fun ConstraintLayout(
+ constraintSet: ConstraintSet,
+ modifier: Modifier = Modifier.None,
+ children: @Composable() () -> Unit
+) {
val measurer = remember { Measurer() }
- Layout(children) { measurables, constraints, _ ->
+ Layout(children, modifier) { measurables, constraints, _ ->
val layoutSize = measurer.performMeasure(
constraints,
constraintSet,
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAlign.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAlign.kt
index 781b2f4..0bcb639 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAlign.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAlign.kt
@@ -139,6 +139,15 @@
* A layout modifier that positions the target component inside its parent to the top in
* vertical direction and wraps the component in horizontal direction.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentHeight(Alignment.TopCenter)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentHeight(Alignment.TopCenter)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentHeight"
+ )
+ )
val Top: LayoutModifier =
AlignmentModifier(alignment = Alignment.TopStart, direction = Direction.Vertical)
@@ -146,6 +155,15 @@
* A layout modifier that positions the target component in the center of the parent in
* vertical direction and wraps the component in horizontal direction.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentHeight(Alignment.Center)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentHeight(Alignment.Center)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentHeight"
+ )
+ )
val CenterVertically: LayoutModifier =
AlignmentModifier(alignment = Alignment.CenterStart, direction = Direction.Vertical)
@@ -153,6 +171,15 @@
* A layout modifier that positions the target component inside its parent to the bottom in
* vertical direction and wraps the component in horizontal direction.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentHeight(Alignment.BottomCenter)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentHeight(Alignment.BottomCenter)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentHeight"
+ )
+ )
val Bottom: LayoutModifier =
AlignmentModifier(alignment = Alignment.BottomStart, direction = Direction.Vertical)
@@ -160,6 +187,15 @@
* A layout modifier that positions the target component inside its parent to the start edge
* in horizontal direction and wraps the component in vertical direction.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentWidth(Alignment.CenterStart)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentWidth(Alignment.CenterStart)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentWidth"
+ )
+ )
val Start: LayoutModifier =
AlignmentModifier(alignment = Alignment.TopStart, direction = Direction.Horizontal)
@@ -167,6 +203,15 @@
* A layout modifier that positions the target component in the center of the parent in
* horizontal direction and wraps the component in vertical direction.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentWidth(Alignment.Center)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentWidth(Alignment.Center)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentWidth"
+ )
+ )
val CenterHorizontally: LayoutModifier =
AlignmentModifier(alignment = Alignment.TopCenter, direction = Direction.Horizontal)
@@ -174,60 +219,150 @@
* A layout modifier that positions the target component inside its parent to the end edge
* in horizontal direction and wraps the component in vertical direction.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentWidth(Alignment.CenterEnd)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentWidth(Alignment.CenterEnd)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentWidth"
+ )
+ )
val End: LayoutModifier =
AlignmentModifier(alignment = Alignment.TopEnd, direction = Direction.Horizontal)
/**
* A layout modifier that positions the target component top-left inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.TopStart)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.TopStart)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val TopStart: LayoutModifier =
AlignmentModifier(alignment = Alignment.TopStart, direction = Direction.Both)
/**
* A layout modifier that positions the target component top-center inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.TopCenter)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.TopCenter)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val TopCenter: LayoutModifier =
AlignmentModifier(alignment = Alignment.TopCenter, direction = Direction.Both)
/**
* A layout modifier that positions the target component top-right inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.TopEnd)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.TopEnd)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val TopEnd: LayoutModifier =
AlignmentModifier(alignment = Alignment.TopEnd, direction = Direction.Both)
/**
* A layout modifier that positions the target component center-left inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.CenterStart)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.CenterStart)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val CenterStart: LayoutModifier =
AlignmentModifier(alignment = Alignment.CenterStart, direction = Direction.Both)
/**
* A layout modifier that positions the target component in the center of its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.Center)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.Center)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val Center: LayoutModifier =
AlignmentModifier(alignment = Alignment.Center, direction = Direction.Both)
/**
* A layout modifier that positions the target component center-right inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.CenterEnd)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.CenterEnd)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val CenterEnd: LayoutModifier =
AlignmentModifier(alignment = Alignment.CenterEnd, direction = Direction.Both)
/**
* A layout modifier that positions the target component bottom-left inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.BottomStart)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.BottomStart)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val BottomStart: LayoutModifier =
AlignmentModifier(alignment = Alignment.BottomStart, direction = Direction.Both)
/**
* A layout modifier that positions the target component bottom-center inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.BottomCenter)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.BottomCenter)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val BottomCenter: LayoutModifier =
AlignmentModifier(alignment = Alignment.BottomCenter, direction = Direction.Both)
/**
* A layout modifier that positions the target component bottom-right inside its parent.
*/
+ @Deprecated(
+ "Use Modifier.wrapContentSize(Alignment.BottomEnd)",
+ replaceWith = ReplaceWith(
+ "Modifier.wrapContentSize(Alignment.BottomEnd)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment",
+ "androidx.ui.layout.wrapContentSize"
+ )
+ )
val BottomEnd: LayoutModifier =
AlignmentModifier(alignment = Alignment.BottomEnd, direction = Direction.Both)
}
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAspectRatio.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAspectRatio.kt
index 532f6b8..ceec828 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAspectRatio.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutAspectRatio.kt
@@ -21,14 +21,29 @@
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
import androidx.ui.core.Measurable
-import androidx.ui.unit.Density
+import androidx.ui.core.Modifier
import androidx.ui.core.satisfiedBy
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.ipx
import androidx.ui.unit.isFinite
/**
+ * Attempts to size the content to match a specified aspect ratio by trying to match one of the
+ * incoming constraints in the following order:
+ * [Constraints.maxWidth], [Constraints.maxHeight], [Constraints.minWidth], [Constraints.minHeight].
+ * The size in the other dimension is determined by the aspect ratio.
+ *
+ * @param ratio the desired width/height ratio
+ */
+@Suppress("DEPRECATION")
+fun Modifier.aspectRatio(
+ @FloatRange(from = 0.0, fromInclusive = false)
+ ratio: Float
+) = this + LayoutAspectRatio(ratio)
+
+/**
* A layout modifier that attempts to size a layout to match a specified aspect ratio. The layout
* modifier will try to match one of the incoming constraints, in the following order: maxWidth,
* maxHeight, minWidth, minHeight. The size in the other dimension will then be computed
@@ -46,7 +61,16 @@
*
* @param aspectRatio A positive non-zero value representing the aspect ratio.
*/
-data class LayoutAspectRatio(
+data class LayoutAspectRatio
+@Deprecated(
+ "Use Modifier.aspectRatio",
+ replaceWith = ReplaceWith(
+ "Modifier.aspectRatio(aspectRatio)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.aspectRatio"
+ )
+)
+constructor(
@FloatRange(from = 0.0, fromInclusive = false)
val aspectRatio: Float
) : LayoutModifier {
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutDirections.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutDirections.kt
index 551a4c4..9b190af 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutDirections.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutDirections.kt
@@ -18,13 +18,43 @@
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
+import androidx.ui.core.Modifier
import androidx.ui.unit.Density
/**
+ * Changes the [LayoutDirection] of the content to [LayoutDirection.Ltr].
+ */
+@Suppress("DEPRECATION")
+val Modifier.ltr: Modifier get() = this + LayoutDirectionModifier.Ltr
+
+/**
+ * Changes the [LayoutDirection] of the content to [LayoutDirection.Rtl].
+ */
+@Suppress("DEPRECATION")
+val Modifier.rtl: Modifier get() = this + LayoutDirectionModifier.Rtl
+
+/**
* A layout modifier that changes the layout direction of the corresponding layout node.
*/
object LayoutDirectionModifier {
+ @Deprecated(
+ "Use Modifier.ltr",
+ replaceWith = ReplaceWith(
+ "Modifier.ltr",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ltr"
+ )
+ )
val Ltr: LayoutModifier = LayoutDirectionModifierImpl(LayoutDirection.Ltr)
+
+ @Deprecated(
+ "Use Modifier.rtl",
+ replaceWith = ReplaceWith(
+ "Modifier.rtl",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ltr"
+ )
+ )
val Rtl: LayoutModifier = LayoutDirectionModifierImpl(LayoutDirection.Rtl)
}
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt
index 5c0d0f1..15e17a7 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt
@@ -18,12 +18,22 @@
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
+import androidx.ui.core.Modifier
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
/**
+ * Offset the content by ([x]dp, [y]dp).
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.LayoutOffsetModifier
+ */
+@Suppress("DEPRECATION")
+fun Modifier.offset(x: Dp, y: Dp) = this + LayoutOffset(x = x, y = y)
+
+/**
* A [LayoutModifier] that offsets the position of the wrapped layout with the given
* horizontal and vertical offsets. The offsets can be positive as well as non positive.
* If the position of the wrapped layout on screen is (posx, posy) and the offsets are [x] and [y],
@@ -40,7 +50,16 @@
* @param x The horizontal offset added to the position of the wrapped layout
* @param y The vertical offset added to the position of the wrapped layout
*/
-data class LayoutOffset(val x: Dp, val y: Dp) : LayoutModifier {
+data class LayoutOffset
+@Deprecated(
+ "Use Modifier.offset",
+ replaceWith = ReplaceWith(
+ "Modifier.offset(x, y)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.offset"
+ )
+)
+constructor(val x: Dp, val y: Dp) : LayoutModifier {
override fun Density.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize,
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutPadding.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutPadding.kt
index cc53490..2198e1d 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutPadding.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutPadding.kt
@@ -20,14 +20,64 @@
import androidx.ui.core.Constraints
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
-import androidx.ui.unit.Density
+import androidx.ui.core.Modifier
import androidx.ui.core.offset
+import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.dp
/**
+ * Apply additional space along each edge of the content in [Dp]: [start], [top], [end] and
+ * [bottom]. The start and end edges will be determined by the current [LayoutDirection].
+ * Padding is applied before content measurement and takes precedence; content may only be as large
+ * as the remaining space.
+ *
+ * Negative padding is not permitted. See [offset].
+ */
+@Suppress("DEPRECATION")
+fun Modifier.padding(
+ start: Dp = 0.dp,
+ top: Dp = 0.dp,
+ end: Dp = 0.dp,
+ bottom: Dp = 0.dp
+) = this + LayoutPadding(
+ start = start,
+ top = top,
+ end = end,
+ bottom = bottom
+)
+
+/**
+ * Apply [all]dp of additional space along each edge of the content, left, top, right and bottom.
+ * Padding is applied before content measurement and takes precedence; content may only be as large
+ * as the remaining space.
+ */
+fun Modifier.padding(all: Dp) = padding(start = all, top = all, end = all, bottom = all)
+
+/**
+ * Apply additional space along each edge of the content in [Dp]: [left], [top], [right] and
+ * [bottom]. These paddings are applied without regard to the current [LayoutDirection], see
+ * [padding] to apply relative paddings. Padding is applied before content measurement and takes
+ * precedence; content may only be as large as the remaining space.
+ *
+ * Negative padding is not permitted. See [offset].
+ */
+@Suppress("DEPRECATION")
+fun Modifier.absolutePadding(
+ left: Dp = 0.dp,
+ top: Dp = 0.dp,
+ right: Dp = 0.dp,
+ bottom: Dp = 0.dp
+) = this + LayoutPaddingAbsolute(
+ left = left,
+ top = top,
+ right = right,
+ bottom = bottom
+)
+
+/**
* Layout modifier that applies the same padding of [all] dp on each side of the wrapped layout.
* The requested padding will be subtracted from the available space before the wrapped layout has
* the chance to choose its own size, so conceptually the padding has higher priority to occupy
@@ -42,6 +92,15 @@
*
* @see LayoutOffset
*/
+@Suppress("DEPRECATION")
+@Deprecated(
+ "Use Modifier.padding",
+ replaceWith = ReplaceWith(
+ "Modifier.padding(all)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.padding"
+ )
+)
fun LayoutPadding(all: Dp): LayoutPadding = LayoutPadding(
start = all,
top = all,
@@ -64,7 +123,16 @@
*
* @see LayoutOffset
*/
-data class LayoutPadding(
+data class LayoutPadding
+@Deprecated(
+ "Use Modifier.padding",
+ replaceWith = ReplaceWith(
+ "Modifier.padding(start, top, end, bottom)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.padding"
+ )
+)
+constructor(
val start: Dp = 0.dp,
val top: Dp = 0.dp,
val end: Dp = 0.dp,
@@ -72,9 +140,8 @@
) : LayoutModifier {
init {
require(
- start.value >= 0f && top.value >= 0f && end.value >= 0f && bottom.value >= 0f,
- PaddingMustBeNonNegative
- )
+ start.value >= 0f && top.value >= 0f && end.value >= 0f && bottom.value >= 0f
+ ) { "Padding must be non-negative" }
}
override fun Density.modifyConstraints(
@@ -105,10 +172,70 @@
} else {
IntPxPosition(end.toIntPx(), top.toIntPx())
}
+}
- internal companion object {
- val PaddingMustBeNonNegative = { "Padding must be non-negative" }
+/**
+ * A [LayoutModifier] that adds [left], [top], [right] and [bottom] padding to the wrapped layout
+ * without regard for layout direction.
+ * The requested padding will be subtracted from the available space before the wrapped layout has
+ * the chance to choose its own size, so conceptually the padding has higher priority to occupy
+ * the available space than the content.
+ * If you only need to modify the position of the wrapped layout without affecting its size
+ * as described above, you should use the [LayoutOffset] modifier instead.
+ * Also note that padding must be non-negative. If you consider using negative (or positive)
+ * padding to offset the wrapped layout, [LayoutOffset] should be used.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.LayoutPaddingModifier
+ *
+ * @see LayoutOffset
+ * @see LayoutPadding
+ */
+data class LayoutPaddingAbsolute
+@Deprecated(
+ "Use Modifier.absolutePadding",
+ replaceWith = ReplaceWith(
+ "Modifier.absolutePadding(left, top, right, bottom)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.absolutePadding"
+ )
+)
+constructor(
+ val left: Dp = 0.dp,
+ val top: Dp = 0.dp,
+ val right: Dp = 0.dp,
+ val bottom: Dp = 0.dp
+) : LayoutModifier {
+ init {
+ require(
+ left.value >= 0f && top.value >= 0f && right.value >= 0f && bottom.value >= 0f
+ ) { "Padding must be non-negative" }
}
+
+ override fun Density.modifyConstraints(
+ constraints: Constraints,
+ layoutDirection: LayoutDirection
+ ) = constraints.offset(
+ horizontal = -left.toIntPx() - right.toIntPx(),
+ vertical = -top.toIntPx() - bottom.toIntPx()
+ )
+
+ override fun Density.modifySize(
+ constraints: Constraints,
+ layoutDirection: LayoutDirection,
+ childSize: IntPxSize
+ ) = IntPxSize(
+ (left.toIntPx() + childSize.width + right.toIntPx())
+ .coerceIn(constraints.minWidth, constraints.maxWidth),
+ (top.toIntPx() + childSize.height + bottom.toIntPx())
+ .coerceIn(constraints.minHeight, constraints.maxHeight)
+ )
+
+ override fun Density.modifyPosition(
+ childSize: IntPxSize,
+ containerSize: IntPxSize,
+ layoutDirection: LayoutDirection
+ ): IntPxPosition = IntPxPosition(left.toIntPx(), top.toIntPx())
}
/**
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutSize.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutSize.kt
index 0b52878..e2fa8e3 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutSize.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutSize.kt
@@ -17,18 +17,216 @@
package androidx.ui.layout
import androidx.compose.Stable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Alignment.BottomCenter
+import androidx.ui.core.Alignment.BottomEnd
+import androidx.ui.core.Alignment.BottomStart
+import androidx.ui.core.Alignment.Center
+import androidx.ui.core.Alignment.CenterEnd
+import androidx.ui.core.Alignment.CenterStart
+import androidx.ui.core.Alignment.TopCenter
+import androidx.ui.core.Alignment.TopEnd
+import androidx.ui.core.Alignment.TopStart
import androidx.ui.core.Constraints
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
import androidx.ui.core.Measurable
-import androidx.ui.unit.Density
+import androidx.ui.core.Modifier
import androidx.ui.core.enforce
import androidx.ui.core.hasBoundedHeight
import androidx.ui.core.hasBoundedWidth
+import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
+import androidx.ui.unit.dp
import androidx.ui.unit.isFinite
+/**
+ * Declare the preferred width of the content to be exactly [width]dp. The incoming measurement
+ * [Constraints] may override this value, forcing the content to be either smaller or larger.
+ *
+ * See [preferredHeight] or [preferredSize] to set other preferred dimensions.
+ * See [preferredWidthIn], [preferredHeightIn] or [preferredSizeIn] to set a preferred size range.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleWidthModifier
+ */
+fun Modifier.preferredWidth(width: Dp) = preferredSizeIn(minWidth = width, maxWidth = width)
+
+/**
+ * Declare the preferred height of the content to be exactly [height]dp. The incoming measurement
+ * [Constraints] may override this value, forcing the content to be either smaller or larger.
+ *
+ * See [preferredWidth] or [preferredSize] to set other preferred dimensions.
+ * See [preferredWidthIn], [preferredHeightIn] or [preferredSizeIn] to set a preferred size range.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleHeightModifier
+ */
+fun Modifier.preferredHeight(height: Dp) = preferredSizeIn(minHeight = height, maxHeight = height)
+
+/**
+ * Declare the preferred size of the content to be exactly [size]dp square. The incoming measurement
+ * [Constraints] may override this value, forcing the content to be either smaller or larger.
+ *
+ * See [preferredWidth] or [preferredHeight] to set width or height alone.
+ * See [preferredWidthIn], [preferredHeightIn] or [preferredSizeIn] to set a preferred size range.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleSizeModifier
+ */
+fun Modifier.preferredSize(size: Dp) = preferredSizeIn(size, size, size, size)
+
+/**
+ * Declare the preferred size of the content to be exactly [width]dp by [height]dp. The incoming
+ * measurement [Constraints] may override this value, forcing the content to be either smaller or
+ * larger.
+ *
+ * See [preferredWidth] or [preferredHeight] to set width or height alone.
+ * See [preferredWidthIn], [preferredHeightIn] or [preferredSizeIn] to set a preferred size range.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleSizeModifier
+ */
+fun Modifier.preferredSize(width: Dp, height: Dp) = preferredSizeIn(
+ minWidth = width,
+ maxWidth = width,
+ minHeight = height,
+ maxHeight = height
+)
+
+/**
+ * Constrain the width of the content to be between [minWidth]dp and [maxWidth]dp as permitted
+ * by the incoming measurement [Constraints]. If the incoming constraints are more restrictive
+ * the requested size will obey the incoming constraints and attempt to be as close as possible
+ * to the preferred size.
+ */
+fun Modifier.preferredWidthIn(
+ minWidth: Dp = Dp.Unspecified,
+ maxWidth: Dp = Dp.Unspecified
+) = preferredSizeIn(minWidth = minWidth, maxWidth = maxWidth)
+
+/**
+ * Constrain the height of the content to be between [minHeight]dp and [maxHeight]dp as permitted
+ * by the incoming measurement [Constraints]. If the incoming constraints are more restrictive
+ * the requested size will obey the incoming constraints and attempt to be as close as possible
+ * to the preferred size.
+ */
+fun Modifier.preferredHeightIn(
+ minHeight: Dp = Dp.Unspecified,
+ maxHeight: Dp = Dp.Unspecified
+) = preferredSizeIn(minHeight = minHeight, maxHeight = maxHeight)
+
+/**
+ * Constrain the width of the content to be between [minWidth]dp and [maxWidth]dp and the height
+ * of the content to be between [minHeight] and [maxHeight] as permitted by the incoming
+ * measurement [Constraints]. If the incoming constraints are more restrictive the requested size
+ * will obey the incoming constraints and attempt to be as close as possible to the preferred size.
+ */
+fun Modifier.preferredSizeIn(
+ minWidth: Dp = Dp.Unspecified,
+ minHeight: Dp = Dp.Unspecified,
+ maxWidth: Dp = Dp.Unspecified,
+ maxHeight: Dp = Dp.Unspecified
+) = preferredSizeIn(
+ DpConstraints(
+ minWidth = if (minWidth != Dp.Unspecified) minWidth else 0.dp,
+ minHeight = if (minHeight != Dp.Unspecified) minHeight else 0.dp,
+ maxWidth = if (maxWidth != Dp.Unspecified) maxWidth else Dp.Infinity,
+ maxHeight = if (maxHeight != Dp.Unspecified) maxHeight else Dp.Infinity
+ )
+)
+
+/**
+ * Constrain the size of the content to be within [constraints] as permitted by the incoming
+ * measurement [Constraints]. If the incoming measurement constraints are more restrictive the
+ * requested size will obey the incoming constraints and attempt to be as close as possible to
+ * the preferred size.
+ */
+fun Modifier.preferredSizeIn(constraints: DpConstraints) = this + SizeModifier(constraints)
+
+/**
+ * Have the content fill the [Constraints.maxWidth] of the incoming measurement constraints
+ * by setting the [minimum width][Constraints.minWidth] to be equal to the
+ * [maximum width][Constraints.maxWidth]. If the incoming maximum width is [IntPx.Infinity] this
+ * modifier will have no effect.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleFillWidthModifier
+ */
+@Suppress("DEPRECATION")
+fun Modifier.fillMaxWidth() = this + LayoutWidth.Fill
+
+/**
+ * Have the content fill the [Constraints.maxHeight] of the incoming measurement constraints
+ * by setting the [minimum height][Constraints.minHeight] to be equal to the
+ * [maximum height][Constraints.maxHeight]. If the incoming maximum height is [IntPx.Infinity] this
+ * modifier will have no effect.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleFillHeightModifier
+ */
+@Suppress("DEPRECATION")
+fun Modifier.fillMaxHeight() = this + LayoutHeight.Fill
+
+/**
+ * Have the content fill the [Constraints.maxWidth] and [Constraints.maxHeight] of the incoming
+ * measurement constraints by setting the [minimum width][Constraints.minWidth] to be equal to the
+ * [maximum width][Constraints.maxWidth] and the [minimum height][Constraints.minHeight] to be
+ * equal to the [maximum height][Constraints.maxHeight]. If the incoming maximum width or height
+ * is [IntPx.Infinity] this modifier will have no effect in that dimension.
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleFillModifier
+ */
+@Suppress("DEPRECATION")
+fun Modifier.fillMaxSize() = this + LayoutSize.Fill
+
+/**
+ * Allow the content to measure at its desired width without regard for the incoming measurement
+ * [minimum width constraint][Constraints.minWidth]. If the content's measured size is smaller
+ * than the minimum width constraint, [align] it within that minimum width space.
+ */
+// TODO: Consider an axis-specific [Alignment]
+@Suppress("DEPRECATION")
+fun Modifier.wrapContentWidth(align: Alignment = Center) = this + when (align) {
+ TopStart, CenterStart, BottomStart -> LayoutAlign.Start
+ TopCenter, Center, BottomCenter -> LayoutAlign.CenterHorizontally
+ TopEnd, CenterEnd, BottomEnd -> LayoutAlign.End
+}
+
+/**
+ * Allow the content to measure at its desired height without regard for the incoming measurement
+ * [minimum height constraint][Constraints.minHeight]. If the content's measured size is smaller
+ * than the minimum height constraint, [align] it within that minimum height space.
+ */
+// TODO: Consider an axis-specific [Alignment]
+@Suppress("DEPRECATION")
+fun Modifier.wrapContentHeight(align: Alignment = Center) = this + when (align) {
+ TopStart, TopCenter, TopEnd -> LayoutAlign.Top
+ CenterStart, Center, CenterEnd -> LayoutAlign.CenterVertically
+ BottomStart, BottomCenter, BottomEnd -> LayoutAlign.Bottom
+}
+
+/**
+ * Allow the content to measure at its desired size without regard for the incoming measurement
+ * [minimum width][Constraints.minWidth] or [minimum height][Constraints.minHeight] constraints.
+ * If the content's measured size is smaller than the minimum size constraint, [align] it
+ * within that minimum sized space.
+ */
+@Suppress("DEPRECATION")
+fun Modifier.wrapContentSize(align: Alignment = Center) = this + when (align) {
+ TopStart -> LayoutAlign.TopStart
+ TopCenter -> LayoutAlign.TopCenter
+ TopEnd -> LayoutAlign.TopEnd
+ CenterStart -> LayoutAlign.CenterStart
+ Center -> LayoutAlign.Center
+ CenterEnd -> LayoutAlign.CenterEnd
+ BottomStart -> LayoutAlign.BottomStart
+ BottomCenter -> LayoutAlign.BottomCenter
+ BottomEnd -> LayoutAlign.BottomEnd
+}
+
private data class SizeModifier(private val modifierConstraints: DpConstraints) : LayoutModifier {
override fun Density.modifyConstraints(
constraints: Constraints,
@@ -94,7 +292,16 @@
* @sample androidx.ui.layout.samples.SimpleWidthModifier
*/
@Stable
-data class LayoutWidth(val width: Dp)
+data class LayoutWidth
+@Deprecated(
+ "Use Modifier.preferredWidth",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredWidth(width)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredWidth"
+ )
+)
+constructor(val width: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints.fixedWidth(width)) {
init {
@@ -111,7 +318,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Min(val minWidth: Dp)
+ data class Min
+ @Deprecated(
+ "Use Modifier.preferredWidthIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredWidthIn(minWidth = minWidth)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredWidthIn"
+ )
+ )
+ constructor(val minWidth: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints(minWidth = minWidth)) {
init {
@@ -128,7 +344,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Max(val maxWidth: Dp)
+ data class Max
+ @Deprecated(
+ "Use Modifier.preferredWidthIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredWidthIn(maxWidth = maxWidth)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredWidthIn"
+ )
+ )
+ constructor(val maxWidth: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints(maxWidth = maxWidth))
@@ -141,7 +366,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Constrain(val minWidth: Dp, val maxWidth: Dp)
+ data class Constrain
+ @Deprecated(
+ "Use Modifier.preferredWidthIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredWidthIn(minWidth, maxWidth)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredWidthIn"
+ )
+ )
+ constructor(val minWidth: Dp, val maxWidth: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints(minWidth = minWidth, maxWidth = maxWidth)) {
init {
@@ -161,6 +395,14 @@
* @sample androidx.ui.layout.samples.SimpleFillWidthModifier
*/
@Stable
+ @Deprecated(
+ "Use Modifier.fillMaxWidth",
+ replaceWith = ReplaceWith(
+ "Modifier.fillMaxWidth()",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.fillMaxWidth"
+ )
+ )
object Fill : LayoutModifier {
override fun Density.modifyConstraints(
constraints: Constraints,
@@ -191,7 +433,16 @@
* @sample androidx.ui.layout.samples.SimpleHeightModifier
*/
@Stable
-data class LayoutHeight(val height: Dp)
+data class LayoutHeight
+@Deprecated(
+ "Use Modifier.preferredHeight",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredHeight(height)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredHeight"
+ )
+)
+constructor(val height: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints.fixedHeight(height)) {
init {
@@ -208,7 +459,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Min(val minHeight: Dp)
+ data class Min
+ @Deprecated(
+ "Use Modifier.preferredHeightIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredHeightIn(minHeight = minHeight)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredHeightIn"
+ )
+ )
+ constructor(val minHeight: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints(minHeight = minHeight)) {
init {
@@ -225,7 +485,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Max(val maxHeight: Dp)
+ data class Max
+ @Deprecated(
+ "Use Modifier.preferredHeightIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredHeightIn(maxHeight = maxHeight)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredHeightIn"
+ )
+ )
+ constructor(val maxHeight: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints(maxHeight = maxHeight))
@@ -238,7 +507,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Constrain(val minHeight: Dp, val maxHeight: Dp)
+ data class Constrain
+ @Deprecated(
+ "Use Modifier.preferredHeightIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredHeightIn(minHeight, maxHeight)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredHeightIn"
+ )
+ )
+ constructor(val minHeight: Dp, val maxHeight: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(
DpConstraints(minHeight = minHeight, maxHeight = maxHeight)
@@ -260,6 +538,14 @@
* @sample androidx.ui.layout.samples.SimpleFillHeightModifier
*/
@Stable
+ @Deprecated(
+ "Use Modifier.fillMaxHeight",
+ replaceWith = ReplaceWith(
+ "Modifier.fillMaxHeight()",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.fillMaxHeight"
+ )
+ )
object Fill : LayoutModifier {
override fun Density.modifyConstraints(
constraints: Constraints,
@@ -293,13 +579,31 @@
* @sample androidx.ui.layout.samples.SimpleSizeModifier
*/
@Stable
-data class LayoutSize(val width: Dp, val height: Dp)
+data class LayoutSize
+@Deprecated(
+ "Use Modifier.preferredSize",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSize(width, height)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSize"
+ )
+)
+constructor(val width: Dp, val height: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(DpConstraints.fixed(width, height)) {
/**
* [Modifies][LayoutModifier] a Compose UI layout element to have a square size of [size].
*/
+ @Suppress("DEPRECATION")
+ @Deprecated(
+ "Use Modifier.preferredSize",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSize(size)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSize"
+ )
+ )
constructor(size: Dp) : this(width = size, height = size)
init {
@@ -318,7 +622,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Min(val minWidth: Dp, val minHeight: Dp)
+ data class Min
+ @Deprecated(
+ "Use Modifier.preferredSizeIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSizeIn(minWidth = minWidth, minHeight = minHeight)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSizeIn"
+ )
+ )
+ constructor(val minWidth: Dp, val minHeight: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(
DpConstraints(minWidth = minWidth, minHeight = minHeight)
@@ -327,6 +640,15 @@
* [Modifies][LayoutModifier] a Compose UI layout element to have a square minimum size of
* [minSize].
*/
+ @Suppress("DEPRECATION")
+ @Deprecated(
+ "Use Modifier.preferredSizeIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSizeIn(minWidth = minSize, minHeight = minSize)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSizeIn"
+ )
+ )
constructor(minSize: Dp) : this(minWidth = minSize, minHeight = minSize)
init {
@@ -344,7 +666,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Max(val maxWidth: Dp, val maxHeight: Dp)
+ data class Max
+ @Deprecated(
+ "Use Modifier.preferredSizeIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSizeIn(maxWidth = maxWidth, maxHeight = maxHeight)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSizeIn"
+ )
+ )
+ constructor(val maxWidth: Dp, val maxHeight: Dp)
// TODO: remove delegation here and implement inline
: LayoutModifier by SizeModifier(
DpConstraints(maxWidth = maxWidth, maxHeight = maxHeight)
@@ -353,6 +684,15 @@
* [Modifies][LayoutModifier] a Compose UI layout element to have a square maximum size of
* [maxSize].
*/
+ @Suppress("DEPRECATION")
+ @Deprecated(
+ "Use Modifier.preferredSizeIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSizeIn(maxWidth = maxSize, maxHeight = maxSize)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSizeIn"
+ )
+ )
constructor(maxSize: Dp) : this(maxWidth = maxSize, maxHeight = maxSize)
}
@@ -366,7 +706,16 @@
* the parent will restrict the final size.
*/
@Stable
- data class Constrain(
+ data class Constrain
+ @Deprecated(
+ "Use Modifier.preferredSizeIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSizeIn(minWidth, minHeight, maxWidth, maxHeight)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSizeIn"
+ )
+ )
+ constructor(
val minWidth: Dp,
val minHeight: Dp,
val maxWidth: Dp,
@@ -384,6 +733,15 @@
* [Modifies][LayoutModifier] a Compose UI layout element to have a square minimum
* size of [minSize] and a square maximum size of [maxSize].
*/
+ @Suppress("DEPRECATION")
+ @Deprecated(
+ "Use Modifier.preferredSizeIn",
+ replaceWith = ReplaceWith(
+ "Modifier.preferredSize(minSize, minSize, maxSize, maxSize)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.preferredSizeIn"
+ )
+ )
constructor(minSize: Dp, maxSize: Dp) : this(
minWidth = minSize,
minHeight = minSize,
@@ -409,6 +767,14 @@
* @sample androidx.ui.layout.samples.SimpleFillModifier
*/
@Stable
+ @Deprecated(
+ "Use Modifier.fillMaxSize",
+ replaceWith = ReplaceWith(
+ "Modifier.fillMaxSize()",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.fillMaxSize"
+ )
+ )
object Fill : LayoutModifier {
override fun Density.modifyConstraints(
constraints: Constraints,
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Row.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Row.kt
index e7c49c5..65ad5be 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Row.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Row.kt
@@ -73,6 +73,17 @@
}
/**
+ * Vertical alignments for use with [RowScope.gravity].
+ *
+ * TODO: Unify with other alignment API
+ */
+enum class RowAlign {
+ Top,
+ Center,
+ Bottom
+}
+
+/**
* Scope for the children of [Row].
*/
@LayoutScopeMarker
@@ -82,21 +93,54 @@
* A layout modifier within a [Row] that positions its target component vertically
* such that its top edge is aligned to the top edge of the [Row].
*/
+ @Deprecated(
+ "Use Modifier.gravity(RowAlign.Top)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(RowAlign.Top)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ColumnAlign"
+ )
+ )
val LayoutGravity.Top: ParentDataModifier get() = TopGravityModifier
/**
* A layout modifier within a Row that positions target component vertically
* such that its center is in the middle of the [Row].
*/
+ @Deprecated(
+ "Use Modifier.gravity(RowAlign.Center)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(RowAlign.Center)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ColumnAlign"
+ )
+ )
val LayoutGravity.Center: ParentDataModifier get() = CenterGravityModifier
/**
* A layout modifier within a Row that positions target component vertically
* such that its bottom edge is aligned to the bottom edge of the [Row].
*/
+ @Deprecated(
+ "Use Modifier.gravity(RowAlign.Bottom)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(RowAlign.Bottom)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.layout.ColumnAlign"
+ )
+ )
val LayoutGravity.Bottom: ParentDataModifier get() = BottomGravityModifier
/**
+ * Position the element vertically within the [Row] according to [align].
+ */
+ fun Modifier.gravity(align: RowAlign) = this + when (align) {
+ RowAlign.Top -> TopGravityModifier
+ RowAlign.Center -> CenterGravityModifier
+ RowAlign.Bottom -> BottomGravityModifier
+ }
+
+ /**
* A layout modifier within a [Row] that positions its target component vertically
* according to the specified [HorizontalAlignmentLine], such that the position of the alignment
* line coincides horizontally with the alignment lines of all other siblings having their
@@ -113,11 +157,28 @@
* Example usage:
* @sample androidx.ui.layout.samples.SimpleRelativeToSiblingsInRow
*/
+ @Deprecated(
+ "Use Modifier.alignWithSiblings",
+ replaceWith = ReplaceWith(
+ "Modifier.alignWithSiblings(alignmentLine)",
+ "androidx.ui.core.Modifier"
+ )
+ )
fun LayoutGravity.RelativeToSiblings(
alignmentLine: HorizontalAlignmentLine
): ParentDataModifier = SiblingsAlignedModifier.WithAlignmentLine(alignmentLine)
/**
+ * Position the element vertically such that its [alignmentLine] aligns with sibling elements
+ * also configured to [alignWithSiblings] with the same [alignmentLine].
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleRelativeToSiblingsInRow
+ */
+ fun Modifier.alignWithSiblings(alignmentLine: HorizontalAlignmentLine) =
+ this + SiblingsAlignedModifier.WithAlignmentLine(alignmentLine)
+
+ /**
* A scoped modifier within a [Row] that sets the horizontal weight of the layout.
* A [Row] child that has a weight will be assigned a space proportional to its weight,
* relative to the other siblings that have weights. This will be calculated by dividing
@@ -133,6 +194,13 @@
*
* @sample androidx.ui.layout.samples.SimpleRow
*/
+ @Deprecated(
+ "Use Modifier.weight",
+ replaceWith = ReplaceWith(
+ "Modifier.weight(weight, fill)",
+ "androidx.ui.core.Modifier"
+ )
+ )
fun LayoutWeight(
@FloatRange(from = 0.0, fromInclusive = false) weight: Float,
fill: Boolean = true
@@ -142,6 +210,19 @@
}
/**
+ * Size the element's width proportional to its [weight] relative to other weighted sibling
+ * elements in the [Row]. The parent will divide the horizontal space remaining after measuring
+ * unweighted child elements and distribute it according to this weight.
+ */
+ fun Modifier.weight(
+ @FloatRange(from = 0.0, fromInclusive = false) weight: Float,
+ fill: Boolean = true
+ ): Modifier {
+ require(weight > 0.0) { "invalid weight $weight; must be greater than zero" }
+ return this + LayoutWeightImpl(weight, fill)
+ }
+
+ /**
* A layout modifier within a [Row] that positions its target component relative
* to all other elements within the parent that have [LayoutGravity.RelativeToSiblings].
* The [alignmentLineBlock] accepts the [Placeable] of the targeted layout and returns the
@@ -158,10 +239,29 @@
* Example usage:
* @sample androidx.ui.layout.samples.SimpleRelativeToSiblings
*/
+ @Deprecated(
+ "Use Modifier.alignWithSiblings",
+ replaceWith = ReplaceWith(
+ "Modifier.alignWithSiblings(alignmentLineBlock)",
+ "androidx.ui.core.Modifier"
+ )
+ )
@Suppress("unused")
fun LayoutGravity.RelativeToSiblings(
alignmentLineBlock: (Placeable) -> IntPx
): ParentDataModifier = SiblingsAlignedModifier.WithAlignmentLineBlock(alignmentLineBlock)
+
+ /**
+ * Position the element vertically such that the alignment line for the content as
+ * determined by [alignmentLineBlock] aligns with sibling elements also configured to
+ * [alignWithSiblings] with an [alignmentLineBlock].
+ *
+ * Example usage:
+ * @sample androidx.ui.layout.samples.SimpleRelativeToSiblings
+ */
+ fun Modifier.alignWithSiblings(
+ alignmentLineBlock: (Placeable) -> IntPx
+ ) = this + SiblingsAlignedModifier.WithAlignmentLineBlock(alignmentLineBlock)
}
private val TopGravityModifier = GravityModifier(CrossAxisAlignment.Start)
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Stack.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Stack.kt
index 46cc732..e4d545c 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Stack.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Stack.kt
@@ -104,6 +104,13 @@
* size of the [Stack] and are positioned within the stack after its size is calculated to
* wrap the non-stretch components.
*/
+ @Deprecated(
+ "Use Modifier.matchParent()",
+ replaceWith = ReplaceWith(
+ "Modifier.matchParent()",
+ "androidx.ui.core.Modifier"
+ )
+ )
val LayoutGravity.Stretch: ParentDataModifier get() = StretchGravityModifier
/**
@@ -113,6 +120,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.TopStart)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.TopStart)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.TopStart: ParentDataModifier get() = TopStartGravityModifier
/**
@@ -120,6 +135,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.TopCenter)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.TopCenter)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.TopCenter: ParentDataModifier get() = TopCenterGravityModifier
/**
@@ -129,6 +152,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.TopEnd)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.TopEnd)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.TopEnd: ParentDataModifier get() = TopEndGravityModifier
/**
@@ -138,6 +169,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.CenterStart)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.CenterStart)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.CenterStart: ParentDataModifier get() = CenterStartGravityModifier
/**
@@ -145,6 +184,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.Center)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.Center)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.Center: ParentDataModifier get() = CenterGravityModifier
/**
@@ -154,6 +201,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.CenterEnd)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.CenterEnd)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.CenterEnd: ParentDataModifier get() = CenterEndGravityModifier
/**
@@ -163,6 +218,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.BottomStart)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.BottomStart)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.BottomStart: ParentDataModifier get() = BottomStartGravityModifier
/**
@@ -171,6 +234,14 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.BottomCenter)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.BottomCenter)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.BottomCenter: ParentDataModifier get() = BottomCenterGravityModifier
/**
@@ -180,8 +251,37 @@
* If the [Stack] wraps its content (by not being constrained to a min size by its own
* parent), a child with this gravity option will contribute to the size of the [Stack].
*/
+ @Deprecated(
+ "Use Modifier.gravity(Alignment.BottomEnd)",
+ replaceWith = ReplaceWith(
+ "Modifier.gravity(Alignment.BottomEnd)",
+ "androidx.ui.core.Modifier",
+ "androidx.ui.core.Alignment"
+ )
+ )
val LayoutGravity.BottomEnd: ParentDataModifier get() = BottomEndGravityModifier
+ /**
+ * Pull the content element to a specific [Alignment] within the [Stack].
+ */
+ fun Modifier.gravity(align: Alignment) = this + when (align) {
+ Alignment.TopStart -> TopStartGravityModifier
+ Alignment.TopCenter -> TopCenterGravityModifier
+ Alignment.TopEnd -> TopEndGravityModifier
+ Alignment.CenterStart -> CenterStartGravityModifier
+ Alignment.Center -> CenterGravityModifier
+ Alignment.CenterEnd -> CenterEndGravityModifier
+ Alignment.BottomStart -> BottomStartGravityModifier
+ Alignment.BottomCenter -> BottomCenterGravityModifier
+ Alignment.BottomEnd -> BottomEndGravityModifier
+ }
+
+ /**
+ * Size the element to match the size of the [Stack] after all other content elements have
+ * been measured.
+ */
+ fun Modifier.matchParent() = this + StretchGravityModifier
+
internal companion object {
val TopStartGravityModifier: ParentDataModifier = StackGravityModifier(Alignment.TopStart)
val TopCenterGravityModifier: ParentDataModifier = StackGravityModifier(Alignment.TopCenter)
diff --git a/ui/ui-material/icons/core/samples/src/main/java/androidx/ui/material/icons/samples/IconSamples.kt b/ui/ui-material/icons/core/samples/src/main/java/androidx/ui/material/icons/samples/IconSamples.kt
index 393fa53..8cbee3a 100644
--- a/ui/ui-material/icons/core/samples/src/main/java/androidx/ui/material/icons/samples/IconSamples.kt
+++ b/ui/ui-material/icons/core/samples/src/main/java/androidx/ui/material/icons/samples/IconSamples.kt
@@ -18,7 +18,8 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
-import androidx.ui.core.asModifier
+import androidx.ui.core.Modifier
+import androidx.ui.core.paint
import androidx.ui.foundation.Box
import androidx.ui.foundation.Icon
import androidx.ui.graphics.vector.VectorAsset
@@ -42,5 +43,5 @@
@Composable
private fun SomeComposable(icon: VectorAsset) {
- Box(modifier = VectorPainter(icon).asModifier())
+ Box(Modifier.paint(VectorPainter(icon)))
}
diff --git a/ui/ui-material/icons/extended/src/androidTest/java/androidx/ui/material/icons/test/IconComparisonTest.kt b/ui/ui-material/icons/extended/src/androidTest/java/androidx/ui/material/icons/test/IconComparisonTest.kt
index 6695fc7..fa199e1 100644
--- a/ui/ui-material/icons/extended/src/androidTest/java/androidx/ui/material/icons/test/IconComparisonTest.kt
+++ b/ui/ui-material/icons/extended/src/androidTest/java/androidx/ui/material/icons/test/IconComparisonTest.kt
@@ -24,10 +24,12 @@
import androidx.test.filters.LargeTest
import androidx.test.filters.SdkSuppress
import androidx.test.rule.ActivityTestRule
+import androidx.ui.core.Alignment
import androidx.ui.core.ContextAmbient
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
-import androidx.ui.core.asModifier
+import androidx.ui.core.paint
import androidx.ui.core.setContent
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
@@ -35,9 +37,8 @@
import androidx.ui.graphics.vector.VectorAsset
import androidx.ui.graphics.vector.VectorPainter
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.res.vectorResource
import androidx.ui.semantics.Semantics
import androidx.ui.test.captureToBitmap
@@ -169,24 +170,22 @@
// Using ipx directly ensures that we will always have a consistent layout / drawing
// story, so anti-aliasing should be identical.
val layoutSize = with(DensityAmbient.current) {
- LayoutSize(72.ipx.toDp())
+ Modifier.preferredSize(72.ipx.toDp())
}
- Column(LayoutGravity.Center) {
+ Column(Modifier.gravity(Alignment.Center)) {
TestTag(ProgrammaticTestTag) {
Semantics(container = true) {
Box(
- modifier = layoutSize +
- VectorPainter(programmaticVector)
- .asModifier(colorFilter = ColorFilter.tint(Color.Red))
+ modifier = layoutSize.paint(VectorPainter(programmaticVector),
+ colorFilter = ColorFilter.tint(Color.Red))
)
}
}
TestTag(XmlTestTag) {
Semantics(container = true) {
Box(
- modifier = layoutSize +
- VectorPainter(xmlVector)
- .asModifier(colorFilter = ColorFilter.tint(Color.Red))
+ modifier = layoutSize.paint(VectorPainter(xmlVector),
+ colorFilter = ColorFilter.tint(Color.Red))
)
}
}
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/AppBarDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/AppBarDemo.kt
index 3a90c2c..ea5c90f 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/AppBarDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/AppBarDemo.kt
@@ -17,6 +17,7 @@
package androidx.ui.material.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.layout.Column
import androidx.ui.layout.Spacer
import androidx.ui.material.samples.SimpleBottomAppBar
@@ -26,7 +27,7 @@
fun AppBarDemo() {
Column {
SimpleTopAppBar()
- Spacer(LayoutWeight(1f))
+ Spacer(Modifier.weight(1f, true))
SimpleBottomAppBar()
}
}
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/BottomNavigationDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/BottomNavigationDemo.kt
index d0548ac..5407ba6 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/BottomNavigationDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/BottomNavigationDemo.kt
@@ -18,10 +18,12 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.RadioGroup
import androidx.ui.material.samples.BottomNavigationSample
import androidx.ui.material.samples.BottomNavigationWithOnlySelectedLabelsSample
@@ -31,7 +33,7 @@
fun BottomNavigationDemo() {
var alwaysShowLabels by state { false }
- Column(LayoutHeight.Fill, arrangement = Arrangement.Bottom) {
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.Bottom) {
RadioGroup {
RadioGroupTextItem(
selected = !alwaysShowLabels,
@@ -45,7 +47,7 @@
)
}
- Spacer(LayoutHeight(50.dp))
+ Spacer(Modifier.preferredHeight(50.dp))
if (alwaysShowLabels) {
BottomNavigationSample()
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ButtonDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ButtonDemo.kt
index f2f1bfb7..4646b44 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ButtonDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ButtonDemo.kt
@@ -17,18 +17,19 @@
package androidx.ui.material.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Text
import androidx.ui.foundation.shape.GenericShape
import androidx.ui.graphics.Color
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
import androidx.ui.material.Button
import androidx.ui.material.MaterialTheme
import androidx.ui.material.OutlinedButton
@@ -46,13 +47,13 @@
@Composable
fun ButtonDemo() {
- Column(LayoutPadding(10.dp)) {
+ Column(Modifier.padding(10.dp)) {
Buttons()
- Spacer(LayoutHeight(DefaultSpace))
+ Spacer(Modifier.preferredHeight(DefaultSpace))
Fabs()
- Spacer(LayoutHeight(DefaultSpace))
+ Spacer(Modifier.preferredHeight(DefaultSpace))
IconButtons()
- Spacer(LayoutHeight(DefaultSpace))
+ Spacer(Modifier.preferredHeight(DefaultSpace))
CustomShapeButton()
}
}
@@ -60,16 +61,16 @@
@Composable
private fun Buttons() {
Text("Buttons")
- Spacer(LayoutHeight(DefaultSpace))
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Spacer(Modifier.preferredHeight(DefaultSpace))
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
ButtonSample()
OutlinedButtonSample()
TextButtonSample()
}
- Spacer(LayoutHeight(DefaultSpace))
+ Spacer(Modifier.preferredHeight(DefaultSpace))
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
Button( backgroundColor = MaterialTheme.colors.secondary) {
Text("Secondary Color")
}
@@ -85,9 +86,9 @@
@Composable
private fun Fabs() {
Text("Floating action buttons")
- Spacer(LayoutHeight(DefaultSpace))
+ Spacer(Modifier.preferredHeight(DefaultSpace))
- Row(LayoutWidth.Fill, arrangement = Arrangement.SpaceEvenly) {
+ Row(Modifier.fillMaxWidth(), arrangement = Arrangement.SpaceEvenly) {
SimpleFab()
SimpleExtendedFabNoIcon()
SimpleExtendedFabWithIcon()
@@ -97,7 +98,7 @@
@Composable
private fun IconButtons() {
Text("Icon buttons")
- Spacer(LayoutHeight(DefaultSpace))
+ Spacer(Modifier.preferredHeight(DefaultSpace))
Row {
IconButtonSample()
@@ -108,10 +109,10 @@
@Composable
private fun CustomShapeButton() {
Text("Custom shape button")
- Spacer(LayoutHeight(DefaultSpace))
+ Spacer(Modifier.preferredHeight(DefaultSpace))
OutlinedButton(
>
- modifier = LayoutSize(100.dp),
+ modifier = Modifier.preferredSize(100.dp),
shape = TriangleShape,
backgroundColor = Color.Yellow,
border = Border(size = 2.dp, color = Color.Black)
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
index 30661a9..6a4101f 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
@@ -50,15 +50,17 @@
import androidx.ui.graphics.SolidColor
import androidx.ui.graphics.toArgb
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutAspectRatio
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.aspectRatio
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.offset
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
import androidx.ui.material.Surface
import androidx.ui.material.TopAppBar
import androidx.ui.text.style.TextAlign
@@ -85,8 +87,11 @@
@Composable
private fun ColorPicker(onColorChange: (Color) -> Unit) {
- WithConstraints(LayoutPadding(50.dp) + LayoutSize.Fill +
- LayoutAspectRatio(1f)) { constraints, _ ->
+ WithConstraints(
+ Modifier.padding(50.dp)
+ .fillMaxSize()
+ .aspectRatio(1f)
+ ) { constraints, _ ->
val diameter = constraints.maxWidth.value
var position by state { PxPosition.Origin }
val colorWheel = remember(diameter) { ColorWheel(diameter) }
@@ -106,7 +111,7 @@
isDragging = it }
)
- Stack(LayoutSize.Fill) {
+ Stack(Modifier.fillMaxSize()) {
Image(modifier = inputModifier, asset = colorWheel.image)
val color = colorWheel.colorForPosition(position)
if (color != null) {
@@ -160,7 +165,7 @@
@Composable
private fun Magnifier(visible: Boolean, position: PxPosition, color: Color) {
val offset = with(DensityAmbient.current) {
- LayoutOffset(
+ Modifier.offset(
position.x.toDp() - MagnifierWidth / 2,
// Align with the center of the selection circle
position.y.toDp() - (MagnifierHeight - (SelectionCircleDiameter / 2))
@@ -173,20 +178,18 @@
) { labelWidth: Dp, selectionDiameter: Dp,
opacity: Float ->
Column(
- modifier = offset + LayoutSize(
- width = MagnifierWidth,
- height = MagnifierHeight
- ) + drawOpacity(opacity)
+ offset.preferredSize(width = MagnifierWidth, height = MagnifierHeight)
+ .drawOpacity(opacity)
) {
- Box(LayoutWidth.Fill, gravity = ContentGravity.Center) {
- MagnifierLabel(LayoutSize(labelWidth, MagnifierLabelHeight), color)
+ Box(Modifier.fillMaxWidth(), gravity = ContentGravity.Center) {
+ MagnifierLabel(Modifier.preferredSize(labelWidth, MagnifierLabelHeight), color)
}
- Spacer(LayoutWeight(1f))
+ Spacer(Modifier.weight(1f))
Box(
- LayoutWidth.Fill + LayoutHeight(SelectionCircleDiameter),
+ Modifier.fillMaxWidth().preferredHeight(SelectionCircleDiameter),
gravity = ContentGravity.Center
) {
- MagnifierSelectionCircle(LayoutSize(selectionDiameter), color)
+ MagnifierSelectionCircle(Modifier.preferredSize(selectionDiameter), color)
}
}
}
@@ -252,13 +255,13 @@
private fun MagnifierLabel(modifier: Modifier, color: Color) {
Surface(shape = MagnifierPopupShape, elevation = 4.dp) {
Row(modifier) {
- Box(LayoutWeight(0.25f) + LayoutHeight.Fill, backgroundColor = color)
+ Box(Modifier.weight(0.25f).fillMaxHeight(), backgroundColor = color)
// Add `#` and drop alpha characters
val text = "#" + Integer.toHexString(color.toArgb()).toUpperCase(Locale.ROOT).drop(2)
val textStyle = currentTextStyle().copy(textAlign = TextAlign.Center)
Text(
text = text,
- modifier = LayoutWeight(0.75f) + LayoutPadding(bottom = 20.dp, top = 10.dp),
+ modifier = Modifier.weight(0.75f).padding(top = 10.dp, bottom = 20.dp),
style = textStyle,
maxLines = 1
)
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/DynamicThemeActivity.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/DynamicThemeActivity.kt
index 32b8176..a7135c1 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/DynamicThemeActivity.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/DynamicThemeActivity.kt
@@ -22,6 +22,7 @@
import androidx.compose.Composable
import androidx.compose.Model
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.core.setContent
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
@@ -34,9 +35,9 @@
import androidx.ui.graphics.lerp
import androidx.ui.graphics.toArgb
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.BottomAppBar
import androidx.ui.material.ColorPalette
import androidx.ui.material.ExtendedFloatingActionButton
@@ -126,7 +127,7 @@
// colour from the Material theme to work out text colour, so we end up doing a
// large amount of work here when the top level theme changes
Box(
- LayoutPadding(25.dp) + LayoutWidth.Fill + LayoutHeight(150.dp),
+ Modifier.padding(25.dp).fillMaxWidth().preferredHeight(150.dp),
shape = RoundedCornerShape(10.dp),
backgroundColor = shapeColor,
gravity = ContentGravity.Center
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ElevationDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ElevationDemo.kt
index 12be3b1..530d023 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ElevationDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ElevationDemo.kt
@@ -17,6 +17,7 @@
package androidx.ui.material.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
import androidx.ui.foundation.Clickable
@@ -26,10 +27,10 @@
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.Card
import androidx.ui.material.MaterialTheme
import androidx.ui.material.ripple.ripple
@@ -39,12 +40,12 @@
@Composable
fun ElevationDemo() {
Column {
- Box(LayoutPadding(20.dp) + LayoutWidth.Fill, gravity = ContentGravity.Center) {
+ Box(Modifier.padding(20.dp).fillMaxWidth(), gravity = ContentGravity.Center) {
val text = getMessage(MaterialTheme.colors.isLight)
Text(text)
}
VerticalScroller {
- Column(LayoutPadding(25.dp) + LayoutSize.Fill) {
+ Column(Modifier.padding(25.dp).fillMaxSize()) {
elevations.forEach { elevation ->
ElevatedCard(elevation)
}
@@ -56,13 +57,13 @@
@Composable
private fun ElevatedCard(elevation: Dp) {
Card(
- LayoutPadding(start = 10.dp, end = 10.dp, top = 20.dp, bottom = 20.dp),
+ Modifier.padding(start = 10.dp, top = 20.dp, end = 10.dp, bottom = 20.dp),
shape = RoundedCornerShape(4.dp),
border = if (elevation == 0.dp) Border(1.dp, Color.Gray) else null,
elevation = elevation
) {
Clickable( modifier = ripple()) {
- Box(LayoutWidth.Fill + LayoutHeight(150.dp), gravity = ContentGravity.Center) {
+ Box(Modifier.fillMaxWidth().preferredHeight(150.dp), gravity = ContentGravity.Center) {
Text("$elevation", style = MaterialTheme.typography.h4)
}
}
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/MaterialThemeDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/MaterialThemeDemo.kt
index 191f9ef..fd26fd5 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/MaterialThemeDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/MaterialThemeDemo.kt
@@ -17,16 +17,17 @@
package androidx.ui.material.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
+import androidx.ui.layout.fillMaxHeight
import androidx.ui.material.samples.MaterialThemeSample
import androidx.ui.material.samples.ThemeColorSample
import androidx.ui.material.samples.ThemeTextStyleSample
@Composable
fun MaterialThemeDemo() {
- Column(modifier = LayoutHeight.Fill, arrangement = Arrangement.SpaceAround) {
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.SpaceAround) {
MaterialThemeSample()
ThemeTextStyleSample()
ThemeColorSample()
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ProgressIndicatorDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ProgressIndicatorDemo.kt
index 0641710..3c60925 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ProgressIndicatorDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ProgressIndicatorDemo.kt
@@ -22,12 +22,14 @@
import androidx.compose.onActive
import androidx.compose.onDispose
import androidx.compose.remember
+import androidx.ui.core.Modifier
import androidx.ui.graphics.Color
-import androidx.ui.layout.Column
import androidx.ui.layout.Arrangement
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.Column
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
+import androidx.ui.layout.fillMaxWidth
import androidx.ui.material.CircularProgressIndicator
import androidx.ui.material.LinearProgressIndicator
@@ -39,29 +41,29 @@
onDispose { state.stop() }
Column {
- val modifier = LayoutWeight(1f) + LayoutGravity.Center + LayoutWidth.Fill
- Row(modifier = modifier, arrangement = Arrangement.SpaceEvenly) {
+ val modifier = Modifier.weight(1f, true).gravity(ColumnAlign.Center).fillMaxWidth()
+ Row(modifier, arrangement = Arrangement.SpaceEvenly) {
// Determinate indicators
- LinearProgressIndicator(progress = state.progress, modifier = LayoutGravity.Center)
- CircularProgressIndicator(progress = state.progress, modifier = LayoutGravity.Center)
+ LinearProgressIndicator(state.progress, Modifier.gravity(RowAlign.Center))
+ CircularProgressIndicator(state.progress, Modifier.gravity(RowAlign.Center))
}
- Row(modifier = modifier, arrangement = Arrangement.SpaceEvenly) {
+ Row(modifier, arrangement = Arrangement.SpaceEvenly) {
// Fancy colours!
LinearProgressIndicator(
progress = (state.progress),
color = state.generateColor(),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
)
CircularProgressIndicator(
progress = (state.progress),
color = state.generateColor(),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
)
}
- Row(modifier = modifier, arrangement = Arrangement.SpaceEvenly) {
+ Row(modifier, arrangement = Arrangement.SpaceEvenly) {
// Indeterminate indicators
- LinearProgressIndicator(modifier = LayoutGravity.Center)
- CircularProgressIndicator(modifier = LayoutGravity.Center)
+ LinearProgressIndicator(Modifier.gravity(RowAlign.Center))
+ CircularProgressIndicator(Modifier.gravity(RowAlign.Center))
}
}
}
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SelectionControlsDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SelectionControlsDemo.kt
index 358729c..6793017 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SelectionControlsDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SelectionControlsDemo.kt
@@ -17,10 +17,11 @@
package androidx.ui.material.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
+import androidx.ui.layout.padding
import androidx.ui.material.MaterialTheme
import androidx.ui.material.samples.CustomRadioGroupSample
import androidx.ui.material.samples.DefaultRadioGroupSample
@@ -32,7 +33,7 @@
@Composable
fun SelectionControlsDemo() {
val headerStyle = MaterialTheme.typography.h6
- Column(LayoutPadding(10.dp), arrangement = Arrangement.SpaceEvenly) {
+ Column(Modifier.padding(10.dp), arrangement = Arrangement.SpaceEvenly) {
Text(text = "Checkbox", style = headerStyle)
TriStateCheckboxSample()
Text(text = "Switch", style = headerStyle)
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SliderDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SliderDemo.kt
index 794c1ca..93c46cd 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SliderDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SliderDemo.kt
@@ -17,15 +17,16 @@
package androidx.ui.material.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
+import androidx.ui.layout.padding
import androidx.ui.material.samples.SliderSample
import androidx.ui.material.samples.StepsSliderSample
import androidx.ui.unit.dp
@Composable
fun SliderDemo() {
- Column(LayoutPadding(10.dp)) {
+ Column(Modifier.padding(10.dp)) {
SliderSample()
StepsSliderSample()
}
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SnackbarDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SnackbarDemo.kt
index 960524c..a605bce 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SnackbarDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/SnackbarDemo.kt
@@ -17,9 +17,10 @@
package androidx.ui.material.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
+import androidx.ui.layout.padding
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Snackbar
import androidx.ui.material.TextButton
@@ -29,8 +30,8 @@
@Composable
fun SnackbarDemo() {
- Column(LayoutPadding(start = 12.dp, end = 12.dp)) {
- val textSpacing = LayoutPadding(top = 12.dp, bottom = 12.dp)
+ Column(Modifier.padding(12.dp, 0.dp, 12.dp, 0.dp)) {
+ val textSpacing = Modifier.padding(top = 12.dp, bottom = 12.dp)
Text("Default Snackbar", modifier = textSpacing)
SimpleSnackbar()
Text("Snackbar with long text", modifier = textSpacing)
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/TabDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/TabDemo.kt
index a5fefb7..4e2dd08 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/TabDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/TabDemo.kt
@@ -18,13 +18,15 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.Button
import androidx.ui.material.samples.FancyIndicatorContainerTabs
import androidx.ui.material.samples.FancyIndicatorTabs
@@ -38,7 +40,7 @@
@Composable
fun TabDemo() {
- Column(modifier = LayoutHeight.Fill, arrangement = Arrangement.SpaceBetween) {
+ Column(Modifier.fillMaxHeight(), arrangement = Arrangement.SpaceBetween) {
val showingSimple = state { true }
val buttonText = "Show ${if (showingSimple.value) "custom" else "simple"} tabs"
@@ -54,7 +56,7 @@
ScrollingFancyIndicatorContainerTabs()
}
Button(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
>
showingSimple.value = !showingSimple.value
},
@@ -62,6 +64,6 @@
) {
Text(buttonText)
}
- Spacer(LayoutHeight(50.dp))
+ Spacer(Modifier.preferredHeight(50.dp))
}
}
diff --git a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/AccountsScreen.kt b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/AccountsScreen.kt
index fda1ead..6c3cde1 100644
--- a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/AccountsScreen.kt
+++ b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/AccountsScreen.kt
@@ -17,16 +17,18 @@
package androidx.ui.material.studies.rally
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.Card
import androidx.ui.material.MaterialTheme
import androidx.ui.unit.dp
@@ -38,31 +40,31 @@
fun AccountsBody() {
VerticalScroller {
Column {
- Stack(LayoutPadding(16.dp)) {
+ Stack(Modifier.padding(16.dp)) {
val accountsProportion = listOf(0.595f, 0.045f, 0.095f, 0.195f, 0.045f)
val colors = listOf(0xFF1EB980, 0xFF005D57, 0xFF04B97F, 0xFF37EFBA, 0xFFFAFFBF)
.map { Color(it) }
AnimatedCircle(
- LayoutHeight(300.dp) + LayoutGravity.Center + LayoutWidth.Fill,
+ Modifier.preferredHeight(300.dp).gravity(Alignment.Center).fillMaxWidth(),
accountsProportion,
colors
)
- Column(modifier = LayoutGravity.Center) {
+ Column(modifier = Modifier.gravity(Alignment.Center)) {
Text(
text = "Total",
style = MaterialTheme.typography.body1,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(ColumnAlign.Center)
)
Text(
text = "$12,132.49",
style = MaterialTheme.typography.h2,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(ColumnAlign.Center)
)
}
}
- Spacer(LayoutHeight(10.dp))
+ Spacer(Modifier.preferredHeight(10.dp))
Card {
- Column(modifier = LayoutPadding(12.dp)) {
+ Column(modifier = Modifier.padding(12.dp)) {
UserData.accounts.forEach { account ->
AccountRow(
name = account.name,
diff --git a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/BillsScreen.kt b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/BillsScreen.kt
index 11266e3..eb894e4 100644
--- a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/BillsScreen.kt
+++ b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/BillsScreen.kt
@@ -17,16 +17,18 @@
package androidx.ui.material.studies.rally
import androidx.compose.Composable
+import androidx.ui.core.Alignment
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.Card
import androidx.ui.material.MaterialTheme
import androidx.ui.unit.dp
@@ -38,32 +40,32 @@
fun BillsBody() {
VerticalScroller {
Column {
- Stack(LayoutPadding(16.dp)) {
+ Stack(Modifier.padding(16.dp)) {
val accountsProportion = listOf(0.65f, 0.25f, 0.03f, 0.05f)
val colors = listOf(0xFF1EB980, 0xFF005D57, 0xFF04B97F, 0xFF37EFBA).map {
Color(it)
}
AnimatedCircle(
- LayoutGravity.Center + LayoutHeight(300.dp) + LayoutWidth.Fill,
+ Modifier.gravity(Alignment.Center).preferredHeight(300.dp).fillMaxWidth(),
accountsProportion,
colors
)
- Column(modifier = LayoutGravity.Center) {
+ Column(modifier = Modifier.gravity(Alignment.Center)) {
Text(
text = "Due",
style = MaterialTheme.typography.body1,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(ColumnAlign.Center)
)
Text(
text = "$1,810.00",
style = MaterialTheme.typography.h2,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(ColumnAlign.Center)
)
}
}
- Spacer(LayoutHeight(10.dp))
+ Spacer(Modifier.preferredHeight(10.dp))
Card {
- Column(modifier = LayoutPadding(12.dp)) {
+ Column(modifier = Modifier.padding(12.dp)) {
UserData.bills.forEach { bill ->
BillRow(
name = bill.name,
diff --git a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/CommonUi.kt b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/CommonUi.kt
index a8f4bfd..c61dd62 100644
--- a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/CommonUi.kt
+++ b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/CommonUi.kt
@@ -23,11 +23,11 @@
import androidx.ui.graphics.Color
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
import androidx.ui.layout.Spacer
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.Divider
import androidx.ui.material.MaterialTheme
import androidx.ui.material.icons.Icons
@@ -70,35 +70,35 @@
amount: Float,
negative: Boolean
) {
- Row(LayoutHeight(68.dp)) {
+ Row(Modifier.preferredHeight(68.dp)) {
val typography = MaterialTheme.typography
- AccountIndicator(color = color, modifier = LayoutGravity.Center)
- Spacer(LayoutWidth(8.dp))
- Column(LayoutGravity.Center) {
+ AccountIndicator(color = color, modifier = Modifier.gravity(RowAlign.Center))
+ Spacer(Modifier.preferredWidth(8.dp))
+ Column(Modifier.gravity(RowAlign.Center)) {
Text(text = title, style = typography.body1)
Text(text = subtitle, style = typography.subtitle1)
}
- Spacer(LayoutWeight(1f))
+ Spacer(Modifier.weight(1f))
Row(
- modifier = LayoutGravity.Center + LayoutWidth(113.dp),
+ modifier = Modifier.gravity(RowAlign.Center).preferredWidth(113.dp),
arrangement = Arrangement.SpaceBetween
) {
Text(
text = if (negative) "–$ " else "$ ",
style = typography.h6,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
)
Text(
text = formatAmount(amount),
style = typography.h6,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
)
}
- Spacer(LayoutWidth(16.dp))
+ Spacer(Modifier.preferredWidth(16.dp))
Icon(
Icons.Filled.ArrowForwardIos,
tintColor = Color.White.copy(alpha = 0.6f),
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(RowAlign.Center),
size = 12.dp
)
}
diff --git a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/Icons.kt b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/Icons.kt
index 0d97552..adad8d0 100644
--- a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/Icons.kt
+++ b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/Icons.kt
@@ -18,14 +18,13 @@
import androidx.compose.Composable
import androidx.ui.core.Modifier
-import androidx.ui.core.asModifier
+import androidx.ui.core.paint
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.graphics.ColorFilter
import androidx.ui.graphics.vector.VectorAsset
import androidx.ui.graphics.vector.VectorPainter
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.preferredSize
import androidx.ui.material.icons.Icons
import androidx.ui.material.icons.lazyMaterialIcon
import androidx.ui.material.icons.materialPath
@@ -45,10 +44,11 @@
size: Dp = 24.dp
) {
Box(
- modifier = LayoutHeight(size) + LayoutWidth(size) + modifier +
- VectorPainter(vectorImage).asModifier(
- colorFilter = ColorFilter.tint(tintColor)
- )
+ Modifier.preferredSize(size)
+ .plus(modifier)
+ .paint(
+ VectorPainter(vectorImage), colorFilter = ColorFilter.tint(tintColor)
+ )
)
}
diff --git a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/OverviewScreen.kt b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/OverviewScreen.kt
index 7f26450..08db65e 100644
--- a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/OverviewScreen.kt
+++ b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/OverviewScreen.kt
@@ -19,17 +19,18 @@
import android.annotation.SuppressLint
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
import androidx.ui.layout.EdgeInsets
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.Card
import androidx.ui.material.Divider
import androidx.ui.material.IconButton
@@ -42,11 +43,11 @@
@Composable
fun OverviewBody() {
VerticalScroller {
- Column(modifier = LayoutPadding(16.dp)) {
+ Column(Modifier.padding(16.dp)) {
AlertCard()
- Spacer(LayoutHeight(RallyDefaultPadding))
+ Spacer(Modifier.preferredHeight(RallyDefaultPadding))
AccountsCard()
- Spacer(LayoutHeight(RallyDefaultPadding))
+ Spacer(Modifier.preferredHeight(RallyDefaultPadding))
BillsCard()
}
}
@@ -71,9 +72,9 @@
}
Card {
Column {
- AlertHeader({ openDialog = true })
+ AlertHeader { openDialog = true }
RallyDivider(
- modifier = LayoutPadding(start = RallyDefaultPadding, end = RallyDefaultPadding)
+ modifier = Modifier.padding(start = RallyDefaultPadding, end = RallyDefaultPadding)
)
AlertItem(alertMessage)
}
@@ -83,18 +84,18 @@
@Composable
private fun AlertHeader(onClickSeeAll: () -> Unit) {
Row(
- modifier = LayoutPadding(RallyDefaultPadding) + LayoutWidth.Fill,
+ modifier = Modifier.padding(RallyDefaultPadding).fillMaxWidth(),
arrangement = Arrangement.SpaceBetween
) {
Text(
text = "Alerts",
style = MaterialTheme.typography.subtitle2,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
)
TextButton(
>
innerPadding = EdgeInsets(0.dp),
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(RowAlign.Center)
) {
Text("SEE ALL")
}
@@ -105,17 +106,17 @@
private fun AlertItem(message: String) {
// TODO: Make alerts into a data structure
Row(
- modifier = LayoutPadding(RallyDefaultPadding),
+ modifier = Modifier.padding(RallyDefaultPadding),
arrangement = Arrangement.SpaceBetween
) {
Text(
style = MaterialTheme.typography.h3,
- modifier = LayoutWeight(1f),
+ modifier = Modifier.weight(1f),
text = message
)
IconButton(
>
- modifier = LayoutGravity.Top
+ modifier = Modifier.gravity(RowAlign.Top)
) {
Icon(Icons.Filled.Sort)
}
@@ -136,13 +137,13 @@
) {
Card {
Column {
- Column(modifier = LayoutPadding(RallyDefaultPadding)) {
+ Column(Modifier.padding(RallyDefaultPadding)) {
Text(text = title, style = MaterialTheme.typography.subtitle2)
val amountText = "$" + formatAmount(amount)
Text(text = amountText, style = MaterialTheme.typography.h2)
}
Divider(color = rallyGreen, height = 1.dp)
- Column(LayoutPadding(start = 16.dp, top = 4.dp, end = 8.dp)) {
+ Column(Modifier.padding(start = 16.dp, top = 4.dp, end = 8.dp)) {
data.take(3).forEach { row(it) }
SeeAllButton(>
}
@@ -200,7 +201,7 @@
private fun SeeAllButton(onClick: () -> Unit) {
TextButton(
>
- modifier = LayoutHeight(44.dp) + LayoutWidth.Fill
+ modifier = Modifier.preferredHeight(44.dp).fillMaxWidth()
) {
Text("SEE ALL")
}
diff --git a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/RallyAlertDialog.kt b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/RallyAlertDialog.kt
index 08efbb3..9b90e95 100644
--- a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/RallyAlertDialog.kt
+++ b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/RallyAlertDialog.kt
@@ -17,12 +17,13 @@
package androidx.ui.material.studies.rally
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.layout.Column
import androidx.ui.layout.EdgeInsets
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
import androidx.ui.material.AlertDialog
import androidx.ui.material.Divider
import androidx.ui.material.MaterialTheme
@@ -42,14 +43,14 @@
buttons = {
Column {
Divider(
- LayoutPadding(start = 12.dp, end = 12.dp),
+ Modifier.padding(12.dp, 0.dp, 12.dp, 0.dp),
color = MaterialTheme.colors.onSurface.copy(alpha = 0.2f)
)
TextButton(
>
shape = RectangleShape,
innerPadding = EdgeInsets(16.dp),
- modifier = LayoutWidth.Fill
+ modifier = Modifier.fillMaxWidth()
) {
Text(buttonText)
}
diff --git a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/TopAppBar.kt b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/TopAppBar.kt
index 7348e06..6c45ddd 100644
--- a/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/TopAppBar.kt
+++ b/ui/ui-material/integration-tests/material-studies/src/main/java/androidx/ui/material/studies/rally/TopAppBar.kt
@@ -22,16 +22,18 @@
import androidx.compose.remember
import androidx.ui.animation.ColorPropKey
import androidx.ui.animation.Transition
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Text
import androidx.ui.foundation.selection.MutuallyExclusiveSetItem
import androidx.ui.graphics.Color
import androidx.ui.graphics.vector.VectorAsset
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Surface
import androidx.ui.material.ripple.ripple
@@ -45,7 +47,7 @@
onTabSelected: (RallyScreenState) -> Unit,
currentScreen: RallyScreenState
) {
- Surface(modifier = LayoutHeight(TabHeight) + LayoutWidth.Fill) {
+ Surface(Modifier.preferredHeight(TabHeight).fillMaxWidth()) {
Row {
allScreens.forEachIndexed { index, screen ->
RallyTab(
@@ -67,7 +69,7 @@
selected: Boolean
) {
TabTransition(selected = selected) { tabTintColor ->
- Box(LayoutPadding(16.dp) + LayoutHeight(TabHeight)) {
+ Box(Modifier.padding(16.dp).preferredHeight(TabHeight)) {
MutuallyExclusiveSetItem(
selected = selected,
>
@@ -76,7 +78,7 @@
Row {
Icon(vectorImage = icon, tintColor = tabTintColor)
if (selected) {
- Spacer(modifier = LayoutWidth(12.dp))
+ Spacer(Modifier.preferredWidth(12.dp))
Text(text, style = TextStyle(color = tabTintColor))
}
}
diff --git a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/AppBarSamples.kt b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/AppBarSamples.kt
index 08976df..468153e 100644
--- a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/AppBarSamples.kt
+++ b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/AppBarSamples.kt
@@ -18,6 +18,7 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Icon
import androidx.ui.foundation.Text
import androidx.ui.foundation.shape.corner.CircleShape
@@ -61,7 +62,7 @@
Icon(Icons.Filled.Menu)
}
// The actions should be at the end of the BottomAppBar
- Spacer(LayoutWeight(1f))
+ Spacer(Modifier.weight(1f, true))
IconButton( /* doSomething() */ }) {
Icon(Icons.Filled.Favorite)
}
diff --git a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/DrawerSamples.kt b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/DrawerSamples.kt
index 7580314..b704d91 100644
--- a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/DrawerSamples.kt
+++ b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/DrawerSamples.kt
@@ -19,17 +19,19 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.BottomDrawerLayout
import androidx.ui.material.Button
import androidx.ui.material.DrawerState
@@ -40,7 +42,7 @@
@Sampled
@Composable
fun StaticDrawerSample() {
- Row(LayoutWidth.Fill) {
+ Row(Modifier.fillMaxWidth()) {
StaticDrawer {
Text("Drawer Content")
}
@@ -79,10 +81,10 @@
@Composable
private fun YourDrawerContent(onStateChange: (DrawerState) -> Unit) {
- Box(LayoutSize.Fill, gravity = ContentGravity.Center) {
- Column(LayoutHeight.Fill) {
+ Box(Modifier.fillMaxSize(), gravity = ContentGravity.Center) {
+ Column(Modifier.fillMaxHeight()) {
Text(text = "Drawer Content")
- Spacer(LayoutHeight(20.dp))
+ Spacer(Modifier.preferredHeight(20.dp))
Button( onStateChange(DrawerState.Closed) }) {
Text("Close Drawer")
}
@@ -92,9 +94,9 @@
@Composable
private fun YourAppContent(text: String, onDrawerStateChange: (DrawerState) -> Unit) {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
Text(text = text)
- Spacer(LayoutHeight(20.dp))
+ Spacer(Modifier.preferredHeight(20.dp))
Button( onDrawerStateChange(DrawerState.Opened) }) {
Text("Click to open")
}
diff --git a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/SelectionControlsSamples.kt b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/SelectionControlsSamples.kt
index 27e871f..9e8b595 100644
--- a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/SelectionControlsSamples.kt
+++ b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/SelectionControlsSamples.kt
@@ -20,13 +20,14 @@
import androidx.compose.Composable
import androidx.compose.remember
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Text
import androidx.ui.foundation.selection.ToggleableState
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
import androidx.ui.layout.Row
+import androidx.ui.layout.padding
import androidx.ui.material.Checkbox
import androidx.ui.material.RadioButton
import androidx.ui.material.RadioGroup
@@ -56,7 +57,7 @@
}
TriStateCheckbox(state = parentState, color = Color.Black)
- Column(LayoutPadding(start = 10.dp)) {
+ Column(Modifier.padding(10.dp, 0.dp, 0.dp, 0.dp)) {
Checkbox(state, onStateChange)
Checkbox(state2, onStateChange2)
}
@@ -130,7 +131,7 @@
onOptionSelected(text) }) {
// TODO: remove Box when Ripple becomes a modifier
Box {
- Column(modifier = LayoutPadding(10.dp)) {
+ Column(modifier = Modifier.padding(10.dp)) {
RadioButton(
selected = selected,
onOptionSelected(text) })
diff --git a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
index 401eae1..ba10137 100644
--- a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
+++ b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
@@ -26,24 +26,27 @@
import androidx.ui.animation.PxPropKey
import androidx.ui.animation.Transition
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.DrawBorder
import androidx.ui.foundation.Icon
import androidx.ui.foundation.Text
+import androidx.ui.foundation.drawBackground
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutOffset
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.offset
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Tab
import androidx.ui.material.TabRow
@@ -62,7 +65,7 @@
Tab(text = { Text(text) }, selected = state == index, state = index })
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Text tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -78,7 +81,7 @@
Tab(icon = { Icon(icon) }, selected = state == index, state = index })
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Icon tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -103,7 +106,7 @@
)
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Text and icon tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -130,7 +133,7 @@
Tab(text = { Text(text) }, selected = state == index, state = index })
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Scrolling text tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -147,7 +150,7 @@
FancyTab(title = title, state = index }, selected = (index == state))
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Fancy tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -176,7 +179,7 @@
Tab(text = { Text(text) }, selected = state == index, state = index })
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Fancy indicator tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -202,7 +205,7 @@
Tab(text = { Text(text) }, selected = state == index, state = index })
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Fancy transition tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -238,7 +241,7 @@
Tab(text = { Text(text) }, selected = state == index, state = index })
}
Text(
- modifier = LayoutGravity.Center,
+ modifier = Modifier.gravity(ColumnAlign.Center),
text = "Scrolling fancy transition tab ${state + 1} selected",
style = MaterialTheme.typography.body1
)
@@ -250,19 +253,19 @@
fun FancyTab(title: String, onClick: () -> Unit, selected: Boolean) {
Tab(selected, onClick) {
Column(
- LayoutPadding(10.dp) + LayoutHeight(50.dp) + LayoutWidth.Fill,
+ Modifier.padding(10.dp).preferredHeight(50.dp).fillMaxWidth(),
arrangement = Arrangement.SpaceBetween
) {
Box(
- LayoutSize(10.dp) + LayoutGravity.Center + DrawBackground(
- color = if (selected) Color.Red else Color.White
- ),
+ Modifier.preferredSize(10.dp)
+ .gravity(ColumnAlign.Center)
+ .drawBackground(color = if (selected) Color.Red else Color.White),
children = emptyContent()
)
Text(
text = title,
style = MaterialTheme.typography.body1,
- modifier = LayoutGravity.Center
+ modifier = Modifier.gravity(ColumnAlign.Center)
)
}
}
@@ -274,10 +277,14 @@
// Draws a rounded rectangular with border around the Tab, with a 5.dp padding from the edges
// Color is passed in as a parameter [color]
Stack(
- LayoutPadding(5.dp) + LayoutSize.Fill + DrawBorder(
- Border(2.dp, color),
- RoundedCornerShape(5.dp)
- )
+ Modifier.padding(5.dp)
+ .fillMaxSize()
+ .plus(
+ DrawBorder(
+ Border(2.dp, color),
+ RoundedCornerShape(5.dp)
+ )
+ )
) {}
}
@@ -325,7 +332,7 @@
// Fill up the entire TabRow with this container, and place children at the left so we can use
// Padding to set the 'offset'
- Box(LayoutSize.Fill, gravity = ContentGravity.BottomStart) {
+ Box(Modifier.fillMaxSize(), gravity = ContentGravity.BottomStart) {
Transition(transitionDefinition, selectedIndex) { state ->
val density = DensityAmbient.current
val offset = with(density) { state[indicatorStart].toDp() }
@@ -333,7 +340,7 @@
(state[indicatorEnd] - state[indicatorStart]).toDp()
}
Box(
- LayoutOffset(x = offset, y = 0.dp) + LayoutWidth(width),
+ Modifier.offset(x = offset, y = 0.dp).preferredWidth(width),
gravity = ContentGravity.Center
) {
// Pass the current color to the indicator
diff --git a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/ThemeSamples.kt b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/ThemeSamples.kt
index 2b9b57f..f0bc09d 100644
--- a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/ThemeSamples.kt
+++ b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/ThemeSamples.kt
@@ -18,11 +18,12 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.Text
import androidx.ui.foundation.isSystemInDarkTheme
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAspectRatio
+import androidx.ui.layout.aspectRatio
import androidx.ui.material.ExtendedFloatingActionButton
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Typography
@@ -68,7 +69,7 @@
@Composable
fun ThemeColorSample() {
val colors = MaterialTheme.colors
- ColoredRect(color = colors.primary, modifier = LayoutAspectRatio(1f))
+ ColoredRect(color = colors.primary, modifier = Modifier.aspectRatio(1f))
}
@Sampled
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
index ef31c0b..6f3f62c 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
@@ -85,20 +85,20 @@
var titleLastBaselineRelativePosition: Px? = null
var actionCoords: LayoutCoordinates? = null
composeTestRule.setMaterialContent {
- Box(onChildPositioned { appBarCoords = it }) {
+ Box(Modifier.onChildPositioned { appBarCoords = it }) {
TopAppBar(
navigationIcon = {
- FakeIcon(onPositioned { navigationIconCoords = it })
+ FakeIcon(Modifier.onPositioned { navigationIconCoords = it })
},
title = {
- Text("title", onPositioned { coords ->
+ Text("title", Modifier.onPositioned { coords: LayoutCoordinates ->
titleCoords = coords
titleLastBaselineRelativePosition =
coords[LastBaseline]!!.toPx()
})
},
actions = {
- FakeIcon(onPositioned { actionCoords = it })
+ FakeIcon(Modifier.onPositioned { actionCoords = it })
}
)
}
@@ -152,13 +152,14 @@
var titleCoords: LayoutCoordinates? = null
var actionCoords: LayoutCoordinates? = null
composeTestRule.setMaterialContent {
- Box(onChildPositioned { appBarCoords = it }) {
+ Box(Modifier.onChildPositioned { appBarCoords = it }) {
TopAppBar(
title = {
- Text("title", onPositioned { titleCoords = it })
+ Text("title",
+ Modifier.onPositioned { titleCoords = it })
},
actions = {
- FakeIcon(onPositioned { actionCoords = it })
+ FakeIcon(Modifier.onPositioned { actionCoords = it })
}
)
}
@@ -213,9 +214,9 @@
var appBarCoords: LayoutCoordinates? = null
var childCoords: LayoutCoordinates? = null
composeTestRule.setMaterialContent {
- Box(onChildPositioned { appBarCoords = it }) {
+ Box(Modifier.onChildPositioned { appBarCoords = it }) {
BottomAppBar {
- FakeIcon(onPositioned { childCoords = it })
+ FakeIcon(Modifier.onPositioned { childCoords = it })
}
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
index 510a510..9671718 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
@@ -18,6 +18,7 @@
import androidx.test.filters.LargeTest
import androidx.ui.core.LastBaseline
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.globalPosition
import androidx.ui.core.onPositioned
import androidx.ui.foundation.Box
@@ -57,14 +58,13 @@
fun bottomNavigation_size() {
lateinit var parentCoords: LayoutCoordinates
val height = 56.dp
- composeTestRule
- .setMaterialContentAndCollectSizes(modifier =
- onPositioned { coords ->
- parentCoords = coords
- }
- ) {
- BottomNavigationSample()
+ composeTestRule.setMaterialContentAndCollectSizes(
+ modifier = Modifier.onPositioned { coords: LayoutCoordinates ->
+ parentCoords = coords
}
+ ) {
+ BottomNavigationSample()
+ }
.assertWidthEqualsTo { parentCoords.size.width }
.assertHeightEqualsTo(height)
}
@@ -73,7 +73,7 @@
fun bottomNavigationItem_sizeAndPositions() {
lateinit var parentCoords: LayoutCoordinates
val itemCoords = mutableMapOf<Int, LayoutCoordinates>()
- composeTestRule.setMaterialContent(modifier = onPositioned { coords ->
+ composeTestRule.setMaterialContent(Modifier.onPositioned { coords: LayoutCoordinates ->
parentCoords = coords
}) {
Box {
@@ -84,7 +84,9 @@
text = { Text("Item $index") },
selected = index == 0,
>
- modifier = onPositioned { coords -> itemCoords[index] = coords }
+ modifier = Modifier.onPositioned { coords: LayoutCoordinates ->
+ itemCoords[index] = coords
+ }
)
}
}
@@ -117,12 +119,18 @@
Box {
BottomNavigation {
BottomNavigationItem(
- modifier = onPositioned { coords -> itemCoords = coords },
+ modifier = Modifier.onPositioned { coords: LayoutCoordinates ->
+ itemCoords = coords
+ },
icon = {
- Icon(Icons.Filled.Favorite, onPositioned { iconCoords = it })
+ Icon(Icons.Filled.Favorite,
+ Modifier.onPositioned { iconCoords = it }
+ )
},
text = {
- Text("Item", onPositioned { textCoords = it })
+ Text("Item",
+ Modifier.onPositioned { textCoords = it }
+ )
},
selected = true,
>
@@ -164,9 +172,13 @@
Box {
BottomNavigation {
BottomNavigationItem(
- modifier = onPositioned { coords -> itemCoords = coords },
+ modifier = Modifier.onPositioned { coords: LayoutCoordinates ->
+ itemCoords = coords
+ },
icon = {
- Icon(Icons.Filled.Favorite, onPositioned { iconCoords = it })
+ Icon(Icons.Filled.Favorite,
+ Modifier.onPositioned { iconCoords = it }
+ )
},
text = {
// TODO: b/149477576 we need a boundary here so that we don't
@@ -207,9 +219,13 @@
Box {
BottomNavigation {
BottomNavigationItem(
- modifier = onPositioned { coords -> itemCoords = coords },
+ modifier = Modifier.onPositioned { coords: LayoutCoordinates ->
+ itemCoords = coords
+ },
icon = {
- Icon(Icons.Filled.Favorite, onPositioned { iconCoords = it })
+ Icon(Icons.Filled.Favorite,
+ Modifier.onPositioned { iconCoords = it }
+ )
},
text = {},
selected = false,
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
index 00b1508..a301e16 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
@@ -20,6 +20,7 @@
import androidx.compose.state
import androidx.test.filters.MediumTest
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.core.onChildPositioned
import androidx.ui.core.onPositioned
@@ -290,9 +291,11 @@
var parentCoordinates: LayoutCoordinates? = null
var childCoordinates: LayoutCoordinates? = null
composeTestRule.setMaterialContent {
- Stack(onChildPositioned { parentCoordinates = it }) {
+ Stack(Modifier.onChildPositioned { parentCoordinates = it }) {
button {
- Text("Test button", onPositioned { childCoordinates = it })
+ Text("Test button",
+ Modifier.onPositioned { childCoordinates = it }
+ )
}
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
index 9794f24..acc6cfd 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
@@ -20,11 +20,13 @@
import androidx.compose.Model
import androidx.compose.emptyContent
import androidx.test.filters.MediumTest
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.core.onPositioned
import androidx.ui.foundation.Box
import androidx.ui.foundation.Clickable
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.createComposeRule
import androidx.ui.test.doGesture
@@ -64,7 +66,7 @@
var position: PxPosition? = null
composeTestRule.setMaterialContent {
ModalDrawerLayout(DrawerState.Opened, {}, drawerContent = {
- Box(LayoutSize.Fill + onPositioned { coords ->
+ Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
position = coords.localToGlobal(PxPosition.Origin)
})
}, bodyContent = emptyContent())
@@ -79,7 +81,7 @@
var position: PxPosition? = null
composeTestRule.setMaterialContent {
ModalDrawerLayout(DrawerState.Closed, {}, drawerContent = {
- Box(LayoutSize.Fill + onPositioned { coords ->
+ Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
position = coords.localToGlobal(PxPosition.Origin)
})
}, bodyContent = emptyContent())
@@ -95,7 +97,9 @@
var size: IntPxSize? = null
composeTestRule.setMaterialContent {
ModalDrawerLayout(DrawerState.Opened, {}, drawerContent = {
- Box(LayoutSize.Fill + onPositioned { coords -> size = coords.size })
+ Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
+ size = coords.size
+ })
}, bodyContent = emptyContent())
}
@@ -111,7 +115,7 @@
var position: PxPosition? = null
composeTestRule.setMaterialContent {
BottomDrawerLayout(DrawerState.Opened, {}, drawerContent = {
- Box(LayoutSize.Fill + onPositioned { coords ->
+ Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
position = coords.localToGlobal(PxPosition.Origin)
})
}, bodyContent = emptyContent())
@@ -131,7 +135,7 @@
var position: PxPosition? = null
composeTestRule.setMaterialContent {
BottomDrawerLayout(DrawerState.Closed, {}, drawerContent = {
- Box(LayoutSize.Fill + onPositioned { coords ->
+ Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
position = coords.localToGlobal(PxPosition.Origin)
})
}, bodyContent = emptyContent())
@@ -147,7 +151,7 @@
composeTestRule
.setMaterialContentAndCollectSizes {
StaticDrawer {
- Box(LayoutSize.Fill)
+ Box(Modifier.fillMaxSize())
}
}
.assertWidthEqualsTo(256.dp)
@@ -166,7 +170,7 @@
ModalDrawerLayout(drawerState.state, { drawerState.state = it },
drawerContent = {
Box(
- LayoutSize.Fill + onPositioned { info ->
+ Modifier.fillMaxSize().onPositioned { info: LayoutCoordinates ->
val pos = info.localToGlobal(PxPosition.Origin)
if (pos.x == 0.px) {
// If fully opened, mark the openedLatch if present
@@ -179,7 +183,8 @@
)
},
bodyContent = {
- Box(LayoutSize.Fill + onPositioned { contentWidth = it.size.width })
+ Box(Modifier.fillMaxSize()
+ .onPositioned { contentWidth = it.size.width })
})
}
}
@@ -216,12 +221,12 @@
ModalDrawerLayout(drawerState.state, { drawerState.state = it },
drawerContent = {
Clickable( drawerClicks += 1 }) {
- Box(LayoutSize.Fill, children = emptyContent())
+ Box(Modifier.fillMaxSize(), children = emptyContent())
}
},
bodyContent = {
Clickable( bodyClicks += 1 }) {
- Box(LayoutSize.Fill, children = emptyContent())
+ Box(Modifier.fillMaxSize(), children = emptyContent())
}
})
}
@@ -265,7 +270,7 @@
Semantics(container = true) {
BottomDrawerLayout(drawerState.state, { drawerState.state = it },
drawerContent = {
- Box(LayoutSize.Fill + onPositioned { info ->
+ Box(Modifier.fillMaxSize().onPositioned { info: LayoutCoordinates ->
val pos = info.localToGlobal(PxPosition.Origin)
if (pos.y.round() == openedHeight) {
// If fully opened, mark the openedLatch if present
@@ -277,7 +282,7 @@
})
},
bodyContent = {
- Box(LayoutSize.Fill + onPositioned {
+ Box(Modifier.fillMaxSize().onPositioned {
contentHeight = it.size.height
openedHeight = it.size.height * BottomDrawerOpenFraction
})
@@ -318,12 +323,12 @@
BottomDrawerLayout(drawerState.state, { drawerState.state = it },
drawerContent = {
Clickable( drawerClicks += 1 }) {
- Box(LayoutSize.Fill, children = emptyContent())
+ Box(Modifier.fillMaxSize(), children = emptyContent())
}
},
bodyContent = {
Clickable( bodyClicks += 1 }) {
- Box(LayoutSize.Fill, children = emptyContent())
+ Box(Modifier.fillMaxSize(), children = emptyContent())
}
})
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ElevationOverlayTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ElevationOverlayTest.kt
index d003b17..ba4eeb7 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ElevationOverlayTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ElevationOverlayTest.kt
@@ -19,10 +19,11 @@
import android.os.Build
import androidx.test.filters.LargeTest
import androidx.test.filters.SdkSuppress
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.assertPixels
import androidx.ui.test.captureToBitmap
@@ -101,7 +102,7 @@
TestTag(Tag) {
Semantics(container = true) {
Box(
- LayoutSize(
+ Modifier.preferredSize(
SurfaceSize.width.toDp(),
SurfaceSize.height.toDp()
)
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
index 85613ed..c6ce9f2 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
@@ -18,11 +18,10 @@
import androidx.compose.emptyContent
import androidx.test.filters.LargeTest
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.onPositioned
import androidx.ui.foundation.Box
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.preferredSize
import androidx.ui.material.samples.IconButtonSample
import androidx.ui.material.samples.IconToggleButtonSample
import androidx.ui.test.assertIsOff
@@ -69,7 +68,7 @@
Box {
IconButton( {
Box(
- LayoutSize(diameter) + onPositioned { iconCoords = it },
+ Modifier.preferredSize(diameter).onPositioned { iconCoords = it },
children = emptyContent()
)
}
@@ -94,8 +93,7 @@
Box {
IconButton( {
Box(
- LayoutWidth(width) + LayoutHeight(height) +
- onPositioned { iconCoords = it },
+ Modifier.preferredSize(width, height).onPositioned { iconCoords = it },
children = emptyContent()
)
}
@@ -134,7 +132,7 @@
Box {
IconToggleButton(checked = false, {
Box(
- LayoutSize(diameter) + onPositioned { iconCoords = it },
+ Modifier.preferredSize(diameter).onPositioned { iconCoords = it },
children = emptyContent()
)
}
@@ -159,8 +157,7 @@
Box {
IconToggleButton(checked = false, {
Box(
- LayoutWidth(width) + LayoutHeight(height) +
- onPositioned { iconCoords = it },
+ Modifier.preferredSize(width, height).onPositioned { iconCoords = it },
children = emptyContent())
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
index d40e108..892480f 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
@@ -18,6 +18,7 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.FirstBaseline
+import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.Modifier
import androidx.ui.core.Ref
import androidx.ui.core.onPositioned
@@ -633,7 +634,7 @@
coords: Ref<PxPosition>,
size: Ref<IntPxSize>,
baseline: Ref<Px> = Ref()
- ): Modifier = onPositioned { coordinates ->
+ ): Modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
coords.value = coordinates.localToGlobal(PxPosition.Origin)
baseline.value = coordinates[FirstBaseline]?.toPx()?.let {
it + coords.value!!.y
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt
index 440f8ab..a5bc064 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt
@@ -23,23 +23,24 @@
import androidx.compose.mutableStateOf
import androidx.test.filters.MediumTest
import androidx.test.filters.SdkSuppress
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.foundation.Box
import androidx.ui.foundation.Clickable
import androidx.ui.foundation.ContentGravity
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.foundation.drawBackground
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Canvas
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
-import androidx.ui.material.ripple.RippleThemeAmbient
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.material.ripple.RippleEffect
import androidx.ui.material.ripple.RippleEffectFactory
import androidx.ui.material.ripple.RippleTheme
+import androidx.ui.material.ripple.RippleThemeAmbient
import androidx.ui.material.ripple.ripple
import androidx.ui.test.assertShape
import androidx.ui.test.captureToBitmap
@@ -80,10 +81,10 @@
DrawRectRippleCallback {
TestTag(contentTag) {
Box(
- modifier = DrawBackground(Color.Blue),
+ modifier = Modifier.drawBackground(Color.Blue),
gravity = ContentGravity.Center
) {
- Box(LayoutSize(10.dp) + ripple())
+ Box(Modifier.preferredSize(10.dp) + ripple())
}
}
}
@@ -112,15 +113,15 @@
DrawRectRippleCallback {
TestTag(contentTag) {
Box(
- modifier = DrawBackground(Color.Blue),
+ modifier = Modifier.drawBackground(Color.Blue),
gravity = ContentGravity.Center
) {
Box(
- LayoutSize(30.dp) +
- LayoutPadding(5.dp) +
- ripple() +
- // this padding should not affect the size of the ripple
- LayoutPadding(5.dp)
+ Modifier.preferredSize(30.dp)
+ .padding(5.dp)
+ .plus(ripple())
+ // this padding should not affect the size of the ripple
+ .padding(5.dp)
)
}
}
@@ -150,10 +151,10 @@
DrawRectRippleCallback {
TestTag(contentTag) {
Box(
- modifier = DrawBackground(Color.Blue),
+ modifier = Modifier.drawBackground(Color.Blue),
gravity = ContentGravity.Center
) {
- Box(LayoutSize(10.dp) + ripple(bounded = false))
+ Box(Modifier.preferredSize(10.dp) + ripple(bounded = false))
}
}
}
@@ -180,10 +181,14 @@
DrawRectRippleCallback {
TestTag(contentTag) {
Box(
- modifier = DrawBackground(Color.Blue),
+ modifier = Modifier.drawBackground(Color.Blue),
gravity = ContentGravity.Center
) {
- Box(LayoutSize(10.dp) + ripple() + DrawBackground(Color.Blue))
+ Box(
+ Modifier.preferredSize(10.dp)
+ .plus(ripple())
+ .drawBackground(Color.Blue)
+ )
}
}
}
@@ -360,7 +365,7 @@
>
modifier = ripple(bounded = false, color = color, enabled = enabled)
) {
- Box(LayoutSize(size))
+ Box(Modifier.preferredSize(size))
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
index b38d1bb..ece5919 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
@@ -17,6 +17,8 @@
package androidx.ui.material
import androidx.test.filters.MediumTest
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.core.onPositioned
import androidx.ui.foundation.ColoredRect
@@ -72,8 +74,12 @@
lateinit var child2: PxPosition
composeTestRule.setMaterialContent {
Scaffold {
- Text("One", onPositioned { child1 = it.positionInParent })
- Text("Two", onPositioned { child2 = it.positionInParent })
+ Text("One",
+ Modifier.onPositioned { child1 = it.positionInParent }
+ )
+ Text("Two",
+ Modifier.onPositioned { child2 = it.positionInParent }
+ )
}
}
assertThat(child1.y).isEqualTo(child2.y)
@@ -90,7 +96,7 @@
topAppBar = {
ColoredRect(
Color.Red,
- onPositioned { positioned ->
+ Modifier.onPositioned { positioned: LayoutCoordinates ->
appbarPosition = positioned.localToGlobal(PxPosition.Origin)
appbarSize = positioned.size
},
@@ -100,7 +106,7 @@
) {
ColoredRect(
Color.Blue,
- onPositioned { contentPosition = it.localToGlobal(PxPosition.Origin) },
+ Modifier.onPositioned { contentPosition = it.localToGlobal(PxPosition.Origin) },
height = 50.dp)
}
}
@@ -118,7 +124,7 @@
bottomAppBar = {
ColoredRect(
Color.Red,
- onPositioned { positioned ->
+ Modifier.onPositioned { positioned: LayoutCoordinates ->
appbarPosition = positioned.positionInParent
appbarSize = positioned.size
},
@@ -128,7 +134,7 @@
) {
ColoredRect(
Color.Blue,
- onPositioned { positioned ->
+ Modifier.onPositioned { positioned: LayoutCoordinates ->
contentPosition = positioned.positionInParent
contentSize = positioned.size
},
@@ -154,7 +160,7 @@
drawerContent = {
ColoredRect(
Color.Blue,
- onPositioned { positioned ->
+ Modifier.onPositioned { positioned: LayoutCoordinates ->
drawerChildPosition = positioned.positionInParent
},
height = 50.dp
@@ -203,7 +209,7 @@
drawerContent = {
ColoredRect(
Color.Blue,
- onPositioned { positioned ->
+ Modifier.onPositioned { positioned: LayoutCoordinates ->
drawerChildPosition = positioned.positionInParent
},
height = 50.dp
@@ -267,7 +273,7 @@
Scaffold(
floatingActionButton = {
FloatingActionButton(
- modifier = onPositioned { positioned ->
+ modifier = Modifier.onPositioned { positioned: LayoutCoordinates ->
fabSize = positioned.size
fabPosition = positioned.localToGlobal(positioned.positionInParent)
},
@@ -279,7 +285,7 @@
bottomAppBar = {
ColoredRect(
Color.Red,
- onPositioned { positioned ->
+ Modifier.onPositioned { positioned: LayoutCoordinates ->
bottomBarPosition =
positioned.localToGlobal(positioned.positionInParent)
},
@@ -303,7 +309,7 @@
Scaffold(
floatingActionButton = {
FloatingActionButton(
- modifier = onPositioned { positioned ->
+ modifier = Modifier.onPositioned { positioned: LayoutCoordinates ->
fabSize = positioned.size
fabPosition = positioned.localToGlobal(positioned.positionInParent)
},
@@ -316,7 +322,7 @@
bottomAppBar = {
ColoredRect(
Color.Red,
- onPositioned { positioned ->
+ Modifier.onPositioned { positioned: LayoutCoordinates ->
bottomBarPosition =
positioned.localToGlobal(positioned.positionInParent)
},
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
index 71655f6..de41ad5 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
@@ -20,6 +20,7 @@
import androidx.ui.core.FirstBaseline
import androidx.ui.core.LastBaseline
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.globalPosition
import androidx.ui.core.onPositioned
import androidx.ui.foundation.Text
@@ -82,7 +83,9 @@
) {
Snackbar(
text = {
- Text("Message", onPositioned { textCoords = it })
+ Text("Message",
+ Modifier.onPositioned { textCoords = it }
+ )
}
)
}
@@ -111,13 +114,20 @@
parentConstraints = DpConstraints(maxWidth = 300.dp)
) {
Snackbar(
- modifier = onPositioned { snackCoords = it },
+ modifier = Modifier.onPositioned { snackCoords = it },
text = {
- Text("Message", onPositioned { textCoords = it })
+ Text("Message",
+ Modifier.onPositioned { textCoords = it }
+ )
},
action = {
- TextButton( modifier = onPositioned { buttonCoords = it }) {
- Text("Undo", onPositioned { buttonTextCoords = it })
+ TextButton(
+ >
+ modifier = Modifier.onPositioned { buttonCoords = it }
+ ) {
+ Text("Undo",
+ Modifier.onPositioned { buttonTextCoords = it }
+ )
}
}
)
@@ -163,7 +173,8 @@
) {
Snackbar(
text = {
- Text(longText, onPositioned { textCoords = it }, maxLines = 2)
+ Text(longText,
+ Modifier.onPositioned { textCoords = it }, maxLines = 2)
}
)
}
@@ -192,12 +203,16 @@
parentConstraints = DpConstraints(maxWidth = 300.dp)
) {
Snackbar(
- modifier = onPositioned { snackCoords = it },
+ modifier = Modifier.onPositioned { snackCoords = it },
text = {
- Text(longText, onPositioned { textCoords = it }, maxLines = 2)
+ Text(longText,
+ Modifier.onPositioned { textCoords = it }, maxLines = 2)
},
action = {
- TextButton(modifier = onPositioned { buttonCoords = it }, {
+ TextButton(
+ modifier = Modifier.onPositioned { buttonCoords = it },
+ >
+ ) {
Text("Undo")
}
}
@@ -243,12 +258,17 @@
parentConstraints = DpConstraints(maxWidth = 300.dp)
) {
Snackbar(
- modifier = onPositioned { snackCoords = it },
+ modifier = Modifier.onPositioned { snackCoords = it },
text = {
- Text("Message", onPositioned { textCoords = it })
+ Text("Message",
+ Modifier.onPositioned { textCoords = it }
+ )
},
action = {
- TextButton( modifier = onPositioned { buttonCoords = it }) {
+ TextButton(
+ >
+ modifier = Modifier.onPositioned { buttonCoords = it }
+ ) {
Text("Undo")
}
},
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
index f59fb2a..c34c259 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
@@ -20,6 +20,7 @@
import androidx.test.filters.LargeTest
import androidx.ui.core.LastBaseline
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.onChildPositioned
import androidx.ui.core.onPositioned
import androidx.ui.foundation.Box
@@ -27,7 +28,7 @@
import androidx.ui.foundation.Icon
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.icons.Icons
import androidx.ui.material.icons.filled.Favorite
import androidx.ui.material.samples.ScrollingTextTabs
@@ -115,13 +116,13 @@
TabRow.IndicatorContainer(tabPositions, state) {
ColoredRect(
Color.Red,
- onPositioned { indicatorCoords = it },
+ Modifier.onPositioned { indicatorCoords = it },
height = indicatorHeight
)
}
}
- Box(onChildPositioned { tabRowCoords = it }) {
+ Box(Modifier.onChildPositioned { tabRowCoords = it }) {
TabRow(
items = titles,
selectedIndex = state,
@@ -181,13 +182,13 @@
Box {
TabRow(
- modifier = onPositioned { tabRowCoords = it },
+ modifier = Modifier.onPositioned { tabRowCoords = it },
items = titles,
selectedIndex = state
) { index, text ->
Tab(
text = {
- Text(text, onPositioned { coords ->
+ Text(text, Modifier.onPositioned { coords: LayoutCoordinates ->
textCoords = coords
textBaseline = coords[LastBaseline]!!.toPx()
})
@@ -226,13 +227,13 @@
Box {
TabRow(
- modifier = onPositioned { tabRowCoords = it },
+ modifier = Modifier.onPositioned { tabRowCoords = it },
items = titles,
selectedIndex = state
) { index, text ->
Tab(
text = {
- Text(text, onPositioned { coords ->
+ Text(text, Modifier.onPositioned { coords: LayoutCoordinates ->
textCoords = coords
textBaseline = coords[LastBaseline]!!.toPx()
})
@@ -272,13 +273,13 @@
Box {
TabRow(
- modifier = onPositioned { tabRowCoords = it },
+ modifier = Modifier.onPositioned { tabRowCoords = it },
items = titles,
selectedIndex = state
) { index, text ->
Tab(
text = {
- Text(text, LayoutWidth(100.dp) + onPositioned { coords ->
+ Text(text, Modifier.preferredWidth(100.dp).onPositioned { coords ->
textCoords = coords
textBaseline = coords[LastBaseline]!!.toPx()
}, maxLines = 2)
@@ -321,7 +322,7 @@
TabRow.IndicatorContainer(tabPositions, state) {
ColoredRect(
Color.Red,
- onPositioned { indicatorCoords = it },
+ Modifier.onPositioned { indicatorCoords = it },
height = indicatorHeight
)
}
@@ -329,7 +330,7 @@
Box {
TabRow(
- modifier = onPositioned { tabRowCoords = it },
+ modifier = Modifier.onPositioned { tabRowCoords = it },
items = titles,
scrollable = true,
selectedIndex = state,
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt b/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
index 5b17c17..8cbaca2 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
@@ -17,6 +17,7 @@
package androidx.ui.material
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.Dialog
@@ -24,12 +25,13 @@
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.AlertDialogButtonLayout.SideBySide
import androidx.ui.material.AlertDialogButtonLayout.Stacked
import androidx.ui.unit.dp
@@ -114,13 +116,13 @@
Dialog( {
MaterialTheme(colors = currentColors, typography = currentTypography) {
Surface(
- modifier = LayoutWidth(AlertDialogWidth),
+ modifier = AlertDialogWidth,
shape = AlertDialogShape
) {
val emphasisLevels = MaterialTheme.emphasisLevels
Column {
if (title != null) {
- Box(modifier = TitlePadding + LayoutGravity.Start) {
+ Box(TitlePadding.gravity(ColumnAlign.Start)) {
ProvideEmphasis(emphasisLevels.high) {
val textStyle = MaterialTheme.typography.h6
ProvideTextStyle(textStyle, title)
@@ -129,16 +131,16 @@
} else {
// TODO(b/138924683): Temporary until padding for the Text's
// baseline
- Spacer(LayoutHeight(NoTitleExtraHeight))
+ Spacer(NoTitleExtraHeight)
}
- Box(modifier = TextPadding + LayoutGravity.Start) {
+ Box(TextPadding.gravity(ColumnAlign.Start)) {
ProvideEmphasis(emphasisLevels.medium) {
val textStyle = MaterialTheme.typography.body1
ProvideTextStyle(textStyle, text)
}
}
- Spacer(LayoutHeight(TextToButtonsHeight))
+ Spacer(TextToButtonsHeight)
buttons()
}
}
@@ -165,12 +167,12 @@
dismissButton: @Composable() (() -> Unit)?,
buttonLayout: AlertDialogButtonLayout
) {
- Box(LayoutWidth.Fill + ButtonsPadding, gravity = ContentGravity.CenterEnd) {
+ Box(ButtonsBoxModifier, gravity = ContentGravity.CenterEnd) {
if (buttonLayout == SideBySide) {
Row(arrangement = Arrangement.End) {
if (dismissButton != null) {
dismissButton()
- Spacer(LayoutWidth(ButtonsWidthSpace))
+ Spacer(ButtonsWidthSpace)
}
confirmButton()
@@ -180,7 +182,7 @@
confirmButton()
if (dismissButton != null) {
- Spacer(LayoutHeight(ButtonsHeightSpace))
+ Spacer(ButtonsHeightSpace)
dismissButton()
}
}
@@ -188,17 +190,17 @@
}
}
-private val AlertDialogWidth = 280.dp
-private val ButtonsPadding = LayoutPadding(all = 8.dp)
-private val ButtonsWidthSpace = 8.dp
-private val ButtonsHeightSpace = 12.dp
+private val AlertDialogWidth = Modifier.preferredWidth(280.dp)
+private val ButtonsBoxModifier = Modifier.fillMaxWidth().padding(all = 8.dp)
+private val ButtonsWidthSpace = Modifier.preferredWidth(8.dp)
+private val ButtonsHeightSpace = Modifier.preferredHeight(12.dp)
// TODO(b/138924683): Top padding should be actually be a distance between the Text baseline and
// the Title baseline
-private val TextPadding = LayoutPadding(start = 24.dp, top = 20.dp, end = 24.dp, bottom = 0.dp)
+private val TextPadding = Modifier.padding(start = 24.dp, top = 20.dp, end = 24.dp, bottom = 0.dp)
// TODO(b/138924683): Top padding should be actually be relative to the Text baseline
-private val TitlePadding = LayoutPadding(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 0.dp)
+private val TitlePadding = Modifier.padding(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 0.dp)
// The height difference of the padding between a Dialog with a title and one without a title
-private val NoTitleExtraHeight = 2.dp
-private val TextToButtonsHeight = 28.dp
+private val NoTitleExtraHeight = Modifier.preferredHeight(2.dp)
+private val TextToButtonsHeight = Modifier.preferredHeight(28.dp)
// TODO: The corner radius should be customizable
private val AlertDialogShape = RoundedCornerShape(4.dp)
\ No newline at end of file
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt b/ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
index 1a1ea27..5e9cd38 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
@@ -35,13 +35,15 @@
import androidx.ui.graphics.addOutline
import androidx.ui.layout.AlignmentLineOffset
import androidx.ui.layout.Arrangement
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.RowScope
import androidx.ui.layout.Spacer
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.BottomAppBar.FabConfiguration
import androidx.ui.semantics.Semantics
import androidx.ui.unit.Density
@@ -87,19 +89,16 @@
AppBar(color, contentColor, elevation, RectangleShape, modifier) {
val emphasisLevels = MaterialTheme.emphasisLevels
if (navigationIcon == null) {
- Spacer(LayoutWidth(TitleInsetWithoutIcon))
+ Spacer(TitleInsetWithoutIcon)
} else {
// TODO: make this a row after b/148014745 is fixed
- Box(
- LayoutHeight.Fill + LayoutWidth(TitleInsetWithIcon),
- gravity = ContentGravity.CenterStart
- ) {
+ Box(TitleIconModifier, gravity = ContentGravity.CenterStart) {
ProvideEmphasis(emphasisLevels.high, navigationIcon)
}
}
// TODO(soboleva): rework this once AlignmentLineOffset is a modifier
- Box(LayoutHeight.Fill + LayoutWeight(1f), gravity = ContentGravity.BottomStart) {
+ Box(Modifier.fillMaxHeight().weight(1f), gravity = ContentGravity.BottomStart) {
val baselineOffset = with(DensityAmbient.current) { TitleBaselineOffset.toDp() }
AlignmentLineOffset(alignmentLine = LastBaseline, after = baselineOffset) {
Semantics(container = true) {
@@ -113,7 +112,7 @@
}
// TODO: remove box and center align row's children after b/148014745 is fixed
- Box(modifier = LayoutHeight.Fill, gravity = ContentGravity.CenterEnd) {
+ Box(Modifier.fillMaxHeight(), gravity = ContentGravity.CenterEnd) {
Row(arrangement = Arrangement.End) {
ProvideEmphasis(emphasisLevels.medium) {
actions()
@@ -243,9 +242,9 @@
}
AppBar(color, contentColor, BottomAppBarElevation, shape, modifier) {
// TODO: remove box and inline row's children after b/148014745 is fixed
- Box(LayoutSize.Fill, gravity = ContentGravity.Center) {
+ Box(Modifier.fillMaxSize(), gravity = ContentGravity.Center) {
// TODO: b/150609566 clarify emphasis for children
- Row(LayoutWidth.Fill, children = children)
+ Row(Modifier.fillMaxWidth(), children = children)
}
}
}
@@ -501,10 +500,9 @@
modifier = modifier
) {
Row(
- LayoutWidth.Fill + LayoutPadding(
- start = AppBarHorizontalPadding,
- end = AppBarHorizontalPadding
- ) + LayoutHeight(AppBarHeight),
+ Modifier.fillMaxWidth()
+ .padding(start = AppBarHorizontalPadding, end = AppBarHorizontalPadding)
+ .preferredHeight(AppBarHeight),
arrangement = Arrangement.SpaceBetween,
children = children
)
@@ -515,9 +513,10 @@
// TODO: this should probably be part of the touch target of the start and end icons, clarify this
private val AppBarHorizontalPadding = 4.dp
// Start inset for the title when there is no navigation icon provided
-private val TitleInsetWithoutIcon = 16.dp - AppBarHorizontalPadding
+private val TitleInsetWithoutIcon = Modifier.preferredWidth(16.dp - AppBarHorizontalPadding)
// Start inset for the title when there is a navigation icon provided
-private val TitleInsetWithIcon = 72.dp - AppBarHorizontalPadding
+private val TitleIconModifier = Modifier.fillMaxHeight()
+ .preferredWidth(72.dp - AppBarHorizontalPadding)
// The baseline distance for the title from the bottom of the app bar
private val TitleBaselineOffset = 20.sp
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/BottomNavigation.kt b/ui/ui-material/src/main/java/androidx/ui/material/BottomNavigation.kt
index 1d86eee..96d0c0dd 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/BottomNavigation.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/BottomNavigation.kt
@@ -25,7 +25,6 @@
import androidx.ui.core.Constraints
import androidx.ui.core.LastBaseline
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
import androidx.ui.core.MeasureScope
import androidx.ui.core.Modifier
import androidx.ui.core.Placeable
@@ -40,10 +39,10 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.lerp
import androidx.ui.layout.Arrangement
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.RowScope
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.preferredHeight
import androidx.ui.material.ripple.ripple
import androidx.ui.text.style.TextAlign
import androidx.ui.unit.Dp
@@ -93,7 +92,7 @@
modifier = modifier
) {
Row(
- LayoutWidth.Fill + LayoutHeight(BottomNavigationHeight),
+ Modifier.fillMaxWidth().preferredHeight(BottomNavigationHeight),
arrangement = Arrangement.SpaceBetween,
children = children
)
@@ -141,7 +140,8 @@
ProvideTextStyle(style, children = text)
}
MutuallyExclusiveSetItem(selected = selected, modifier = ripple()) {
- Box(modifier + RowScope.LayoutWeight(1f), gravity = ContentGravity.Center) {
+ // TODO This composable has magic behavior within a Row; reconsider this behavior later
+ Box(with(RowScope) { modifier.weight(1f) }, gravity = ContentGravity.Center) {
BottomNavigationTransition(activeColor, inactiveColor, selected) { progress ->
val animationProgress = if (alwaysShowLabels) 1f else progress
@@ -204,9 +204,9 @@
) {
Layout(
{
- Box(LayoutTag("icon"), children = icon)
+ Box(Modifier.tag("icon"), children = icon)
Box(
- LayoutTag("text") + drawOpacity(iconPositionAnimationProgress),
+ Modifier.tag("text").drawOpacity(iconPositionAnimationProgress),
paddingStart = BottomNavigationItemHorizontalPadding,
paddingEnd = BottomNavigationItemHorizontalPadding,
children = text
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Button.kt b/ui/ui-material/src/main/java/androidx/ui/material/Button.kt
index f0291f0..c246821 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Button.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Button.kt
@@ -28,7 +28,7 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shape
import androidx.ui.layout.EdgeInsets
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSizeIn
import androidx.ui.material.ripple.ripple
import androidx.ui.semantics.Semantics
import androidx.ui.unit.Dp
@@ -223,7 +223,7 @@
)
// Specification for Material Button:
-private val ButtonConstraints = LayoutSize.Min(64.dp, 36.dp)
+private val ButtonConstraints = Modifier.preferredSizeIn(minWidth = 64.dp, minHeight = 36.dp)
/**
* Contains the default values used by [Button]
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Checkbox.kt b/ui/ui-material/src/main/java/androidx/ui/material/Checkbox.kt
index e37f36a..6b1c1d9 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Checkbox.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Checkbox.kt
@@ -40,8 +40,8 @@
import androidx.ui.graphics.Paint
import androidx.ui.graphics.PaintingStyle
import androidx.ui.graphics.StrokeCap
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.material.ripple.ripple
import androidx.ui.semantics.Semantics
import androidx.ui.unit.dp
@@ -116,7 +116,7 @@
DrawCheckbox(
value = state,
activeColor = color,
- modifier = LayoutPadding(CheckboxDefaultPadding)
+ modifier = CheckboxDefaultPadding
)
}
}
@@ -131,7 +131,7 @@
}
val checkboxPaint = remember { Paint() }
Transition(definition = definition, toState = value) { state ->
- Canvas(modifier = modifier + LayoutSize(CheckboxSize)) {
+ Canvas(modifier.preferredSize(CheckboxSize)) {
drawBox(
color = state[BoxColorProp],
innerRadiusFraction = state[InnerRadiusFractionProp],
@@ -329,7 +329,7 @@
}
}
-private val CheckboxDefaultPadding = 2.dp
+private val CheckboxDefaultPadding = Modifier.padding(2.dp)
private val CheckboxSize = 20.dp
private val StrokeWidth = 2.dp
private val RadiusSize = 2.dp
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/DataTable.kt b/ui/ui-material/src/main/java/androidx/ui/material/DataTable.kt
index 54e15ce..e97ac2b 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/DataTable.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/DataTable.kt
@@ -21,7 +21,7 @@
import androidx.ui.core.Alignment
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
+import androidx.ui.core.Modifier
import androidx.ui.core.tag
import androidx.ui.foundation.Border
import androidx.ui.foundation.Box
@@ -38,14 +38,14 @@
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
import androidx.ui.layout.EdgeInsets
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
import androidx.ui.layout.Spacer
import androidx.ui.layout.Table
import androidx.ui.layout.TableColumnWidth
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredHeight
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.ripple.ripple
import androidx.ui.text.TextStyle
import androidx.ui.text.font.FontWeight
@@ -216,7 +216,7 @@
} else {
Row {
Image(asset = image)
- Spacer(LayoutWidth(2.dp))
+ Spacer(DataTableWidthSpacerModifier)
Text(text = text(j))
}
}
@@ -261,7 +261,7 @@
} else {
Row {
Image(asset = image)
- Spacer(LayoutWidth(2.dp))
+ Spacer(DataTableWidthSpacerModifier)
Text(text = text(j))
}
}
@@ -368,7 +368,7 @@
tableRow {
if (showCheckboxes) {
Box(
- LayoutHeight(headerRowHeight),
+ Modifier.preferredHeight(headerRowHeight),
paddingStart = cellSpacing.left,
paddingTop = cellSpacing.top,
paddingEnd = cellSpacing.right,
@@ -392,7 +392,7 @@
}
for (j in 0 until columns) {
Box(
- LayoutHeight(headerRowHeight),
+ Modifier.preferredHeight(headerRowHeight),
paddingStart = cellSpacing.left,
paddingTop = cellSpacing.top,
paddingEnd = cellSpacing.right,
@@ -414,7 +414,7 @@
headerDecoration = {
// TODO(calintat): Replace with animated arrow icons.
Text(text = if (sorting.ascending) "↑" else "↓")
- Spacer(LayoutWidth(2.dp))
+ Spacer(DataTableWidthSpacerModifier)
}
} else {
>
@@ -445,7 +445,7 @@
tableRow {
if (showCheckboxes) {
Box(
- LayoutHeight(dataRowHeight),
+ Modifier.preferredHeight(dataRowHeight),
paddingStart = cellSpacing.left,
paddingTop = cellSpacing.top,
paddingEnd = cellSpacing.right,
@@ -457,7 +457,7 @@
}
for (j in 0 until columns) {
Box(
- LayoutHeight(dataRowHeight),
+ Modifier.preferredHeight(dataRowHeight),
paddingStart = cellSpacing.left,
paddingTop = cellSpacing.top,
paddingEnd = cellSpacing.right,
@@ -477,7 +477,7 @@
if (row. null) return@forEachIndexed
Clickable(
row.onSelectedChange.invoke(!row.selected) },
- modifier = LayoutTag(index) + ripple()
+ modifier = Modifier.tag(index) + ripple()
) {
ColoredRect(
color = if (row.selected) {
@@ -516,33 +516,33 @@
Column {
table()
Box(
- LayoutHeight(dataRowHeight),
+ Modifier.preferredHeight(dataRowHeight),
paddingStart = cellSpacing.left,
paddingTop = cellSpacing.top,
paddingEnd = cellSpacing.right,
paddingBottom = cellSpacing.bottom,
gravity = ContentGravity.Center
) {
- Row(LayoutSize.Fill, arrangement = Arrangement.End) {
+ Row(Modifier.fillMaxSize(), arrangement = Arrangement.End) {
val pages = (rows.size - 1) / pagination.rowsPerPage + 1
val startRow = pagination.rowsPerPage * pagination.page
val endRow = (startRow + pagination.rowsPerPage).coerceAtMost(rows.size)
- val modifier = LayoutGravity.Center
+ val center = Modifier.gravity(RowAlign.Center)
// TODO(calintat): Replace this with a dropdown menu whose items are taken
// from availableRowsPerPage (filtered to those that are in the range
// 0 until rows.size). When an item is selected, it should invoke
// onRowsPerPageChange with the appropriate value.
- Text(text = "Rows per page: ${pagination.rowsPerPage}", modifier = modifier)
+ Text(text = "Rows per page: ${pagination.rowsPerPage}", modifier = center)
- Spacer(LayoutWidth(32.dp))
+ Spacer(DataTableTextSpacerModifier)
- Text(text = "${startRow + 1}-$endRow of ${rows.size}", modifier = modifier)
+ Text(text = "${startRow + 1}-$endRow of ${rows.size}", modifier = center)
- Spacer(LayoutWidth(32.dp))
+ Spacer(DataTableTextSpacerModifier)
// TODO(calintat): Replace this with an image button with chevron_left icon.
- Box(modifier = modifier) {
+ Box(center) {
Clickable(
>
val newPage = pagination.page - 1
@@ -555,10 +555,10 @@
}
}
- Spacer(LayoutWidth(24.dp))
+ Spacer(DataTableNextSpacerModifier)
// TODO(calintat): Replace this with an image button with chevron_right icon.
- Box(modifier = modifier) {
+ Box(center) {
Clickable(
>
val newPage = pagination.page + 1
@@ -581,3 +581,6 @@
private val CellSpacing = EdgeInsets(left = 16.dp, right = 16.dp)
private val BorderColor = Color(0xFFC6C6C6)
private val BorderWidth = 1.dp
+private val DataTableWidthSpacerModifier = Modifier.preferredWidth(2.dp)
+private val DataTableTextSpacerModifier = Modifier.preferredWidth(32.dp)
+private val DataTableNextSpacerModifier = Modifier.preferredWidth(24.dp)
\ No newline at end of file
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Divider.kt b/ui/ui-material/src/main/java/androidx/ui/material/Divider.kt
index 4a28b88..4a28182 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Divider.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Divider.kt
@@ -20,7 +20,7 @@
import androidx.ui.core.Modifier
import androidx.ui.foundation.ColoredRect
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutPadding
+import androidx.ui.layout.padding
import androidx.ui.unit.Dp
import androidx.ui.unit.dp
@@ -38,6 +38,6 @@
height: Dp = 1.dp,
indent: Dp = 0.dp
) {
- val indentMod = if (indent.value != 0f) LayoutPadding(start = indent) else Modifier.None
+ val indentMod = if (indent.value != 0f) Modifier.padding(start = indent) else Modifier.None
ColoredRect(color, modifier + indentMod, height = height)
}
\ No newline at end of file
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt b/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt
index f337c3c..3dfa417 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Drawer.kt
@@ -21,9 +21,10 @@
import androidx.compose.Composable
import androidx.compose.remember
import androidx.ui.core.DensityAmbient
-import androidx.ui.core.DrawClipToBounds
import androidx.ui.core.Layout
+import androidx.ui.core.Modifier
import androidx.ui.core.WithConstraints
+import androidx.ui.core.clipToBounds
import androidx.ui.core.hasBoundedHeight
import androidx.ui.core.hasBoundedWidth
import androidx.ui.foundation.Box
@@ -33,10 +34,11 @@
import androidx.ui.graphics.Paint
import androidx.ui.graphics.PaintingStyle
import androidx.ui.layout.DpConstraints
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSizeIn
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.internal.StateDraggable
import androidx.ui.unit.IntPx
import androidx.ui.unit.Px
@@ -78,7 +80,7 @@
fun StaticDrawer(
drawerContent: @Composable() () -> Unit
) {
- Box(LayoutWidth(StaticDrawerWidth) + LayoutHeight.Fill, children = drawerContent)
+ Box(StaticDrawerModifier, children = drawerContent)
}
/**
@@ -110,7 +112,7 @@
drawerContent: @Composable() () -> Unit,
bodyContent: @Composable() () -> Unit
) {
- Box(LayoutSize.Fill) {
+ Box(Modifier.fillMaxSize()) {
WithConstraints { pxConstraints, _ ->
// TODO : think about Infinite max bounds case
if (!pxConstraints.hasBoundedWidth) {
@@ -177,7 +179,7 @@
drawerContent: @Composable() () -> Unit,
bodyContent: @Composable() () -> Unit
) {
- Box(LayoutSize.Fill) {
+ Box(Modifier.fillMaxSize()) {
WithConstraints { pxConstraints, _ ->
// TODO : think about Infinite max bounds case
if (!pxConstraints.hasBoundedHeight) {
@@ -237,7 +239,7 @@
) {
WithOffset(xOffset = xOffset) {
Box(
- LayoutSize.Constrain(
+ Modifier.preferredSizeIn(
constraints.minWidth,
constraints.minHeight,
constraints.maxWidth,
@@ -247,7 +249,7 @@
) {
// remove Container when we will support multiply children
Surface {
- Box(LayoutSize.Fill, children = children)
+ Box(Modifier.fillMaxSize(), children = children)
}
}
}
@@ -261,7 +263,7 @@
) {
WithOffset(yOffset = yOffset) {
Box(
- LayoutSize.Constrain(
+ Modifier.preferredSizeIn(
constraints.minWidth,
constraints.minHeight,
constraints.maxWidth,
@@ -270,7 +272,7 @@
) {
// remove Container when we will support multiply children
Surface {
- Box(LayoutSize.Fill, children = children)
+ Box(Modifier.fillMaxSize(), children = children)
}
}
}
@@ -289,7 +291,7 @@
val scrimContent = @Composable {
val paint = remember { Paint().apply { style = PaintingStyle.fill } }
val color = MaterialTheme.colors.onSurface
- Canvas(LayoutSize.Fill) {
+ Canvas(Modifier.fillMaxSize()) {
val scrimAlpha = fraction() * ScrimDefaultOpacity
paint.color = color.copy(alpha = scrimAlpha)
drawRect(size.toRect(), paint)
@@ -310,7 +312,7 @@
child: @Composable() () -> Unit
) {
Layout(children = {
- Box(modifier = DrawClipToBounds, children = child)
+ Box(Modifier.clipToBounds(), children = child)
}) { measurables, constraints, _ ->
if (measurables.size > 1) {
throw IllegalStateException("Only one child is allowed")
@@ -334,16 +336,15 @@
}
}
-private val ScrimDefaultOpacity = 0.32f
+private const val ScrimDefaultOpacity = 0.32f
private val VerticalDrawerPadding = 56.dp
-// drawer children specs
-private val StaticDrawerWidth = 256.dp
-private val DrawerStiffness = 1000f
+private val StaticDrawerModifier = Modifier.preferredWidth(256.dp).fillMaxHeight()
+private const val DrawerStiffness = 1000f
private val AnimationBuilder =
PhysicsBuilder<Float>().apply {
stiffness = DrawerStiffness
}
-internal val BottomDrawerOpenFraction = 0.5f
+internal const val BottomDrawerOpenFraction = 0.5f
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt b/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt
index 027452a..caeb50e 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt
@@ -30,12 +30,11 @@
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shape
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSizeIn
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.ripple.ripple
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
@@ -124,7 +123,10 @@
elevation: Dp = 6.dp
) {
FloatingActionButton(
- modifier = modifier + LayoutSize.Min(ExtendedFabSize),
+ modifier = modifier.preferredSizeIn(
+ minWidth = ExtendedFabSize,
+ minHeight = ExtendedFabSize
+ ),
>
shape = shape,
backgroundColor = backgroundColor,
@@ -132,7 +134,7 @@
elevation = elevation
) {
Box(
- modifier = LayoutPadding(
+ modifier = Modifier.padding(
start = ExtendedFabTextPadding,
end = ExtendedFabTextPadding
),
@@ -143,7 +145,7 @@
} else {
Row {
icon()
- Spacer(LayoutWidth(ExtendedFabIconPadding))
+ Spacer(Modifier.preferredWidth(ExtendedFabIconPadding))
text()
}
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/IconButton.kt b/ui/ui-material/src/main/java/androidx/ui/material/IconButton.kt
index 5d67d41..9815b6d 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/IconButton.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/IconButton.kt
@@ -22,7 +22,7 @@
import androidx.ui.foundation.Clickable
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.selection.Toggleable
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.material.ripple.ripple
import androidx.ui.unit.dp
@@ -102,4 +102,4 @@
// TODO: b/149691127 investigate our strategy around accessibility touch targets, and remove
// per-component definitions of this size.
// Diameter of the IconButton, to allow for correct minimum touch target size for accessibility
-private val IconButtonSizeModifier = LayoutSize(48.dp)
+private val IconButtonSizeModifier = Modifier.preferredSize(48.dp)
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ListItem.kt b/ui/ui-material/src/main/java/androidx/ui/material/ListItem.kt
index 9317581..0faccab 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ListItem.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ListItem.kt
@@ -29,12 +29,12 @@
import androidx.ui.foundation.ProvideTextStyle
import androidx.ui.foundation.Text
import androidx.ui.graphics.ImageAsset
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.RowAlign
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeightIn
+import androidx.ui.layout.preferredSizeIn
+import androidx.ui.layout.preferredWidthIn
import androidx.ui.material.ripple.ripple
import androidx.ui.text.TextStyle
import androidx.ui.text.style.TextOverflow
@@ -196,11 +196,11 @@
trailing: @Composable() (() -> Unit)?
) {
val minHeight = if (icon == null) MinHeight else MinHeightWithIcon
- Row(LayoutHeight.Min(minHeight)) {
+ Row(Modifier.preferredHeightIn(minHeight = minHeight)) {
if (icon != null) {
Box(
- modifier = LayoutGravity.Center +
- LayoutWidth.Min(IconLeftPadding + IconMinPaddedWidth),
+ Modifier.gravity(RowAlign.Center)
+ .preferredWidthIn(minWidth = IconLeftPadding + IconMinPaddedWidth),
gravity = ContentGravity.CenterStart,
paddingStart = IconLeftPadding,
paddingTop = IconVerticalPadding,
@@ -209,14 +209,15 @@
)
}
Box(
- modifier = LayoutWeight(1f) + LayoutGravity.Center +
- LayoutPadding(start = ContentLeftPadding, end = ContentRightPadding),
+ Modifier.weight(1f)
+ .gravity(RowAlign.Center)
+ .padding(start = ContentLeftPadding, end = ContentRightPadding),
gravity = ContentGravity.CenterStart,
children = text
)
if (trailing != null) {
Box(
- LayoutGravity.Center,
+ Modifier.gravity(RowAlign.Center),
paddingEnd = TrailingRightPadding,
children = trailing
)
@@ -254,15 +255,16 @@
trailing: @Composable() (() -> Unit)?
) {
val minHeight = if (icon == null) MinHeight else MinHeightWithIcon
- Row(LayoutHeight.Min(minHeight)) {
- val modifier = LayoutWeight(1f) + LayoutPadding(
- start = ContentLeftPadding,
- end = ContentRightPadding
- )
+ Row(Modifier.preferredHeightIn(minHeight = minHeight)) {
+ val modifier = Modifier.weight(1f)
+ .padding(start = ContentLeftPadding, end = ContentRightPadding)
if (icon != null) {
Box(
- LayoutSize.Min(IconLeftPadding + IconMinPaddedWidth, minHeight),
+ Modifier.preferredSizeIn(
+ minWidth = IconLeftPadding + IconMinPaddedWidth,
+ minHeight = minHeight
+ ),
gravity = ContentGravity.TopStart,
paddingStart = IconLeftPadding,
paddingTop = IconVerticalPadding,
@@ -309,7 +311,8 @@
) {
Box(
// TODO(popam): find way to center and wrap content without minHeight
- LayoutHeight.Min(minHeight) + LayoutPadding(end = TrailingRightPadding),
+ Modifier.preferredHeightIn(minHeight = minHeight)
+ .padding(end = TrailingRightPadding),
gravity = ContentGravity.Center,
children = trailing
)
@@ -344,10 +347,11 @@
overlineText: @Composable() (() -> Unit)?,
trailing: @Composable() (() -> Unit)?
) {
- Row(LayoutHeight.Min(MinHeight)) {
+ Row(Modifier.preferredHeightIn(minHeight = MinHeight)) {
if (icon != null) {
+ val minSize = IconLeftPadding + IconMinPaddedWidth
Box(
- LayoutSize.Min(IconLeftPadding + IconMinPaddedWidth),
+ Modifier.preferredSizeIn(minWidth = minSize, minHeight = minSize),
gravity = ContentGravity.CenterStart,
paddingStart = IconLeftPadding,
paddingTop = IconThreeLineVerticalPadding,
@@ -361,8 +365,8 @@
ThreeLineBaselineSecondOffset,
ThreeLineBaselineThirdOffset
),
- LayoutWeight(1f) +
- LayoutPadding(start = ContentLeftPadding, end = ContentRightPadding)
+ Modifier.weight(1f)
+ .padding(start = ContentLeftPadding, end = ContentRightPadding)
) {
if (overlineText != null) overlineText()
text()
@@ -371,7 +375,7 @@
if (trailing != null) {
OffsetToBaselineOrCenter(
ThreeLineBaselineFirstOffset - ThreeLineTrailingTopPadding,
- LayoutPadding(top = ThreeLineTrailingTopPadding, end = TrailingRightPadding),
+ Modifier.padding(top = ThreeLineTrailingTopPadding, end = TrailingRightPadding),
trailing
)
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt b/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt
index ac62427..27e1d0ec 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ProgressIndicator.kt
@@ -38,8 +38,8 @@
import androidx.ui.graphics.PaintingStyle
import androidx.ui.graphics.StrokeCap
import androidx.ui.graphics.vectormath.degrees
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
import kotlin.math.abs
import kotlin.math.max
@@ -63,7 +63,7 @@
color.copy(alpha = BackgroundOpacity),
StrokeCap.butt
)
- Canvas(modifier + LayoutSize(LinearIndicatorWidth, StrokeWidth)) {
+ Canvas(modifier.preferredSize(LinearIndicatorWidth, StrokeWidth)) {
drawLinearIndicatorBackground(backgroundPaint)
drawLinearIndicator(0f, progress, paint)
}
@@ -95,7 +95,7 @@
color.copy(alpha = BackgroundOpacity),
StrokeCap.butt
)
- Canvas(modifier + LayoutSize(LinearIndicatorWidth, StrokeWidth)) {
+ Canvas(modifier.preferredSize(LinearIndicatorWidth, StrokeWidth)) {
drawLinearIndicatorBackground(backgroundPaint)
if (firstLineHead - firstLineTail > 0) {
drawLinearIndicator(firstLineHead, firstLineTail, paint)
@@ -143,8 +143,9 @@
) {
DeterminateProgressIndicator(progress = progress) {
val paint = paint(color, StrokeCap.butt)
- Canvas(modifier = modifier + LayoutPadding(CircularIndicatorPadding) +
- LayoutSize(CircularIndicatorDiameter)
+ Canvas(
+ modifier.padding(CircularIndicatorPadding)
+ .preferredSize(CircularIndicatorDiameter)
) {
// Start at 12 O'clock
val startAngle = 270f
@@ -185,8 +186,9 @@
startAngle += StartAngleOffset + currentRotationAngleOffset
startAngle += baseRotation
- Canvas(modifier = modifier + LayoutPadding(CircularIndicatorPadding) +
- LayoutSize(CircularIndicatorDiameter)
+ Canvas(
+ modifier.padding(CircularIndicatorPadding)
+ .preferredSize(CircularIndicatorDiameter)
) {
drawIndeterminateCircularIndicator(startAngle, sweep, paint)
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt b/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
index b6db517..cefcff2 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
@@ -23,6 +23,7 @@
import androidx.ui.animation.ColorPropKey
import androidx.ui.animation.DpPropKey
import androidx.ui.animation.Transition
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Canvas
import androidx.ui.foundation.CanvasScope
@@ -33,11 +34,11 @@
import androidx.ui.graphics.Paint
import androidx.ui.graphics.PaintingStyle
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.material.ripple.ripple
import androidx.ui.semantics.Semantics
import androidx.ui.text.TextStyle
@@ -160,12 +161,12 @@
RadioGroupItem(selected = selected, {
// TODO: remove this Box when Ripple becomes a modifier.
Box {
- Row(LayoutWidth.Fill + LayoutPadding(DefaultRadioItemPadding)) {
+ Row(Modifier.fillMaxWidth().padding(DefaultRadioItemPadding)) {
RadioButton(selected = selected, color = radioColor)
Text(
text = text,
style = MaterialTheme.typography.body1.merge(textStyle),
- modifier = LayoutPadding(start = DefaultRadioLabelOffset)
+ modifier = Modifier.padding(start = DefaultRadioLabelOffset)
)
}
}
@@ -205,7 +206,7 @@
generateTransitionDefinition(color, unselectedColor)
}
Transition(definition = definition, toState = selected) { state ->
- Canvas(modifier = LayoutPadding(RadioButtonPadding) + LayoutSize(RadioButtonSize)) {
+ Canvas(Modifier.padding(RadioButtonPadding).preferredSize(RadioButtonSize)) {
drawRadio(
state[ColorProp],
state[OuterRadiusProp],
@@ -261,10 +262,10 @@
private val GapProp = DpPropKey()
private val ColorProp = ColorPropKey()
-private val RadiusClosureDuration = 150
-private val PulseDuration = 100
-private val GapDuration = 150
-private val TotalDuration = RadiusClosureDuration + PulseDuration + GapDuration
+private const val RadiusClosureDuration = 150
+private const val PulseDuration = 100
+private const val GapDuration = 150
+private const val TotalDuration = RadiusClosureDuration + PulseDuration + GapDuration
private fun generateTransitionDefinition(
selectedColor: Color,
@@ -328,7 +329,7 @@
private val RadioStrokeWidth = 2.dp
// TODO(malkov): random numbers for now to produce radio as in material comp.
private val DefaultGap = 3.dp
-private val UnselectedOpacity = 0.6f
+private const val UnselectedOpacity = 0.6f
// for animations
private val OuterOffsetDuringAnimation = 2.dp
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Scaffold.kt b/ui/ui-material/src/main/java/androidx/ui/material/Scaffold.kt
index 750b570..a021b61 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Scaffold.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Scaffold.kt
@@ -20,16 +20,17 @@
import androidx.compose.Model
import androidx.compose.onDispose
import androidx.compose.remember
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
import androidx.ui.core.Layout
import androidx.ui.core.Modifier
import androidx.ui.core.onPositioned
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
import androidx.ui.material.BottomAppBar.FabConfiguration
import androidx.ui.material.BottomAppBar.FabDockedPosition
import androidx.ui.material.Scaffold.FabPosition
@@ -131,12 +132,12 @@
) {
val child = @Composable {
Surface(color = MaterialTheme.colors.background) {
- Column(LayoutSize.Fill) {
+ Column(Modifier.fillMaxSize()) {
if (topAppBar != null) ScaffoldSlot(children = topAppBar)
- Stack(modifier = LayoutWeight(1f, fill = true)) {
- ScaffoldContent(LayoutSize.Fill, scaffoldState, bodyContent)
+ Stack(Modifier.weight(1f, fill = true)) {
+ ScaffoldContent(Modifier.fillMaxSize(), scaffoldState, bodyContent)
ScaffoldBottom(
- modifier = LayoutGravity.BottomCenter,
+ Modifier.gravity(Alignment.BottomCenter),
scaffoldState = scaffoldState,
fabPos = floatingActionButtonPosition,
fab = floatingActionButton,
@@ -160,6 +161,9 @@
}
}
+private fun FabPosition.toColumnAlign() =
+ if (this == FabPosition.End) ColumnAlign.End else ColumnAlign.Center
+
/**
* Scaffold part that is on the bottom. Includes FAB and BottomBar
*/
@@ -172,13 +176,15 @@
bottomBar: @Composable() ((FabConfiguration?) -> Unit)? = null
) {
if (fabPos != FabPosition.CenterDocked && fabPos != FabPosition.EndDocked) {
- Column(modifier = modifier + LayoutWidth.Fill) {
+ Column(modifier.fillMaxWidth()) {
if (fab != null) {
- val fabSpacing =
- LayoutPadding(bottom = FabSpacing, start = FabSpacing, end = FabSpacing)
- val gravity =
- if (fabPos == FabPosition.End) LayoutGravity.End else LayoutGravity.Center
- FabContainer(fabPos, gravity + fabSpacing, scaffoldState, fab)
+ FabContainer(
+ fabPos,
+ Modifier.gravity(fabPos.toColumnAlign())
+ .padding(start = FabSpacing, end = FabSpacing, bottom = FabSpacing),
+ scaffoldState,
+ fab
+ )
}
if (bottomBar != null) {
BottomBarContainer(scaffoldState, bottomBar)
@@ -249,7 +255,7 @@
val bottomSpace = with(DensityAmbient.current) {
scaffoldState.bottomBarSize?.height?.toDp() ?: 0.dp
}
- content(LayoutPadding(bottom = bottomSpace))
+ content(Modifier.padding(bottom = bottomSpace))
}
}
@@ -260,7 +266,7 @@
) {
onDispose(callback = { scaffoldState.bottomBarSize = null })
ScaffoldSlot(
- modifier = onPositioned {
+ modifier = Modifier.onPositioned {
if (scaffoldState.bottomBarSize != it.size) scaffoldState.bottomBarSize = it.size
},
children = {
@@ -276,26 +282,28 @@
scaffoldState: ScaffoldState,
fab: @Composable() () -> Unit
) {
- onDispose(callback = { scaffoldState.fabConfiguration = null })
- val { coords ->
- // TODO(mount): This should probably use bounding box rather than position/size
- val position = coords.parentCoordinates?.childToLocal(coords, PxPosition.Origin)
- ?: PxPosition.Origin
- val config =
- when (fabPos) {
- FabPosition.CenterDocked -> {
- FabConfiguration(coords.size, position, FabDockedPosition.Center)
+ onDispose { scaffoldState.fabConfiguration = null }
+ ScaffoldSlot(
+ modifier = modifier.onPositioned { coords ->
+ // TODO(mount): This should probably use bounding box rather than position/size
+ val position = coords.parentCoordinates?.childToLocal(coords, PxPosition.Origin)
+ ?: PxPosition.Origin
+ val config =
+ when (fabPos) {
+ FabPosition.CenterDocked -> {
+ FabConfiguration(coords.size, position, FabDockedPosition.Center)
+ }
+ FabPosition.EndDocked -> {
+ FabConfiguration(coords.size, position, FabDockedPosition.End)
+ }
+ else -> {
+ null
+ }
}
- FabPosition.EndDocked -> {
- FabConfiguration(coords.size, position, FabDockedPosition.End)
- }
- else -> {
- null
- }
- }
- if (scaffoldState.fabConfiguration != config) scaffoldState.fabConfiguration = config
- }
- ScaffoldSlot(modifier = modifier + onPositioned, children = fab)
+ if (scaffoldState.fabConfiguration != config) scaffoldState.fabConfiguration = config
+ },
+ children = fab
+ )
}
/**
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt b/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
index 3ad0f50..15c86e8 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
@@ -26,6 +26,7 @@
import androidx.compose.state
import androidx.ui.animation.AnimatedFloatModel
import androidx.ui.animation.asDisposableClock
+import androidx.ui.core.Alignment
import androidx.ui.core.AnimationClockAmbient
import androidx.ui.core.DensityAmbient
import androidx.ui.core.Modifier
@@ -44,13 +45,13 @@
import androidx.ui.graphics.PaintingStyle
import androidx.ui.graphics.PointMode
import androidx.ui.graphics.StrokeCap
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Spacer
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredHeightIn
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidthIn
import androidx.ui.material.ripple.ripple
import androidx.ui.semantics.Semantics
import androidx.ui.semantics.accessibilityValue
@@ -255,15 +256,16 @@
val thumbSize = ThumbRadius * 2
val fraction = with(position) { calcFraction(startValue, endValue, this.value) }
val offset = (widthDp - thumbSize) * fraction
- Track(LayoutGravity.CenterStart + LayoutSize.Fill, color, position)
- Box(LayoutGravity.CenterStart + LayoutPadding(start = offset)) {
+ val center = Modifier.gravity(Alignment.CenterStart)
+ Track(center.fillMaxSize(), color, position)
+ Box(center.padding(start = offset)) {
Surface(
shape = CircleShape,
color = color,
elevation = if (pressed) 6.dp else 1.dp,
modifier = ripple(bounded = false)
) {
- Spacer(LayoutSize(thumbSize, thumbSize))
+ Spacer(Modifier.preferredSize(thumbSize, thumbSize))
}
}
}
@@ -346,7 +348,8 @@
private val SliderHeight = 48.dp
private val SliderMinWidth = 144.dp // TODO: clarify min width
private val DefaultSliderConstraints =
- LayoutWidth.Min(SliderMinWidth) + LayoutHeight.Max(SliderHeight)
+ Modifier.preferredWidthIn(minWidth = SliderMinWidth)
+ .preferredHeightIn(maxHeight = SliderHeight)
private val InactiveTrackColorAlpha = 0.24f
private val TickColorAlpha = 0.54f
private val SliderToTickAnimation = TweenBuilder<Float>().apply { duration = 100 }
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt b/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt
index 14a25cf..3cbf972 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt
@@ -20,7 +20,6 @@
import androidx.ui.core.FirstBaseline
import androidx.ui.core.LastBaseline
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
import androidx.ui.core.Modifier
import androidx.ui.core.tag
import androidx.ui.foundation.Box
@@ -30,9 +29,9 @@
import androidx.ui.graphics.compositeOver
import androidx.ui.layout.AlignmentLineOffset
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
import androidx.ui.unit.IntPx
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -94,7 +93,7 @@
private fun TextOnlySnackbar(text: @Composable() () -> Unit) {
Layout(
text,
- modifier = LayoutPadding(start = HorizontalSpacing, end = HorizontalSpacing)
+ modifier = Modifier.padding(start = HorizontalSpacing, end = HorizontalSpacing)
) { measurables, constraints, _ ->
require(measurables.size == 1) {
"text for Snackbar expected to have exactly only one child"
@@ -117,18 +116,19 @@
action: @Composable() () -> Unit
) {
Column(
- modifier = LayoutWidth.Fill + LayoutPadding(
- start = HorizontalSpacing,
- end = HorizontalSpacingButtonSide,
- bottom = SeparateButtonExtraY
- )
+ modifier = Modifier.fillMaxWidth()
+ .padding(
+ start = HorizontalSpacing,
+ end = HorizontalSpacingButtonSide,
+ bottom = SeparateButtonExtraY
+ )
) {
AlignmentLineOffset(alignmentLine = LastBaseline, after = LongButtonVerticalOffset) {
AlignmentLineOffset(alignmentLine = FirstBaseline, before = HeightToFirstLine) {
- Box(LayoutPadding(end = HorizontalSpacingButtonSide), children = text)
+ Box(Modifier.padding(end = HorizontalSpacingButtonSide), children = text)
}
}
- Box(modifier = LayoutGravity.End, children = action)
+ Box(Modifier.gravity(ColumnAlign.End), children = action)
}
}
@@ -141,10 +141,10 @@
val actionTag = "action"
Layout(
{
- Box(LayoutTag(textTag), children = text)
- Box(LayoutTag(actionTag), children = action)
+ Box(Modifier.tag(textTag), children = text)
+ Box(Modifier.tag(actionTag), children = action)
},
- modifier = LayoutPadding(start = HorizontalSpacing, end = HorizontalSpacingButtonSide)
+ modifier = Modifier.padding(start = HorizontalSpacing, end = HorizontalSpacingButtonSide)
) { measurables, constraints, _ ->
val buttonPlaceable = measurables.first { it.tag == actionTag }.measure(constraints)
val textMaxWidth =
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Surface.kt b/ui/ui-material/src/main/java/androidx/ui/material/Surface.kt
index b1b8b17..cc550355 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Surface.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Surface.kt
@@ -19,14 +19,14 @@
import androidx.compose.Composable
import androidx.ui.core.Layout
import androidx.ui.core.Modifier
-import androidx.ui.core.drawClip
+import androidx.ui.core.clip
import androidx.ui.core.drawShadow
import androidx.ui.foundation.Border
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.DrawBorder
import androidx.ui.foundation.ProvideContentColor
import androidx.ui.foundation.ProvideTextStyle
import androidx.ui.foundation.Text
+import androidx.ui.foundation.drawBackground
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shape
@@ -86,12 +86,15 @@
elevation: Dp = 0.dp,
children: @Composable() () -> Unit
) {
- val borderModifier = if (border != null) DrawBorder(border, shape) else Modifier.None
- val shadowModifier = drawShadow(shape = shape, elevation = elevation, clipToOutline = false)
- val backgroundColor = getBackgroundColorForElevation(color, elevation)
- val background = DrawBackground(shape = shape, color = backgroundColor)
- val clip = drawClip(shape)
- SurfaceLayout(modifier + shadowModifier + borderModifier + background + clip) {
+ SurfaceLayout(
+ modifier.drawShadow(shape = shape, elevation = elevation, clipToOutline = false)
+ .plus(if (border != null) DrawBorder(border, shape) else Modifier.None)
+ .drawBackground(
+ color = getBackgroundColorForElevation(color, elevation),
+ shape = shape
+ )
+ .clip(shape)
+ ) {
ProvideContentColor(contentColor, children)
}
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt b/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt
index d6c534a..0daa58b 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt
@@ -29,9 +29,9 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.graphics.StrokeCap
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.material.internal.StateDraggable
import androidx.ui.material.ripple.ripple
import androidx.ui.semantics.Semantics
@@ -64,7 +64,7 @@
enabled = enabled,
modifier = ripple(bounded = false, enabled = enabled)
) {
- SwitchImpl(checked, onCheckedChange, color, LayoutPadding(DefaultSwitchPadding))
+ SwitchImpl(checked, onCheckedChange, color, Modifier.padding(DefaultSwitchPadding))
}
}
}
@@ -110,7 +110,7 @@
} else {
MaterialTheme.colors.onSurface.copy(alpha = UncheckedTrackOpacity)
}
- Canvas(modifier + LayoutSize(SwitchWidth, SwitchHeight)) {
+ Canvas(modifier.preferredSize(SwitchWidth, SwitchHeight)) {
drawTrack(trackColor)
drawThumb(thumbValue.value, thumbColor)
}
@@ -146,8 +146,8 @@
drawCircle(Offset(x, centerHeight.value), thumbRadius, paint)
}
-private val CheckedTrackOpacity = 0.54f
-private val UncheckedTrackOpacity = 0.38f
+private const val CheckedTrackOpacity = 0.54f
+private const val UncheckedTrackOpacity = 0.38f
private val TrackWidth = 34.dp
private val TrackStrokeWidth = 14.dp
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt b/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt
index 957015e..f9276de 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Tab.kt
@@ -26,12 +26,12 @@
import androidx.ui.animation.ColorPropKey
import androidx.ui.animation.PxPropKey
import androidx.ui.animation.Transition
+import androidx.ui.core.Alignment
import androidx.ui.core.Constraints
import androidx.ui.core.DensityAmbient
import androidx.ui.core.FirstBaseline
import androidx.ui.core.LastBaseline
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
import androidx.ui.core.Modifier
import androidx.ui.core.Placeable
import androidx.ui.core.WithConstraints
@@ -46,12 +46,12 @@
import androidx.ui.foundation.contentColor
import androidx.ui.foundation.selection.MutuallyExclusiveSetItem
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.fillMaxWidth
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredWidth
import androidx.ui.material.TabRow.TabPosition
import androidx.ui.material.ripple.ripple
import androidx.ui.text.style.TextAlign
@@ -191,12 +191,12 @@
}
}
- Stack(LayoutWidth.Fill) {
+ Stack(Modifier.fillMaxWidth()) {
Row {
- tabs(LayoutWeight(1f))
+ tabs(Modifier.weight(1f))
}
- Box(LayoutGravity.BottomCenter + LayoutWidth.Fill, children = divider)
- Box(LayoutGravity.Stretch) {
+ Box(Modifier.gravity(Alignment.BottomCenter).fillMaxWidth(), children = divider)
+ Box(Modifier.matchParent()) {
indicatorContainer(tabPositions)
}
}
@@ -231,15 +231,15 @@
HorizontalScroller(
scrollerPosition = scrollableTabData.position,
- modifier = LayoutWidth.Fill
+ modifier = Modifier.fillMaxWidth()
) {
val indicatorTag = "indicator"
val dividerTag = "divider"
Layout(
{
tabs()
- Box(LayoutTag(indicatorTag), children = indicator)
- Box(LayoutTag(dividerTag), children = divider)
+ Box(Modifier.tag(indicatorTag), children = indicator)
+ Box(Modifier.tag(dividerTag), children = divider)
}
) { measurables, constraints, _ ->
val tabPlaceables = mutableListOf<Pair<Placeable, IntPx>>()
@@ -382,11 +382,11 @@
tabPositions[selectedIndex].width.toDp()
}
- Box(LayoutSize.Fill, gravity = ContentGravity.BottomStart) {
+ Box(Modifier.fillMaxSize(), gravity = ContentGravity.BottomStart) {
IndicatorTransition(tabPositions, selectedIndex) { indicatorOffset ->
val offset = with(DensityAmbient.current) { indicatorOffset.toDp() }
Box(
- modifier = LayoutPadding(start = offset) + LayoutWidth(currentTabWidth),
+ Modifier.padding(start = offset).preferredWidth(currentTabWidth),
children = indicator
)
}
@@ -508,7 +508,7 @@
children: @Composable() () -> Unit
) {
MutuallyExclusiveSetItem(selected = selected, modifier = ripple()) {
- Box(modifier + LayoutWidth.Fill, gravity = ContentGravity.Center, children = children)
+ Box(modifier.fillMaxWidth(), gravity = ContentGravity.Center, children = children)
}
}
@@ -570,12 +570,12 @@
Layout(
{
Box(
- LayoutTag("text"),
+ Modifier.tag("text"),
paddingStart = HorizontalTextPadding,
paddingEnd = HorizontalTextPadding,
children = text
)
- Box(LayoutTag("icon"), children = icon)
+ Box(Modifier.tag("icon"), children = icon)
}
) { measurables, constraints, _ ->
val textPlaceable = measurables.first { it.tag == "text" }.measure(
diff --git a/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt b/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt
index f199b3a..47d0b53 100644
--- a/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt
+++ b/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt
@@ -77,7 +77,7 @@
override val root = LayoutNode().also {
it.measureBlocks = RootMeasureBlocks
it.layoutDirection = context.getLayoutDirection()
- it.modifier = drawLayer(clipToBounds = false)
+ it.modifier = Modifier.drawLayer(clipToBounds = false)
}
// LayoutNodes that need measure and layout
diff --git a/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt b/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
index 0d8babb..679e533 100644
--- a/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
+++ b/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
@@ -1007,10 +1007,10 @@
// that implements both DrawModifier and LayoutModifier will have it's draw bounds
// reflect the dimensions defined by the LayoutModifier.
if (mod is OnPositionedModifier) {
- onPositionedCallbacks += mod.onPositioned
+ onPositionedCallbacks += mod
}
if (mod is OnChildPositionedModifier) {
- onChildPositionedCallbacks += mod.onChildPositioned
+ onChildPositionedCallbacks += mod
}
if (mod is DrawModifier) {
wrapper = ModifiedDrawNode(wrapper, mod)
@@ -1097,12 +1097,12 @@
/**
* List of all OnPositioned callbacks in the modifier chain.
*/
- private val -> Unit>()
+ private val >
/**
* List of all OnChildPositioned callbacks in the modifier chain.
*/
- private val -> Unit>()
+ private val >
override fun measure(constraints: Constraints): Placeable {
val owner = requireOwner()
@@ -1195,16 +1195,11 @@
*/
private fun hasNewPositioningCallback(): Boolean {
return modifier.foldOut(false) { mod, hasNewCallback ->
- var ret = hasNewCallback
- if (!hasNewCallback) {
- when (mod) {
- is OnPositionedModifier ->
- ret = !onPositionedCallbacks.contains(mod.onPositioned)
- is OnChildPositionedModifier ->
- ret = !onChildPositionedCallbacks.contains(mod.onChildPositioned)
- }
+ hasNewCallback || when (mod) {
+ is OnPositionedModifier -> mod !in onPositionedCallbacks
+ is OnChildPositionedModifier -> mod !in onChildPositionedCallbacks
+ else -> false
}
- ret
}
}
@@ -1335,13 +1330,13 @@
val >
for (i in 0..onPositioned.lastIndex) {
val callback = onPositioned[i]
- callback(layoutNode.coordinates)
+ callback.onPositioned(layoutNode.coordinates)
}
val >
if (onChildPositioned != null) {
for (i in 0..onChildPositioned.lastIndex) {
val callback = onChildPositioned[i]
- callback(layoutNode.coordinates)
+ callback.onChildPositioned(layoutNode.coordinates)
}
}
}
diff --git a/ui/ui-platform/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt b/ui/ui-platform/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
index 9571682..9a00e73 100644
--- a/ui/ui-platform/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
+++ b/ui/ui-platform/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
@@ -559,7 +559,7 @@
paint.strokeWidth = 1f
paint.style = PaintingStyle.stroke
}
- val introducedDrawLayerModifier = drawLayer(
+ val introducedDrawLayerModifier = Modifier.drawLayer(
clipToBounds = false,
clipToOutline = false
) as DrawLayerModifier
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/AnimationSynchronizationTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/AnimationSynchronizationTest.kt
index 0026707..8c1a749 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/AnimationSynchronizationTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/AnimationSynchronizationTest.kt
@@ -29,13 +29,14 @@
import androidx.test.filters.LargeTest
import androidx.test.filters.MediumTest
import androidx.ui.animation.Transition
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Canvas
-import androidx.ui.foundation.DrawBackground
+import androidx.ui.foundation.drawBackground
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import androidx.ui.test.android.ComposeIdlingResource
import com.google.common.truth.Truth.assertThat
import org.junit.Ignore
@@ -260,7 +261,7 @@
val paint = remember { Paint().also { it.color = Color.Cyan } }
hasRecomposed = true
- Box(modifier = DrawBackground(color = Color.Yellow) + LayoutSize.Fill) {
+ Box(modifier = Modifier.drawBackground(Color.Yellow).fillMaxSize()) {
hasRecomposed = true
Transition(
definition = animationDefinition,
@@ -268,7 +269,7 @@
animationRunning = false }
) { state ->
hasRecomposed = true
- Canvas(modifier = LayoutSize.Fill) {
+ Canvas(modifier = Modifier.fillMaxSize()) {
recordedAnimatedValues.add(state[x])
drawRect(animatedRect.translate(state[x], 0f), paint)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTests.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTests.kt
index 0f05dca..166fbec 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTests.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTests.kt
@@ -19,7 +19,9 @@
import androidx.compose.Composable
import androidx.compose.Model
import androidx.test.filters.MediumTest
+import androidx.ui.core.Alignment
import androidx.ui.core.Layout
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.foundation.Box
import androidx.ui.foundation.Canvas
@@ -29,11 +31,10 @@
import androidx.ui.graphics.Paint
import androidx.ui.graphics.PaintingStyle
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
import androidx.ui.layout.Stack
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.ScrollTo
import androidx.ui.semantics.Semantics
import androidx.ui.text.TextStyle
@@ -76,7 +77,7 @@
private fun createScrollableContent() {
composeTestRule.setContent {
val style = TextStyle(fontSize = 30.sp)
- VerticalScroller(modifier = LayoutPadding(10.dp)) {
+ VerticalScroller(modifier = Modifier.padding(10.dp)) {
Column {
for (i in 1..100) {
Semantics(container = true) {
@@ -180,7 +181,8 @@
}
}
},
- modifier = LayoutGravity.Center) { measurables, constraints, _ ->
+ modifier = Modifier.gravity(Alignment.Center)
+ ) { measurables, constraints, _ ->
val placeable =
measurables[0].measure(constraints.copy(maxWidth = IntPx.Infinity))
layout(placeable.width, placeable.height) {
@@ -236,7 +238,7 @@
val drawRect = @Composable { color: Color ->
Semantics(container = true) {
- Canvas(LayoutSize(100.dp)) {
+ Canvas(Modifier.preferredSize(100.dp)) {
val paint = Paint()
paint.color = color
paint.style = PaintingStyle.fill
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
index ed4e052..b87af10 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
@@ -17,15 +17,16 @@
package androidx.ui.test
import androidx.test.filters.MediumTest
-import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.Modifier
import androidx.ui.core.onPositioned
import androidx.ui.foundation.Box
import androidx.ui.foundation.ContentGravity
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutGravity
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.LayoutWidth
+import androidx.ui.layout.ColumnAlign
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.preferredWidth
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -52,12 +53,14 @@
var parentCoordinates: LayoutCoordinates? = null
var childCoordinates: LayoutCoordinates? = null
composeTestRule.setContent {
- Column(onPositioned { coordinates ->
+ Column(Modifier.onPositioned { coordinates: LayoutCoordinates ->
parentCoordinates = coordinates
latch.countDown()
}) {
- Box(LayoutSize(10.dp) + LayoutGravity.Start +
- onPositioned { coordinates ->
+ Box(
+ Modifier.preferredSize(10.dp)
+ .gravity(ColumnAlign.Start)
+ .onPositioned { coordinates ->
childCoordinates = coordinates
latch.countDown()
}
@@ -79,14 +82,18 @@
var childCoordinates: LayoutCoordinates? = null
composeTestRule.setContent {
with(DensityAmbient.current) {
- Box(LayoutWidth(40.ipx.toDp()), gravity = ContentGravity.Center) {
- Column(LayoutWidth(20.ipx.toDp()) +
- onPositioned { coordinates ->
+ Box(Modifier.preferredWidth(40.ipx.toDp()), gravity = ContentGravity.Center) {
+ Column(
+ Modifier.preferredWidth(20.ipx.toDp())
+ .onPositioned { coordinates: LayoutCoordinates ->
parentCoordinates = coordinates
latch.countDown()
- }) {
- Box(LayoutSize(10.ipx.toDp()) + LayoutGravity.Center +
- onPositioned { coordinates ->
+ }
+ ) {
+ Box(
+ Modifier.preferredSize(10.ipx.toDp())
+ .gravity(ColumnAlign.Center)
+ .onPositioned { coordinates ->
childCoordinates = coordinates
latch.countDown()
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendClickTest.kt
index 6297bec..1504208 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendClickTest.kt
@@ -34,7 +34,7 @@
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.android.AndroidComposeTestRule
import androidx.ui.unit.PxPosition
@@ -124,8 +124,9 @@
override val cancelHandler: () -> Unit = {}
}
}
+ squareSize.toDp()
Box(
- pointerInputModifier + LayoutSize(squareSize.toDp()),
+ pointerInputModifier.preferredSize(squareSize.toDp()),
backgroundColor = colors[i]
)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendDoubleClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendDoubleClickTest.kt
index a7e3d8e..b2ca650 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendDoubleClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendDoubleClickTest.kt
@@ -24,8 +24,8 @@
import androidx.ui.core.pointerinput.PointerInputModifier
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.android.AndroidInputDispatcher
import androidx.ui.test.util.PointerInputRecorder
@@ -54,9 +54,9 @@
Semantics(container = true) {
with(DensityAmbient.current) {
Box(
- DoubleTapGestureDetector(onDoubleTap) +
- pointerInputRecorder +
- LayoutSize(width.toDp(), height.toDp()),
+ DoubleTapGestureDetector(onDoubleTap)
+ .plus(pointerInputRecorder)
+ .preferredSize(width.toDp(), height.toDp()),
backgroundColor = Color.Yellow
)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendLongClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendLongClickTest.kt
index 036f31d..2c5f152 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendLongClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendLongClickTest.kt
@@ -18,15 +18,18 @@
import androidx.compose.Composable
import androidx.test.filters.MediumTest
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.core.TestTag
import androidx.ui.core.gesture.LongPressGestureDetector
import androidx.ui.core.gesture.LongPressTimeout
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.semantics.Semantics
import androidx.ui.test.util.PointerInputRecorder
import androidx.ui.test.util.areAlmostEqualTo
@@ -50,17 +53,14 @@
@Composable
private fun Ui(recorder: PointerInputRecorder, onLongPress: (PxPosition) -> Unit) {
- Stack(LayoutSize.Fill + LayoutAlign.BottomEnd) {
+ Stack(Modifier.fillMaxSize().wrapContentSize(Alignment.BottomEnd)) {
TestTag(tag) {
Semantics(container = true) {
with(DensityAmbient.current) {
Box(
- LongPressGestureDetector(onLongPress) +
- recorder +
- LayoutSize(
- width.toDp(),
- height.toDp()
- ),
+ LongPressGestureDetector(onLongPress)
+ .plus(recorder)
+ .preferredSize(width.toDp(), height.toDp()),
backgroundColor = Color.Yellow
)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeTest.kt
index a95c0b7..ef6a79b 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeTest.kt
@@ -18,12 +18,14 @@
import androidx.compose.Composable
import androidx.test.filters.MediumTest
+import androidx.ui.core.Alignment
import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.graphics.Color
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.semantics.Semantics
import androidx.ui.semantics.testTag
import androidx.ui.test.util.PointerInputRecorder
@@ -56,10 +58,10 @@
@Composable
fun Ui(alignment: Modifier) {
- Stack(LayoutSize.Fill + alignment) {
+ Stack(Modifier.fillMaxSize() + alignment) {
Semantics(container = true, properties = { testTag = tag }) {
Box(
- recorder + LayoutSize(100.dp),
+ recorder.preferredSize(100.dp),
backgroundColor = Color.Yellow
)
}
@@ -68,7 +70,7 @@
@Test
fun swipeUp() {
- composeTestRule.setContent { Ui(LayoutAlign.TopStart) }
+ composeTestRule.setContent { Ui(Modifier.wrapContentSize(Alignment.TopStart)) }
findByTag(tag).doGesture { sendSwipeUp() }
composeTestRule.runOnUiThread {
recorder.run {
@@ -81,7 +83,7 @@
@Test
fun swipeDown() {
- composeTestRule.setContent { Ui(LayoutAlign.TopEnd) }
+ composeTestRule.setContent { Ui(Modifier.wrapContentSize(Alignment.TopEnd)) }
findByTag(tag).doGesture { sendSwipeDown() }
composeTestRule.runOnUiThread {
recorder.run {
@@ -94,7 +96,7 @@
@Test
fun swipeLeft() {
- composeTestRule.setContent { Ui(LayoutAlign.BottomEnd) }
+ composeTestRule.setContent { Ui(Modifier.wrapContentSize(Alignment.BottomEnd)) }
findByTag(tag).doGesture { sendSwipeLeft() }
composeTestRule.runOnUiThread {
recorder.run {
@@ -107,7 +109,7 @@
@Test
fun swipeRight() {
- composeTestRule.setContent { Ui(LayoutAlign.BottomStart) }
+ composeTestRule.setContent { Ui(Modifier.wrapContentSize(Alignment.BottomStart)) }
findByTag(tag).doGesture { sendSwipeRight() }
composeTestRule.runOnUiThread {
recorder.run {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeVelocityTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeVelocityTest.kt
index df5ab8b..f96ac05 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeVelocityTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/SendSwipeVelocityTest.kt
@@ -19,14 +19,17 @@
import androidx.compose.Composable
import androidx.compose.remember
import androidx.test.filters.MediumTest
+import androidx.ui.core.Alignment
import androidx.ui.core.DensityAmbient
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Canvas
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
-import androidx.ui.layout.LayoutAlign
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
+import androidx.ui.layout.fillMaxSize
+import androidx.ui.layout.preferredSize
+import androidx.ui.layout.wrapContentSize
import androidx.ui.semantics.Semantics
import androidx.ui.semantics.testTag
import androidx.ui.test.android.AndroidInputDispatcher
@@ -148,10 +151,10 @@
@Composable
fun Ui() {
val paint = remember { Paint().apply { color = Color.Yellow } }
- Stack(LayoutSize.Fill + LayoutAlign.BottomEnd) {
+ Stack(Modifier.fillMaxSize().wrapContentSize(Alignment.BottomEnd)) {
Semantics(container = true, properties = { testTag = tag }) {
with(DensityAmbient.current) {
- Canvas(recorder + LayoutSize(500.px.toDp())) {
+ Canvas(recorder.preferredSize(500.px.toDp())) {
bounds = Rect(0f, 0f, size.width.value, size.height.value)
drawRect(bounds, paint)
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt b/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt
index 272a3f2..8ddb5ac 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/SizesTesting.kt
@@ -17,16 +17,16 @@
package androidx.ui.test
import androidx.compose.Composable
+import androidx.ui.core.Modifier
+import androidx.ui.core.onChildPositioned
+import androidx.ui.layout.DpConstraints
+import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSizeIn
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
-import androidx.ui.core.onChildPositioned
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.layout.DpConstraints
-import androidx.ui.layout.LayoutSize
-import androidx.ui.layout.Stack
-import androidx.ui.layout.Stack
import androidx.ui.unit.round
import androidx.ui.unit.toPxSize
import kotlin.math.abs
@@ -54,11 +54,10 @@
performSetContent {
Stack {
Stack(
- LayoutSize.Min(parentConstraints.minWidth, parentConstraints.minHeight) +
- LayoutSize.Max(parentConstraints.maxWidth, parentConstraints.maxHeight) +
- onChildPositioned { coordinates -> realSize = coordinates.size.toPxSize() }
+ Modifier.preferredSizeIn(parentConstraints)
+ .onChildPositioned { coordinates -> realSize = coordinates.size.toPxSize() }
) {
- children()
+ children()
}
}
}
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeInputField.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeInputField.kt
index e34d810..22d7073 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeInputField.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeInputField.kt
@@ -18,12 +18,13 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.foundation.TextField
+import androidx.ui.foundation.VerticalScroller
import androidx.ui.input.ImeAction
import androidx.ui.input.KeyboardType
import androidx.ui.layout.Column
-import androidx.ui.foundation.VerticalScroller
-import androidx.ui.layout.LayoutHeight
+import androidx.ui.layout.fillMaxHeight
import androidx.ui.text.TextStyle
private val KEYBOARD_TYPES = listOf(
@@ -50,7 +51,7 @@
@Composable
fun InputFieldDemo() {
VerticalScroller {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
TagLine(tag = "simple editing")
EditLine()
TagLine(tag = "simple editing2")
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
index d986add..26e73e4 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeText.kt
@@ -17,15 +17,16 @@
package androidx.ui.text.demos
import androidx.compose.Composable
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
import androidx.ui.geometry.Offset
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shadow
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
import androidx.ui.text.AnnotatedString
import androidx.ui.text.LocaleList
import androidx.ui.text.SpanStyle
@@ -293,7 +294,7 @@
@Composable
fun TextDemoHeight() {
// This group of text composables show different height.
- Row(LayoutWidth.Fill) {
+ Row(Modifier.fillMaxWidth()) {
Text(
text = "$displayText\n$displayText ",
style = TextStyle(fontSize = fontSize8)
@@ -371,31 +372,31 @@
for (i in 1..10) {
text = "$text$displayText "
}
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
SecondTagLine(tag = "textAlign = TextAlign.Left")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = displayText,
style = TextStyle(fontSize = fontSize8, textAlign = TextAlign.Left)
)
SecondTagLine(tag = "textAlign = TextAlign.Right")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = displayText,
style = TextStyle(fontSize = fontSize8, textAlign = TextAlign.Right)
)
SecondTagLine(tag = "textAlign = TextAlign.Center")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = displayText,
style = TextStyle(fontSize = fontSize8, textAlign = TextAlign.Center)
)
SecondTagLine(tag = "textAlign = default and TextAlign.Justify")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = text,
style = TextStyle(
fontSize = fontSize8,
@@ -403,7 +404,7 @@
)
)
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = text,
style = TextStyle(
fontSize = fontSize8,
@@ -414,25 +415,25 @@
SecondTagLine(tag = "textAlign = TextAlign.Start for Ltr")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = displayText,
style = TextStyle(fontSize = fontSize8, textAlign = TextAlign.Start)
)
SecondTagLine(tag = "textAlign = TextAlign.Start for Rtl")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = displayTextArabic,
style = TextStyle(fontSize = fontSize8, textAlign = TextAlign.Start)
)
SecondTagLine(tag = "textAlign = TextAlign.End for Ltr")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = displayText,
style = TextStyle(fontSize = fontSize8, textAlign = TextAlign.End)
)
SecondTagLine(tag = "textAlign = TextAlign.End for Rtl")
Text(
- modifier = LayoutWidth.Fill,
+ modifier = Modifier.fillMaxWidth(),
text = displayTextArabic,
style = TextStyle(fontSize = fontSize8, textAlign = TextAlign.End)
)
@@ -448,7 +449,7 @@
}
val textStyle = TextStyle(fontSize = fontSize8, color = Color(0xFFFF0000))
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
Text(text = text, style = textStyle)
Text(text = text, style = textStyle, softWrap = false)
}
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelection.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelection.kt
index fa00de5..69b13c4 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelection.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelection.kt
@@ -18,15 +18,16 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.core.selection.Selection
import androidx.ui.core.selection.SelectionContainer
import androidx.ui.foundation.Text
import androidx.ui.foundation.VerticalScroller
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutHeight
-import androidx.ui.layout.LayoutWidth
import androidx.ui.layout.Row
+import androidx.ui.layout.fillMaxHeight
+import androidx.ui.layout.fillMaxWidth
import androidx.ui.text.AnnotatedString
import androidx.ui.text.LocaleList
import androidx.ui.text.SpanStyle
@@ -134,9 +135,9 @@
SelectionContainer(
selection = selection.value,
selection.value = it }) {
- Column(LayoutHeight.Fill) {
+ Column(Modifier.fillMaxHeight()) {
for (i in 0..2) {
- Row(LayoutWidth.Fill) {
+ Row(Modifier.fillMaxWidth()) {
for (j in 0..2) {
Text(
text = text,
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelectionSample.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelectionSample.kt
index 187d1d5..39c12e4 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelectionSample.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeTextSelectionSample.kt
@@ -18,6 +18,7 @@
import androidx.compose.Composable
import androidx.compose.state
+import androidx.ui.core.Modifier
import androidx.ui.core.selection.Selection
import androidx.ui.core.selection.SelectionContainer
import androidx.ui.foundation.Box
@@ -25,9 +26,9 @@
import androidx.ui.foundation.VerticalScroller
import androidx.ui.graphics.Color
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
-import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
+import androidx.ui.layout.padding
+import androidx.ui.layout.preferredSize
import androidx.ui.text.AnnotatedString
import androidx.ui.text.SpanStyle
import androidx.ui.text.TextStyle
@@ -77,7 +78,7 @@
selection = selection.value,
selection.value = it }
) {
- Column(LayoutPadding(12.dp)) {
+ Column(Modifier.padding(12.dp)) {
Basics()
AddTextElement()
langContent.forEach {
@@ -98,12 +99,12 @@
style = commonStyle.merge(header)
)
Row {
- Box(LayoutPadding(8.dp) + LayoutSize(48.dp), backgroundColor = rectColor)
+ Box(Modifier.padding(8.dp).preferredSize(48.dp), backgroundColor = rectColor)
Text(
text = "Jetpack Compose is a modern toolkit for building native Android UI." +
" Jetpack Compose simplifies and accelerates UI development on Android " +
"with less code, powerful tools, and intuitive Kotlin APIs.",
- modifier = LayoutWeight(1f),
+ modifier = Modifier.weight(1f),
style = commonStyle
)
}
@@ -116,7 +117,7 @@
style = commonStyle.merge(header2)
)
Row {
- Column(modifier = LayoutWeight(1f)) {
+ Column(Modifier.weight(1f)) {
Text(
text = AnnotatedString {
append("To begin, follow the")
@@ -132,10 +133,10 @@
style = commonStyle
)
}
- Box(LayoutPadding(8.dp) + LayoutSize(48.dp), backgroundColor = rectColor)
+ Box(Modifier.padding(8.dp).preferredSize(48.dp), backgroundColor = rectColor)
}
Box(
- LayoutPadding(top = 20.dp, bottom = 20.dp) + LayoutSize(200.dp, 60.dp),
+ Modifier.padding(top = 20.dp, bottom = 20.dp).preferredSize(200.dp, 60.dp),
backgroundColor = rectColor
)
Text(
@@ -202,12 +203,12 @@
)
Row {
Box(
- LayoutPadding(8.dp) + LayoutSize(48.dp),
+ Modifier.padding(8.dp).preferredSize(48.dp),
backgroundColor = rectColor
)
Text(
text = content,
- modifier = LayoutWeight(1f),
+ modifier = Modifier.weight(1f),
style = commonStyle
)
}
diff --git a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt
index 4297e95..6a8b1da 100644
--- a/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt
+++ b/ui/ui-text/integration-tests/text-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt
@@ -21,13 +21,13 @@
import androidx.compose.state
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
-import androidx.ui.core.LayoutTag
-import androidx.ui.foundation.TextField
+import androidx.ui.core.Modifier
import androidx.ui.core.tag
import androidx.ui.foundation.Box
-import androidx.ui.foundation.DrawBackground
import androidx.ui.foundation.Text
+import androidx.ui.foundation.TextField
import androidx.ui.foundation.VerticalScroller
+import androidx.ui.foundation.drawBackground
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.input.ImeAction
@@ -249,7 +249,7 @@
// Force 4.ipx with red color cursor
Layout(
children = emptyContent(),
- modifier = DrawBackground(Color.Red)
+ modifier = Modifier.drawBackground(Color.Red)
) { _, constraints, _ -> layout(4.ipx, constraints.maxHeight) {} }
}
}
@@ -280,7 +280,7 @@
val inputField = @Composable {
TextField(
- modifier = LayoutTag("inputField"),
+ modifier = Modifier.tag("inputField"),
value = state.value,
state.value = it },
textStyle = TextStyle(fontSize = fontSize8)
@@ -292,7 +292,7 @@
} else {
Layout({
inputField()
- Box(LayoutTag("hintText"), children = hintText)
+ Box(Modifier.tag("hintText"), children = hintText)
}) { measurable, constraints, _ ->
val inputFieldPlacable =
measurable.first { it.tag == "inputField" }.measure(constraints)
@@ -311,13 +311,13 @@
val layoutResult = state<TextLayoutResult?> { null }
Layout({
TextField(
- modifier = LayoutTag("inputField"),
+ modifier = Modifier.tag("inputField"),
value = state.value,
state.value = it },
textStyle = TextStyle(fontSize = fontSize8),
layoutResult.value = it }
)
- Box(LayoutTag("cursor"), children = cursor)
+ Box(Modifier.tag("cursor"), children = cursor)
}) { measurable, constraints, _ ->
val inputFieldPlacable =
measurable.first { it.tag == "inputField" }.measure(constraints)
diff --git a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/BoundsTest.kt b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/BoundsTest.kt
index c0150cc..e12f2a5 100644
--- a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/BoundsTest.kt
+++ b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/BoundsTest.kt
@@ -17,10 +17,11 @@
package androidx.ui.tooling
import androidx.test.filters.SmallTest
+import androidx.ui.core.Modifier
import androidx.ui.foundation.Box
import androidx.ui.foundation.Text
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutPadding
+import androidx.ui.layout.padding
import androidx.ui.unit.Density
import androidx.ui.unit.dp
import org.junit.Assert
@@ -39,8 +40,8 @@
show {
Inspectable {
Box {
- Column(LayoutPadding(10.dp)) {
- Text("Hello", LayoutPadding(5.dp)) {}
+ Column(Modifier.padding(10.dp)) {
+ Text("Hello", Modifier.padding(5.dp)) {}
}
}
}
diff --git a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/InspectableTests.kt b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/InspectableTests.kt
index 9d5cdc9..169ae6b 100644
--- a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/InspectableTests.kt
+++ b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/InspectableTests.kt
@@ -19,13 +19,14 @@
import androidx.compose.SlotTable
import androidx.test.filters.SmallTest
import androidx.ui.core.DrawNode
-import androidx.ui.core.draw
+import androidx.ui.core.Modifier
+import androidx.ui.core.drawBehind
import androidx.ui.foundation.Box
import androidx.ui.foundation.ColoredRect
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.layout.Column
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.preferredSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.toRect
@@ -46,7 +47,7 @@
show {
Inspectable {
Column {
- Box(LayoutSize(100.dp) + draw { canvas, size ->
+ Box(Modifier.preferredSize(100.dp).drawBehind { canvas, size ->
val paint = Paint().also { it.color = Color(0xFF) }
canvas.drawRect(size.toRect(), paint)
})
diff --git a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ToolingTest.kt b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ToolingTest.kt
index 7f6b960..3435683 100644
--- a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ToolingTest.kt
+++ b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ToolingTest.kt
@@ -19,10 +19,11 @@
import android.os.Handler
import androidx.compose.Composable
import androidx.test.rule.ActivityTestRule
+import androidx.ui.core.Modifier
import androidx.ui.core.onPositioned
import androidx.ui.core.setContent
import androidx.ui.foundation.Box
-import androidx.ui.layout.LayoutSize
+import androidx.ui.layout.fillMaxSize
import org.junit.Before
import org.junit.Rule
import java.util.concurrent.CountDownLatch
@@ -49,8 +50,10 @@
positionedLatch = CountDownLatch(1)
activityTestRule.onUiThread {
activity.setContent {
- Box(onPositioned { positionedLatch.countDown() } + LayoutSize.Fill,
- children = composable)
+ Box(
+ Modifier.onPositioned { positionedLatch.countDown() }.fillMaxSize(),
+ children = composable
+ )
}
}
diff --git a/ui/ui-unit/src/main/java/androidx/ui/unit/Dp.kt b/ui/ui-unit/src/main/java/androidx/ui/unit/Dp.kt
index d5e1fd4..8fb9dce 100644
--- a/ui/ui-unit/src/main/java/androidx/ui/unit/Dp.kt
+++ b/ui/ui-unit/src/main/java/androidx/ui/unit/Dp.kt
@@ -134,7 +134,7 @@
* // -- or --
* val y = 10.dp
*/
-inline val Int.dp: Dp get() = Dp(value = this.toFloat())
+inline val Int.dp: Dp get() = if (this == 0) Hairline else Dp(value = this.toFloat())
/**
* Create a [Dp] using a [Double]:
@@ -143,7 +143,7 @@
* // -- or --
* val y = 10.0.dp
*/
-inline val Double.dp: Dp get() = Dp(value = this.toFloat())
+inline val Double.dp: Dp get() = if (this == 0.0) Hairline else Dp(value = this.toFloat())
/**
* Create a [Dp] using a [Float]:
@@ -152,7 +152,7 @@
* // -- or --
* val y = 10f.dp
*/
-inline val Float.dp: Dp get() = Dp(value = this)
+inline val Float.dp: Dp get() = if (this == 0f) Hairline else Dp(value = this)
inline operator fun Float.div(other: Dp) =
DpInverse(this / other.value)