API proposal: Layout prefix for LayoutModifiers
A common report so far is that layout modifiers are difficult to
discover and sometimes remember. They lack a common autocomplete stem
that would permit easier discovery in the IDE. Additionally, as new
layout modifiers have been introduced they've created namespace
confusion at point of use, impairing readability.
This change introduces, "Layout" as a common prefix for LayoutModifier
accessors, mirroring Android's historical use of "layout_" prefixes
in XML attributes that affect layout behavior of a child within
a parent. This is phase one of a series of intended changes that will
also change the organization of some of these modifiers to allow for
closer grouping and discoverability of related modifiers, especially
around size, with a leaning to familiar Android constructs.
Also rename Spacing to LayoutPadding under the new convention,
as Spacing never really stuck. (Though it did prevent confusion with
Android's historical layout_padding.)
Test: all existing tests
Change-Id: I2fad064aab900081859efac52cf7ad663abfd30e
diff --git a/ui/ui-layout/integration-tests/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt b/ui/ui-layout/integration-tests/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt
index 930e0a0..55151bc 100644
--- a/ui/ui-layout/integration-tests/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt
+++ b/ui/ui-layout/integration-tests/samples/src/main/java/androidx/ui/layout/samples/AspectRatioSample.kt
@@ -21,7 +21,7 @@
import androidx.ui.core.dp
import androidx.ui.foundation.ColoredRect
import androidx.ui.graphics.Color
-import androidx.ui.layout.AspectRatio
+import androidx.ui.layout.LayoutAspectRatio
import androidx.ui.layout.Container
import androidx.ui.layout.DpConstraints
@@ -29,6 +29,6 @@
@Composable
fun SimpleAspectRatio() {
Container(constraints = DpConstraints.tightConstraintsForWidth(100.dp)) {
- ColoredRect(color = Color.Gray, modifier = AspectRatio(2f))
+ ColoredRect(color = Color.Gray, modifier = LayoutAspectRatio(2f))
}
}