Merge Density and DensityScope. Remove ambientDensity()
1) Renamed `DensityScope` to `Density` and bring the `density` and `fontScale` `val` properties into it directly
2) Provided a concrete implementation `DensityImpl` as a private data class
3) Provided a default factory `fun Density(...): Density` that returns a `DensityImpl`
4) Removed ambientDensity() in favour of using DensityAmbient.current directly
5) Removed withDensity(density) as now we can just use with(density)
A lot of tests are affected, but the changes there are just the replacements of the usage.
Relnote: Density and DensityScope were merged into one interface. Instead of ambientDensity() you can now use DensityAmbient.current. Instead of withDensity(density) just with(density)
Test: run all tests, demo app
Bug: 147672883
Bug: 148380287
Change-Id: I11cb1f069a95f32f4ecab631f49d38dc1c071a42
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 bdfaff5..316ed49 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,7 +18,6 @@
import androidx.compose.Composable
import androidx.ui.core.Draw
-import androidx.ui.core.ambientDensity
import androidx.ui.foundation.Border
import androidx.ui.foundation.DrawBorder
import androidx.ui.foundation.shape.DrawShape
@@ -34,9 +33,8 @@
// code below was replaced by DrawBorder but we still need it
// in order to have honest benchmark here
val borderModifier = DrawBorder(Border(1.dp, Color.Cyan), CircleShape)
- val density = ambientDensity()
Draw { canvas, size ->
- borderModifier.draw(density, {}, canvas, size)
+ borderModifier.draw(this, {}, canvas, size)
}
val innerSize = getInnerSize().value
Container(width = innerSize, height = innerSize) {
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 07571d6..65f26c2 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
@@ -18,7 +18,6 @@
import androidx.compose.Composable
import androidx.ui.core.Draw
-import androidx.ui.core.ambientDensity
import androidx.ui.foundation.Border
import androidx.ui.foundation.DrawBorder
import androidx.ui.foundation.shape.DrawShape
@@ -35,7 +34,6 @@
import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.withDensity
class SimpleRadioButton2TestCase : BaseSimpleRadioButtonTestCase() {
@Composable
@@ -44,9 +42,8 @@
// code below was replaced by DrawBorder but we still need it
// in order to have honest benchmark here
val borderModifier = DrawBorder(Border(1.dp, Color.Cyan), CircleShape)
- val density = ambientDensity()
Draw { canvas, size ->
- borderModifier.draw(density, {}, canvas, size)
+ borderModifier.draw(this, {}, canvas, size)
}
val padding = (48.dp - getInnerSize().value) / 2
DrawShape(PaddingShape(padding, CircleShape), Color.Cyan)
@@ -56,7 +53,7 @@
private data class PaddingShape(val padding: Dp, val shape: Shape) : Shape {
override fun createOutline(size: PxSize, density: Density): Outline {
- val twoPaddings = withDensity(density) { (padding * 2).toPx() }
+ val twoPaddings = with(density) { (padding * 2).toPx() }
val sizeMinusPaddings = PxSize(size.width - twoPaddings, size.height - twoPaddings)
val rawResult = shape.createOutline(sizeMinusPaddings, density)
return rawResult.offset(twoPaddings / 2)
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 2ee433d..449cbb8 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,8 +19,8 @@
import androidx.compose.Composable
import androidx.compose.onCommit
import androidx.compose.remember
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Text
-import androidx.ui.core.WithDensity
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.HorizontalScroller
import androidx.ui.foundation.ScrollerPosition
@@ -76,7 +76,7 @@
val content = @Composable {
Row(LayoutWidth.Fill) {
repeat(6) {
- WithDensity {
+ with(DensityAmbient.current) {
Column(LayoutHeight.Fill) {
val color = remember {
val red = Random.nextInt(256)
diff --git a/ui/settings.gradle b/ui/settings.gradle
index 80d9dc2..3a3d2eb 100644
--- a/ui/settings.gradle
+++ b/ui/settings.gradle
@@ -83,6 +83,7 @@
includeProject(":ui:ui-text:integration-tests:ui-text-samples", "ui-text/integration-tests/samples")
includeProject(":ui:ui-tooling", "ui-tooling")
includeProject(":ui:ui-unit", "ui-unit")
+includeProject(":ui:ui-unit:integration-tests:samples", "ui-unit/integration-tests/samples")
includeProject(":ui:ui-util", "ui-util")
includeProject(":ui:ui-vector", "ui-vector")
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleAnimation.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleAnimation.kt
index c95bb0d..6872989 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleAnimation.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleAnimation.kt
@@ -28,8 +28,8 @@
import androidx.compose.remember
import androidx.compose.state
import androidx.ui.animation.Transition
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
-import androidx.ui.core.ambientDensity
import androidx.ui.core.gesture.PressGestureDetector
import androidx.ui.core.setContent
import androidx.ui.geometry.Offset
@@ -38,7 +38,6 @@
import androidx.ui.layout.Container
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
-import androidx.ui.unit.withDensity
class StateBasedRippleAnimation : Activity() {
@@ -57,7 +56,7 @@
@Composable
fun RippleRect() {
- val radius = withDensity(ambientDensity()) { TargetRadius.toPx() }
+ val radius = with(DensityAmbient.current) { TargetRadius.toPx() }
val toState = state { ButtonStatus.Initial }
val rippleTransDef = remember { createTransDef(radius.value) }
val onPress: (PxPosition) -> Unit = { position ->
diff --git a/ui/ui-core/api/0.1.0-dev05.txt b/ui/ui-core/api/0.1.0-dev05.txt
index cfcc1ac..ed26719 100644
--- a/ui/ui-core/api/0.1.0-dev05.txt
+++ b/ui/ui-core/api/0.1.0-dev05.txt
@@ -112,11 +112,11 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ 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 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);
}
- public interface DrawReceiver extends androidx.ui.unit.DensityScope {
+ public interface DrawReceiver extends androidx.ui.unit.Density {
method public void drawChildren();
}
@@ -165,21 +165,21 @@
}
public interface LayoutModifier extends androidx.ui.core.Modifier.Element {
- method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
- method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
public interface Measurable extends androidx.ui.core.IntrinsicMeasurable {
method public androidx.ui.core.Placeable measure(androidx.ui.core.Constraints constraints);
}
- public abstract class MeasureScope implements androidx.ui.unit.DensityScope {
+ public abstract class MeasureScope implements androidx.ui.unit.Density {
ctor public MeasureScope();
method public final androidx.ui.core.MeasureScope.LayoutResult layout(androidx.ui.unit.IntPx width, androidx.ui.unit.IntPx height, java.util.Map<androidx.ui.core.AlignmentLine,androidx.ui.unit.IntPx> alignmentLines = emptyMap(), kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable.PlacementScope,kotlin.Unit> placementBlock);
}
@@ -216,7 +216,7 @@
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
- method public default Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public default Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public abstract class Placeable {
diff --git a/ui/ui-core/api/current.txt b/ui/ui-core/api/current.txt
index cfcc1ac..ed26719 100644
--- a/ui/ui-core/api/current.txt
+++ b/ui/ui-core/api/current.txt
@@ -112,11 +112,11 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ 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 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);
}
- public interface DrawReceiver extends androidx.ui.unit.DensityScope {
+ public interface DrawReceiver extends androidx.ui.unit.Density {
method public void drawChildren();
}
@@ -165,21 +165,21 @@
}
public interface LayoutModifier extends androidx.ui.core.Modifier.Element {
- method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
- method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
public interface Measurable extends androidx.ui.core.IntrinsicMeasurable {
method public androidx.ui.core.Placeable measure(androidx.ui.core.Constraints constraints);
}
- public abstract class MeasureScope implements androidx.ui.unit.DensityScope {
+ public abstract class MeasureScope implements androidx.ui.unit.Density {
ctor public MeasureScope();
method public final androidx.ui.core.MeasureScope.LayoutResult layout(androidx.ui.unit.IntPx width, androidx.ui.unit.IntPx height, java.util.Map<androidx.ui.core.AlignmentLine,androidx.ui.unit.IntPx> alignmentLines = emptyMap(), kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable.PlacementScope,kotlin.Unit> placementBlock);
}
@@ -216,7 +216,7 @@
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
- method public default Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public default Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public abstract class Placeable {
diff --git a/ui/ui-core/api/public_plus_experimental_0.1.0-dev05.txt b/ui/ui-core/api/public_plus_experimental_0.1.0-dev05.txt
index cfcc1ac..ed26719 100644
--- a/ui/ui-core/api/public_plus_experimental_0.1.0-dev05.txt
+++ b/ui/ui-core/api/public_plus_experimental_0.1.0-dev05.txt
@@ -112,11 +112,11 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ 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 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);
}
- public interface DrawReceiver extends androidx.ui.unit.DensityScope {
+ public interface DrawReceiver extends androidx.ui.unit.Density {
method public void drawChildren();
}
@@ -165,21 +165,21 @@
}
public interface LayoutModifier extends androidx.ui.core.Modifier.Element {
- method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
- method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
public interface Measurable extends androidx.ui.core.IntrinsicMeasurable {
method public androidx.ui.core.Placeable measure(androidx.ui.core.Constraints constraints);
}
- public abstract class MeasureScope implements androidx.ui.unit.DensityScope {
+ public abstract class MeasureScope implements androidx.ui.unit.Density {
ctor public MeasureScope();
method public final androidx.ui.core.MeasureScope.LayoutResult layout(androidx.ui.unit.IntPx width, androidx.ui.unit.IntPx height, java.util.Map<androidx.ui.core.AlignmentLine,androidx.ui.unit.IntPx> alignmentLines = emptyMap(), kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable.PlacementScope,kotlin.Unit> placementBlock);
}
@@ -216,7 +216,7 @@
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
- method public default Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public default Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public abstract class Placeable {
diff --git a/ui/ui-core/api/public_plus_experimental_current.txt b/ui/ui-core/api/public_plus_experimental_current.txt
index cfcc1ac..ed26719 100644
--- a/ui/ui-core/api/public_plus_experimental_current.txt
+++ b/ui/ui-core/api/public_plus_experimental_current.txt
@@ -112,11 +112,11 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ 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 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);
}
- public interface DrawReceiver extends androidx.ui.unit.DensityScope {
+ public interface DrawReceiver extends androidx.ui.unit.Density {
method public void drawChildren();
}
@@ -165,21 +165,21 @@
}
public interface LayoutModifier extends androidx.ui.core.Modifier.Element {
- method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
- method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
public interface Measurable extends androidx.ui.core.IntrinsicMeasurable {
method public androidx.ui.core.Placeable measure(androidx.ui.core.Constraints constraints);
}
- public abstract class MeasureScope implements androidx.ui.unit.DensityScope {
+ public abstract class MeasureScope implements androidx.ui.unit.Density {
ctor public MeasureScope();
method public final androidx.ui.core.MeasureScope.LayoutResult layout(androidx.ui.unit.IntPx width, androidx.ui.unit.IntPx height, java.util.Map<androidx.ui.core.AlignmentLine,androidx.ui.unit.IntPx> alignmentLines = emptyMap(), kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable.PlacementScope,kotlin.Unit> placementBlock);
}
@@ -216,7 +216,7 @@
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
- method public default Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public default Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public abstract class Placeable {
diff --git a/ui/ui-core/api/restricted_0.1.0-dev05.txt b/ui/ui-core/api/restricted_0.1.0-dev05.txt
index cfcc1ac..ed26719 100644
--- a/ui/ui-core/api/restricted_0.1.0-dev05.txt
+++ b/ui/ui-core/api/restricted_0.1.0-dev05.txt
@@ -112,11 +112,11 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ 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 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);
}
- public interface DrawReceiver extends androidx.ui.unit.DensityScope {
+ public interface DrawReceiver extends androidx.ui.unit.Density {
method public void drawChildren();
}
@@ -165,21 +165,21 @@
}
public interface LayoutModifier extends androidx.ui.core.Modifier.Element {
- method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
- method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
public interface Measurable extends androidx.ui.core.IntrinsicMeasurable {
method public androidx.ui.core.Placeable measure(androidx.ui.core.Constraints constraints);
}
- public abstract class MeasureScope implements androidx.ui.unit.DensityScope {
+ public abstract class MeasureScope implements androidx.ui.unit.Density {
ctor public MeasureScope();
method public final androidx.ui.core.MeasureScope.LayoutResult layout(androidx.ui.unit.IntPx width, androidx.ui.unit.IntPx height, java.util.Map<androidx.ui.core.AlignmentLine,androidx.ui.unit.IntPx> alignmentLines = emptyMap(), kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable.PlacementScope,kotlin.Unit> placementBlock);
}
@@ -216,7 +216,7 @@
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
- method public default Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public default Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public abstract class Placeable {
diff --git a/ui/ui-core/api/restricted_current.txt b/ui/ui-core/api/restricted_current.txt
index cfcc1ac..ed26719 100644
--- a/ui/ui-core/api/restricted_current.txt
+++ b/ui/ui-core/api/restricted_current.txt
@@ -112,11 +112,11 @@
}
public final class DrawModifierKt {
- method public static androidx.ui.core.DrawModifier draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onDraw);
+ 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 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);
}
- public interface DrawReceiver extends androidx.ui.unit.DensityScope {
+ public interface DrawReceiver extends androidx.ui.unit.Density {
method public void drawChildren();
}
@@ -165,21 +165,21 @@
}
public interface LayoutModifier extends androidx.ui.core.Modifier.Element {
- method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
- method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public default androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public default androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public default androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public default androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public default androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public default androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
public interface Measurable extends androidx.ui.core.IntrinsicMeasurable {
method public androidx.ui.core.Placeable measure(androidx.ui.core.Constraints constraints);
}
- public abstract class MeasureScope implements androidx.ui.unit.DensityScope {
+ public abstract class MeasureScope implements androidx.ui.unit.Density {
ctor public MeasureScope();
method public final androidx.ui.core.MeasureScope.LayoutResult layout(androidx.ui.unit.IntPx width, androidx.ui.unit.IntPx height, java.util.Map<androidx.ui.core.AlignmentLine,androidx.ui.unit.IntPx> alignmentLines = emptyMap(), kotlin.jvm.functions.Function1<? super androidx.ui.core.Placeable.PlacementScope,kotlin.Unit> placementBlock);
}
@@ -216,7 +216,7 @@
}
public interface ParentDataModifier extends androidx.ui.core.Modifier.Element {
- method public default Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public default Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public abstract class Placeable {
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 0ca39e2..f3b5445 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
@@ -18,7 +18,6 @@
import androidx.ui.graphics.Canvas
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.PxSize
/**
@@ -37,11 +36,11 @@
* Creates a [DrawModifier] that calls [onDraw] before the contents of the layout.
*/
fun draw(
- onDraw: DensityScope.(canvas: Canvas, size: PxSize) -> Unit
-): DrawModifier = object : DrawModifier, DensityScope {
+ onDraw: Density.(canvas: Canvas, size: PxSize) -> Unit
+): DrawModifier = object : DrawModifier, Density {
private var _density: Density? = null
- override val density: Density
- get() = _density!!
+ override val density: Float get() = _density!!.density
+ override val fontScale: Float get() = _density!!.fontScale
override fun draw(
density: Density,
@@ -69,8 +68,8 @@
onDraw: DrawReceiver.(canvas: Canvas, size: PxSize) -> Unit
): DrawModifier = object : DrawModifier, DrawReceiver {
private var _density: Density? = null
- override val density: Density
- get() = _density!!
+ override val density: Float get() = _density!!.density
+ override val fontScale: Float get() = _density!!.fontScale
private var drawContentFunction: (() -> Unit)? = null
override fun draw(
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/DrawReceiver.kt b/ui/ui-core/src/main/java/androidx/ui/core/DrawReceiver.kt
index ac7a36f..d6b6b88 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/DrawReceiver.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/DrawReceiver.kt
@@ -15,7 +15,7 @@
*/
package androidx.ui.core
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
/**
* Receiver scope for [Draw] lambda that allows ordering the child drawing between
@@ -23,7 +23,7 @@
* a [Canvas] should be modified for the children. [DrawReceiver] is the receiver scope for
* the `onPaint` to give access to [drawChildren].
*/
-interface DrawReceiver : DensityScope {
+interface DrawReceiver : Density {
/**
* Causes child drawing operations to run during the `onPaint` lambda.
*/
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/IntrinsicMeasurable.kt b/ui/ui-core/src/main/java/androidx/ui/core/IntrinsicMeasurable.kt
index 58583ac..708bbcb 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/IntrinsicMeasurable.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/IntrinsicMeasurable.kt
@@ -16,7 +16,7 @@
package androidx.ui.core
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
/**
@@ -57,4 +57,4 @@
/**
* A function for performing intrinsic measurement.
*/
-typealias IntrinsicMeasureBlock = DensityScope.(List<IntrinsicMeasurable>, IntPx) -> IntPx
+typealias IntrinsicMeasureBlock = Density.(List<IntrinsicMeasurable>, IntPx) -> IntPx
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutModifier.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutModifier.kt
index 707d6e8..4e87388 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutModifier.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutModifier.kt
@@ -16,7 +16,7 @@
package androidx.ui.core
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
@@ -28,20 +28,20 @@
/**
* Modifies [constraints] for performing measurement of the modified layout element.
*/
- fun DensityScope.modifyConstraints(constraints: Constraints): Constraints = constraints
+ fun Density.modifyConstraints(constraints: Constraints): Constraints = constraints
/**
* Returns the container size of a modified layout element given the original container
* measurement [constraints] and the measured [childSize].
*/
- fun DensityScope.modifySize(constraints: Constraints, childSize: IntPxSize): IntPxSize =
+ fun Density.modifySize(constraints: Constraints, childSize: IntPxSize): IntPxSize =
childSize
/**
* Determines the modified minimum intrinsic width of [measurable].
* See [Measurable.minIntrinsicWidth].
*/
- fun DensityScope.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
+ fun Density.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
val constraints = Constraints(maxHeight = height)
val layoutWidth = measurable.minIntrinsicWidth(modifyConstraints(constraints).maxHeight)
return modifySize(constraints, IntPxSize(layoutWidth, height)).width
@@ -51,7 +51,7 @@
* Determines the modified maximum intrinsic width of [measurable].
* See [Measurable.maxIntrinsicWidth].
*/
- fun DensityScope.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
+ fun Density.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
val constraints = Constraints(maxHeight = height)
val layoutWidth = measurable.maxIntrinsicWidth(modifyConstraints(constraints).maxHeight)
return modifySize(constraints, IntPxSize(layoutWidth, height)).width
@@ -61,7 +61,7 @@
* Determines the modified minimum intrinsic height of [measurable].
* See [Measurable.minIntrinsicHeight].
*/
- fun DensityScope.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
+ fun Density.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
val constraints = Constraints(maxWidth = width)
val layoutHeight = measurable.minIntrinsicHeight(modifyConstraints(constraints).maxWidth)
return modifySize(constraints, IntPxSize(width, layoutHeight)).height
@@ -71,7 +71,7 @@
* Determines the modified maximum intrinsic height of [measurable].
* See [Measurable.maxIntrinsicHeight].
*/
- fun DensityScope.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
+ fun Density.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
val constraints = Constraints(maxWidth = width)
val layoutHeight = measurable.maxIntrinsicHeight(modifyConstraints(constraints).maxWidth)
return modifySize(constraints, IntPxSize(width, layoutHeight)).height
@@ -81,7 +81,7 @@
* Returns the position of a modified child of size [childSize] within a container of
* size [containerSize].
*/
- fun DensityScope.modifyPosition(
+ fun Density.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize
): IntPxPosition = IntPxPosition.Origin
@@ -89,7 +89,7 @@
/**
* Returns the modified position of [line] given its unmodified [value].
*/
- fun DensityScope.modifyAlignmentLine(
+ fun Density.modifyAlignmentLine(
line: AlignmentLine,
value: IntPx?
): IntPx? = value
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/MeasureScope.kt b/ui/ui-core/src/main/java/androidx/ui/core/MeasureScope.kt
index 854b151..3652e0b 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/MeasureScope.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/MeasureScope.kt
@@ -16,14 +16,14 @@
package androidx.ui.core
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
/**
* The receiver scope of a layout's measure lambda. The return value of the
* measure lambda is [LayoutResult], which should be returned by [layout]
*/
-abstract class MeasureScope : DensityScope {
+abstract class MeasureScope : Density {
/**
* Interface holding the size and alignment lines of the measured layout, as well as the
* children positioning logic.
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/ParentDataModifier.kt b/ui/ui-core/src/main/java/androidx/ui/core/ParentDataModifier.kt
index 2a2c21f..a97c0ee 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/ParentDataModifier.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/ParentDataModifier.kt
@@ -16,7 +16,7 @@
package androidx.ui.core
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
/**
* A [Modifier.Element] that changes the way a UI component is measured and laid out.
@@ -25,5 +25,5 @@
/**
* Provides a parentData given the [parentData] already provided through the modifier's chain.
*/
- fun DensityScope.modifyParentData(parentData: Any?): Any? = parentData
+ fun Density.modifyParentData(parentData: Any?): Any? = parentData
}
diff --git a/ui/ui-foundation/integration-tests/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt b/ui/ui-foundation/integration-tests/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt
index 90c8ada..e55503f 100644
--- a/ui/ui-foundation/integration-tests/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt
+++ b/ui/ui-foundation/integration-tests/samples/src/main/java/androidx/ui/foundation/samples/DraggableSamples.kt
@@ -19,7 +19,7 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
import androidx.ui.core.Alignment
-import androidx.ui.core.ambientDensity
+import androidx.ui.core.DensityAmbient
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.animation.AnchorsFlingConfig
import androidx.ui.foundation.animation.animatedDragValue
@@ -31,14 +31,13 @@
import androidx.ui.layout.Container
import androidx.ui.layout.Padding
import androidx.ui.unit.dp
-import androidx.ui.unit.withDensity
@Sampled
@Composable
fun DraggableSample() {
val max = 300.dp
val min = 0.dp
- val (minPx, maxPx) = withDensity(ambientDensity()) {
+ val (minPx, maxPx) = with(DensityAmbient.current) {
min.toPx().value to max.toPx().value
}
val position = animatedDragValue(0f, minPx, maxPx)
@@ -48,7 +47,7 @@
dragDirection = DragDirection.Horizontal
) {
// dragValue is the current value in progress of dragging
- val draggedDp = withDensity(ambientDensity()) {
+ val draggedDp = with(DensityAmbient.current) {
position.value.toDp()
}
val squareSize = 50.dp
@@ -69,7 +68,7 @@
fun AnchoredDraggableSample() {
val max = 300.dp
val min = 0.dp
- val (minPx, maxPx) = withDensity(ambientDensity()) {
+ val (minPx, maxPx) = with(DensityAmbient.current) {
min.toPx().value to max.toPx().value
}
// define anchors and related animation controller
@@ -83,9 +82,7 @@
dragDirection = DragDirection.Horizontal,
position.fling(flingConfig, it) }
) {
- val draggedDp = withDensity(ambientDensity()) {
- position.value.toDp()
- }
+ val draggedDp = with(DensityAmbient.current) { position.value.toDp() }
val squareSize = 50.dp
// Draw a seekbar-like widget that has a black background
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BackgroundTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BackgroundTest.kt
index c42e2c4..1811ea2 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BackgroundTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BackgroundTest.kt
@@ -21,8 +21,8 @@
import androidx.test.filters.MediumTest
import androidx.test.filters.SdkSuppress
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.TestTag
-import androidx.ui.core.WithDensity
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.graphics.Color
@@ -35,7 +35,7 @@
import androidx.ui.test.captureToBitmap
import androidx.ui.test.createComposeRule
import androidx.ui.test.findByTag
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.px
import org.junit.Rule
import org.junit.Test
@@ -153,11 +153,11 @@
}
@Composable
- private fun OuterJunk(children: @Composable DensityScope.() -> Unit) {
+ private fun OuterJunk(children: @Composable Density.() -> Unit) {
Align(Alignment.TopLeft) {
TestTag(contentTag) {
Semantics(container = true) {
- WithDensity(children)
+ DensityAmbient.current.children()
}
}
}
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 3beb286..f3df83b 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,9 +21,9 @@
import androidx.test.filters.MediumTest
import androidx.test.filters.SdkSuppress
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.TestTag
-import androidx.ui.core.WithDensity
import androidx.ui.foundation.shape.RectangleShape
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.foundation.shape.corner.RoundedCornerShape
@@ -39,7 +39,7 @@
import androidx.ui.test.captureToBitmap
import androidx.ui.test.createComposeRule
import androidx.ui.test.findByTag
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.px
import org.junit.Rule
import org.junit.Test
@@ -114,12 +114,12 @@
}
@Composable
- fun SemanticParent(children: @Composable DensityScope.() -> Unit) {
+ fun SemanticParent(children: @Composable Density.() -> Unit) {
Align(Alignment.TopLeft) {
TestTag(tag = testTag) {
Semantics(container = true) {
Container {
- WithDensity(children)
+ DensityAmbient.current.children()
}
}
}
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 676036f..bf24f7f 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
@@ -61,7 +61,6 @@
import androidx.ui.unit.px
import androidx.ui.unit.toPx
import androidx.ui.unit.toRect
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
@@ -285,7 +284,7 @@
rowHeight: IntPx = defaultCellSize
) {
// We assume that the height of the device is more than 45 px
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
composeTestRule.setContent {
Align(alignment = Alignment.TopLeft) {
TestTag(scrollerTag) {
@@ -322,7 +321,7 @@
columnWidth: IntPx = defaultCellSize
) {
// We assume that the height of the device is more than 45 px
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
composeTestRule.setContent {
Align(alignment = Alignment.TopLeft) {
TestTag(scrollerTag) {
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 500abc2..d810647 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
@@ -18,8 +18,8 @@
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
-import androidx.ui.core.WithDensity
import androidx.ui.geometry.Rect
import androidx.ui.graphics.BlendMode
import androidx.ui.graphics.Color
@@ -35,12 +35,11 @@
image: Image,
tint: Color? = null
) {
- // TODO b/132071873: WithDensity should be able to use the DSL syntax
- WithDensity(block = {
+ with(DensityAmbient.current) {
Container(width = image.width.toDp(), height = image.height.toDp()) {
DrawImage(image, tint)
}
- })
+ }
}
/**
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/DrawShape.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/DrawShape.kt
index 9ea106ca..70e0fa0 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/DrawShape.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/DrawShape.kt
@@ -53,7 +53,7 @@
brush.applyTo(paint)
lastParentSize = parentSize
val outline =
- lastOutline ?: shape.createOutline(parentSize, density).also { lastOutline = it }
+ lastOutline ?: shape.createOutline(parentSize, this).also { lastOutline = it }
canvas.drawOutline(outline, paint)
}
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt
index 5ef848e..e0ddd4f 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt
@@ -24,7 +24,6 @@
import androidx.ui.unit.PxSize
import androidx.ui.unit.minDimension
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
/**
* Defines size of a corner in [Px]. For example for rounded shape it can be a corner radius.
@@ -49,7 +48,7 @@
private data class DpCornerSize(private val size: Dp) : CornerSize {
override fun toPx(shapeSize: PxSize, density: Density) =
- withDensity(density) { size.toPx() }
+ with(density) { size.toPx() }
}
/**
diff --git a/ui/ui-framework/api/0.1.0-dev05.txt b/ui/ui-framework/api/0.1.0-dev05.txt
index 05e74d8..1f26630 100644
--- a/ui/ui-framework/api/0.1.0-dev05.txt
+++ b/ui/ui-framework/api/0.1.0-dev05.txt
@@ -9,7 +9,7 @@
}
public final class DrawKt {
- method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
+ method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
method public static inline void Draw(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
}
@@ -23,7 +23,7 @@
}
public final class LayoutKt {
- method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
+ method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method @Deprecated public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit>![] childrenArray, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super androidx.ui.core.MultiComposableMeasurables,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static inline void OnChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned, kotlin.jvm.functions.Function0<kotlin.Unit> children);
@@ -36,7 +36,7 @@
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
- method public Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public final class LayoutTagKt {
@@ -124,8 +124,6 @@
public final class WrapperKt {
method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void WithDensity(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,kotlin.Unit> block);
- method public static inline androidx.ui.unit.Density ambientDensity();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
diff --git a/ui/ui-framework/api/current.txt b/ui/ui-framework/api/current.txt
index 05e74d8..1f26630 100644
--- a/ui/ui-framework/api/current.txt
+++ b/ui/ui-framework/api/current.txt
@@ -9,7 +9,7 @@
}
public final class DrawKt {
- method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
+ method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
method public static inline void Draw(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
}
@@ -23,7 +23,7 @@
}
public final class LayoutKt {
- method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
+ method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method @Deprecated public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit>![] childrenArray, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super androidx.ui.core.MultiComposableMeasurables,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static inline void OnChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned, kotlin.jvm.functions.Function0<kotlin.Unit> children);
@@ -36,7 +36,7 @@
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
- method public Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public final class LayoutTagKt {
@@ -124,8 +124,6 @@
public final class WrapperKt {
method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void WithDensity(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,kotlin.Unit> block);
- method public static inline androidx.ui.unit.Density ambientDensity();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
diff --git a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev05.txt b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev05.txt
index 05e74d8..1f26630 100644
--- a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev05.txt
+++ b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev05.txt
@@ -9,7 +9,7 @@
}
public final class DrawKt {
- method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
+ method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
method public static inline void Draw(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
}
@@ -23,7 +23,7 @@
}
public final class LayoutKt {
- method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
+ method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method @Deprecated public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit>![] childrenArray, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super androidx.ui.core.MultiComposableMeasurables,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static inline void OnChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned, kotlin.jvm.functions.Function0<kotlin.Unit> children);
@@ -36,7 +36,7 @@
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
- method public Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public final class LayoutTagKt {
@@ -124,8 +124,6 @@
public final class WrapperKt {
method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void WithDensity(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,kotlin.Unit> block);
- method public static inline androidx.ui.unit.Density ambientDensity();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
diff --git a/ui/ui-framework/api/public_plus_experimental_current.txt b/ui/ui-framework/api/public_plus_experimental_current.txt
index 05e74d8..1f26630 100644
--- a/ui/ui-framework/api/public_plus_experimental_current.txt
+++ b/ui/ui-framework/api/public_plus_experimental_current.txt
@@ -9,7 +9,7 @@
}
public final class DrawKt {
- method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
+ method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
method public static inline void Draw(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
}
@@ -23,7 +23,7 @@
}
public final class LayoutKt {
- method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
+ method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method @Deprecated public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit>![] childrenArray, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super androidx.ui.core.MultiComposableMeasurables,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static inline void OnChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned, kotlin.jvm.functions.Function0<kotlin.Unit> children);
@@ -36,7 +36,7 @@
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
- method public Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public final class LayoutTagKt {
@@ -124,8 +124,6 @@
public final class WrapperKt {
method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void WithDensity(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,kotlin.Unit> block);
- method public static inline androidx.ui.unit.Density ambientDensity();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
diff --git a/ui/ui-framework/api/restricted_0.1.0-dev05.txt b/ui/ui-framework/api/restricted_0.1.0-dev05.txt
index 05e74d8..1f26630 100644
--- a/ui/ui-framework/api/restricted_0.1.0-dev05.txt
+++ b/ui/ui-framework/api/restricted_0.1.0-dev05.txt
@@ -9,7 +9,7 @@
}
public final class DrawKt {
- method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
+ method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
method public static inline void Draw(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
}
@@ -23,7 +23,7 @@
}
public final class LayoutKt {
- method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
+ method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method @Deprecated public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit>![] childrenArray, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super androidx.ui.core.MultiComposableMeasurables,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static inline void OnChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned, kotlin.jvm.functions.Function0<kotlin.Unit> children);
@@ -36,7 +36,7 @@
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
- method public Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public final class LayoutTagKt {
@@ -124,8 +124,6 @@
public final class WrapperKt {
method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void WithDensity(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,kotlin.Unit> block);
- method public static inline androidx.ui.unit.Density ambientDensity();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
diff --git a/ui/ui-framework/api/restricted_current.txt b/ui/ui-framework/api/restricted_current.txt
index 05e74d8..1f26630 100644
--- a/ui/ui-framework/api/restricted_current.txt
+++ b/ui/ui-framework/api/restricted_current.txt
@@ -9,7 +9,7 @@
}
public final class DrawKt {
- method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
+ method public static inline void Draw(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
method public static inline void Draw(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit> onPaint);
}
@@ -23,7 +23,7 @@
}
public final class LayoutKt {
- method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
+ method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> minIntrinsicHeightMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicWidthMeasureBlock, kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super java.util.List<? extends androidx.ui.core.IntrinsicMeasurable>,? super androidx.ui.unit.IntPx,androidx.ui.unit.IntPx> maxIntrinsicHeightMeasureBlock, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit> children, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super java.util.List<? extends androidx.ui.core.Measurable>,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method @Deprecated public static void Layout(kotlin.jvm.functions.Function0<kotlin.Unit>![] childrenArray, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function3<? super androidx.ui.core.MeasureScope,? super androidx.ui.core.MultiComposableMeasurables,? super androidx.ui.core.Constraints,? extends androidx.ui.core.MeasureScope.LayoutResult> measureBlock);
method public static inline void OnChildPositioned(kotlin.jvm.functions.Function1<? super androidx.ui.core.LayoutCoordinates,kotlin.Unit> onPositioned, kotlin.jvm.functions.Function0<kotlin.Unit> children);
@@ -36,7 +36,7 @@
method public Object component1();
method public androidx.ui.core.LayoutTag copy(Object tag);
method public Object getTag();
- method public Object? modifyParentData(androidx.ui.unit.DensityScope, Object? parentData);
+ method public Object? modifyParentData(androidx.ui.unit.Density, Object? parentData);
}
public final class LayoutTagKt {
@@ -124,8 +124,6 @@
public final class WrapperKt {
method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void WithDensity(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,kotlin.Unit> block);
- method public static inline androidx.ui.unit.Density ambientDensity();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
diff --git a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsActivity.kt b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsActivity.kt
index bd775d2..cb81a74 100644
--- a/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsActivity.kt
+++ b/ui/ui-framework/integration-tests/framework-demos/src/main/java/androidx/ui/framework/demos/VectorGraphicsActivity.kt
@@ -19,9 +19,9 @@
import android.app.Activity
import android.os.Bundle
import androidx.compose.Composable
+import androidx.ui.core.DensityAmbient
import androidx.ui.unit.Dp
import androidx.ui.unit.Px
-import androidx.ui.core.WithDensity
import androidx.ui.unit.dp
import androidx.ui.core.setContent
import androidx.ui.graphics.Color
@@ -50,7 +50,7 @@
setContent {
Column {
val vectorAsset = loadVectorResource(R.drawable.ic_crane)
- WithDensity {
+ with(DensityAmbient.current) {
vectorAsset.resource.resource?.let {
Center {
Container(width = 200.dp, height = 100.dp) {
diff --git a/ui/ui-framework/integration-tests/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt b/ui/ui-framework/integration-tests/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt
index c956c1cf..5838044 100644
--- a/ui/ui-framework/integration-tests/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt
+++ b/ui/ui-framework/integration-tests/samples/src/main/java/androidx/ui/framework/samples/WithConstraintsSample.kt
@@ -18,18 +18,17 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.WithConstraints
-import androidx.ui.core.ambientDensity
import androidx.ui.graphics.Color
import androidx.ui.unit.dp
-import androidx.ui.unit.withDensity
@Sampled
@Composable
fun WithConstraintsSample() {
WithConstraints { constraints ->
val rectangleHeight = 100.dp
- val threshold = withDensity(ambientDensity()) { (rectangleHeight * 2).toIntPx() }
+ val threshold = with(DensityAmbient.current) { (rectangleHeight * 2).toIntPx() }
if (constraints.maxHeight < threshold) {
SizedRectangle(color = Color.Blue, width = 50.dp, height = rectangleHeight)
} else {
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 62d2696..c629c8f 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
@@ -32,7 +32,6 @@
import androidx.ui.unit.isFinite
import androidx.ui.unit.toPxPosition
import androidx.ui.unit.toPxSize
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth
import org.hamcrest.CoreMatchers.instanceOf
import org.hamcrest.Description
@@ -63,7 +62,7 @@
// TODO(b/140215440): Some tests are calling the OnChildPosition method inside the Popup too
// many times
private fun createPopupWithAlignmentRule(alignment: Alignment, measureLatch: CountDownLatch) {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
val popupWidthDp = popupSize.width.toDp()
val popupHeightDp = popupSize.height.toDp()
val parentWidthDp = parentSize.width.toDp()
@@ -134,10 +133,10 @@
@Test
fun popup_hasActualSize() {
- val popupWidthDp = withDensity(composeTestRule.density) {
+ val popupWidthDp = with(composeTestRule.density) {
popupSize.width.toDp()
}
- val popupHeightDp = withDensity(composeTestRule.density) {
+ val popupHeightDp = with(composeTestRule.density) {
popupSize.height.toDp()
}
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 5667ca7..37dd191 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
@@ -32,7 +32,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.ipx
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.times
@@ -68,7 +67,7 @@
}
@Test
- fun testTextLayout() = withDensity(density) {
+ fun testTextLayout() = with(density) {
val layoutLatch = CountDownLatch(2)
val textSize = Ref<IntPxSize>()
val doubleTextSize = Ref<IntPxSize>()
@@ -96,7 +95,7 @@
}
@Test
- fun testTextLayout_intrinsicMeasurements() = withDensity(density) {
+ fun testTextLayout_intrinsicMeasurements() = with(density) {
val layoutLatch = CountDownLatch(2)
val textSize = Ref<IntPxSize>()
val doubleTextSize = Ref<IntPxSize>()
@@ -154,7 +153,7 @@
}
@Test
- fun testTextLayout_providesBaselines() = withDensity(density) {
+ fun testTextLayout_providesBaselines() = with(density) {
val layoutLatch = CountDownLatch(2)
show {
val text = @Composable {
@@ -181,7 +180,7 @@
}
@Test
- fun testOnTextLayout() = withDensity(density) {
+ fun testOnTextLayout() = with(density) {
val layoutLatch = CountDownLatch(2)
val callback = mock<(TextLayoutResult) -> Unit>()
show {
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureDetectorTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureDetectorTest.kt
index 393863e..d167072 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureDetectorTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureDetectorTest.kt
@@ -20,12 +20,11 @@
import android.view.ViewGroup
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Layout
-import androidx.ui.core.ambientDensity
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.unit.IntPx
-import androidx.ui.unit.withDensity
import com.nhaarman.mockitokotlin2.inOrder
import com.nhaarman.mockitokotlin2.spy
import com.nhaarman.mockitokotlin2.verifyNoMoreInteractions
@@ -59,7 +58,7 @@
val setupLatch = CountDownLatch(2)
activityTestRule.runOnUiThreadIR {
activity.setContent {
- touchSlop = withDensity(ambientDensity()) { TouchSlop.toIntPx() }
+ touchSlop = with(DensityAmbient.current) { TouchSlop.toIntPx() }
ScaleGestureDetector(scaleObserver) {
Layout(
measureBlock = { _, _ ->
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureDetectorTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureDetectorTest.kt
index 78b1d94..9f38fca 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureDetectorTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureDetectorTest.kt
@@ -20,8 +20,8 @@
import android.view.ViewGroup
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Layout
-import androidx.ui.core.ambientDensity
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.unit.IntPx
@@ -29,7 +29,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.inOrder
import com.nhaarman.mockitokotlin2.spy
@@ -242,7 +241,7 @@
val setupLatch = CountDownLatch(2)
activityTestRule.runOnUiThreadIR {
activity.setContent {
- touchSlop = withDensity(ambientDensity()) { TouchSlop.toIntPx() }
+ touchSlop = with(DensityAmbient.current) { TouchSlop.toIntPx() }
TouchSlopDragGestureDetector(
dragObserver,
startDragImmediately = startDragImmediately
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/SelectionContainerTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/SelectionContainerTest.kt
index 6de9ea4..e56b58e 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/SelectionContainerTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/SelectionContainerTest.kt
@@ -22,6 +22,7 @@
import android.view.View
import android.view.ViewGroup
import androidx.compose.Providers
+import androidx.compose.mutableStateOf
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
import androidx.ui.core.hapticfeedback.HapticFeedback
@@ -31,7 +32,6 @@
import androidx.ui.core.gesture.PointerCoords
import androidx.ui.core.gesture.PointerProperties
import androidx.ui.core.hapticfeedback.HapticFeedbackType
-import androidx.ui.core.test.ValueModel
import androidx.ui.test.android.AndroidComposeTestRule
import androidx.ui.text.TextStyle
import androidx.ui.text.font.FontStyle
@@ -40,7 +40,6 @@
import androidx.ui.text.font.asFontFamily
import androidx.ui.unit.px
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.times
@@ -73,112 +72,104 @@
private lateinit var gestureCountDownLatch: CountDownLatch
- private val selection = ValueModel<Selection?>(null)
+ private val selection = mutableStateOf<Selection?>(null)
private val fontSize = 10.sp
private val hapticFeedback = mock<HapticFeedback>()
@Before
fun setup() {
- withDensity(composeTestRule.density) {
- composeTestRule.setContent {
- Providers(
- HapticFeedBackAmbient provides hapticFeedback
- ) {
- SelectionContainer(
- selection = selection.value,
- >
- selection.value = it
- gestureCountDownLatch.countDown()
- }
- ) {
- Text(
- textContent,
- style = TextStyle(fontFamily = fontFamily, fontSize = fontSize)
- )
+ composeTestRule.setContent {
+ Providers(
+ HapticFeedBackAmbient provides hapticFeedback
+ ) {
+ SelectionContainer(
+ selection = selection.value,
+ >
+ selection.value = it
+ gestureCountDownLatch.countDown()
}
+ ) {
+ Text(
+ textContent,
+ style = TextStyle(fontFamily = fontFamily, fontSize = fontSize)
+ )
}
}
- view = activity.findViewById<ViewGroup>(R.id.content)
}
+ view = activity.findViewById<ViewGroup>(R.id.content)
}
@Test
@SdkSuppress(minSdkVersion = 27)
fun press_to_cancel() {
- withDensity(composeTestRule.density) {
- // Setup. Long press to create a selection.
- // A reasonable number.
- val position = 50.px
- longPress(x = position.value, y = position.value)
- composeTestRule.runOnIdleCompose {
- assertThat(selection.value).isNotNull()
- }
+ // Setup. Long press to create a selection.
+ // A reasonable number.
+ val position = 50.px
+ longPress(x = position.value, y = position.value)
+ composeTestRule.runOnIdleCompose {
+ assertThat(selection.value).isNotNull()
+ }
- // Act.
- press(x = position.value, y = position.value)
+ // Act.
+ press(x = position.value, y = position.value)
- // Assert.
- composeTestRule.runOnIdleCompose {
- assertThat(selection.value).isNull()
- verify(
- hapticFeedback,
- times(2)
- ).performHapticFeedback(HapticFeedbackType.TextHandleMove)
- }
+ // Assert.
+ composeTestRule.runOnIdleCompose {
+ assertThat(selection.value).isNull()
+ verify(
+ hapticFeedback,
+ times(2)
+ ).performHapticFeedback(HapticFeedbackType.TextHandleMove)
}
}
@Test
fun long_press_select_a_word() {
- withDensity(composeTestRule.density) {
- // Setup.
- val characterSize = fontSize.toPx().value
+ // Setup.
+ val characterSize = with(composeTestRule.density) { fontSize.toPx().value }
- // Act.
- longPress(
- x = textContent.indexOf('m') * characterSize,
- y = 0.5f * characterSize
- )
+ // Act.
+ longPress(
+ x = textContent.indexOf('m') * characterSize,
+ y = 0.5f * characterSize
+ )
- // Assert. Should select "Demo".
- composeTestRule.runOnIdleCompose {
- assertThat(selection.value!!.start.offset).isEqualTo(textContent.indexOf('D'))
- assertThat(selection.value!!.end.offset).isEqualTo(textContent.indexOf('o') + 1)
- verify(
- hapticFeedback,
- times(1)
- ).performHapticFeedback(HapticFeedbackType.TextHandleMove)
- }
+ // Assert. Should select "Demo".
+ composeTestRule.runOnIdleCompose {
+ assertThat(selection.value!!.start.offset).isEqualTo(textContent.indexOf('D'))
+ assertThat(selection.value!!.end.offset).isEqualTo(textContent.indexOf('o') + 1)
+ verify(
+ hapticFeedback,
+ times(1)
+ ).performHapticFeedback(HapticFeedbackType.TextHandleMove)
}
}
@Test
@SdkSuppress(minSdkVersion = 27)
fun long_press_and_drag_select_text_range() {
- withDensity(composeTestRule.density) {
- // Setup. Want to selection "Dem".
- val startOffset = textContent.indexOf('D')
- val endOffset = textContent.indexOf('m') + 1
- val characterSize = fontSize.toPx().value
+ // Setup. Want to selection "Dem".
+ val startOffset = textContent.indexOf('D')
+ val endOffset = textContent.indexOf('m') + 1
+ val characterSize = with(composeTestRule.density) { fontSize.toPx().value }
- // Act.
- longPressAndDrag(
- startX = startOffset * characterSize,
- startY = 0.5f * characterSize,
- endX = endOffset * characterSize,
- endY = 0.5f * characterSize
- )
+ // Act.
+ longPressAndDrag(
+ startX = startOffset * characterSize,
+ startY = 0.5f * characterSize,
+ endX = endOffset * characterSize,
+ endY = 0.5f * characterSize
+ )
- // Assert.
- composeTestRule.runOnIdleCompose {
- assertThat(selection.value!!.start.offset).isEqualTo(startOffset)
- assertThat(selection.value!!.end.offset).isEqualTo("Text Demo".length)
- verify(
- hapticFeedback,
- times(1)
- ).performHapticFeedback(HapticFeedbackType.TextHandleMove)
- }
+ // Assert.
+ composeTestRule.runOnIdleCompose {
+ assertThat(selection.value!!.start.offset).isEqualTo(startOffset)
+ assertThat(selection.value!!.end.offset).isEqualTo("Text Demo".length)
+ verify(
+ hapticFeedback,
+ times(1)
+ ).performHapticFeedback(HapticFeedbackType.TextHandleMove)
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/TextSelectionDelegateTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/TextSelectionDelegateTest.kt
index f26d191..49c9a9a 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/TextSelectionDelegateTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/selection/TextSelectionDelegateTest.kt
@@ -42,7 +42,6 @@
import androidx.ui.unit.TextUnit
import androidx.ui.unit.px
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.mock
import org.junit.Test
@@ -65,157 +64,151 @@
@Test
fun getTextSelectionInfo_long_press_select_word_ltr() {
- withDensity(defaultDensity) {
- val text = "hello world\n"
- val fontSize = 20.sp
- val fontSizeInPx = fontSize.toPx().value
+ val text = "hello world\n"
+ val fontSize = 20.sp
+ val fontSizeInPx = with(defaultDensity) { fontSize.toPx().value }
- val textLayoutResult = simpleTextLayout(
- text = text,
- fontSize = fontSize,
- density = defaultDensity
+ val textLayoutResult = simpleTextLayout(
+ text = text,
+ fontSize = fontSize,
+ density = defaultDensity
+ )
+
+ val start = PxPosition((fontSizeInPx * 2).px, (fontSizeInPx / 2).px)
+ val end = start
+
+ // Act.
+ val textSelectionInfo = getTextSelectionInfo(
+ textLayoutResult = textLayoutResult,
+ selectionCoordinates = Pair(start, end),
+ layoutCoordinates = mock(),
+ wordBasedSelection = true
+ )
+
+ // Assert.
+ assertThat(textSelectionInfo).isNotNull()
+
+ assertThat(textSelectionInfo?.start).isNotNull()
+ textSelectionInfo?.start?.let {
+ assertThat(it.coordinates).isEqualTo(
+ PxPosition(0.px, fontSizeInPx.px)
)
+ assertThat(it.direction).isEqualTo(TextDirection.Ltr)
+ assertThat(it.layoutCoordinates).isNotNull()
+ assertThat(it.offset).isEqualTo(0)
+ }
- val start = PxPosition((fontSizeInPx * 2).px, (fontSizeInPx / 2).px)
- val end = start
-
- // Act.
- val textSelectionInfo = getTextSelectionInfo(
- textLayoutResult = textLayoutResult,
- selectionCoordinates = Pair(start, end),
- layoutCoordinates = mock(),
- wordBasedSelection = true
+ assertThat(textSelectionInfo?.end).isNotNull()
+ textSelectionInfo?.end?.let {
+ assertThat(it.coordinates).isEqualTo(
+ PxPosition(("hello".length * fontSizeInPx).px, fontSizeInPx.px)
)
-
- // Assert.
- assertThat(textSelectionInfo).isNotNull()
-
- assertThat(textSelectionInfo?.start).isNotNull()
- textSelectionInfo?.start?.let {
- assertThat(it.coordinates).isEqualTo(
- PxPosition(0.px, fontSizeInPx.px)
- )
- assertThat(it.direction).isEqualTo(TextDirection.Ltr)
- assertThat(it.layoutCoordinates).isNotNull()
- assertThat(it.offset).isEqualTo(0)
- }
-
- assertThat(textSelectionInfo?.end).isNotNull()
- textSelectionInfo?.end?.let {
- assertThat(it.coordinates).isEqualTo(
- PxPosition(("hello".length * fontSizeInPx).px, fontSizeInPx.px)
- )
- assertThat(it.direction).isEqualTo(TextDirection.Ltr)
- assertThat(it.layoutCoordinates).isNotNull()
- assertThat(it.offset).isEqualTo("hello".length)
- }
+ assertThat(it.direction).isEqualTo(TextDirection.Ltr)
+ assertThat(it.layoutCoordinates).isNotNull()
+ assertThat(it.offset).isEqualTo("hello".length)
}
}
@Test
fun getTextSelectionInfo_long_press_select_word_rtl() {
- withDensity(defaultDensity) {
- val text = "\u05D0\u05D1\u05D2 \u05D3\u05D4\u05D5\n"
- val fontSize = 20.sp
- val fontSizeInPx = fontSize.toPx().value
+ val text = "\u05D0\u05D1\u05D2 \u05D3\u05D4\u05D5\n"
+ val fontSize = 20.sp
+ val fontSizeInPx = with(defaultDensity) { fontSize.toPx().value }
- val textLayoutResult = simpleTextLayout(
- text = text,
- fontSize = fontSize,
- density = defaultDensity
+ val textLayoutResult = simpleTextLayout(
+ text = text,
+ fontSize = fontSize,
+ density = defaultDensity
+ )
+
+ val start = PxPosition((fontSizeInPx * 2).px, (fontSizeInPx / 2).px)
+ val end = start
+
+ // Act.
+ val textSelectionInfo = getTextSelectionInfo(
+ textLayoutResult = textLayoutResult,
+ selectionCoordinates = Pair(start, end),
+ layoutCoordinates = mock(),
+ wordBasedSelection = true
+ )
+
+ // Assert.
+ assertThat(textSelectionInfo).isNotNull()
+
+ assertThat(textSelectionInfo?.start).isNotNull()
+ textSelectionInfo?.start?.let {
+ assertThat(it.coordinates).isEqualTo(
+ PxPosition(("\u05D3\u05D4\u05D5".length * fontSizeInPx).px, fontSizeInPx.px)
)
+ assertThat(it.direction).isEqualTo(TextDirection.Rtl)
+ assertThat(it.layoutCoordinates).isNotNull()
+ assertThat(it.offset).isEqualTo(text.indexOf("\u05D3"))
+ }
- val start = PxPosition((fontSizeInPx * 2).px, (fontSizeInPx / 2).px)
- val end = start
-
- // Act.
- val textSelectionInfo = getTextSelectionInfo(
- textLayoutResult = textLayoutResult,
- selectionCoordinates = Pair(start, end),
- layoutCoordinates = mock(),
- wordBasedSelection = true
+ assertThat(textSelectionInfo?.end).isNotNull()
+ textSelectionInfo?.end?.let {
+ assertThat(it.coordinates).isEqualTo(
+ PxPosition(0.px, fontSizeInPx.px)
)
-
- // Assert.
- assertThat(textSelectionInfo).isNotNull()
-
- assertThat(textSelectionInfo?.start).isNotNull()
- textSelectionInfo?.start?.let {
- assertThat(it.coordinates).isEqualTo(
- PxPosition(("\u05D3\u05D4\u05D5".length * fontSizeInPx).px, fontSizeInPx.px)
- )
- assertThat(it.direction).isEqualTo(TextDirection.Rtl)
- assertThat(it.layoutCoordinates).isNotNull()
- assertThat(it.offset).isEqualTo(text.indexOf("\u05D3"))
- }
-
- assertThat(textSelectionInfo?.end).isNotNull()
- textSelectionInfo?.end?.let {
- assertThat(it.coordinates).isEqualTo(
- PxPosition(0.px, fontSizeInPx.px)
- )
- assertThat(it.direction).isEqualTo(TextDirection.Rtl)
- assertThat(it.layoutCoordinates).isNotNull()
- assertThat(it.offset).isEqualTo(text.indexOf("\u05D5") + 1)
- }
+ assertThat(it.direction).isEqualTo(TextDirection.Rtl)
+ assertThat(it.layoutCoordinates).isNotNull()
+ assertThat(it.offset).isEqualTo(text.indexOf("\u05D5") + 1)
}
}
@Test
fun getTextSelectionInfo_long_press_drag_handle_not_cross_select_word() {
- withDensity(defaultDensity) {
- val text = "hello world"
- val fontSize = 20.sp
- val fontSizeInPx = fontSize.toPx().value
+ val text = "hello world"
+ val fontSize = 20.sp
+ val fontSizeInPx = with(defaultDensity) { fontSize.toPx().value }
- val textLayoutResult = simpleTextLayout(
- text = text,
- fontSize = fontSize,
- density = defaultDensity
+ val textLayoutResult = simpleTextLayout(
+ text = text,
+ fontSize = fontSize,
+ density = defaultDensity
+ )
+
+ val rawStartOffset = text.indexOf('e')
+ val rawEndOffset = text.indexOf('r')
+ val start = PxPosition((fontSizeInPx * rawStartOffset).px, (fontSizeInPx / 2).px)
+ val end = PxPosition((fontSizeInPx * rawEndOffset).px, (fontSizeInPx / 2).px)
+
+ // Act.
+ val textSelectionInfo = getTextSelectionInfo(
+ textLayoutResult = textLayoutResult,
+ selectionCoordinates = Pair(start, end),
+ layoutCoordinates = mock(),
+ wordBasedSelection = true
+ )
+
+ // Assert.
+ assertThat(textSelectionInfo).isNotNull()
+
+ assertThat(textSelectionInfo?.start).isNotNull()
+ textSelectionInfo?.start?.let {
+ assertThat(it.coordinates).isEqualTo(
+ PxPosition(0.px, fontSizeInPx.px)
)
-
- val rawStartOffset = text.indexOf('e')
- val rawEndOffset = text.indexOf('r')
- val start = PxPosition((fontSizeInPx * rawStartOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * rawEndOffset).px, (fontSizeInPx / 2).px)
-
- // Act.
- val textSelectionInfo = getTextSelectionInfo(
- textLayoutResult = textLayoutResult,
- selectionCoordinates = Pair(start, end),
- layoutCoordinates = mock(),
- wordBasedSelection = true
- )
-
- // Assert.
- assertThat(textSelectionInfo).isNotNull()
-
- assertThat(textSelectionInfo?.start).isNotNull()
- textSelectionInfo?.start?.let {
- assertThat(it.coordinates).isEqualTo(
- PxPosition(0.px, fontSizeInPx.px)
- )
- assertThat(it.direction).isEqualTo(TextDirection.Ltr)
- assertThat(it.layoutCoordinates).isNotNull()
- assertThat(it.offset).isEqualTo(0)
- }
-
- assertThat(textSelectionInfo?.end).isNotNull()
- textSelectionInfo?.end?.let {
- assertThat(it.coordinates).isEqualTo(
- PxPosition((text.length * fontSizeInPx).px, fontSizeInPx.px)
- )
- assertThat(it.direction).isEqualTo(TextDirection.Ltr)
- assertThat(it.layoutCoordinates).isNotNull()
- assertThat(it.offset).isEqualTo(text.length)
- }
- assertThat(textSelectionInfo?.handlesCrossed).isFalse()
+ assertThat(it.direction).isEqualTo(TextDirection.Ltr)
+ assertThat(it.layoutCoordinates).isNotNull()
+ assertThat(it.offset).isEqualTo(0)
}
+
+ assertThat(textSelectionInfo?.end).isNotNull()
+ textSelectionInfo?.end?.let {
+ assertThat(it.coordinates).isEqualTo(
+ PxPosition((text.length * fontSizeInPx).px, fontSizeInPx.px)
+ )
+ assertThat(it.direction).isEqualTo(TextDirection.Ltr)
+ assertThat(it.layoutCoordinates).isNotNull()
+ assertThat(it.offset).isEqualTo(text.length)
+ }
+ assertThat(textSelectionInfo?.handlesCrossed).isFalse()
}
@Test
fun getTextSelectionInfo_long_press_drag_handle_cross_select_word() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -267,7 +260,7 @@
@Test
fun getTextSelectionInfo_drag_select_range_ltr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -319,7 +312,7 @@
@Test
fun getTextSelectionInfo_drag_select_range_rtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2 \u05D3\u05D4\u05D5\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -380,7 +373,7 @@
@Test
fun getTextSelectionInfo_drag_select_range_bidi() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "Hello"
val textRtl = "\u05D0\u05D1\u05D2\u05D3\u05D4"
val text = textLtr + textRtl
@@ -443,7 +436,7 @@
@Test
fun testTextSelectionProcessor_single_widget_handles_crossed_ltr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -492,7 +485,7 @@
@Test
fun testTextSelectionProcessor_single_widget_handles_crossed_rtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2 \u05D3\u05D4\u05D5\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -548,7 +541,7 @@
@Test
fun testTextSelectionProcessor_single_widget_handles_crossed_bidi() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "Hello"
val textRtl = "\u05D0\u05D1\u05D2\u05D3\u05D4"
val text = textLtr + textRtl
@@ -609,7 +602,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_ltr_drag_endHandle() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -673,7 +666,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_rtl_drag_endHandle() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2 \u05D3\u05D4\u05D5\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -749,7 +742,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_startHandle_not_crossed() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -814,7 +807,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_startHandle_crossed() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -879,7 +872,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_startHandle_not_crossed_bounded() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -930,7 +923,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_startHandle_crossed_bounded() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -981,7 +974,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_startHandle_not_crossed_boundary() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1034,7 +1027,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_startHandle_crossed_boundary() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1085,7 +1078,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_endHandle_crossed() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1150,7 +1143,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_endHandle_not_crossed_bounded() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1201,7 +1194,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_endHandle_crossed_bounded() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1252,7 +1245,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_endHandle_not_crossed_boundary() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1305,7 +1298,7 @@
@Test
fun testTextSelectionProcessor_bound_to_one_character_drag_endHandle_crossed_boundary() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1358,7 +1351,7 @@
@Test
fun testTextSelectionProcessor_cross_widget_not_contain_start() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1406,7 +1399,7 @@
@Test
fun testTextSelectionProcessor_cross_widget_not_contain_end() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1455,7 +1448,7 @@
@Test
fun testTextSelectionProcessor_cross_widget_not_contain_start_handles_crossed() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1505,7 +1498,7 @@
@Test
fun testTextSelectionProcessor_cross_widget_not_contain_end_handles_crossed() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1555,7 +1548,7 @@
@Test
fun testTextSelectionProcessor_not_selected() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "hello world\n"
val fontSize = 20.sp
val textLayoutResult = simpleTextLayout(
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 68407e9..906038f 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
@@ -65,7 +65,6 @@
import androidx.ui.graphics.Paint
import androidx.ui.graphics.PaintingStyle
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
@@ -2070,9 +2069,9 @@
}
private val AlignTopLeft = object : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints) =
+ override fun Density.modifyConstraints(constraints: Constraints) =
constraints.copy(minWidth = 0.ipx, minHeight = 0.ipx)
- override fun DensityScope.modifySize(
+ override fun Density.modifySize(
constraints: Constraints,
childSize: IntPxSize
) = IntPxSize(constraints.maxWidth, constraints.maxHeight)
@@ -2528,30 +2527,30 @@
val bottom: IntPx = 0.ipx
) : LayoutModifier {
- override fun DensityScope.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
+ override fun Density.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
measurable.minIntrinsicWidth((height - (top + bottom)).coerceAtLeast(0.ipx)) +
(left + right)
- override fun DensityScope.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
+ override fun Density.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
measurable.maxIntrinsicWidth((height - (top + bottom)).coerceAtLeast(0.ipx)) +
(left + right)
- override fun DensityScope.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
+ override fun Density.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
measurable.minIntrinsicHeight((width - (left + right)).coerceAtLeast(0.ipx)) +
(top + bottom)
- override fun DensityScope.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
+ override fun Density.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
measurable.maxIntrinsicHeight((width - (left + right)).coerceAtLeast(0.ipx)) +
(top + bottom)
- override fun DensityScope.modifyConstraints(
+ override fun Density.modifyConstraints(
constraints: Constraints
) = constraints.offset(
horizontal = -left - right,
vertical = -top - bottom
)
- override fun DensityScope.modifySize(
+ override fun Density.modifySize(
constraints: Constraints,
childSize: IntPxSize
) = IntPxSize(
@@ -2561,7 +2560,7 @@
.coerceIn(constraints.minHeight, constraints.maxHeight)
)
- override fun DensityScope.modifyPosition(
+ override fun Density.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize
) = IntPxPosition(left, top)
@@ -2672,7 +2671,7 @@
paint.style = PaintingStyle.fill
}
- override fun DensityScope.modifyPosition(
+ override fun Density.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize
): IntPxPosition {
@@ -2682,11 +2681,11 @@
)
}
- override fun DensityScope.modifyConstraints(constraints: Constraints): Constraints {
+ override fun Density.modifyConstraints(constraints: Constraints): Constraints {
return Constraints.fixed(10.ipx, 10.ipx)
}
- override fun DensityScope.modifySize(
+ override fun Density.modifySize(
constraints: Constraints,
childSize: IntPxSize
): IntPxSize {
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 458cdb1..fe32670 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
@@ -49,7 +49,7 @@
import androidx.ui.test.captureToBitmap
import androidx.ui.test.createComposeRule
import androidx.ui.test.findByTag
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.ipx
import junit.framework.TestCase.assertNotNull
@@ -369,7 +369,7 @@
}
fun LayoutConstraints(childConstraints: Constraints) = object : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints): Constraints {
+ override fun Density.modifyConstraints(constraints: Constraints): Constraints {
return childConstraints
}
}
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 7a8d10d..d9870b6 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
@@ -19,8 +19,8 @@
import androidx.compose.Composable
import androidx.compose.MutableState
import androidx.compose.state
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
-import androidx.ui.core.WithDensity
import androidx.ui.core.test.AtLeastSize
import androidx.ui.framework.test.R
import androidx.ui.geometry.Rect
@@ -46,7 +46,7 @@
vectorState = state
val vectorAsset = loadVectorResource(state.value)
- WithDensity {
+ with(DensityAmbient.current) {
vectorAsset.resource.resource?.let {
val width = it.defaultWidth
vectorSize = width.toIntPx().value
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/res/PrimitiveResourcesTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/res/PrimitiveResourcesTest.kt
index a904a10..741ae23 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/res/PrimitiveResourcesTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/res/PrimitiveResourcesTest.kt
@@ -20,9 +20,7 @@
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.ui.core.ContextAmbient
-import androidx.ui.unit.Density
import androidx.ui.unit.dp
-import androidx.ui.unit.withDensity
import androidx.ui.framework.test.R
import androidx.ui.test.createComposeRule
import com.google.common.truth.Truth.assertThat
@@ -78,9 +76,7 @@
composeTestRule.setContent {
Providers(ContextAmbient provides context) {
- withDensity(Density(context.resources.displayMetrics.density)) {
- assertThat(dimensionResource(R.dimen.dimension_value)).isEqualTo(32.dp)
- }
+ assertThat(dimensionResource(R.dimen.dimension_value)).isEqualTo(32.dp)
}
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Draw.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Draw.kt
index 4435ae0..81aa486 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Draw.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Draw.kt
@@ -18,7 +18,7 @@
import androidx.compose.Composable
import androidx.ui.graphics.Canvas
import androidx.ui.tooling.InspectionMode
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.PxSize
/**
@@ -27,14 +27,14 @@
* Example usage:
* @sample androidx.ui.framework.samples.DrawSample
*
- * The [onPaint] lambda uses a [DensityScope] receiver scope, to allow easy translation
+ * The [onPaint] lambda uses a [Density] receiver scope, to allow easy translation
* between [Dp], [Sp], and [Px]. The `parentSize` parameter indicates the layout size of
* the parent.
*/
@Suppress("NOTHING_TO_INLINE")
@Composable
inline fun Draw(
- noinline onPaint: DensityScope.(canvas: Canvas, parentSize: PxSize) -> Unit
+ noinline onPaint: Density.(canvas: Canvas, parentSize: PxSize) -> Unit
) {
// Hide the internals of DrawNode
if (InspectionMode.current) {
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Layout.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Layout.kt
index 2a78053..0dbcaf0 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Layout.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Layout.kt
@@ -24,7 +24,6 @@
import androidx.compose.compositionReference
import androidx.compose.remember
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
@@ -87,25 +86,25 @@
constraints: Constraints
) = measureScope.measureBlock(measurables, constraints)
override fun minIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
- ) = densityScope.minIntrinsicWidthMeasureBlock(measurables, h)
+ ) = density.minIntrinsicWidthMeasureBlock(measurables, h)
override fun minIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
- ) = densityScope.minIntrinsicHeightMeasureBlock(measurables, w)
+ ) = density.minIntrinsicHeightMeasureBlock(measurables, w)
override fun maxIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
- ) = densityScope.maxIntrinsicWidthMeasureBlock(measurables, h)
+ ) = density.maxIntrinsicWidthMeasureBlock(measurables, h)
override fun maxIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
- ) = densityScope.maxIntrinsicHeightMeasureBlock(measurables, w)
+ ) = density.maxIntrinsicHeightMeasureBlock(measurables, w)
}
Layout(children, measureBlocks, modifier)
}
@@ -235,8 +234,8 @@
*/
@PublishedApi
internal class IntrinsicsMeasureScope(
- override val density: Density
-) : MeasureScope() {
+ density: Density
+) : MeasureScope(), Density by density {
// TODO(popam): clean this up and prevent measuring inside intrinsics
}
@@ -252,25 +251,25 @@
constraints: Constraints
) = measureScope.measureBlock(measurables, constraints)
override fun minIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
- ) = densityScope.MeasuringMinIntrinsicWidth(measureBlock, measurables, h)
+ ) = density.MeasuringMinIntrinsicWidth(measureBlock, measurables, h)
override fun minIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
- ) = densityScope.MeasuringMinIntrinsicHeight(measureBlock, measurables, w)
+ ) = density.MeasuringMinIntrinsicHeight(measureBlock, measurables, w)
override fun maxIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
- ) = densityScope.MeasuringMaxIntrinsicWidth(measureBlock, measurables, h)
+ ) = density.MeasuringMaxIntrinsicWidth(measureBlock, measurables, h)
override fun maxIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
- ) = densityScope.MeasuringMaxIntrinsicHeight(measureBlock, measurables, w)
+ ) = density.MeasuringMaxIntrinsicHeight(measureBlock, measurables, w)
override fun toString(): String {
// this calls simpleIdentityToString on measureBlock because it is typically a lambda,
@@ -286,7 +285,7 @@
* Default implementation for the min intrinsic width of a layout. This works by running the
* measure block with measure calls replaced with intrinsic measurement calls.
*/
-private inline fun DensityScope.MeasuringMinIntrinsicWidth(
+private inline fun Density.MeasuringMinIntrinsicWidth(
measureBlock: MeasureBlock,
measurables: List<IntrinsicMeasurable>,
h: IntPx
@@ -295,7 +294,7 @@
DefaultIntrinsicMeasurable(it, IntrinsicMinMax.Min, IntrinsicWidthHeight.Width)
}
val constraints = Constraints(maxHeight = h)
- val layoutReceiver = IntrinsicsMeasureScope(density)
+ val layoutReceiver = IntrinsicsMeasureScope(this)
val layoutResult = layoutReceiver.measureBlock(mapped, constraints)
return layoutResult.width
}
@@ -304,7 +303,7 @@
* Default implementation for the min intrinsic width of a layout. This works by running the
* measure block with measure calls replaced with intrinsic measurement calls.
*/
-private inline fun DensityScope.MeasuringMinIntrinsicHeight(
+private inline fun Density.MeasuringMinIntrinsicHeight(
measureBlock: MeasureBlock,
measurables: List<IntrinsicMeasurable>,
w: IntPx
@@ -313,7 +312,7 @@
DefaultIntrinsicMeasurable(it, IntrinsicMinMax.Min, IntrinsicWidthHeight.Height)
}
val constraints = Constraints(maxWidth = w)
- val layoutReceiver = IntrinsicsMeasureScope(density)
+ val layoutReceiver = IntrinsicsMeasureScope(this)
val layoutResult = layoutReceiver.measureBlock(mapped, constraints)
return layoutResult.height
}
@@ -322,7 +321,7 @@
* Default implementation for the max intrinsic width of a layout. This works by running the
* measure block with measure calls replaced with intrinsic measurement calls.
*/
-private inline fun DensityScope.MeasuringMaxIntrinsicWidth(
+private inline fun Density.MeasuringMaxIntrinsicWidth(
measureBlock: MeasureBlock,
measurables: List<IntrinsicMeasurable>,
h: IntPx
@@ -331,7 +330,7 @@
DefaultIntrinsicMeasurable(it, IntrinsicMinMax.Max, IntrinsicWidthHeight.Width)
}
val constraints = Constraints(maxHeight = h)
- val layoutReceiver = IntrinsicsMeasureScope(density)
+ val layoutReceiver = IntrinsicsMeasureScope(this)
val layoutResult = layoutReceiver.measureBlock(mapped, constraints)
return layoutResult.width
}
@@ -340,7 +339,7 @@
* Default implementation for the max intrinsic height of a layout. This works by running the
* measure block with measure calls replaced with intrinsic measurement calls.
*/
-private inline fun DensityScope.MeasuringMaxIntrinsicHeight(
+private inline fun Density.MeasuringMaxIntrinsicHeight(
measureBlock: MeasureBlock,
measurables: List<IntrinsicMeasurable>,
w: IntPx
@@ -349,7 +348,7 @@
DefaultIntrinsicMeasurable(it, IntrinsicMinMax.Max, IntrinsicWidthHeight.Height)
}
val constraints = Constraints(maxWidth = w)
- val layoutReceiver = IntrinsicsMeasureScope(density)
+ val layoutReceiver = IntrinsicsMeasureScope(this)
val layoutResult = layoutReceiver.measureBlock(mapped, constraints)
return layoutResult.height
}
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 018e41f..e39fed5 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
@@ -17,7 +17,7 @@
package androidx.ui.core
import androidx.compose.Immutable
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
/**
* A [ParentDataModifier] which tags the target with the given [tag]. The provided tag
@@ -29,7 +29,7 @@
*/
@Immutable
data class LayoutTag(override val tag: Any) : ParentDataModifier, LayoutTagParentData {
- override fun DensityScope.modifyParentData(parentData: Any?): Any? {
+ override fun Density.modifyParentData(parentData: Any?): Any? {
return this@LayoutTag
}
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
index 480e112..448cda3 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
@@ -120,7 +120,7 @@
// Ambients
// selection registrar, if no SelectionContainer is added ambient value will be null
val selectionRegistrar = SelectionRegistrarAmbient.current
- val density = ambientDensity()
+ val density = DensityAmbient.current
val resourceLoader = FontLoaderAmbient.current
val layoutDirection = LayoutDirectionAmbient.current
val themeStyle = CurrentTextStyleAmbient.current
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
index d2cd40d..d1996b8 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
@@ -23,7 +23,6 @@
import androidx.animation.DefaultAnimationClock
import androidx.ui.core.input.FocusManager
import androidx.ui.input.TextInputService
-import androidx.compose.Ambient
import androidx.compose.composer
import androidx.compose.Composable
import androidx.compose.Compose
@@ -44,7 +43,6 @@
import androidx.ui.core.selection.SelectionContainer
import androidx.ui.text.font.Font
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import kotlinx.coroutines.Dispatchers
import kotlin.coroutines.CoroutineContext
@@ -232,28 +230,3 @@
* The ambient to provide haptic feedback to the user.
*/
val HapticFeedBackAmbient = staticAmbientOf<HapticFeedback>()
-
-/**
- * Aambient to get a [Density] object from an internal [DensityAmbient].
- *
- * Note: this is an experiment with the ways to achieve a read-only public [Ambient]s.
- */
-@Suppress("NOTHING_TO_INLINE")
-@Composable
-inline fun ambientDensity() = DensityAmbient.current
-
-/**
- * A component to be able to convert dimensions between each other.
- * A [Density] object will be take from an ambient.
- *
- * Usage example:
- * WithDensity {
- * Draw() { canvas, _ ->
- * canvas.drawRect(Rect(0, 0, dpHeight.toPx(), dpWidth.toPx()), paint)
- * }
- * }
- */
-@Composable
-fun WithDensity(block: @Composable DensityScope.() -> Unit) {
- DensityScope(ambientDensity()).block()
-}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/ScaleSlopExceededGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/ScaleSlopExceededGestureDetector.kt
index fc93130..c3e3553 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/ScaleSlopExceededGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/ScaleSlopExceededGestureDetector.kt
@@ -18,14 +18,13 @@
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.PointerEventPass
import androidx.ui.core.PointerInputChange
import androidx.ui.core.PointerInput
-import androidx.ui.core.ambientDensity
import androidx.ui.core.changedToUpIgnoreConsumed
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.Px
-import androidx.ui.unit.withDensity
import kotlin.math.absoluteValue
// TODO(b/143877464): Implement a "can scale in / can scale out" check so that scale slop is only
@@ -52,7 +51,7 @@
onScaleSlopExceeded: () -> Unit,
children: @Composable() () -> Unit
) {
- val scaleSlop = withDensity(ambientDensity()) { ScaleSlop.toPx() }
+ val scaleSlop = with(DensityAmbient.current) { ScaleSlop.toPx() }
val recognizer = remember { ScaleSlopExceededGestureRecognizer(scaleSlop) }
// TODO(b/129784010): Consider also allowing onStart, onScale, and onEnd to be set individually.
recognizer.>
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt
index 895db82..cbb2bc7 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/gesture/TouchSlopExceededGestureDetector.kt
@@ -18,18 +18,17 @@
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Direction
import androidx.ui.core.PointerEventPass
import androidx.ui.core.PointerInputChange
import androidx.ui.core.PointerInput
-import androidx.ui.core.ambientDensity
import androidx.ui.core.changedToDownIgnoreConsumed
import androidx.ui.core.changedToUpIgnoreConsumed
import androidx.ui.core.positionChange
import androidx.ui.core.PointerId
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.withDensity
// TODO(shepshapard): Convert to functional component with effects once effects are ready.
/**
@@ -49,7 +48,7 @@
canDrag: ((Direction) -> Boolean)? = null,
children: @Composable() () -> Unit
) {
- val touchSlop = withDensity(ambientDensity()) { TouchSlop.toIntPx() }
+ val touchSlop = with(DensityAmbient.current) { TouchSlop.toIntPx() }
val recognizer = remember { TouchSlopExceededGestureRecognizer(touchSlop) }
recognizer.canDrag = canDrag
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 cd5c63e..be02dbe 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
@@ -21,8 +21,8 @@
import androidx.compose.onPreCommit
import androidx.compose.remember
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
-import androidx.ui.core.ambientDensity
import androidx.ui.graphics.BlendMode
import androidx.ui.graphics.Brush
import androidx.ui.graphics.Color
@@ -35,7 +35,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
-import androidx.ui.unit.withDensity
import kotlin.math.ceil
/**
@@ -73,8 +72,9 @@
name: String = "",
children: @Composable() VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
) {
- val widthPx = withDensity(ambientDensity()) { defaultWidth.toPx() }
- val heightPx = withDensity(ambientDensity()) { defaultHeight.toPx() }
+ val density = DensityAmbient.current
+ val widthPx = with(density) { defaultWidth.toPx() }
+ val heightPx = with(density) { defaultHeight.toPx() }
val vpWidth = if (viewportWidth == unset) widthPx.value else viewportWidth
val vpHeight = if (viewportHeight == unset) heightPx.value else viewportHeight
diff --git a/ui/ui-framework/src/main/java/androidx/ui/res/PrimitiveResources.kt b/ui/ui-framework/src/main/java/androidx/ui/res/PrimitiveResources.kt
index 3367d2b..c0997d6 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/res/PrimitiveResources.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/res/PrimitiveResources.kt
@@ -22,7 +22,7 @@
import androidx.annotation.IntegerRes
import androidx.compose.Composable
import androidx.ui.core.ContextAmbient
-import androidx.ui.core.ambientDensity
+import androidx.ui.core.DensityAmbient
import androidx.ui.unit.Dp
/**
@@ -70,7 +70,7 @@
@Composable
fun dimensionResource(@DimenRes id: Int): Dp {
val context = ContextAmbient.current
- val density = ambientDensity()
+ val density = DensityAmbient.current
val pxValue = context.resources.getDimension(id)
return Dp(pxValue / density.density)
}
diff --git a/ui/ui-layout/api/0.1.0-dev05.txt b/ui/ui-layout/api/0.1.0-dev05.txt
index b53e481..4fe6fd2 100644
--- a/ui/ui-layout/api/0.1.0-dev05.txt
+++ b/ui/ui-layout/api/0.1.0-dev05.txt
@@ -87,8 +87,8 @@
}
public final class DpConstraintsKt {
- method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.DensityScope, androidx.ui.layout.DpConstraints dpConstraints);
- method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.Density, androidx.ui.layout.DpConstraints dpConstraints);
+ method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
method public static androidx.ui.layout.DpConstraints enforce(androidx.ui.layout.DpConstraints, androidx.ui.layout.DpConstraints otherConstraints);
method public static boolean getHasBoundedHeight(androidx.ui.layout.DpConstraints);
method public static boolean getHasBoundedWidth(androidx.ui.layout.DpConstraints);
@@ -189,11 +189,11 @@
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
- method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
}
public final class LayoutGravity {
@@ -207,9 +207,9 @@
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.unit.Dp getHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -223,15 +223,15 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
@@ -242,9 +242,9 @@
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.unit.Dp getMaxHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -256,9 +256,9 @@
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.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -275,9 +275,9 @@
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.DensityScope, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
@@ -293,9 +293,9 @@
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.unit.Dp getHeight();
method public androidx.ui.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -314,15 +314,15 @@
method public androidx.ui.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
@@ -336,9 +336,9 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -353,9 +353,9 @@
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.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -367,9 +367,9 @@
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.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -383,15 +383,15 @@
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.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
@@ -402,9 +402,9 @@
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.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -416,9 +416,9 @@
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.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
diff --git a/ui/ui-layout/api/current.txt b/ui/ui-layout/api/current.txt
index b53e481..4fe6fd2 100644
--- a/ui/ui-layout/api/current.txt
+++ b/ui/ui-layout/api/current.txt
@@ -87,8 +87,8 @@
}
public final class DpConstraintsKt {
- method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.DensityScope, androidx.ui.layout.DpConstraints dpConstraints);
- method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.Density, androidx.ui.layout.DpConstraints dpConstraints);
+ method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
method public static androidx.ui.layout.DpConstraints enforce(androidx.ui.layout.DpConstraints, androidx.ui.layout.DpConstraints otherConstraints);
method public static boolean getHasBoundedHeight(androidx.ui.layout.DpConstraints);
method public static boolean getHasBoundedWidth(androidx.ui.layout.DpConstraints);
@@ -189,11 +189,11 @@
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
- method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
}
public final class LayoutGravity {
@@ -207,9 +207,9 @@
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.unit.Dp getHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -223,15 +223,15 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
@@ -242,9 +242,9 @@
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.unit.Dp getMaxHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -256,9 +256,9 @@
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.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -275,9 +275,9 @@
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.DensityScope, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
@@ -293,9 +293,9 @@
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.unit.Dp getHeight();
method public androidx.ui.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -314,15 +314,15 @@
method public androidx.ui.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
@@ -336,9 +336,9 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -353,9 +353,9 @@
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.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -367,9 +367,9 @@
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.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -383,15 +383,15 @@
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.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
@@ -402,9 +402,9 @@
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.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -416,9 +416,9 @@
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.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
diff --git a/ui/ui-layout/api/public_plus_experimental_0.1.0-dev05.txt b/ui/ui-layout/api/public_plus_experimental_0.1.0-dev05.txt
index b53e481..4fe6fd2 100644
--- a/ui/ui-layout/api/public_plus_experimental_0.1.0-dev05.txt
+++ b/ui/ui-layout/api/public_plus_experimental_0.1.0-dev05.txt
@@ -87,8 +87,8 @@
}
public final class DpConstraintsKt {
- method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.DensityScope, androidx.ui.layout.DpConstraints dpConstraints);
- method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.Density, androidx.ui.layout.DpConstraints dpConstraints);
+ method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
method public static androidx.ui.layout.DpConstraints enforce(androidx.ui.layout.DpConstraints, androidx.ui.layout.DpConstraints otherConstraints);
method public static boolean getHasBoundedHeight(androidx.ui.layout.DpConstraints);
method public static boolean getHasBoundedWidth(androidx.ui.layout.DpConstraints);
@@ -189,11 +189,11 @@
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
- method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
}
public final class LayoutGravity {
@@ -207,9 +207,9 @@
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.unit.Dp getHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -223,15 +223,15 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
@@ -242,9 +242,9 @@
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.unit.Dp getMaxHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -256,9 +256,9 @@
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.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -275,9 +275,9 @@
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.DensityScope, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
@@ -293,9 +293,9 @@
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.unit.Dp getHeight();
method public androidx.ui.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -314,15 +314,15 @@
method public androidx.ui.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
@@ -336,9 +336,9 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -353,9 +353,9 @@
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.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -367,9 +367,9 @@
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.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -383,15 +383,15 @@
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.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
@@ -402,9 +402,9 @@
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.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -416,9 +416,9 @@
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.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
diff --git a/ui/ui-layout/api/public_plus_experimental_current.txt b/ui/ui-layout/api/public_plus_experimental_current.txt
index b53e481..4fe6fd2 100644
--- a/ui/ui-layout/api/public_plus_experimental_current.txt
+++ b/ui/ui-layout/api/public_plus_experimental_current.txt
@@ -87,8 +87,8 @@
}
public final class DpConstraintsKt {
- method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.DensityScope, androidx.ui.layout.DpConstraints dpConstraints);
- method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.Density, androidx.ui.layout.DpConstraints dpConstraints);
+ method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
method public static androidx.ui.layout.DpConstraints enforce(androidx.ui.layout.DpConstraints, androidx.ui.layout.DpConstraints otherConstraints);
method public static boolean getHasBoundedHeight(androidx.ui.layout.DpConstraints);
method public static boolean getHasBoundedWidth(androidx.ui.layout.DpConstraints);
@@ -189,11 +189,11 @@
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
- method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
}
public final class LayoutGravity {
@@ -207,9 +207,9 @@
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.unit.Dp getHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -223,15 +223,15 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
@@ -242,9 +242,9 @@
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.unit.Dp getMaxHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -256,9 +256,9 @@
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.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -275,9 +275,9 @@
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.DensityScope, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
@@ -293,9 +293,9 @@
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.unit.Dp getHeight();
method public androidx.ui.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -314,15 +314,15 @@
method public androidx.ui.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
@@ -336,9 +336,9 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -353,9 +353,9 @@
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.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -367,9 +367,9 @@
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.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -383,15 +383,15 @@
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.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
@@ -402,9 +402,9 @@
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.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -416,9 +416,9 @@
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.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
diff --git a/ui/ui-layout/api/restricted_0.1.0-dev05.txt b/ui/ui-layout/api/restricted_0.1.0-dev05.txt
index b53e481..4fe6fd2 100644
--- a/ui/ui-layout/api/restricted_0.1.0-dev05.txt
+++ b/ui/ui-layout/api/restricted_0.1.0-dev05.txt
@@ -87,8 +87,8 @@
}
public final class DpConstraintsKt {
- method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.DensityScope, androidx.ui.layout.DpConstraints dpConstraints);
- method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.Density, androidx.ui.layout.DpConstraints dpConstraints);
+ method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
method public static androidx.ui.layout.DpConstraints enforce(androidx.ui.layout.DpConstraints, androidx.ui.layout.DpConstraints otherConstraints);
method public static boolean getHasBoundedHeight(androidx.ui.layout.DpConstraints);
method public static boolean getHasBoundedWidth(androidx.ui.layout.DpConstraints);
@@ -189,11 +189,11 @@
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
- method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
}
public final class LayoutGravity {
@@ -207,9 +207,9 @@
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.unit.Dp getHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -223,15 +223,15 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
@@ -242,9 +242,9 @@
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.unit.Dp getMaxHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -256,9 +256,9 @@
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.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -275,9 +275,9 @@
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.DensityScope, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
@@ -293,9 +293,9 @@
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.unit.Dp getHeight();
method public androidx.ui.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -314,15 +314,15 @@
method public androidx.ui.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
@@ -336,9 +336,9 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -353,9 +353,9 @@
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.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -367,9 +367,9 @@
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.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -383,15 +383,15 @@
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.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
@@ -402,9 +402,9 @@
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.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -416,9 +416,9 @@
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.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
diff --git a/ui/ui-layout/api/restricted_current.txt b/ui/ui-layout/api/restricted_current.txt
index b53e481..4fe6fd2 100644
--- a/ui/ui-layout/api/restricted_current.txt
+++ b/ui/ui-layout/api/restricted_current.txt
@@ -87,8 +87,8 @@
}
public final class DpConstraintsKt {
- method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.DensityScope, androidx.ui.layout.DpConstraints dpConstraints);
- method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public static androidx.ui.core.Constraints Constraints(androidx.ui.unit.Density, androidx.ui.layout.DpConstraints dpConstraints);
+ method public static androidx.ui.layout.DpConstraints DpConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
method public static androidx.ui.layout.DpConstraints enforce(androidx.ui.layout.DpConstraints, androidx.ui.layout.DpConstraints otherConstraints);
method public static boolean getHasBoundedHeight(androidx.ui.layout.DpConstraints);
method public static boolean getHasBoundedWidth(androidx.ui.layout.DpConstraints);
@@ -189,11 +189,11 @@
method public float component1();
method public androidx.ui.layout.LayoutAspectRatio copy(float aspectRatio);
method public float getAspectRatio();
- method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
- method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.DensityScope, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
- method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.unit.IntPx minIntrinsicHeightOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx width);
+ method public androidx.ui.unit.IntPx minIntrinsicWidthOf(androidx.ui.unit.Density, androidx.ui.core.Measurable measurable, androidx.ui.unit.IntPx height);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
}
public final class LayoutGravity {
@@ -207,9 +207,9 @@
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.unit.Dp getHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -223,15 +223,15 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutHeight.Fill! INSTANCE;
}
@@ -242,9 +242,9 @@
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.unit.Dp getMaxHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -256,9 +256,9 @@
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.unit.Dp getMinHeight();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -275,9 +275,9 @@
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.DensityScope, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
}
@kotlin.DslMarker public @interface LayoutScopeMarker {
@@ -293,9 +293,9 @@
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.unit.Dp getHeight();
method public androidx.ui.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -314,15 +314,15 @@
method public androidx.ui.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutSize.Fill! INSTANCE;
}
@@ -336,9 +336,9 @@
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.unit.Dp getMaxHeight();
method public androidx.ui.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -353,9 +353,9 @@
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.unit.Dp getMinHeight();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -367,9 +367,9 @@
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.unit.Dp getWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -383,15 +383,15 @@
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.unit.Dp getMaxWidth();
method public androidx.ui.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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.DensityScope, androidx.ui.core.Constraints constraints);
+ method public androidx.ui.core.Constraints modifyConstraints(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints);
field public static final androidx.ui.layout.LayoutWidth.Fill! INSTANCE;
}
@@ -402,9 +402,9 @@
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.unit.Dp getMaxWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
@@ -416,9 +416,9 @@
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.unit.Dp getMinWidth();
- method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.DensityScope, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
- method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.DensityScope, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
- method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.DensityScope, androidx.ui.core.Constraints constraints, androidx.ui.unit.IntPxSize childSize);
+ method public androidx.ui.unit.IntPx? modifyAlignmentLine(androidx.ui.unit.Density, androidx.ui.core.AlignmentLine line, androidx.ui.unit.IntPx? value);
+ method public androidx.ui.unit.IntPxPosition modifyPosition(androidx.ui.unit.Density, androidx.ui.unit.IntPxSize childSize, androidx.ui.unit.IntPxSize containerSize);
+ method public androidx.ui.unit.IntPxSize modifySize(androidx.ui.unit.Density, androidx.ui.core.Constraints constraints, 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);
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignTest.kt
index d40f291..4bb62a7 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignTest.kt
@@ -36,7 +36,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -48,7 +47,7 @@
@RunWith(JUnit4::class)
class AlignTest : LayoutTest() {
@Test
- fun testAlign() = withDensity(density) {
+ fun testAlign() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -88,7 +87,7 @@
}
@Test
- fun test2DAlignedModifier() = withDensity(density) {
+ fun test2DAlignedModifier() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -128,7 +127,7 @@
}
@Test
- fun test1DAlignedModifier() = withDensity(density) {
+ fun test1DAlignedModifier() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -165,7 +164,7 @@
}
@Test
- fun testAlign_wrapsContent_whenMeasuredWithInfiniteConstraints() = withDensity(density) {
+ fun testAlign_wrapsContent_whenMeasuredWithInfiniteConstraints() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -212,7 +211,7 @@
}
@Test
- fun testAlignedModifier_wrapsContent_whenMeasuredWithInfiniteConstraints() = withDensity(
+ fun testAlignedModifier_wrapsContent_whenMeasuredWithInfiniteConstraints() = with(
density
) {
val sizeDp = 50.dp
@@ -291,7 +290,7 @@
}
@Test
- fun testAlign_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testAlign_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Align(alignment = Alignment.TopLeft) {
Container(LayoutAspectRatio(2f)) { }
@@ -313,7 +312,7 @@
}
@Test
- fun test2DAlignedModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun test2DAlignedModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutAlign.TopLeft + LayoutAspectRatio(2f)) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -340,7 +339,7 @@
}
@Test
- fun test1DAlignedModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun test1DAlignedModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutAlign.CenterVertically + LayoutAspectRatio(2f)) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -368,7 +367,7 @@
}
@Test
- fun testAlign_hasCorrectIntrinsicMeasurements_whenNoChildren() = withDensity(density) {
+ fun testAlign_hasCorrectIntrinsicMeasurements_whenNoChildren() = with(density) {
testIntrinsics(@Composable {
Align(alignment = Alignment.TopLeft) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -384,7 +383,7 @@
}
@Test
- fun testAlign_alignsCorrectly_whenOddDimensions_endAligned() = withDensity(density) {
+ fun testAlign_alignsCorrectly_whenOddDimensions_endAligned() = with(density) {
// Given a 100 x 100 pixel container, we want to make sure that when aligning a 1 x 1 pixel
// child to both ends (bottom, and right) we correctly position children at the last
// possible pixel, and avoid rounding issues. Previously we first centered the coordinates,
@@ -443,7 +442,7 @@
}
@Test
- fun testAlignedModifier_alignsCorrectly_whenOddDimensions_endAligned() = withDensity(density) {
+ fun testAlignedModifier_alignsCorrectly_whenOddDimensions_endAligned() = with(density) {
// Given a 100 x 100 pixel container, we want to make sure that when aligning a 1 x 1 pixel
// child to both ends (bottom, and right) we correctly position children at the last
// possible pixel, and avoid rounding issues. Previously we first centered the coordinates,
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 925f10e..eb439e0 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
@@ -34,7 +34,6 @@
import androidx.ui.unit.min
import androidx.ui.unit.px
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@@ -46,7 +45,7 @@
@RunWith(JUnit4::class)
class AlignmentLineTest : LayoutTest() {
@Test
- fun testAlignmentLineOffset_vertical() = withDensity(density) {
+ fun testAlignmentLineOffset_vertical() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = VerticalAlignmentLine(::min)
val beforeDp = 20.px.toDp()
@@ -85,7 +84,7 @@
}
@Test
- fun testAlignmentLineOffset_horizontal() = withDensity(density) {
+ fun testAlignmentLineOffset_horizontal() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = HorizontalAlignmentLine(::min)
val beforeDp = 20.px.toDp()
@@ -121,7 +120,7 @@
}
@Test
- fun testAlignmentLineOffset_vertical_withSmallOffsets() = withDensity(density) {
+ fun testAlignmentLineOffset_vertical_withSmallOffsets() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = VerticalAlignmentLine(::min)
val beforeDp = 5.px.toDp()
@@ -153,7 +152,7 @@
}
@Test
- fun testAlignmentLineOffset_horizontal_withSmallOffsets() = withDensity(density) {
+ fun testAlignmentLineOffset_horizontal_withSmallOffsets() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = HorizontalAlignmentLine(::min)
val beforeDp = 5.px.toDp()
@@ -185,7 +184,7 @@
}
@Test
- fun testAlignmentLineOffset_vertical_withInsufficientSpace() = withDensity(density) {
+ fun testAlignmentLineOffset_vertical_withInsufficientSpace() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = VerticalAlignmentLine(::min)
val maxWidth = 30.px.toDp()
@@ -225,7 +224,7 @@
}
@Test
- fun testAlignmentLineOffset_horizontal_withInsufficientSpace() = withDensity(density) {
+ fun testAlignmentLineOffset_horizontal_withInsufficientSpace() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = HorizontalAlignmentLine(::min)
val maxHeight = 30.px.toDp()
@@ -265,7 +264,7 @@
}
@Test
- fun testAlignmentLineOffset_vertical_keepsCrossAxisMinConstraints() = withDensity(density) {
+ fun testAlignmentLineOffset_vertical_keepsCrossAxisMinConstraints() = with(density) {
val testLine = VerticalAlignmentLine(::min)
val latch = CountDownLatch(1)
val minHeight = 10.dp
@@ -285,7 +284,7 @@
}
@Test
- fun testAlignmentLineOffset_horizontal_keepsCrossAxisMinConstraints() = withDensity(density) {
+ fun testAlignmentLineOffset_horizontal_keepsCrossAxisMinConstraints() = with(density) {
val testLine = HorizontalAlignmentLine(::min)
val latch = CountDownLatch(1)
val minWidth = 10.dp
@@ -305,7 +304,7 @@
}
@Test
- fun testCenterAlignmentLine_vertical_keepsCrossAxisMinConstraints() = withDensity(density) {
+ fun testCenterAlignmentLine_vertical_keepsCrossAxisMinConstraints() = with(density) {
val testLine = VerticalAlignmentLine(::min)
val latch = CountDownLatch(1)
val minHeight = 10.dp
@@ -325,7 +324,7 @@
}
@Test
- fun testCenterAlignmentLine_horizontal_keepsCrossAxisMinConstraints() = withDensity(density) {
+ fun testCenterAlignmentLine_horizontal_keepsCrossAxisMinConstraints() = with(density) {
val testLine = HorizontalAlignmentLine(::min)
val latch = CountDownLatch(1)
val minWidth = 10.dp
@@ -345,7 +344,7 @@
}
@Test
- fun testCenterAlignmentLine_vertical_withInfiniteWidth() = withDensity(density) {
+ fun testCenterAlignmentLine_vertical_withInfiniteWidth() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = VerticalAlignmentLine(::min)
val childWidth = 30.dp
@@ -389,7 +388,7 @@
}
@Test
- fun testCenterAlignmentLine_horizontal_withInfiniteHeight() = withDensity(density) {
+ fun testCenterAlignmentLine_horizontal_withInfiniteHeight() = with(density) {
val layoutLatch = CountDownLatch(2)
val testLine = HorizontalAlignmentLine(::min)
val childWidth = 30.dp
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioModifierTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioModifierTest.kt
index fbeafa0..6afd43b 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioModifierTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioModifierTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -40,7 +39,7 @@
@RunWith(JUnit4::class)
class AspectRatioModifierTest : LayoutTest() {
@Test
- fun testAspectRatioModifier_intrinsicDimensions() = withDensity(density) {
+ fun testAspectRatioModifier_intrinsicDimensions() = with(density) {
testIntrinsics(@Composable {
Container(modifier = LayoutAspectRatio(2f), width = 30.dp, height = 40.dp) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioTest.kt
index c967e8b..84d5b44 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AspectRatioTest.kt
@@ -38,7 +38,6 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.px
import androidx.ui.unit.toPxSize
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
@@ -52,7 +51,7 @@
@RunWith(JUnit4::class)
class AspectRatioTest : LayoutTest() {
@Test
- fun testAspectRatio_placesChild() = withDensity(density) {
+ fun testAspectRatio_placesChild() = with(density) {
val positionedLatch = CountDownLatch(1)
val containerSize = Ref<PxSize>()
val containerPosition = Ref<PxPosition>()
@@ -79,7 +78,7 @@
}
@Test
- fun testAspectRatio_withNoChild() = withDensity(density) {
+ fun testAspectRatio_withNoChild() = with(density) {
val sizeDp = 10.dp
val sizePx = 10.dp.toIntPx()
@@ -113,7 +112,7 @@
}
@Test
- fun testAspectRatio_sizesCorrectly() = withDensity(density) {
+ fun testAspectRatio_sizesCorrectly() = with(density) {
assertEquals(IntPxSize(30.ipx, 30.ipx), getSize(1f, Constraints(maxWidth = 30.ipx)))
assertEquals(IntPxSize(30.ipx, 15.ipx), getSize(2f, Constraints(maxWidth = 30.ipx)))
assertEquals(
@@ -135,7 +134,7 @@
}
@Test
- fun testAspectRatio_intrinsicDimensions() = withDensity(density) {
+ fun testAspectRatio_intrinsicDimensions() = with(density) {
testIntrinsics(@Composable {
AspectRatio(2f) {
Container(width = 30.dp, height = 40.dp) { }
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 aecbf6c..0e0ddbd 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
@@ -42,7 +42,6 @@
import androidx.ui.unit.px
import androidx.ui.unit.round
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -55,7 +54,7 @@
@RunWith(JUnit4::class)
class ContainerTest : LayoutTest() {
@Test
- fun testContainer_wrapsChild() = withDensity(density) {
+ fun testContainer_wrapsChild() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -79,7 +78,7 @@
}
@Test
- fun testContainer_appliesPaddingToChild() = withDensity(density) {
+ fun testContainer_appliesPaddingToChild() = with(density) {
val paddingDp = 20.dp
val padding = paddingDp.toIntPx()
val sizeDp = 50.dp
@@ -116,7 +115,7 @@
}
@Test
- fun testContainer_passesConstraintsToChild() = withDensity(density) {
+ fun testContainer_passesConstraintsToChild() = with(density) {
val sizeDp = 100.dp
val childWidthDp = 20.dp
val childWidth = childWidthDp.toIntPx()
@@ -178,7 +177,7 @@
}
@Test
- fun testContainer_fillsAvailableSpace_whenSizeIsMax() = withDensity(density) {
+ fun testContainer_fillsAvailableSpace_whenSizeIsMax() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -223,7 +222,7 @@
}
@Test
- fun testContainer_respectsIncomingMinConstraints() = withDensity(density) {
+ fun testContainer_respectsIncomingMinConstraints() = with(density) {
// Start with an even number of IntPx to avoid rounding issues due to different DPI
// I.e, if we fix Dp instead, it's possible that when we convert to Px, sizeDp can round
// down but sizeDp * 2 can round up, causing a 1 pixel test error.
@@ -267,7 +266,7 @@
}
@Test
- fun testContainer_hasTheRightSize_withPaddingAndNoChildren() = withDensity(density) {
+ fun testContainer_hasTheRightSize_withPaddingAndNoChildren() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -289,7 +288,7 @@
}
@Test
- fun testContainer_correctlyAppliesNonSymmetricPadding() = withDensity(density) {
+ fun testContainer_correctlyAppliesNonSymmetricPadding() = with(density) {
val childSizeDp = 50.dp
val paddingLeft = 8.dp
val paddingTop = 7.dp
@@ -323,7 +322,7 @@
}
@Test
- fun testContainer_contentSmallerThanPaddingIsCentered() = withDensity(density) {
+ fun testContainer_contentSmallerThanPaddingIsCentered() = with(density) {
val containerSize = 50.dp
val padding = 10.dp
val childSize = 5.dp
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ExpandedModifierTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ExpandedModifierTest.kt
index 69be468..265fafc 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ExpandedModifierTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ExpandedModifierTest.kt
@@ -35,7 +35,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.min
-import androidx.ui.unit.withDensity
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@@ -50,7 +49,7 @@
private val Height = 100.dp
@Test
- fun testExpandedModifier_correctSize() = withDensity(density) {
+ fun testExpandedModifier_correctSize() = with(density) {
val displayMetrics = Resources.getSystem().displayMetrics
val screenWidth = displayMetrics.widthPixels
val screenHeight = displayMetrics.heightPixels
@@ -74,7 +73,7 @@
}
@Test
- fun testExpandedModifier_noChangeIntrinsicMeasurements() = withDensity(density) {
+ fun testExpandedModifier_noChangeIntrinsicMeasurements() = with(density) {
verifyIntrinsicMeasurements(LayoutWidth.Fill)
verifyIntrinsicMeasurements(LayoutHeight.Fill)
verifyIntrinsicMeasurements(LayoutSize.Fill)
@@ -107,7 +106,7 @@
return size.value!!
}
- private fun verifyIntrinsicMeasurements(expandedModifier: Modifier) = withDensity(density) {
+ private fun verifyIntrinsicMeasurements(expandedModifier: Modifier) = with(density) {
// intrinsic measurements do not change with the ExpandedModifier
testIntrinsics(@Composable {
Container(
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlexTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlexTest.kt
index 25baab4..95afe4e 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlexTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlexTest.kt
@@ -58,7 +58,6 @@
import androidx.ui.unit.px
import androidx.ui.unit.round
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
@@ -74,7 +73,7 @@
class FlexTest : LayoutTest() {
// region Size and position tests for Row and Column
@Test
- fun testRow() = withDensity(density) {
+ fun testRow() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -117,7 +116,7 @@
}
@Test
- fun testRow_withFlexibleChildren() = withDensity(density) {
+ fun testRow_withFlexibleChildren() = with(density) {
val width = 50.dp
val height = 80.dp
val childrenHeight = height.toIntPx()
@@ -165,7 +164,7 @@
}
@Test
- fun testRow_withLooselyFlexibleChildren() = withDensity(density) {
+ fun testRow_withLooselyFlexibleChildren() = with(density) {
val width = 50.dp
val childrenWidth = width.toIntPx()
val height = 80.dp
@@ -215,7 +214,7 @@
}
@Test
- fun testColumn() = withDensity(density) {
+ fun testColumn() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -257,7 +256,7 @@
}
@Test
- fun testColumn_withFlexibleChildren() = withDensity(density) {
+ fun testColumn_withFlexibleChildren() = with(density) {
val width = 80.dp
val childrenWidth = width.toIntPx()
val height = 50.dp
@@ -303,7 +302,7 @@
}
@Test
- fun testColumn_withLooselyFlexibleChildren() = withDensity(density) {
+ fun testColumn_withLooselyFlexibleChildren() = with(density) {
val width = 80.dp
val childrenWidth = width.toIntPx()
val height = 50.dp
@@ -346,7 +345,7 @@
}
@Test
- fun testRow_doesNotPlaceChildrenOutOfBounds_becauseOfRoundings() = withDensity(density) {
+ fun testRow_doesNotPlaceChildrenOutOfBounds_becauseOfRoundings() = with(density) {
val expectedRowWidth = 11.ipx
val leftPadding = 1.px
var rowWidth = 0.ipx
@@ -385,7 +384,7 @@
}
@Test
- fun testRow_isNotLargerThanItsChildren_becauseOfRoundings() = withDensity(density) {
+ fun testRow_isNotLargerThanItsChildren_becauseOfRoundings() = with(density) {
val expectedRowWidth = 8.ipx
val leftPadding = 1.px
var rowWidth = 0.ipx
@@ -432,7 +431,7 @@
}
@Test
- fun testColumn_isNotLargetThanItsChildren_becauseOfRoundings() = withDensity(density) {
+ fun testColumn_isNotLargetThanItsChildren_becauseOfRoundings() = with(density) {
val expectedColumnHeight = 8.ipx
val topPadding = 1.px
var columnHeight = 0.ipx
@@ -479,7 +478,7 @@
}
@Test
- fun testColumn_doesNotPlaceChildrenOutOfBounds_becauseOfRoundings() = withDensity(density) {
+ fun testColumn_doesNotPlaceChildrenOutOfBounds_becauseOfRoundings() = with(density) {
val expectedColumnHeight = 11.ipx
val topPadding = 1.px
var columnHeight = 0.ipx
@@ -521,7 +520,7 @@
// region Cross axis alignment tests in Row
@Test
- fun testRow_withStretchCrossAxisAlignment() = withDensity(density) {
+ fun testRow_withStretchCrossAxisAlignment() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -568,7 +567,7 @@
}
@Test
- fun testRow_withGravityModifier() = withDensity(density) {
+ fun testRow_withGravityModifier() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -622,7 +621,7 @@
}
@Test
- fun testRow_withRelativeToSiblingsModifier() = withDensity(density) {
+ fun testRow_withRelativeToSiblingsModifier() = with(density) {
val baseline1Dp = 30.dp
val baseline1 = baseline1Dp.toIntPx()
val baseline2Dp = 25.dp
@@ -712,7 +711,7 @@
// region Cross axis alignment tests in Column
@Test
- fun testColumn_withStretchCrossAxisAlignment() = withDensity(density) {
+ fun testColumn_withStretchCrossAxisAlignment() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -757,7 +756,7 @@
}
@Test
- fun testColumn_withGravityModifier() = withDensity(density) {
+ fun testColumn_withGravityModifier() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -811,7 +810,7 @@
}
@Test
- fun testColumn_withRelativeToSiblingsModifier() = withDensity(density) {
+ fun testColumn_withRelativeToSiblingsModifier() = with(density) {
val sizeDp = 40.dp
val size = sizeDp.toIntPx()
val firstBaseline1Dp = 20.dp
@@ -896,7 +895,7 @@
// region Size tests in Row
@Test
- fun testRow_expandedWidth_withExpandedModifier() = withDensity(density) {
+ fun testRow_expandedWidth_withExpandedModifier() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -926,7 +925,7 @@
}
@Test
- fun testRow_wrappedWidth_withNoFlexibleChildren() = withDensity(density) {
+ fun testRow_wrappedWidth_withNoFlexibleChildren() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -956,7 +955,7 @@
}
@Test
- fun testRow_expandedWidth_withFlexibleChildren() = withDensity(density) {
+ fun testRow_expandedWidth_withFlexibleChildren() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -986,7 +985,7 @@
}
@Test
- fun testRow_withMaxCrossAxisSize() = withDensity(density) {
+ fun testRow_withMaxCrossAxisSize() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -1016,7 +1015,7 @@
}
@Test
- fun testRow_withMinCrossAxisSize() = withDensity(density) {
+ fun testRow_withMinCrossAxisSize() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -1046,7 +1045,7 @@
}
@Test
- fun testRow_withExpandedModifier_respectsMaxWidthConstraint() = withDensity(density) {
+ fun testRow_withExpandedModifier_respectsMaxWidthConstraint() = with(density) {
val sizeDp = 50.dp
val rowWidthDp = 250.dp
@@ -1079,7 +1078,7 @@
}
@Test
- fun testRow_withFlexibleChildren_respectsMaxWidthConstraint() = withDensity(density) {
+ fun testRow_withFlexibleChildren_respectsMaxWidthConstraint() = with(density) {
val sizeDp = 50.dp
val rowWidthDp = 250.dp
@@ -1112,7 +1111,7 @@
}
@Test
- fun testRow_withInflexibleChildren_respectsMinWidthConstraint() = withDensity(density) {
+ fun testRow_withInflexibleChildren_respectsMinWidthConstraint() = with(density) {
val sizeDp = 50.dp
val rowWidthDp = 250.dp
@@ -1145,7 +1144,7 @@
}
@Test
- fun testRow_withMaxCrossAxisSize_respectsMaxHeightConstraint() = withDensity(density) {
+ fun testRow_withMaxCrossAxisSize_respectsMaxHeightConstraint() = with(density) {
val sizeDp = 50.dp
val rowHeightDp = 250.dp
@@ -1178,7 +1177,7 @@
}
@Test
- fun testRow_withMinCrossAxisSize_respectsMinHeightConstraint() = withDensity(density) {
+ fun testRow_withMinCrossAxisSize_respectsMinHeightConstraint() = with(density) {
val sizeDp = 50.dp
val rowHeightDp = 150.dp
@@ -1212,7 +1211,7 @@
@Test @Ignore("Wrap is not supported when there are flexible children. " +
"Should use maxWidth(.Infinity) modifier when it is available")
- fun testRow_withMinMainAxisSize() = withDensity(density) {
+ fun testRow_withMinMainAxisSize() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val rowWidthDp = 250.dp
@@ -1256,7 +1255,7 @@
}
@Test
- fun testRow_measuresChildrenCorrectly_whenMeasuredWithInfiniteWidth() = withDensity(density) {
+ fun testRow_measuresChildrenCorrectly_whenMeasuredWithInfiniteWidth() = with(density) {
val rowMinWidth = 100.dp
val inflexibleChildWidth = 30.dp
val latch = CountDownLatch(1)
@@ -1292,7 +1291,7 @@
}
@Test
- fun testRow_measuresInflexibleChildrenCorrectly() = withDensity(density) {
+ fun testRow_measuresInflexibleChildrenCorrectly() = with(density) {
val availableWidth = 100.dp
val childWidth = 50.dp
val availableHeight = 200.dp
@@ -1340,7 +1339,7 @@
// region Size tests in Column
@Test
- fun testColumn_expandedHeight_withExpandedModifier() = withDensity(density) {
+ fun testColumn_expandedHeight_withExpandedModifier() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -1370,7 +1369,7 @@
}
@Test
- fun testColumn_wrappedHeight_withNoFlexibleChildren() = withDensity(density) {
+ fun testColumn_wrappedHeight_withNoFlexibleChildren() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -1400,7 +1399,7 @@
}
@Test
- fun testColumn_expandedHeight_withFlexibleChildren() = withDensity(density) {
+ fun testColumn_expandedHeight_withFlexibleChildren() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -1430,7 +1429,7 @@
}
@Test
- fun testColumn_withMaxCrossAxisSize() = withDensity(density) {
+ fun testColumn_withMaxCrossAxisSize() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -1460,7 +1459,7 @@
}
@Test
- fun testColumn_withMinCrossAxisSize() = withDensity(density) {
+ fun testColumn_withMinCrossAxisSize() = with(density) {
val sizeDp = 50.dp
val drawLatch = CountDownLatch(1)
@@ -1490,7 +1489,7 @@
}
@Test
- fun testColumn_withExpandedModifier_respectsMaxHeightConstraint() = withDensity(density) {
+ fun testColumn_withExpandedModifier_respectsMaxHeightConstraint() = with(density) {
val sizeDp = 50.dp
val columnHeightDp = 250.dp
@@ -1523,7 +1522,7 @@
}
@Test
- fun testColumn_withFlexibleChildren_respectsMaxHeightConstraint() = withDensity(density) {
+ fun testColumn_withFlexibleChildren_respectsMaxHeightConstraint() = with(density) {
val sizeDp = 50.dp
val columnHeightDp = 250.dp
@@ -1556,7 +1555,7 @@
}
@Test
- fun testColumn_withInflexibleChildren_respectsMinHeightConstraint() = withDensity(density) {
+ fun testColumn_withInflexibleChildren_respectsMinHeightConstraint() = with(density) {
val sizeDp = 50.dp
val columnHeightDp = 250.dp
@@ -1589,7 +1588,7 @@
}
@Test
- fun testColumn_withMaxCrossAxisSize_respectsMaxWidthConstraint() = withDensity(density) {
+ fun testColumn_withMaxCrossAxisSize_respectsMaxWidthConstraint() = with(density) {
val sizeDp = 50.dp
val columnWidthDp = 250.dp
@@ -1622,7 +1621,7 @@
}
@Test
- fun testColumn_withMinCrossAxisSize_respectsMinWidthConstraint() = withDensity(density) {
+ fun testColumn_withMinCrossAxisSize_respectsMinWidthConstraint() = with(density) {
val sizeDp = 50.dp
val columnWidthDp = 150.dp
@@ -1656,7 +1655,7 @@
@Test @Ignore("Wrap is not supported when there are flexible children. " +
"Should use maxHeight(IntPx.Infinity) modifier when it is available")
- fun testColumn_withMinMainAxisSize() = withDensity(density) {
+ fun testColumn_withMinMainAxisSize() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val columnHeightDp = 250.dp
@@ -1701,7 +1700,7 @@
@Test
fun testColumn_measuresChildrenCorrectly_whenMeasuredWithInfiniteHeight() =
- withDensity(density) {
+ with(density) {
val columnMinHeight = 100.dp
val inflexibleChildHeight = 30.dp
val latch = CountDownLatch(1)
@@ -1736,7 +1735,7 @@
}
@Test
- fun testColumn_measuresInflexibleChildrenCorrectly() = withDensity(density) {
+ fun testColumn_measuresInflexibleChildrenCorrectly() = with(density) {
val availableWidth = 100.dp
val childWidth = 50.dp
val availableHeight = 200.dp
@@ -1784,7 +1783,7 @@
// region Main axis alignment tests in Row
@Test
- fun testRow_withBeginArrangement() = withDensity(density) {
+ fun testRow_withBeginArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -1825,7 +1824,7 @@
}
@Test
- fun testRow_withEndArrangement() = withDensity(density) {
+ fun testRow_withEndArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -1866,7 +1865,7 @@
}
@Test
- fun testRow_withCenterArrangement() = withDensity(density) {
+ fun testRow_withCenterArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -1908,7 +1907,7 @@
}
@Test
- fun testRow_withSpaceEvenlyArrangement() = withDensity(density) {
+ fun testRow_withSpaceEvenlyArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -1950,7 +1949,7 @@
}
@Test
- fun testRow_withSpaceBetweenArrangement() = withDensity(density) {
+ fun testRow_withSpaceBetweenArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -1992,7 +1991,7 @@
}
@Test
- fun testRow_withSpaceAroundArrangement() = withDensity(density) {
+ fun testRow_withSpaceAroundArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2034,7 +2033,7 @@
}
@Test
- fun testRow_withCustomArrangement() = withDensity(density) {
+ fun testRow_withCustomArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2081,7 +2080,7 @@
// region Main axis alignment tests in Column
@Test
- fun testColumn_withStartArrangement() = withDensity(density) {
+ fun testColumn_withStartArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2122,7 +2121,7 @@
}
@Test
- fun testColumn_withEndArrangement() = withDensity(density) {
+ fun testColumn_withEndArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2163,7 +2162,7 @@
}
@Test
- fun testColumn_withCenterArrangement() = withDensity(density) {
+ fun testColumn_withCenterArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2205,7 +2204,7 @@
}
@Test
- fun testColumn_withSpaceEvenlyArrangement() = withDensity(density) {
+ fun testColumn_withSpaceEvenlyArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2247,7 +2246,7 @@
}
@Test
- fun testColumn_withSpaceBetweenArrangement() = withDensity(density) {
+ fun testColumn_withSpaceBetweenArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2289,7 +2288,7 @@
}
@Test
- fun testColumn_withSpaceAroundArrangement() = withDensity(density) {
+ fun testColumn_withSpaceAroundArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2337,7 +2336,7 @@
}
@Test
- fun testColumn_withCustomArrangement() = withDensity(density) {
+ fun testColumn_withCustomArrangement() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -2382,7 +2381,7 @@
}
@Test
- fun testRow_doesNotUseMinConstraintsOnChildren() = withDensity(density) {
+ fun testRow_doesNotUseMinConstraintsOnChildren() = with(density) {
val sizeDp = 50.dp
val childSizeDp = 30.dp
val childSize = childSizeDp.toIntPx()
@@ -2411,7 +2410,7 @@
}
@Test
- fun testColumn_doesNotUseMinConstraintsOnChildren() = withDensity(density) {
+ fun testColumn_doesNotUseMinConstraintsOnChildren() = with(density) {
val sizeDp = 50.dp
val childSizeDp = 30.dp
val childSize = childSizeDp.toIntPx()
@@ -2442,7 +2441,7 @@
// region Intrinsic measurement tests
@Test
- fun testRow_withInflexibleChildren_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testRow_withInflexibleChildren_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Row {
Container(LayoutAspectRatio(2f)) { }
@@ -2524,7 +2523,7 @@
}
@Test
- fun testRow_withFlexibleChildren_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testRow_withFlexibleChildren_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Row {
ConstrainedBox(DpConstraints.fixed(20.dp, 30.dp), LayoutFlexible(3f)) { }
@@ -2670,7 +2669,7 @@
}
@Test
- fun testColumn_withInflexibleChildren_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testColumn_withInflexibleChildren_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Column {
Container(LayoutAspectRatio(2f)) { }
@@ -2747,7 +2746,7 @@
}
@Test
- fun testColumn_withFlexibleChildren_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testColumn_withFlexibleChildren_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Column {
ConstrainedBox(DpConstraints.fixed(30.dp, 20.dp), LayoutFlexible(3f)) { }
@@ -2894,7 +2893,7 @@
// region Modifiers specific tests
@Test
- fun testFlexModifiersChain_leftMostWins() = withDensity(density) {
+ fun testFlexModifiersChain_leftMostWins() = with(density) {
val positionedLatch = CountDownLatch(1)
val containerHeight = Ref<IntPx>()
val columnHeight = 24.ipx
@@ -2922,7 +2921,7 @@
}
@Test
- fun testRelativeToSiblingsModifiersChain_leftMostWins() = withDensity(density) {
+ fun testRelativeToSiblingsModifiersChain_leftMostWins() = with(density) {
val positionedLatch = CountDownLatch(1)
val containerSize = Ref<IntPxSize>()
val containerPosition = Ref<PxPosition>()
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 6037e11..4a7eea5 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
@@ -32,7 +32,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -45,7 +44,7 @@
@RunWith(JUnit4::class)
class FlowTest : LayoutTest() {
@Test
- fun testFlowRow() = withDensity(density) {
+ fun testFlowRow() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -99,7 +98,7 @@
}
@Test
- fun testFlowRow_withMainAxisSize_wrap() = withDensity(density) {
+ fun testFlowRow_withMainAxisSize_wrap() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -153,7 +152,7 @@
}
@Test
- fun testFlowRow_withMainAxisSize_expand() = withDensity(density) {
+ fun testFlowRow_withMainAxisSize_expand() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -207,7 +206,7 @@
}
@Test
- fun testFlowRow_withMainAxisAlignment_center() = withDensity(density) {
+ fun testFlowRow_withMainAxisAlignment_center() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -264,7 +263,7 @@
}
@Test
- fun testFlowRow_withMainAxisAlignment_start() = withDensity(density) {
+ fun testFlowRow_withMainAxisAlignment_start() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -321,7 +320,7 @@
}
@Test
- fun testFlowRow_withMainAxisAlignment_end() = withDensity(density) {
+ fun testFlowRow_withMainAxisAlignment_end() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -378,7 +377,7 @@
}
@Test
- fun testFlowRow_withMainAxisAlignment_spaceEvenly() = withDensity(density) {
+ fun testFlowRow_withMainAxisAlignment_spaceEvenly() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -438,7 +437,7 @@
}
@Test
- fun testFlowRow_withMainAxisAlignment_spaceBetween() = withDensity(density) {
+ fun testFlowRow_withMainAxisAlignment_spaceBetween() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -498,7 +497,7 @@
}
@Test
- fun testFlowRow_withMainAxisAlignment_spaceAround() = withDensity(density) {
+ fun testFlowRow_withMainAxisAlignment_spaceAround() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -558,7 +557,7 @@
}
@Test
- fun testFlowRow_withLastLineMainAxisAlignment_justify_center() = withDensity(density) {
+ fun testFlowRow_withLastLineMainAxisAlignment_justify_center() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -623,7 +622,7 @@
}
@Test
- fun testFlowRow_withLastLineMainAxisAlignment_justify_start() = withDensity(density) {
+ fun testFlowRow_withLastLineMainAxisAlignment_justify_start() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -688,7 +687,7 @@
}
@Test
- fun testFlowRow_withLastLineMainAxisAlignment_justify_end() = withDensity(density) {
+ fun testFlowRow_withLastLineMainAxisAlignment_justify_end() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -753,7 +752,7 @@
}
@Test
- fun testFlowRow_withMainAxisSpacing() = withDensity(density) {
+ fun testFlowRow_withMainAxisSpacing() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -809,7 +808,7 @@
}
@Test
- fun testFlowRow_withCrossAxisAlignment_center() = withDensity(density) {
+ fun testFlowRow_withCrossAxisAlignment_center() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -872,7 +871,7 @@
}
@Test
- fun testFlowRow_withCrossAxisAlignment_start() = withDensity(density) {
+ fun testFlowRow_withCrossAxisAlignment_start() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -932,7 +931,7 @@
}
@Test
- fun testFlowRow_withCrossAxisAlignment_end() = withDensity(density) {
+ fun testFlowRow_withCrossAxisAlignment_end() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -995,7 +994,7 @@
}
@Test
- fun testFlowRow_withCrossAxisSpacing() = withDensity(density) {
+ fun testFlowRow_withCrossAxisSpacing() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1051,7 +1050,7 @@
}
@Test
- fun testFlowColumn() = withDensity(density) {
+ fun testFlowColumn() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1105,7 +1104,7 @@
}
@Test
- fun testFlowColumn_withMainAxisSize_wrap() = withDensity(density) {
+ fun testFlowColumn_withMainAxisSize_wrap() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1159,7 +1158,7 @@
}
@Test
- fun testFlowColumn_withMainAxisSize_expand() = withDensity(density) {
+ fun testFlowColumn_withMainAxisSize_expand() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1213,7 +1212,7 @@
}
@Test
- fun testFlowColumn_withMainAxisAlignment_center() = withDensity(density) {
+ fun testFlowColumn_withMainAxisAlignment_center() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1270,7 +1269,7 @@
}
@Test
- fun testFlowColumn_withMainAxisAlignment_start() = withDensity(density) {
+ fun testFlowColumn_withMainAxisAlignment_start() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1327,7 +1326,7 @@
}
@Test
- fun testFlowColumn_withMainAxisAlignment_end() = withDensity(density) {
+ fun testFlowColumn_withMainAxisAlignment_end() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1384,7 +1383,7 @@
}
@Test
- fun testFlowColumn_withMainAxisAlignment_spaceEvenly() = withDensity(density) {
+ fun testFlowColumn_withMainAxisAlignment_spaceEvenly() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1444,7 +1443,7 @@
}
@Test
- fun testFlowColumn_withMainAxisAlignment_spaceBetween() = withDensity(density) {
+ fun testFlowColumn_withMainAxisAlignment_spaceBetween() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1504,7 +1503,7 @@
}
@Test
- fun testFlowColumn_withMainAxisAlignment_spaceAround() = withDensity(density) {
+ fun testFlowColumn_withMainAxisAlignment_spaceAround() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1564,7 +1563,7 @@
}
@Test
- fun testFlowColumn_withLastLineMainAxisAlignment_justify_center() = withDensity(density) {
+ fun testFlowColumn_withLastLineMainAxisAlignment_justify_center() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1629,7 +1628,7 @@
}
@Test
- fun testFlowColumn_withLastLineMainAxisAlignment_justify_start() = withDensity(density) {
+ fun testFlowColumn_withLastLineMainAxisAlignment_justify_start() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1694,7 +1693,7 @@
}
@Test
- fun testFlowColumn_withLastLineMainAxisAlignment_justify_end() = withDensity(density) {
+ fun testFlowColumn_withLastLineMainAxisAlignment_justify_end() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1759,7 +1758,7 @@
}
@Test
- fun testFlowColumn_withMainAxisSpacing() = withDensity(density) {
+ fun testFlowColumn_withMainAxisSpacing() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1815,7 +1814,7 @@
}
@Test
- fun testFlowColumn_withCrossAxisAlignment_center() = withDensity(density) {
+ fun testFlowColumn_withCrossAxisAlignment_center() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1878,7 +1877,7 @@
}
@Test
- fun testFlowColumn_withCrossAxisAlignment_start() = withDensity(density) {
+ fun testFlowColumn_withCrossAxisAlignment_start() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1935,7 +1934,7 @@
}
@Test
- fun testFlowColumn_withCrossAxisAlignment_end() = withDensity(density) {
+ fun testFlowColumn_withCrossAxisAlignment_end() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
@@ -1998,7 +1997,7 @@
}
@Test
- fun testFlowColumn_withCrossAxisSpacing() = withDensity(density) {
+ fun testFlowColumn_withCrossAxisSpacing() = with(density) {
val numberOfSquares = 15
val size = 48.ipx
val sizeDp = size.toDp()
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 9c8b7f1..889c2f7 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
@@ -34,7 +34,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -46,7 +45,7 @@
@RunWith(JUnit4::class)
class IntrinsicTest : LayoutTest() {
@Test
- fun testMinIntrinsicWidth() = withDensity(density) {
+ fun testMinIntrinsicWidth() = with(density) {
val positionedLatch = CountDownLatch(2)
val minIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -77,7 +76,7 @@
}
@Test
- fun testMinIntrinsicHeight() = withDensity(density) {
+ fun testMinIntrinsicHeight() = with(density) {
val positionedLatch = CountDownLatch(2)
val minIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -108,7 +107,7 @@
}
@Test
- fun testMaxIntrinsicWidth() = withDensity(density) {
+ fun testMaxIntrinsicWidth() = with(density) {
val positionedLatch = CountDownLatch(2)
val maxIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -139,7 +138,7 @@
}
@Test
- fun testMaxIntrinsicHeight() = withDensity(density) {
+ fun testMaxIntrinsicHeight() = with(density) {
val positionedLatch = CountDownLatch(2)
val maxIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -170,7 +169,7 @@
}
@Test
- fun testMinIntrinsicWidth_respectsIncomingMaxConstraints() = withDensity(density) {
+ fun testMinIntrinsicWidth_respectsIncomingMaxConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val minIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -203,7 +202,7 @@
}
@Test
- fun testMinIntrinsicWidth_respectsIncomingMinConstraints() = withDensity(density) {
+ fun testMinIntrinsicWidth_respectsIncomingMinConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val minIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -236,7 +235,7 @@
}
@Test
- fun testMinIntrinsicHeight_respectsMaxIncomingConstraints() = withDensity(density) {
+ fun testMinIntrinsicHeight_respectsMaxIncomingConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val minIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -269,7 +268,7 @@
}
@Test
- fun testMinIntrinsicHeight_respectsMinIncomingConstraints() = withDensity(density) {
+ fun testMinIntrinsicHeight_respectsMinIncomingConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val minIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -302,7 +301,7 @@
}
@Test
- fun testMaxIntrinsicWidth_respectsMaxIncomingConstraints() = withDensity(density) {
+ fun testMaxIntrinsicWidth_respectsMaxIncomingConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val maxIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -335,7 +334,7 @@
}
@Test
- fun testMaxIntrinsicWidth_respectsMinIncomingConstraints() = withDensity(density) {
+ fun testMaxIntrinsicWidth_respectsMinIncomingConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val maxIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -368,7 +367,7 @@
}
@Test
- fun testMaxIntrinsicHeight_respectsMaxIncomingConstraints() = withDensity(density) {
+ fun testMaxIntrinsicHeight_respectsMaxIncomingConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val maxIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -401,7 +400,7 @@
}
@Test
- fun testMaxIntrinsicHeight_respectsMinIncomingConstraints() = withDensity(density) {
+ fun testMaxIntrinsicHeight_respectsMinIncomingConstraints() = with(density) {
val positionedLatch = CountDownLatch(2)
val maxIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
@@ -434,7 +433,7 @@
}
@Test
- fun testMinIntrinsicWidth_intrinsicMeasurements() = withDensity(density) {
+ fun testMinIntrinsicWidth_intrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
MinIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp) { }
@@ -448,7 +447,7 @@
}
@Test
- fun testMinIntrinsicHeight_intrinsicMeasurements() = withDensity(density) {
+ fun testMinIntrinsicHeight_intrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
MinIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp) { }
@@ -462,7 +461,7 @@
}
@Test
- fun testMaxIntrinsicWidth_intrinsicMeasurements() = withDensity(density) {
+ fun testMaxIntrinsicWidth_intrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
MaxIntrinsicWidth {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp) { }
@@ -476,7 +475,7 @@
}
@Test
- fun testMaxIntrinsicHeight_intrinsicMeasurements() = withDensity(density) {
+ fun testMaxIntrinsicHeight_intrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
MaxIntrinsicHeight {
FixedIntrinsicsBox(10.dp, 20.dp, 30.dp, 40.dp, 50.dp, 60.dp) { }
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 af2e30c3..df42f83 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
@@ -35,7 +35,6 @@
import androidx.ui.unit.min
import androidx.ui.unit.px
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import org.junit.Assert
import org.junit.Assert.assertEquals
import org.junit.Test
@@ -65,7 +64,7 @@
* available for both content and padding.
*/
@Test
- fun paddingAllAppliedToChild() = withDensity(density) {
+ fun paddingAllAppliedToChild() = with(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
TestBox(modifier = LayoutPadding(padding), body = child)
@@ -102,7 +101,7 @@
* unwilling to satisfy.
*/
@Test
- fun insufficientSpaceAvailable() = withDensity(density) {
+ fun insufficientSpaceAvailable() = with(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
TestBox(modifier = LayoutPadding(padding), body = child)
@@ -110,7 +109,7 @@
}
@Test
- fun intrinsicMeasurements() = withDensity(density) {
+ fun intrinsicMeasurements() = with(density) {
val padding = 100.ipx.toDp()
val latch = CountDownLatch(1)
@@ -171,7 +170,7 @@
private fun testPaddingIsAppliedImplementation(
padding: Dp,
paddingContainer: @Composable() (@Composable() () -> Unit) -> Unit
- ) = withDensity(density) {
+ ) = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val paddingPx = padding.toIntPx()
@@ -217,7 +216,7 @@
right: Dp,
bottom: Dp,
paddingContainer: @Composable() ((@Composable() () -> Unit) -> Unit)
- ) = withDensity(density) {
+ ) = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -268,7 +267,7 @@
private fun testPaddingWithInsufficientSpaceImplementation(
padding: Dp,
paddingContainer: @Composable() (@Composable() () -> Unit) -> Unit
- ) = withDensity(density) {
+ ) = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val paddingPx = padding.toIntPx()
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 83acfa1..42456ad 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
@@ -40,7 +40,6 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.min
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Assert
import org.junit.Assert.assertTrue
@@ -55,7 +54,7 @@
class OnPositionedTest : LayoutTest() {
@Test
- fun simplePadding() = withDensity(density) {
+ fun simplePadding() = with(density) {
val paddingLeftPx = 100.px
val paddingTopPx = 120.px
var realLeft: Px? = null
@@ -80,7 +79,7 @@
}
@Test
- fun simplePaddingWithChildPositioned() = withDensity(density) {
+ fun simplePaddingWithChildPositioned() = with(density) {
val paddingLeftPx = 100.px
val paddingTopPx = 120.px
var realLeft: Px? = null
@@ -105,7 +104,7 @@
}
@Test
- fun nestedLayoutCoordinates() = withDensity(density) {
+ fun nestedLayoutCoordinates() = with(density) {
val firstPaddingPx = 10.px
val secondPaddingPx = 20.px
val thirdPaddingPx = 30.px
@@ -144,7 +143,7 @@
}
@Test
- fun childPositionedForTwoContainers() = withDensity(density) {
+ fun childPositionedForTwoContainers() = with(density) {
val size = 100.px
val sizeDp = size.toDp()
var firstCoordinates: LayoutCoordinates? = null
@@ -174,7 +173,7 @@
}
@Test
- fun globalCoordinatesAreInActivityCoordinates() = withDensity(density) {
+ fun globalCoordinatesAreInActivityCoordinates() = with(density) {
val padding = 30
val localPosition = PxPosition.Origin
val globalPosition = PxPosition(padding.ipx, padding.ipx)
@@ -206,7 +205,7 @@
}
@Test
- fun justAddedOnPositionedCallbackFiredWithoutLayoutChanges() = withDensity(density) {
+ fun justAddedOnPositionedCallbackFiredWithoutLayoutChanges() = with(density) {
val needCallback = NeedCallback(false)
val positionedLatch = CountDownLatch(1)
@@ -249,7 +248,7 @@
activityTestRule.runOnUiThread { modelLeft.size = 40.dp }
positionedLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
assertThat(realLeft).isEqualTo(40.dp.toPx())
}
}
@@ -284,7 +283,7 @@
activityTestRule.runOnUiThread { modelLeft.size = 40.dp }
positionedLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
assertThat(realLeft).isEqualTo(40.dp.toPx())
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt
index 0454dcd..db1f8e3 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/PaddingTest.kt
@@ -33,7 +33,6 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.px
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -46,7 +45,7 @@
class PaddingTest : LayoutTest() {
@Test
- fun testPadding_IsApplied() = withDensity(density) {
+ fun testPadding_IsApplied() = with(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
Padding(padding = EdgeInsets(padding), children = child)
@@ -54,7 +53,7 @@
}
@Test
- fun testPadding_overloadAll_IsApplied() = withDensity(density) {
+ fun testPadding_overloadAll_IsApplied() = with(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
Padding(padding = padding, children = child)
@@ -62,7 +61,7 @@
}
@Test
- fun testPadding_overloadSides_IsApplied() = withDensity(density) {
+ fun testPadding_overloadSides_IsApplied() = with(density) {
val padding = 10.dp
testPaddingIsAppliedImplementation(padding) { child: @Composable() () -> Unit ->
Padding(left = padding, top = padding, right = padding, bottom = padding, children =
@@ -100,7 +99,7 @@
}
@Test
- fun testPadding_withInsufficientSpace() = withDensity(density) {
+ fun testPadding_withInsufficientSpace() = with(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
Padding(padding = EdgeInsets(padding), children = child)
@@ -108,7 +107,7 @@
}
@Test
- fun testPadding_overloadAll_withInsufficientSpace() = withDensity(density) {
+ fun testPadding_overloadAll_withInsufficientSpace() = with(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
Padding(padding = padding, children = child)
@@ -116,7 +115,7 @@
}
@Test
- fun testPadding_overloadSides_withInsufficientSpace() = withDensity(density) {
+ fun testPadding_overloadSides_withInsufficientSpace() = with(density) {
val padding = 30.dp
testPaddingWithInsufficientSpaceImplementation(padding) { child: @Composable() () -> Unit ->
Padding(left = 30.dp, right = 30.dp, top = 30.dp, bottom = 30.dp, children = child)
@@ -126,7 +125,7 @@
private fun testPaddingIsAppliedImplementation(
padding: Dp,
paddingContainer: @Composable() (@Composable() () -> Unit) -> Unit
- ) = withDensity(density) {
+ ) = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val paddingPx = padding.toIntPx()
@@ -172,7 +171,7 @@
right: Dp,
bottom: Dp,
paddingContainer: @Composable() ((@Composable() () -> Unit) -> Unit)
- ) = withDensity(density) {
+ ) = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -224,7 +223,7 @@
padding: Dp,
paddingContainer: @Composable() ((@Composable() () -> Unit) -> Unit)
) =
- withDensity(density) {
+ with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val paddingPx = padding.toIntPx()
@@ -261,7 +260,7 @@
}
@Test
- fun testPadding_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testPadding_hasCorrectIntrinsicMeasurements() = with(density) {
val padding = 100.ipx.toDp()
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SizeModifiersTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SizeModifiersTest.kt
index f81d8bf..bd024df 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SizeModifiersTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/SizeModifiersTest.kt
@@ -35,7 +35,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -48,7 +47,7 @@
class SizeModifiersTest : LayoutTest() {
@Test
- fun testSize_withWidthSizeModifiers() = withDensity(density) {
+ fun testSize_withWidthSizeModifiers() = with(density) {
val sizeDp = 50.dp
val sizeIpx = sizeDp.toIntPx()
@@ -107,7 +106,7 @@
}
@Test
- fun testSize_withHeightSizeModifiers() = withDensity(density) {
+ fun testSize_withHeightSizeModifiers() = with(density) {
val sizeDp = 10.dp
val sizeIpx = sizeDp.toIntPx()
@@ -163,7 +162,7 @@
}
@Test
- fun testSize_withSizeModifiers() = withDensity(density) {
+ fun testSize_withSizeModifiers() = with(density) {
val sizeDp = 50.dp
val sizeIpx = sizeDp.toIntPx()
@@ -210,7 +209,7 @@
}
@Test
- fun testSizeModifiers_respectMaxConstraint() = withDensity(density) {
+ fun testSizeModifiers_respectMaxConstraint() = with(density) {
val sizeDp = 100.dp
val size = sizeDp.toIntPx()
@@ -246,7 +245,7 @@
}
@Test
- fun testMaxModifiers_withInfiniteValue() = withDensity(density) {
+ fun testMaxModifiers_withInfiniteValue() = with(density) {
val sizeDp = 20.dp
val sizeIpx = sizeDp.toIntPx()
@@ -289,7 +288,7 @@
}
@Test
- fun testMinWidthModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testMinWidthModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutWidth.Min(10.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -319,7 +318,7 @@
}
@Test
- fun testMaxWidthModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testMaxWidthModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutWidth.Max(20.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -349,7 +348,7 @@
}
@Test
- fun testMinHeightModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testMinHeightModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutHeight.Min(30.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -379,7 +378,7 @@
}
@Test
- fun testMaxHeightModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testMaxHeightModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutHeight.Max(40.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -409,7 +408,7 @@
}
@Test
- fun testWidthModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testWidthModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutWidth(10.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -439,7 +438,7 @@
}
@Test
- fun testHeightModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testHeightModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutHeight(10.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -469,7 +468,7 @@
}
@Test
- fun testWidthHeightModifiers_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testWidthHeightModifiers_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(
LayoutWidth.Min(10.dp) + LayoutWidth.Max(20.dp) + LayoutHeight.Min(30.dp) +
@@ -502,7 +501,7 @@
}
@Test
- fun testMinSizeModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testMinSizeModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutSize.Min(20.dp, 30.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -532,7 +531,7 @@
}
@Test
- fun testMaxSizeModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testMaxSizeModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutSize.Max(40.dp, 50.dp)) {
Container(LayoutAspectRatio(1f)) { }
@@ -562,7 +561,7 @@
}
@Test
- fun testSizeModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testSizeModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(LayoutSize(40.dp, 50.dp)) {
Container(LayoutAspectRatio(1f)) { }
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 e3194ff..d71e508 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
@@ -28,7 +28,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth
import org.junit.Test
import org.junit.runner.RunWith
@@ -64,7 +63,7 @@
}
drawLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
Truth.assertThat(size?.height).isEqualTo(height.toIntPx())
Truth.assertThat(size?.width).isEqualTo(width.toIntPx())
}
@@ -98,7 +97,7 @@
}
drawLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
Truth.assertThat(size?.height).isEqualTo(containerHeight.toIntPx())
Truth.assertThat(size?.width).isEqualTo(containerWidth.toIntPx())
}
@@ -122,7 +121,7 @@
}
drawLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
Truth.assertThat(size?.height).isEqualTo(0.ipx)
Truth.assertThat(size?.width).isEqualTo(width.toIntPx())
}
@@ -155,7 +154,7 @@
}
drawLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
Truth.assertThat(size?.height).isEqualTo(0.ipx)
Truth.assertThat(size?.width).isEqualTo(containerWidth.toIntPx())
}
@@ -179,7 +178,7 @@
}
drawLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
Truth.assertThat(size?.height).isEqualTo(height.toIntPx())
Truth.assertThat(size?.width).isEqualTo(0.ipx)
}
@@ -212,7 +211,7 @@
}
drawLatch.await(1, TimeUnit.SECONDS)
- withDensity(density) {
+ with(density) {
Truth.assertThat(size?.height).isEqualTo(containerHeight.toIntPx())
Truth.assertThat(size?.width).isEqualTo(0.ipx)
}
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 3075805..be99ce2 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
@@ -35,7 +35,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -47,7 +46,7 @@
@RunWith(JUnit4::class)
class StackTest : LayoutTest() {
@Test
- fun testStack() = withDensity(density) {
+ fun testStack() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -93,7 +92,7 @@
}
@Test
- fun testStack_withMultipleAlignedChildren() = withDensity(density) {
+ fun testStack_withMultipleAlignedChildren() = with(density) {
val size = 250.ipx
val sizeDp = size.toDp()
val doubleSizeDp = sizeDp * 2
@@ -144,7 +143,7 @@
}
@Test
- fun testStack_withStretchChildren() = withDensity(density) {
+ fun testStack_withStretchChildren() = with(density) {
val size = 250.ipx
val sizeDp = size.toDp()
val halfSizeDp = sizeDp / 2
@@ -244,7 +243,7 @@
}
@Test
- fun testStack_expanded() = withDensity(density) {
+ fun testStack_expanded() = with(density) {
val size = 250.ipx
val sizeDp = size.toDp()
val halfSize = 125.ipx
@@ -295,7 +294,7 @@
}
@Test
- fun testStack_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testStack_hasCorrectIntrinsicMeasurements() = with(density) {
val testWidth = 90.ipx.toDp()
val testHeight = 80.ipx.toDp()
@@ -338,7 +337,7 @@
}
@Test
- fun testStack_hasCorrectIntrinsicMeasurements_withNoAlignedChildren() = withDensity(density) {
+ fun testStack_hasCorrectIntrinsicMeasurements_withNoAlignedChildren() = with(density) {
testIntrinsics(@Composable {
Stack {
ConstrainedBox(
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 b40f06d..7d0cd64 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
@@ -35,7 +35,6 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.max
import androidx.ui.unit.min
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -49,7 +48,7 @@
@RunWith(JUnit4::class)
class TableTest : LayoutTest() {
@Test
- fun testTable() = withDensity(density) {
+ fun testTable() = with(density) {
val rows = 8
val columns = 8
@@ -111,7 +110,7 @@
}
@Test
- fun testTable_withColumnWidth_flex() = withDensity(density) {
+ fun testTable_withColumnWidth_flex() = with(density) {
val rows = 8
val columns = 8
@@ -178,7 +177,7 @@
}
@Test
- fun testTable_withColumnWidth_wrap() = withDensity(density) {
+ fun testTable_withColumnWidth_wrap() = with(density) {
val rows = 8
val columns = 8
@@ -236,7 +235,7 @@
}
@Test
- fun testTable_withColumnWidth_wrap_flexible() = withDensity(density) {
+ fun testTable_withColumnWidth_wrap_flexible() = with(density) {
val rows = 8
val columns = 8
@@ -307,7 +306,7 @@
}
@Test
- fun testTable_withColumnWidth_minIntrinsic() = withDensity(density) {
+ fun testTable_withColumnWidth_minIntrinsic() = with(density) {
val rows = 8
val columns = 8
@@ -368,7 +367,7 @@
}
@Test
- fun testTable_withColumnWidth_maxIntrinsic() = withDensity(density) {
+ fun testTable_withColumnWidth_maxIntrinsic() = with(density) {
val rows = 8
val columns = 8
@@ -429,7 +428,7 @@
}
@Test
- fun testTable_withColumnWidth_fixed() = withDensity(density) {
+ fun testTable_withColumnWidth_fixed() = with(density) {
val rows = 8
val columns = 8
@@ -490,7 +489,7 @@
}
@Test
- fun testTable_withColumnWidth_fraction() = withDensity(density) {
+ fun testTable_withColumnWidth_fraction() = with(density) {
val rows = 8
val columns = 8
@@ -556,7 +555,7 @@
}
@Test
- fun testTable_withColumnWidth_min() = withDensity(density) {
+ fun testTable_withColumnWidth_min() = with(density) {
val rows = 8
val columns = 8
@@ -631,7 +630,7 @@
}
@Test
- fun testTable_withColumnWidth_max() = withDensity(density) {
+ fun testTable_withColumnWidth_max() = with(density) {
val rows = 8
val columns = 8
@@ -706,7 +705,7 @@
}
@Test
- fun testTable_withColumnWidth_min_oneWrap() = withDensity(density) {
+ fun testTable_withColumnWidth_min_oneWrap() = with(density) {
val rows = 8
val columns = 8
@@ -771,7 +770,7 @@
}
@Test
- fun testTable_withColumnWidth_max_oneWrap() = withDensity(density) {
+ fun testTable_withColumnWidth_max_oneWrap() = with(density) {
val rows = 8
val columns = 8
@@ -836,7 +835,7 @@
}
@Test
- fun testTable_withColumnWidth_min_twoWraps() = withDensity(density) {
+ fun testTable_withColumnWidth_min_twoWraps() = with(density) {
val rows = 8
val columns = 8
@@ -896,7 +895,7 @@
}
@Test
- fun testTable_withColumnWidth_max_twoWraps() = withDensity(density) {
+ fun testTable_withColumnWidth_max_twoWraps() = with(density) {
val rows = 8
val columns = 8
@@ -956,7 +955,7 @@
}
@Test
- fun testTable_withColumnWidth_custom() = withDensity(density) {
+ fun testTable_withColumnWidth_custom() = with(density) {
val rows = 8
val columns = 8
@@ -1029,7 +1028,7 @@
}
@Test
- fun testTable_withDifferentRowHeights() = withDensity(density) {
+ fun testTable_withDifferentRowHeights() = with(density) {
val rows = 8
val columns = 8
@@ -1096,7 +1095,7 @@
}
@Test
- fun testTable_withDifferentColumnWidths() = withDensity(density) {
+ fun testTable_withDifferentColumnWidths() = with(density) {
val rows = 8
val columns = 5
@@ -1207,7 +1206,7 @@
}
@Test
- fun testTable_withDecorations() = withDensity(density) {
+ fun testTable_withDecorations() = with(density) {
val rows = 8
val columns = 8
val decorations = 3
@@ -1297,7 +1296,7 @@
}
@Test
- fun testTable_hasCorrectIntrinsicMeasurements_flex() = withDensity(density) {
+ fun testTable_hasCorrectIntrinsicMeasurements_flex() = with(density) {
val rows = 8
val columns = 8
@@ -1342,7 +1341,7 @@
}
@Test
- fun testTable_hasCorrectIntrinsicMeasurements_wrap() = withDensity(density) {
+ fun testTable_hasCorrectIntrinsicMeasurements_wrap() = with(density) {
val rows = 8
val columns = 8
@@ -1387,7 +1386,7 @@
}
@Test
- fun testTable_hasCorrectIntrinsicMeasurements_wrap_flexible() = withDensity(density) {
+ fun testTable_hasCorrectIntrinsicMeasurements_wrap_flexible() = with(density) {
val rows = 8
val columns = 8
@@ -1432,7 +1431,7 @@
}
@Test
- fun testTable_hasCorrectIntrinsicMeasurements_minIntrinsic() = withDensity(density) {
+ fun testTable_hasCorrectIntrinsicMeasurements_minIntrinsic() = with(density) {
val rows = 8
val columns = 8
@@ -1477,7 +1476,7 @@
}
@Test
- fun testTable_hasCorrectIntrinsicMeasurements_maxIntrinsic() = withDensity(density) {
+ fun testTable_hasCorrectIntrinsicMeasurements_maxIntrinsic() = with(density) {
val rows = 8
val columns = 8
@@ -1522,7 +1521,7 @@
}
@Test
- fun testTable_hasCorrectIntrinsicMeasurements_fixed() = withDensity(density) {
+ fun testTable_hasCorrectIntrinsicMeasurements_fixed() = with(density) {
val rows = 8
val columns = 8
@@ -1569,7 +1568,7 @@
}
@Test
- fun testTable_hasCorrectIntrinsicMeasurements_fraction() = withDensity(density) {
+ fun testTable_hasCorrectIntrinsicMeasurements_fraction() = with(density) {
val rows = 8
val columns = 8
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/WrapTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/WrapTest.kt
index 6522a43..60e333b 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/WrapTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/WrapTest.kt
@@ -38,7 +38,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -50,7 +49,7 @@
@RunWith(JUnit4::class)
class WrapTest : LayoutTest() {
@Test
- fun testWrap() = withDensity(density) {
+ fun testWrap() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -84,7 +83,7 @@
}
@Test
- fun testWrappedModifier() = withDensity(density) {
+ fun testWrappedModifier() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
@@ -105,7 +104,7 @@
}
@Test
- fun testWrap_respectsMinConstraints() = withDensity(density) {
+ fun testWrap_respectsMinConstraints() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val doubleSizeDp = sizeDp * 2
@@ -145,7 +144,7 @@
}
@Test
- fun testWrappedModifier_respectsMinConstraints() = withDensity(density) {
+ fun testWrappedModifier_respectsMinConstraints() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val doubleSizeDp = sizeDp * 2
@@ -197,7 +196,7 @@
}
@Test
- fun testWrap_respectsMinConstraintsAndAlignment() = withDensity(density) {
+ fun testWrap_respectsMinConstraintsAndAlignment() = with(density) {
val sizeDp = 50.dp
val size = sizeDp.toIntPx()
val doubleSizeDp = sizeDp * 2
@@ -239,7 +238,7 @@
}
@Test
- fun testWrap_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testWrap_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Wrap {
Container(modifier = LayoutAspectRatio(2f)) { }
@@ -261,7 +260,7 @@
}
@Test
- fun testWrappedModifier_hasCorrectIntrinsicMeasurements() = withDensity(density) {
+ fun testWrappedModifier_hasCorrectIntrinsicMeasurements() = with(density) {
testIntrinsics(@Composable {
Container(modifier = LayoutAspectRatio(2f) + LayoutWrapped) { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
@@ -281,7 +280,7 @@
}
@Test
- fun testWrap_hasCorrectIntrinsicMeasurements_whenNoChildren() = withDensity(density) {
+ fun testWrap_hasCorrectIntrinsicMeasurements_whenNoChildren() = with(density) {
testIntrinsics(@Composable {
Wrap { }
}) { minIntrinsicWidth, minIntrinsicHeight, maxIntrinsicWidth, maxIntrinsicHeight ->
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Align.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Align.kt
index f30c91c..930ef6c 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Align.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Align.kt
@@ -21,7 +21,7 @@
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
import androidx.ui.core.LayoutModifier
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.ipx
@@ -223,13 +223,13 @@
private val alignment: Alignment,
private val direction: Direction
) : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints) = when (direction) {
+ override fun Density.modifyConstraints(constraints: Constraints) = when (direction) {
Direction.Both -> constraints.copy(minWidth = 0.ipx, minHeight = 0.ipx)
Direction.Horizontal -> constraints.copy(minWidth = 0.ipx)
Direction.Vertical -> constraints.copy(minHeight = 0.ipx)
}
- override fun DensityScope.modifySize(
+ override fun Density.modifySize(
constraints: Constraints,
childSize: IntPxSize
): IntPxSize {
@@ -250,7 +250,7 @@
return IntPxSize(width, height)
}
- override fun DensityScope.modifyPosition(
+ override fun Density.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize
): IntPxPosition {
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/AspectRatio.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/AspectRatio.kt
index 5cfb8c3..31e7711 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/AspectRatio.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/AspectRatio.kt
@@ -23,7 +23,7 @@
import androidx.ui.core.LayoutModifier
import androidx.ui.core.Measurable
import androidx.ui.core.satisfiedBy
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.ipx
@@ -55,7 +55,7 @@
require(aspectRatio > 0) { "aspectRatio $aspectRatio must be > 0" }
}
- override fun DensityScope.modifyConstraints(constraints: Constraints): Constraints {
+ override fun Density.modifyConstraints(constraints: Constraints): Constraints {
val size = constraints.findSizeWith(aspectRatio)
return if (size != null)
Constraints.fixed(size.width, size.height)
@@ -63,22 +63,22 @@
constraints
}
- override fun DensityScope.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
+ override fun Density.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
return if (height == IntPx.Infinity) measurable.minIntrinsicWidth(height)
else height * aspectRatio
}
- override fun DensityScope.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
+ override fun Density.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx {
return if (height == IntPx.Infinity) measurable.maxIntrinsicWidth(height)
else height * aspectRatio
}
- override fun DensityScope.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
+ override fun Density.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
return if (width == IntPx.Infinity) measurable.minIntrinsicHeight(width)
else width / aspectRatio
}
- override fun DensityScope.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
+ override fun Density.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx {
return if (width == IntPx.Infinity) measurable.maxIntrinsicHeight(width)
else width / aspectRatio
}
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 4778b26..aac06c1 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
@@ -40,7 +40,7 @@
import androidx.ui.core.hasBoundedHeight
import androidx.ui.core.hasBoundedWidth
import androidx.ui.core.tag
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
@@ -557,11 +557,11 @@
private class Measurer internal constructor() : BasicMeasure.Measurer {
private val root = ConstraintWidgetContainer(0, 0).also { it.measurer = this }
private val placeables = mutableMapOf<Measurable, Placeable>()
- private lateinit var densityScope: DensityScope
+ private lateinit var density: Density
private val state = object : State() {
override fun convertDimension(value: Any?): Int {
return if (value is Dp) {
- with(densityScope) { value.toIntPx().value }
+ with(density) { value.toIntPx().value }
} else {
super.convertDimension(value)
}
@@ -605,9 +605,9 @@
constraints: Constraints,
constraintSet: ConstraintSet,
measurables: List<Measurable>,
- densityScope: DensityScope
+ density: Density
): IntPxSize {
- this.densityScope = densityScope
+ this.density = density
state.reset()
measurables.forEach { measurable ->
state.map(measurable.tag ?: object : Any() {}, measurable)
@@ -658,16 +658,16 @@
}
private data class TagModifier(val tag: Any) : LayoutModifier, ParentDataModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints) = constraints
- override fun DensityScope.modifySize(constraints: Constraints, childSize: IntPxSize) = childSize
- override fun DensityScope.minIntrinsicWidthOf(measurable: Measurable, height: IntPx) =
+ override fun Density.modifyConstraints(constraints: Constraints) = constraints
+ override fun Density.modifySize(constraints: Constraints, childSize: IntPxSize) = childSize
+ override fun Density.minIntrinsicWidthOf(measurable: Measurable, height: IntPx) =
measurable.minIntrinsicWidth(height)
- override fun DensityScope.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx) =
+ override fun Density.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx) =
measurable.maxIntrinsicWidth(height)
- override fun DensityScope.minIntrinsicHeightOf(measurable: Measurable, width: IntPx) =
+ override fun Density.minIntrinsicHeightOf(measurable: Measurable, width: IntPx) =
measurable.minIntrinsicHeight(width)
- override fun DensityScope.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx) =
+ override fun Density.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx) =
measurable.maxIntrinsicHeight(width)
- override fun DensityScope.modifyAlignmentLine(line: AlignmentLine, value: IntPx?) = value
- override fun DensityScope.modifyParentData(parentData: Any?) = this@TagModifier
+ override fun Density.modifyAlignmentLine(line: AlignmentLine, value: IntPx?) = value
+ override fun Density.modifyParentData(parentData: Any?) = this@TagModifier
}
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/DpConstraints.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/DpConstraints.kt
index 5e3c284..2b3dd48 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/DpConstraints.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/DpConstraints.kt
@@ -18,7 +18,7 @@
import androidx.compose.Immutable
import androidx.ui.core.Constraints
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.coerceAtLeast
import androidx.ui.unit.coerceIn
@@ -140,7 +140,7 @@
/**
* Creates the [Constraints] corresponding to the current [DpConstraints].
*/
-fun DensityScope.Constraints(dpConstraints: DpConstraints) = Constraints(
+fun Density.Constraints(dpConstraints: DpConstraints) = Constraints(
minWidth = dpConstraints.minWidth.toIntPx(),
maxWidth = dpConstraints.maxWidth.toIntPx(),
minHeight = dpConstraints.minHeight.toIntPx(),
@@ -150,7 +150,7 @@
/**
* Creates the [DpConstraints] corresponding to the current [Constraints].
*/
-fun DensityScope.DpConstraints(constraints: Constraints) = DpConstraints(
+fun Density.DpConstraints(constraints: Constraints) = DpConstraints(
minWidth = constraints.minWidth.toDp(),
maxWidth = constraints.maxWidth.toDp(),
minHeight = constraints.minHeight.toDp(),
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Flex.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Flex.kt
index 4ea897d..37e2e60 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Flex.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Flex.kt
@@ -31,7 +31,7 @@
import androidx.ui.core.ParentDataModifier
import androidx.ui.core.Placeable
import androidx.ui.core.VerticalAlignmentLine
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.ipx
@@ -1098,7 +1098,7 @@
}
private data class FlexModifier(val flexProperties: FlexChildProperties) : ParentDataModifier {
- override fun DensityScope.modifyParentData(parentData: Any?): FlexChildProperties {
+ override fun Density.modifyParentData(parentData: Any?): FlexChildProperties {
return ((parentData as? FlexChildProperties) ?: FlexChildProperties()).also {
it.flex = flexProperties.flex
it.fit = flexProperties.fit
@@ -1107,11 +1107,11 @@
}
private sealed class SiblingsAlignedModifier : ParentDataModifier {
- abstract override fun DensityScope.modifyParentData(parentData: Any?): Any?
+ abstract override fun Density.modifyParentData(parentData: Any?): Any?
internal data class WithAlignmentLineBlock(val block: (Placeable) -> IntPx) :
SiblingsAlignedModifier() {
- override fun DensityScope.modifyParentData(parentData: Any?): Any? {
+ override fun Density.modifyParentData(parentData: Any?): Any? {
return ((parentData as? FlexChildProperties) ?: FlexChildProperties()).also {
it.crossAxisAlignment =
CrossAxisAlignment.Relative(AlignmentLineProvider.Block(block))
@@ -1121,7 +1121,7 @@
internal data class WithAlignmentLine(val line: AlignmentLine) :
SiblingsAlignedModifier() {
- override fun DensityScope.modifyParentData(parentData: Any?): Any? {
+ override fun Density.modifyParentData(parentData: Any?): Any? {
return ((parentData as? FlexChildProperties) ?: FlexChildProperties()).also {
it.crossAxisAlignment =
CrossAxisAlignment.Relative(AlignmentLineProvider.Value(line))
@@ -1131,7 +1131,7 @@
}
private data class GravityModifier(val alignment: CrossAxisAlignment) : ParentDataModifier {
- override fun DensityScope.modifyParentData(parentData: Any?): FlexChildProperties {
+ override fun Density.modifyParentData(parentData: Any?): FlexChildProperties {
return ((parentData as? FlexChildProperties) ?: FlexChildProperties()).also {
it.crossAxisAlignment = alignment
}
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Padding.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Padding.kt
index b97ea47..8616b38 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Padding.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Padding.kt
@@ -22,7 +22,7 @@
import androidx.ui.core.Layout
import androidx.ui.core.LayoutModifier
import androidx.ui.core.offset
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
@@ -89,14 +89,14 @@
val right: Dp = 0.dp,
val bottom: Dp = 0.dp
) : LayoutModifier {
- override fun DensityScope.modifyConstraints(
+ override fun Density.modifyConstraints(
constraints: Constraints
) = constraints.offset(
horizontal = -left.toIntPx() - right.toIntPx(),
vertical = -top.toIntPx() - bottom.toIntPx()
)
- override fun DensityScope.modifySize(
+ override fun Density.modifySize(
constraints: Constraints,
childSize: IntPxSize
) = IntPxSize(
@@ -106,7 +106,7 @@
.coerceIn(constraints.minHeight, constraints.maxHeight)
)
- override fun DensityScope.modifyPosition(
+ override fun Density.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize
) = IntPxPosition(left.toIntPx(), top.toIntPx())
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/SizeModifiers.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/SizeModifiers.kt
index 1591537..870761e 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/SizeModifiers.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/SizeModifiers.kt
@@ -23,34 +23,34 @@
import androidx.ui.core.enforce
import androidx.ui.core.hasBoundedHeight
import androidx.ui.core.hasBoundedWidth
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.isFinite
private data class SizeModifier(private val modifierConstraints: DpConstraints) : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints) =
+ override fun Density.modifyConstraints(constraints: Constraints) =
Constraints(modifierConstraints).enforce(constraints)
- override fun DensityScope.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
+ override fun Density.minIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
measurable.minIntrinsicWidth(height).let {
val constraints = Constraints(modifierConstraints)
it.coerceIn(constraints.minWidth, constraints.maxWidth)
}
- override fun DensityScope.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
+ override fun Density.maxIntrinsicWidthOf(measurable: Measurable, height: IntPx): IntPx =
measurable.maxIntrinsicWidth(height).let {
val constraints = Constraints(modifierConstraints)
it.coerceIn(constraints.minWidth, constraints.maxWidth)
}
- override fun DensityScope.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
+ override fun Density.minIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
measurable.minIntrinsicHeight(width).let {
val constraints = Constraints(modifierConstraints)
it.coerceIn(constraints.minHeight, constraints.maxHeight)
}
- override fun DensityScope.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
+ override fun Density.maxIntrinsicHeightOf(measurable: Measurable, width: IntPx): IntPx =
measurable.maxIntrinsicHeight(width).let {
val constraints = Constraints(modifierConstraints)
it.coerceIn(constraints.minHeight, constraints.maxHeight)
@@ -142,7 +142,7 @@
*/
@Stable
object Fill : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints): Constraints =
+ override fun Density.modifyConstraints(constraints: Constraints): Constraints =
if (constraints.hasBoundedWidth) {
constraints.copy(minWidth = constraints.maxWidth, maxWidth = constraints.maxWidth)
} else {
@@ -238,7 +238,7 @@
*/
@Stable
object Fill : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints): Constraints =
+ override fun Density.modifyConstraints(constraints: Constraints): Constraints =
if (constraints.hasBoundedHeight) {
constraints.copy(
minHeight = constraints.maxHeight,
@@ -384,7 +384,7 @@
*/
@Stable
object Fill : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints): Constraints =
+ override fun Density.modifyConstraints(constraints: Constraints): Constraints =
when {
constraints.hasBoundedWidth && constraints.hasBoundedHeight -> constraints.copy(
minWidth = constraints.maxWidth,
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 a687c77e..a02fd3f 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
@@ -24,7 +24,7 @@
import androidx.ui.core.Modifier
import androidx.ui.core.ParentDataModifier
import androidx.ui.core.Placeable
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.ipx
@@ -207,7 +207,7 @@
val alignment: Alignment,
val stretch: Boolean = false
) : ParentDataModifier {
- override fun DensityScope.modifyParentData(parentData: Any?): StackChildData {
+ override fun Density.modifyParentData(parentData: Any?): StackChildData {
return ((parentData as? StackChildData) ?: StackChildData(alignment, stretch))
}
}
\ No newline at end of file
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Table.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Table.kt
index 3cb26c8..0337286 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Table.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Table.kt
@@ -28,14 +28,12 @@
import androidx.ui.core.Placeable
import androidx.ui.core.constrain
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.isFinite
import androidx.ui.unit.max
import androidx.ui.unit.min
-import androidx.ui.unit.withDensity
/**
* Collects information about the children of a [Table] when
@@ -331,7 +329,7 @@
containerWidth: IntPx,
density: Density
): IntPx {
- return withDensity(density) { width.toIntPx() }
+ return with(density) { width.toIntPx() }
}
}
@@ -543,7 +541,7 @@
}
)
}
- columnWidths[column] = spec.preferredWidth(cells, constraints.maxWidth, density)
+ columnWidths[column] = spec.preferredWidth(cells, constraints.maxWidth, this)
availableSpace -= columnWidths[column]
totalFlex += spec.flexValue
}
@@ -674,7 +672,7 @@
}
}
-private fun DensityScope.intrinsicWidth(
+private fun Density.intrinsicWidth(
columns: Int,
columnWidth: (columnIndex: Int) -> TableColumnWidth,
children: List<IntrinsicMeasurable>,
@@ -703,9 +701,9 @@
)
}
val width = if (minimise) {
- spec.minIntrinsicWidth(cells, IntPx.Infinity, density, availableHeight)
+ spec.minIntrinsicWidth(cells, IntPx.Infinity, this, availableHeight)
} else {
- spec.maxIntrinsicWidth(cells, IntPx.Infinity, density, availableHeight)
+ spec.maxIntrinsicWidth(cells, IntPx.Infinity, this, availableHeight)
}
if (spec.flexValue <= 0) {
inflexibleSpace += width
@@ -717,7 +715,7 @@
return flexibleSpace * totalFlex + inflexibleSpace
}
-private fun DensityScope.intrinsicHeight(
+private fun Density.intrinsicHeight(
columns: Int,
columnWidth: (columnIndex: Int) -> TableColumnWidth,
children: List<IntrinsicMeasurable>,
@@ -746,7 +744,7 @@
)
}
columnWidths[column] =
- spec.maxIntrinsicWidth(cells, availableWidth, density, IntPx.Infinity)
+ spec.maxIntrinsicWidth(cells, availableWidth, this, IntPx.Infinity)
availableSpace -= columnWidths[column]
totalFlex += spec.flexValue
}
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/Wrap.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/Wrap.kt
index 16104a5..2b1156c 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/Wrap.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/Wrap.kt
@@ -21,7 +21,7 @@
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
import androidx.ui.core.LayoutModifier
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.ipx
@@ -66,10 +66,10 @@
* size itself to min incoming constraints and place its content in the center.
*/
val LayoutWrapped: LayoutModifier = object : LayoutModifier {
- override fun DensityScope.modifyConstraints(constraints: Constraints) =
+ override fun Density.modifyConstraints(constraints: Constraints) =
constraints.copy(minWidth = 0.ipx, minHeight = 0.ipx)
- override fun DensityScope.modifySize(
+ override fun Density.modifySize(
constraints: Constraints,
childSize: IntPxSize
): IntPxSize {
@@ -78,7 +78,7 @@
return IntPxSize(width, height)
}
- override fun DensityScope.modifyPosition(
+ override fun Density.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize
): IntPxPosition {
diff --git a/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt b/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
index f83060d..5dd11a5 100644
--- a/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
+++ b/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
@@ -25,8 +25,8 @@
import androidx.ui.animation.PxPropKey
import androidx.ui.animation.Transition
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Text
-import androidx.ui.core.ambientDensity
import androidx.ui.foundation.Border
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.DrawBorder
@@ -48,7 +48,6 @@
import androidx.ui.material.TabRow
import androidx.ui.unit.dp
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
@Sampled
@Composable
@@ -326,8 +325,9 @@
// Padding to set the 'offset'
Container(expanded = true, alignment = Alignment.BottomLeft) {
Transition(transitionDefinition, selectedIndex) { state ->
- val offset = withDensity(ambientDensity()) { state[indicatorStart].toDp() }
- val width = withDensity(ambientDensity()) {
+ val density = DensityAmbient.current
+ val offset = with(density) { state[indicatorStart].toDp() }
+ val width = with(density) {
(state[indicatorEnd] - state[indicatorStart]).toDp()
}
Padding(left = offset) {
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 9c839cf..94da01e 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
@@ -43,7 +43,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.sp
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -227,7 +226,7 @@
}
}
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
assertThat(realSize.height.value)
.isGreaterThan(36.dp.toIntPx().value.toFloat())
}
@@ -311,7 +310,7 @@
composeTestRule.runOnIdleCompose {
val topLeft = childCoordinates!!.localToGlobal(PxPosition.Origin).x -
parentCoordinates!!.localToGlobal(PxPosition.Origin).x
- val currentPadding = withDensity(composeTestRule.density) {
+ val currentPadding = with(composeTestRule.density) {
padding.toIntPx().toPx()
}
assertThat(currentPadding).isEqualTo(topLeft)
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 9c5856c..a5c142a 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
@@ -32,7 +32,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.withDensity
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -93,7 +92,7 @@
}
private fun setupSurfaceForTesting(elevation: Dp, colorPalette: ColorPalette) {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
composeTestRule.setContent {
MaterialTheme(colorPalette) {
Container {
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt
index 2155187..a4ec00c 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt
@@ -22,7 +22,6 @@
import androidx.ui.test.createComposeRule
import androidx.ui.unit.dp
import androidx.ui.unit.round
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -51,13 +50,13 @@
.setMaterialContentAndGetPixelSize {
FloatingActionButton(icon = createImage(), text = "Extended")
}
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
assertThat(size.width.round().value).isAtLeast(48.dp.toIntPx().value)
assertThat(size.height.round()).isEqualTo(48.dp.toIntPx())
}
}
- private fun createImage() = withDensity(composeTestRule.density) {
+ private fun createImage() = with(composeTestRule.density) {
val size = 24.dp.toIntPx().value
Image(size, size, ImageConfig.Argb8888)
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
index b073e8e..9b6fc4d 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
@@ -23,7 +23,7 @@
import androidx.ui.test.CollectedSizes
import androidx.ui.test.ComposeTestRule
import androidx.ui.test.setContentAndGetPixelSize
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.PxSize
fun ComposeTestRule.setMaterialContent(composable: @Composable() () -> Unit) {
@@ -33,9 +33,9 @@
}
}
}
-fun <T> ComposeTestRule.runOnIdleComposeWithDensity(action: DensityScope.() -> T): T {
+fun <T> ComposeTestRule.runOnIdleComposeWithDensity(action: Density.() -> T): T {
return runOnIdleCompose {
- DensityScope(density).action()
+ density.action()
}
}
fun ComposeTestRule.setMaterialContentAndCollectSizes(
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 75012b0..b83cfdf 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
@@ -35,7 +35,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.round
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -92,7 +91,7 @@
.assertWidthEqualsTo(300.dp)
assertThat(textCoords).isNotNull()
textCoords?.let {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
assertThat(it[FirstBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(it[FirstBaseline])
.isEqualTo(it[LastBaseline])
@@ -147,7 +146,7 @@
localButtonTextCoords != null &&
localSnackCoords != null
) {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
val buttonTextPos =
localSnackCoords.childToLocal(localButtonTextCoords, PxPosition.Origin)
assertThat(localTextCoords[FirstBaseline]).isNotEqualTo(IntPx.Zero)
@@ -182,7 +181,7 @@
.assertWidthEqualsTo(300.dp)
assertThat(textCoords).isNotNull()
textCoords?.let {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
assertThat(it[FirstBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(it[LastBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(it[FirstBaseline]).isNotEqualTo(it[LastBaseline])
@@ -229,7 +228,7 @@
val localSnackCoords = snackCoords
if (localTextCoords != null && localButtonCoords != null && localSnackCoords != null) {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
val buttonPositionInSnack =
localSnackCoords.childToLocal(localButtonCoords, PxPosition.Origin)
val buttonCenter =
@@ -283,7 +282,7 @@
val localSnackCoords = snackCoords
if (localTextCoords != null && localButtonCoords != null && localSnackCoords != null) {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
val buttonPositionInSnack =
localSnackCoords.childToLocal(localButtonCoords, PxPosition.Origin)
val textPositionInSnack =
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 eb4f55c..d1d2b94 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
@@ -39,7 +39,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -159,7 +158,7 @@
// Indicator should now be placed in the bottom left of the second tab, so its x coordinate
// should be in the middle of the TabRow
composeTestRule.runOnIdleCompose {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
val indicatorPositionX = indicatorCoords!!.localToGlobal(PxPosition.Origin).x
val expectedPositionX = tabRowWidth / 2
assertThat(indicatorPositionX).isEqualTo(expectedPositionX.toPx())
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 1af1e12..54b6215 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
@@ -19,9 +19,9 @@
import androidx.compose.Immutable
import androidx.ui.core.Alignment
import androidx.ui.core.CurrentTextStyleProvider
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.LastBaseline
import androidx.ui.core.Text
-import androidx.ui.core.ambientDensity
import androidx.ui.foundation.Clickable
import androidx.ui.foundation.SimpleImage
import androidx.ui.foundation.shape.RectangleShape
@@ -62,7 +62,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.sp
import androidx.ui.unit.toPxSize
-import androidx.ui.unit.withDensity
import kotlin.math.sqrt
/**
@@ -178,7 +177,7 @@
Container(LayoutFlexible(1f) + LayoutAlign.BottomLeft) {
AlignmentLineOffset(
alignmentLine = LastBaseline,
- after = withDensity(ambientDensity()) { AppBarTitleBaselineOffset.toDp() }
+ after = with(DensityAmbient.current) { AppBarTitleBaselineOffset.toDp() }
) {
Semantics(container = true) {
// TODO: AlignmentLineOffset requires a child, so in case title() is
@@ -380,7 +379,7 @@
*/
private fun Path.addCutoutShape(density: Density) {
// The gap on all sides between the FAB and the cutout
- val cutoutOffset = withDensity(density) { BottomAppBarCutoutOffset.toPx() }
+ val cutoutOffset = with(density) { BottomAppBarCutoutOffset.toPx() }
val cutoutSize = PxSize(
width = fabSize.width + (cutoutOffset * 2),
@@ -400,7 +399,7 @@
// TODO: consider exposing the custom cutout shape instead of just replacing circle shapes?
if (cutoutShape == CircleShape) {
- val edgeRadius = withDensity(density) { BottomAppBarRoundedEdgeRadius.toPx().value }
+ val edgeRadius = with(density) { BottomAppBarRoundedEdgeRadius.toPx().value }
// TODO: possibly support providing a custom vertical offset?
addRoundedEdges(cutoutStartX, cutoutEndX, cutoutRadius, edgeRadius, 0f)
}
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 93666bf..8b1354a 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
@@ -19,11 +19,11 @@
import androidx.animation.PhysicsBuilder
import androidx.compose.Composable
import androidx.compose.remember
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
import androidx.ui.core.Layout
import androidx.ui.core.RepaintBoundary
import androidx.ui.core.WithConstraints
-import androidx.ui.core.ambientDensity
import androidx.ui.core.hasBoundedHeight
import androidx.ui.core.hasBoundedWidth
import androidx.ui.foundation.Clickable
@@ -43,7 +43,6 @@
import androidx.ui.unit.min
import androidx.ui.unit.px
import androidx.ui.unit.toRect
-import androidx.ui.unit.withDensity
import androidx.ui.util.lerp
/**
@@ -116,7 +115,7 @@
if (!pxConstraints.hasBoundedWidth) {
throw IllegalStateException("Drawer shouldn't have infinite width")
}
- val constraints = withDensity(ambientDensity()) {
+ val constraints = with(DensityAmbient.current) {
DpConstraints(pxConstraints)
}
val minValue = -pxConstraints.maxWidth.value.toFloat()
@@ -183,7 +182,7 @@
if (!pxConstraints.hasBoundedHeight) {
throw IllegalStateException("Drawer shouldn't have infinite height")
}
- val constraints = withDensity(ambientDensity()) {
+ val constraints = with(DensityAmbient.current) {
DpConstraints(pxConstraints)
}
val minValue = 0f
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 1b32642..39f8876 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
@@ -26,8 +26,8 @@
import androidx.compose.Composable
import androidx.compose.remember
import androidx.ui.animation.Transition
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
-import androidx.ui.core.ambientDensity
import androidx.ui.foundation.DeterminateProgressIndicator
import androidx.ui.geometry.Offset
import androidx.ui.geometry.Rect
@@ -41,7 +41,6 @@
import androidx.ui.layout.Wrap
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.withDensity
import androidx.ui.graphics.vectormath.degrees
import kotlin.math.abs
import kotlin.math.max
@@ -472,9 +471,9 @@
@Composable
private fun paint(color: Color, strokeCap: StrokeCap): Paint {
- val density = ambientDensity()
+ val density = DensityAmbient.current
val basePaint = remember {
- withDensity(density) {
+ with(density) {
Paint().apply {
isAntiAlias = true
style = PaintingStyle.stroke
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 b92922e..3a8888e 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
@@ -43,7 +43,7 @@
import androidx.ui.material.ripple.Ripple
import androidx.ui.semantics.Semantics
import androidx.ui.text.TextStyle
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
@@ -230,7 +230,7 @@
}
}
-private fun DensityScope.drawRadio(
+private fun Density.drawRadio(
canvas: Canvas,
parentSize: PxSize,
color: Color,
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 e4d3f1c..07321c6 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
@@ -40,7 +40,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
-import androidx.ui.unit.withDensity
/**
* State for [Scaffold] composable component.
@@ -260,7 +259,7 @@
content: @Composable() (Modifier) -> Unit
) {
ScaffoldSlot(modifier) {
- val bottomSpace = withDensity(DensityAmbient.current) {
+ val bottomSpace = with(DensityAmbient.current) {
scaffoldState.bottomBarSize?.height?.toDp() ?: 0.dp
}
content(LayoutPadding(bottom = bottomSpace))
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 7112c79..d836d7b 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
@@ -24,10 +24,10 @@
import androidx.compose.remember
import androidx.compose.state
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
import androidx.ui.core.Modifier
import androidx.ui.core.WithConstraints
-import androidx.ui.core.ambientDensity
import androidx.ui.core.gesture.PressGestureDetector
import androidx.ui.foundation.animation.AnimatedValueHolder
import androidx.ui.foundation.animation.FlingConfig
@@ -54,7 +54,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.px
import androidx.ui.unit.toRect
-import androidx.ui.unit.withDensity
import androidx.ui.util.lerp
import kotlin.math.abs
@@ -210,7 +209,7 @@
@Composable
private fun SliderImpl(position: SliderPosition, color: Color, width: Float, pressed: Boolean) {
- val widthDp = withDensity(ambientDensity()) {
+ val widthDp = with(DensityAmbient.current) {
width.px.toDp()
}
Semantics(container = true, properties = { accessibilityValue = "${position.value}" }) {
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 7a22c93..48cccd3 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
@@ -18,8 +18,8 @@
import androidx.animation.TweenBuilder
import androidx.compose.Composable
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
-import androidx.ui.core.ambientDensity
import androidx.ui.foundation.ValueHolder
import androidx.ui.foundation.gestures.DragDirection
import androidx.ui.foundation.selection.Toggleable
@@ -34,11 +34,10 @@
import androidx.ui.material.internal.StateDraggable
import androidx.ui.material.ripple.Ripple
import androidx.ui.semantics.Semantics
-import androidx.ui.unit.DensityScope
+import androidx.ui.unit.Density
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
/**
* A Switch is a two state toggleable component that provides on/off like options
@@ -73,7 +72,7 @@
@Composable
private fun SwitchImpl(checked: Boolean, onCheckedChange: ((Boolean) -> Unit)?, color: Color) {
val minBound = 0f
- val maxBound = withDensity(ambientDensity()) { ThumbPathLength.toPx().value }
+ val maxBound = with(DensityAmbient.current) { ThumbPathLength.toPx().value }
StateDraggable(
state = checked,
?: {},
@@ -107,7 +106,7 @@
}
}
-private fun DensityScope.drawTrack(
+private fun Density.drawTrack(
canvas: Canvas,
parentSize: PxSize,
trackColor: Color
@@ -129,7 +128,7 @@
)
}
-private fun DensityScope.drawThumb(
+private fun Density.drawThumb(
canvas: Canvas,
parentSize: PxSize,
position: Float,
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 2881981..5d716c7 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
@@ -27,6 +27,7 @@
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
@@ -37,7 +38,6 @@
import androidx.ui.core.Placeable
import androidx.ui.core.Text
import androidx.ui.core.WithConstraints
-import androidx.ui.core.ambientDensity
import androidx.ui.core.tag
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.HorizontalScroller
@@ -66,7 +66,6 @@
import androidx.ui.unit.max
import androidx.ui.unit.sp
import androidx.ui.unit.toPx
-import androidx.ui.unit.withDensity
/**
* A TabRow contains a row of [Tab]s, and displays an indicator underneath the currently
@@ -207,7 +206,7 @@
tabs: @Composable() () -> Unit,
indicatorContainer: @Composable() (tabPositions: List<TabPosition>) -> Unit
) {
- val edgeOffset = withDensity(ambientDensity()) { ScrollableTabRowEdgeOffset.toIntPx() }
+ val edgeOffset = with(DensityAmbient.current) { ScrollableTabRowEdgeOffset.toIntPx() }
// TODO: unfortunate 1f lag as we need to first calculate tab positions before drawing the
// indicator container
@@ -384,13 +383,13 @@
) {
// TODO: should we animate the width of the indicator as it moves between tabs of different
// sizes inside a scrollable tab row?
- val currentTabWidth = withDensity(ambientDensity()) {
+ val currentTabWidth = with(DensityAmbient.current) {
tabPositions[selectedIndex].width.toDp()
}
Container(expanded = true, alignment = Alignment.BottomLeft) {
IndicatorTransition(tabPositions, selectedIndex) { indicatorOffset ->
- Padding(left = withDensity(ambientDensity()) { indicatorOffset.toDp() }) {
+ Padding(left = with(DensityAmbient.current) { indicatorOffset.toDp() }) {
Container(width = currentTabWidth, children = indicator)
}
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt
index 4ddbe7f..3318091 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt
@@ -31,7 +31,6 @@
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.Dp
import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
@@ -45,12 +44,11 @@
import androidx.ui.unit.toOffset
import androidx.ui.unit.toPxSize
import androidx.ui.unit.toRect
-import androidx.ui.unit.withDensity
internal fun getRippleStartRadius(size: PxSize) =
max(size.width, size.height) * 0.3f
-internal fun DensityScope.getRippleTargetRadius(size: PxSize) =
+internal fun Density.getRippleTargetRadius(size: PxSize) =
PxPosition(size.width, size.height).getDistance() / 2f + 10.dp.toPx()
/**
@@ -117,7 +115,7 @@
init {
val surfaceSize = coordinates.size.toPxSize()
val startRadius = getRippleStartRadius(surfaceSize)
- val targetRadius = withDensity(density) {
+ val targetRadius = with(density) {
radius?.toPx() ?: getRippleTargetRadius(surfaceSize)
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
index 56a92f2..a07d35c 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
@@ -21,10 +21,10 @@
import androidx.compose.onDispose
import androidx.compose.remember
import androidx.ui.animation.transitionsEnabled
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.OnChildPositioned
-import androidx.ui.core.ambientDensity
import androidx.ui.core.gesture.PressIndicatorGestureDetector
import androidx.ui.graphics.Color
import androidx.ui.unit.Density
@@ -58,7 +58,7 @@
enabled: Boolean = true,
children: @Composable() () -> Unit
) {
- val density = ambientDensity()
+ val density = DensityAmbient.current
val state = remember { RippleState() }
val theme = RippleThemeAmbient.current
diff --git a/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt b/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt
index f78d000..280d6e4 100644
--- a/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt
+++ b/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt
@@ -19,7 +19,6 @@
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
@@ -45,11 +44,11 @@
val height = 160f
val size = PxSize(width.px, height.px)
val density = Density(2f)
- val expectedRadius = withDensity(density) {
+ val expectedRadius = with(density) {
// 10 is an extra offset from spec
halfDistance(width, height) + 10.dp.toPx().value
}
- val result = withDensity(density) { getRippleTargetRadius(size) }
+ val result = with(density) { getRippleTargetRadius(size) }
assertThat(result).isEqualTo(expectedRadius.px)
}
diff --git a/ui/ui-platform/api/0.1.0-dev05.txt b/ui/ui-platform/api/0.1.0-dev05.txt
index 47704ba..f30ca00 100644
--- a/ui/ui-platform/api/0.1.0-dev05.txt
+++ b/ui/ui-platform/api/0.1.0-dev05.txt
@@ -11,7 +11,7 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.unit.DensityScope androidx.ui.core.SemanticsTreeProvider {
+ public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
ctor public AndroidComposeView(android.content.Context context);
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public androidx.ui.unit.IntPxPosition calculatePosition();
@@ -138,14 +138,14 @@
public final class DrawNode extends androidx.ui.core.ComponentNode {
ctor public DrawNode();
method public boolean getNeedsPaint();
- method public kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
+ method public kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
method public kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaintWithChildren();
method public void invalidate();
method public void setNeedsPaint(boolean p);
- method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
+ method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
method public void setOnPaintWithChildren(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
property public final boolean needsPaint;
- property public final kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
+ property public final kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
property public final kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaintWithChildren;
}
@@ -237,19 +237,19 @@
}
public static interface LayoutNode.MeasureBlocks {
- method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
method public androidx.ui.core.MeasureScope.LayoutResult measure(androidx.ui.core.MeasureScope measureScope, java.util.List<? extends androidx.ui.core.Measurable> measurables, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public abstract static class LayoutNode.NoIntrinsicsMeasureBlocks implements androidx.ui.core.LayoutNode.MeasureBlocks {
ctor public LayoutNode.NoIntrinsicsMeasureBlocks(String error);
- method public Void maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
- method public Void minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public final class LayoutNodeWrapperKt {
diff --git a/ui/ui-platform/api/current.txt b/ui/ui-platform/api/current.txt
index 47704ba..f30ca00 100644
--- a/ui/ui-platform/api/current.txt
+++ b/ui/ui-platform/api/current.txt
@@ -11,7 +11,7 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.unit.DensityScope androidx.ui.core.SemanticsTreeProvider {
+ public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
ctor public AndroidComposeView(android.content.Context context);
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public androidx.ui.unit.IntPxPosition calculatePosition();
@@ -138,14 +138,14 @@
public final class DrawNode extends androidx.ui.core.ComponentNode {
ctor public DrawNode();
method public boolean getNeedsPaint();
- method public kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
+ method public kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
method public kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaintWithChildren();
method public void invalidate();
method public void setNeedsPaint(boolean p);
- method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
+ method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
method public void setOnPaintWithChildren(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
property public final boolean needsPaint;
- property public final kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
+ property public final kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
property public final kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaintWithChildren;
}
@@ -237,19 +237,19 @@
}
public static interface LayoutNode.MeasureBlocks {
- method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
method public androidx.ui.core.MeasureScope.LayoutResult measure(androidx.ui.core.MeasureScope measureScope, java.util.List<? extends androidx.ui.core.Measurable> measurables, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public abstract static class LayoutNode.NoIntrinsicsMeasureBlocks implements androidx.ui.core.LayoutNode.MeasureBlocks {
ctor public LayoutNode.NoIntrinsicsMeasureBlocks(String error);
- method public Void maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
- method public Void minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public final class LayoutNodeWrapperKt {
diff --git a/ui/ui-platform/api/public_plus_experimental_0.1.0-dev05.txt b/ui/ui-platform/api/public_plus_experimental_0.1.0-dev05.txt
index c151984..aa6a737 100644
--- a/ui/ui-platform/api/public_plus_experimental_0.1.0-dev05.txt
+++ b/ui/ui-platform/api/public_plus_experimental_0.1.0-dev05.txt
@@ -11,7 +11,7 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.unit.DensityScope androidx.ui.core.SemanticsTreeProvider {
+ public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
ctor public AndroidComposeView(android.content.Context context);
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public androidx.ui.unit.IntPxPosition calculatePosition();
@@ -140,14 +140,14 @@
public final class DrawNode extends androidx.ui.core.ComponentNode {
ctor public DrawNode();
method public boolean getNeedsPaint();
- method public kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
+ method public kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
method public kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaintWithChildren();
method public void invalidate();
method public void setNeedsPaint(boolean p);
- method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
+ method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
method public void setOnPaintWithChildren(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
property public final boolean needsPaint;
- property public final kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
+ property public final kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
property public final kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaintWithChildren;
}
@@ -239,19 +239,19 @@
}
public static interface LayoutNode.MeasureBlocks {
- method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
method public androidx.ui.core.MeasureScope.LayoutResult measure(androidx.ui.core.MeasureScope measureScope, java.util.List<? extends androidx.ui.core.Measurable> measurables, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public abstract static class LayoutNode.NoIntrinsicsMeasureBlocks implements androidx.ui.core.LayoutNode.MeasureBlocks {
ctor public LayoutNode.NoIntrinsicsMeasureBlocks(String error);
- method public Void maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
- method public Void minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public final class LayoutNodeWrapperKt {
diff --git a/ui/ui-platform/api/public_plus_experimental_current.txt b/ui/ui-platform/api/public_plus_experimental_current.txt
index c151984..aa6a737 100644
--- a/ui/ui-platform/api/public_plus_experimental_current.txt
+++ b/ui/ui-platform/api/public_plus_experimental_current.txt
@@ -11,7 +11,7 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.unit.DensityScope androidx.ui.core.SemanticsTreeProvider {
+ public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
ctor public AndroidComposeView(android.content.Context context);
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public androidx.ui.unit.IntPxPosition calculatePosition();
@@ -140,14 +140,14 @@
public final class DrawNode extends androidx.ui.core.ComponentNode {
ctor public DrawNode();
method public boolean getNeedsPaint();
- method public kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
+ method public kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
method public kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaintWithChildren();
method public void invalidate();
method public void setNeedsPaint(boolean p);
- method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
+ method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
method public void setOnPaintWithChildren(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
property public final boolean needsPaint;
- property public final kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
+ property public final kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
property public final kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaintWithChildren;
}
@@ -239,19 +239,19 @@
}
public static interface LayoutNode.MeasureBlocks {
- method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
method public androidx.ui.core.MeasureScope.LayoutResult measure(androidx.ui.core.MeasureScope measureScope, java.util.List<? extends androidx.ui.core.Measurable> measurables, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public abstract static class LayoutNode.NoIntrinsicsMeasureBlocks implements androidx.ui.core.LayoutNode.MeasureBlocks {
ctor public LayoutNode.NoIntrinsicsMeasureBlocks(String error);
- method public Void maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
- method public Void minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public final class LayoutNodeWrapperKt {
diff --git a/ui/ui-platform/api/restricted_0.1.0-dev05.txt b/ui/ui-platform/api/restricted_0.1.0-dev05.txt
index fadb481..b7d7c3c 100644
--- a/ui/ui-platform/api/restricted_0.1.0-dev05.txt
+++ b/ui/ui-platform/api/restricted_0.1.0-dev05.txt
@@ -11,7 +11,7 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.unit.DensityScope androidx.ui.core.SemanticsTreeProvider {
+ public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
ctor public AndroidComposeView(android.content.Context context);
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public androidx.ui.unit.IntPxPosition calculatePosition();
@@ -140,14 +140,14 @@
public final class DrawNode extends androidx.ui.core.ComponentNode {
ctor public DrawNode();
method public boolean getNeedsPaint();
- method public kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
+ method public kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
method public kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaintWithChildren();
method public void invalidate();
method public void setNeedsPaint(boolean p);
- method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
+ method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
method public void setOnPaintWithChildren(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
property public final boolean needsPaint;
- property public final kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
+ property public final kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
property public final kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaintWithChildren;
}
@@ -239,19 +239,19 @@
}
public static interface LayoutNode.MeasureBlocks {
- method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
method public androidx.ui.core.MeasureScope.LayoutResult measure(androidx.ui.core.MeasureScope measureScope, java.util.List<? extends androidx.ui.core.Measurable> measurables, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public abstract static class LayoutNode.NoIntrinsicsMeasureBlocks implements androidx.ui.core.LayoutNode.MeasureBlocks {
ctor public LayoutNode.NoIntrinsicsMeasureBlocks(String error);
- method public Void maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
- method public Void minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public final class LayoutNodeWrapperKt {
diff --git a/ui/ui-platform/api/restricted_current.txt b/ui/ui-platform/api/restricted_current.txt
index fadb481..b7d7c3c 100644
--- a/ui/ui-platform/api/restricted_current.txt
+++ b/ui/ui-platform/api/restricted_current.txt
@@ -11,7 +11,7 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.unit.DensityScope androidx.ui.core.SemanticsTreeProvider {
+ public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
ctor public AndroidComposeView(android.content.Context context);
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public androidx.ui.unit.IntPxPosition calculatePosition();
@@ -140,14 +140,14 @@
public final class DrawNode extends androidx.ui.core.ComponentNode {
ctor public DrawNode();
method public boolean getNeedsPaint();
- method public kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
+ method public kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaint();
method public kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? getOnPaintWithChildren();
method public void invalidate();
method public void setNeedsPaint(boolean p);
- method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.DensityScope,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
+ method public void setOnPaint(kotlin.jvm.functions.Function3<? super androidx.ui.unit.Density,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
method public void setOnPaintWithChildren(kotlin.jvm.functions.Function3<? super androidx.ui.core.DrawReceiver,? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.PxSize,kotlin.Unit>? value);
property public final boolean needsPaint;
- property public final kotlin.jvm.functions.Function3<androidx.ui.unit.DensityScope,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
+ property public final kotlin.jvm.functions.Function3<androidx.ui.unit.Density,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaint;
property public final kotlin.jvm.functions.Function3<androidx.ui.core.DrawReceiver,androidx.ui.graphics.Canvas,androidx.ui.unit.PxSize,kotlin.Unit>? onPaintWithChildren;
}
@@ -239,19 +239,19 @@
}
public static interface LayoutNode.MeasureBlocks {
- method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
method public androidx.ui.core.MeasureScope.LayoutResult measure(androidx.ui.core.MeasureScope measureScope, java.util.List<? extends androidx.ui.core.Measurable> measurables, androidx.ui.core.Constraints constraints);
- method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public androidx.ui.unit.IntPx minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public androidx.ui.unit.IntPx minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public abstract static class LayoutNode.NoIntrinsicsMeasureBlocks implements androidx.ui.core.LayoutNode.MeasureBlocks {
ctor public LayoutNode.NoIntrinsicsMeasureBlocks(String error);
- method public Void maxIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void maxIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
- method public Void minIntrinsicHeight(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
- method public Void minIntrinsicWidth(androidx.ui.unit.DensityScope densityScope, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void maxIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void maxIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
+ method public Void minIntrinsicHeight(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx w);
+ method public Void minIntrinsicWidth(androidx.ui.unit.Density density, java.util.List<? extends androidx.ui.core.IntrinsicMeasurable> measurables, androidx.ui.unit.IntPx h);
}
public final class LayoutNodeWrapperKt {
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 8f432d1..79ac566 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
@@ -59,7 +59,6 @@
import androidx.ui.input.TextInputServiceAndroid
import androidx.ui.text.font.Font
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.PxSize
@@ -67,7 +66,6 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.max
import androidx.ui.unit.px
-import androidx.ui.unit.withDensity
import org.jetbrains.annotations.TestOnly
import java.lang.reflect.Method
@@ -76,8 +74,9 @@
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
class AndroidComposeView constructor(context: Context) :
- ViewGroup(context), AndroidOwner, SemanticsTreeProvider, DensityScope {
- override var density: Density = Density(context)
+ ViewGroup(context), AndroidOwner, SemanticsTreeProvider {
+
+ override var density = Density(context)
private set
val root = LayoutNode().also {
@@ -563,7 +562,7 @@
receiver.childDrawn = false
receiver.canvas = canvas
receiver.parentSize = parentSize
- receiver.density = density
+ receiver.currentDensity = density
}
onPaintWithChildren(receiver, canvas, parentSize)
if (!receiver.childDrawn) {
@@ -571,7 +570,7 @@
}
} else {
val >
- this.onPaint(canvas, parentSize)
+ density.onPaint(canvas, parentSize)
}
node.needsPaint = false
}
@@ -738,10 +737,13 @@
private val drawNode: DrawNode,
var canvas: Canvas,
var parentSize: PxSize,
- override var density: Density
- ) : DensityScope, DrawReceiver {
+ var currentDensity: Density
+ ) : DrawReceiver {
internal var childDrawn = false
+ override val density: Float get() = currentDensity.density
+ override val fontScale: Float get() = currentDensity.fontScale
+
override fun drawChildren() {
if (childDrawn) {
throw IllegalStateException("Cannot call drawChildren() twice within Draw element")
@@ -907,25 +909,25 @@
}
override fun minIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
) = error("Undefined intrinsics block and it is required")
override fun minIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
) = error("Undefined intrinsics block and it is required")
override fun maxIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
) = error("Undefined intrinsics block and it is required")
override fun maxIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
) = error("Undefined intrinsics block and it is required")
@@ -1136,7 +1138,7 @@
dirty = true
}
alpha = repaintBoundaryNode.opacity
- elevation = withDensity(density) { repaintBoundaryNode.elevation.toPx().value }
+ elevation = with(density) { repaintBoundaryNode.elevation.toPx().value }
}
override fun updateDisplayList() {
@@ -1228,7 +1230,7 @@
dirty = true
}
renderNode.alpha = repaintBoundaryNode.opacity
- renderNode.elevation = withDensity(density) { repaintBoundaryNode.elevation.toPx().value }
+ renderNode.elevation = with(density) { repaintBoundaryNode.elevation.toPx().value }
ownerView.invalidate()
}
}
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 043454e..ef0df6f 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
@@ -31,7 +31,6 @@
import androidx.ui.graphics.Canvas
import androidx.ui.graphics.Shape
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
@@ -774,7 +773,7 @@
invalidate()
}
- var onPaint: (DensityScope.(canvas: Canvas, parentSize: PxSize) -> Unit)? = null
+ var onPaint: (Density.(canvas: Canvas, parentSize: PxSize) -> Unit)? = null
set(value) {
field = value
invalidate()
@@ -824,7 +823,7 @@
* The function used to calculate [IntrinsicMeasurable.minIntrinsicWidth].
*/
fun minIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
): IntPx
@@ -833,7 +832,7 @@
* The lambda used to calculate [IntrinsicMeasurable.minIntrinsicHeight].
*/
fun minIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
): IntPx
@@ -842,7 +841,7 @@
* The function used to calculate [IntrinsicMeasurable.maxIntrinsicWidth].
*/
fun maxIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
): IntPx
@@ -851,7 +850,7 @@
* The lambda used to calculate [IntrinsicMeasurable.maxIntrinsicHeight].
*/
fun maxIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
): IntPx
@@ -859,25 +858,25 @@
abstract class NoIntrinsicsMeasureBlocks(private val error: String) : MeasureBlocks {
override fun minIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
) = error(error)
override fun minIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
) = error(error)
override fun maxIntrinsicWidth(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
h: IntPx
) = error(error)
override fun maxIntrinsicHeight(
- densityScope: DensityScope,
+ density: Density,
measurables: List<IntrinsicMeasurable>,
w: IntPx
) = error(error)
@@ -902,9 +901,13 @@
/**
* The scope used to run the [MeasureBlocks.measure] [MeasureBlock].
*/
- val measureScope: MeasureScope = object : InnerMeasureScope() {
- override val density: Density
+ val measureScope: MeasureScope = object : InnerMeasureScope(), Density {
+ private val ownerDensity: Density
get() = owner?.density ?: Density(1f)
+ override val density: Float
+ get() = ownerDensity.density
+ override val fontScale: Float
+ get() = ownerDensity.fontScale
override val layoutNode: LayoutNode = this@LayoutNode
}
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 cd63d39..460eb03 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
@@ -24,7 +24,6 @@
import androidx.ui.graphics.Paint
import androidx.ui.graphics.PaintingStyle
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
@@ -223,7 +222,7 @@
internal class InnerPlaceable(
layoutNode: LayoutNode
-) : LayoutNodeWrapper(layoutNode), DensityScope {
+) : LayoutNodeWrapper(layoutNode), Density by layoutNode.measureScope {
override val providedAlignmentLines: Set<AlignmentLine>
get() = layoutNode.providedAlignmentLines.keys
override val isAttached: Boolean
@@ -280,8 +279,6 @@
layoutNode.layout()
}
- override val density: Density get() = layoutNode.measureScope.density
-
override fun layoutSize(innermostSize: IntPxSize): IntPxSize {
size = innermostSize
return innermostSize
diff --git a/ui/ui-test/api/0.1.0-dev05.txt b/ui/ui-test/api/0.1.0-dev05.txt
index afc645d..1e00bce 100644
--- a/ui/ui-test/api/0.1.0-dev05.txt
+++ b/ui/ui-test/api/0.1.0-dev05.txt
@@ -37,11 +37,11 @@
public final class CollectedSizes {
ctor public CollectedSizes(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(androidx.ui.unit.Dp expectedHeight);
- method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedHeightPx);
+ method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedHeightPx);
method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(androidx.ui.unit.Dp expectedSize);
- method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedSquarePx);
+ method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedSquarePx);
method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(androidx.ui.unit.Dp expectedWidth);
- method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedWidthPx);
+ method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedWidthPx);
}
public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
diff --git a/ui/ui-test/api/current.txt b/ui/ui-test/api/current.txt
index afc645d..1e00bce 100644
--- a/ui/ui-test/api/current.txt
+++ b/ui/ui-test/api/current.txt
@@ -37,11 +37,11 @@
public final class CollectedSizes {
ctor public CollectedSizes(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(androidx.ui.unit.Dp expectedHeight);
- method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedHeightPx);
+ method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedHeightPx);
method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(androidx.ui.unit.Dp expectedSize);
- method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedSquarePx);
+ method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedSquarePx);
method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(androidx.ui.unit.Dp expectedWidth);
- method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedWidthPx);
+ method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedWidthPx);
}
public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
diff --git a/ui/ui-test/api/public_plus_experimental_0.1.0-dev05.txt b/ui/ui-test/api/public_plus_experimental_0.1.0-dev05.txt
index afc645d..1e00bce 100644
--- a/ui/ui-test/api/public_plus_experimental_0.1.0-dev05.txt
+++ b/ui/ui-test/api/public_plus_experimental_0.1.0-dev05.txt
@@ -37,11 +37,11 @@
public final class CollectedSizes {
ctor public CollectedSizes(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(androidx.ui.unit.Dp expectedHeight);
- method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedHeightPx);
+ method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedHeightPx);
method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(androidx.ui.unit.Dp expectedSize);
- method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedSquarePx);
+ method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedSquarePx);
method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(androidx.ui.unit.Dp expectedWidth);
- method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedWidthPx);
+ method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedWidthPx);
}
public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
diff --git a/ui/ui-test/api/public_plus_experimental_current.txt b/ui/ui-test/api/public_plus_experimental_current.txt
index afc645d..1e00bce 100644
--- a/ui/ui-test/api/public_plus_experimental_current.txt
+++ b/ui/ui-test/api/public_plus_experimental_current.txt
@@ -37,11 +37,11 @@
public final class CollectedSizes {
ctor public CollectedSizes(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(androidx.ui.unit.Dp expectedHeight);
- method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedHeightPx);
+ method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedHeightPx);
method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(androidx.ui.unit.Dp expectedSize);
- method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedSquarePx);
+ method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedSquarePx);
method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(androidx.ui.unit.Dp expectedWidth);
- method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedWidthPx);
+ method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedWidthPx);
}
public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
diff --git a/ui/ui-test/api/restricted_0.1.0-dev05.txt b/ui/ui-test/api/restricted_0.1.0-dev05.txt
index afc645d..1e00bce 100644
--- a/ui/ui-test/api/restricted_0.1.0-dev05.txt
+++ b/ui/ui-test/api/restricted_0.1.0-dev05.txt
@@ -37,11 +37,11 @@
public final class CollectedSizes {
ctor public CollectedSizes(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(androidx.ui.unit.Dp expectedHeight);
- method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedHeightPx);
+ method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedHeightPx);
method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(androidx.ui.unit.Dp expectedSize);
- method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedSquarePx);
+ method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedSquarePx);
method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(androidx.ui.unit.Dp expectedWidth);
- method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedWidthPx);
+ method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedWidthPx);
}
public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
diff --git a/ui/ui-test/api/restricted_current.txt b/ui/ui-test/api/restricted_current.txt
index afc645d..1e00bce 100644
--- a/ui/ui-test/api/restricted_current.txt
+++ b/ui/ui-test/api/restricted_current.txt
@@ -37,11 +37,11 @@
public final class CollectedSizes {
ctor public CollectedSizes(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(androidx.ui.unit.Dp expectedHeight);
- method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedHeightPx);
+ method public androidx.ui.test.CollectedSizes assertHeightEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedHeightPx);
method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(androidx.ui.unit.Dp expectedSize);
- method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedSquarePx);
+ method public androidx.ui.test.CollectedSizes assertIsSquareWithSize(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedSquarePx);
method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(androidx.ui.unit.Dp expectedWidth);
- method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,androidx.ui.unit.IntPx> expectedWidthPx);
+ method public androidx.ui.test.CollectedSizes assertWidthEqualsTo(kotlin.jvm.functions.Function1<? super androidx.ui.unit.Density,androidx.ui.unit.IntPx> expectedWidthPx);
}
public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/BitmapCapturingTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/BitmapCapturingTest.kt
index f236098..50cd2338 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/BitmapCapturingTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/BitmapCapturingTest.kt
@@ -24,7 +24,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.core.TestTag
import androidx.ui.unit.ipx
-import androidx.ui.unit.withDensity
import androidx.ui.foundation.ColoredRect
import androidx.ui.foundation.shape.DrawShape
import androidx.ui.foundation.shape.RectangleShape
@@ -155,7 +154,7 @@
}
private fun composeCheckerboard() {
- withDensity(composeTestRule.density) {
+ with(composeTestRule.density) {
composeTestRule.setContent {
Container(alignment = Alignment.TopLeft) {
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 7e1892d..f2d03fe 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
@@ -18,9 +18,9 @@
import androidx.test.filters.MediumTest
import androidx.ui.core.LayoutCoordinates
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.OnChildPositioned
import androidx.ui.core.OnPositioned
-import androidx.ui.core.WithDensity
import androidx.ui.layout.Column
import androidx.ui.layout.Container
import androidx.ui.layout.LayoutGravity
@@ -76,7 +76,7 @@
var parentCoordinates: LayoutCoordinates? = null
var childCoordinates: LayoutCoordinates? = null
composeTestRule.setContent {
- WithDensity {
+ with(DensityAmbient.current) {
Container(LayoutWidth(40.ipx.toDp())) {
Column(LayoutWidth(20.ipx.toDp())) {
OnPositioned { coordinates ->
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 30bafda..d76786e 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
@@ -24,10 +24,10 @@
import androidx.compose.Compose
import androidx.test.filters.MediumTest
import androidx.ui.core.AndroidComposeView
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.PointerEventPass
import androidx.ui.core.PointerInput
import androidx.ui.core.TestTag
-import androidx.ui.core.WithDensity
import androidx.ui.core.changedToUp
import androidx.ui.core.setContent
import androidx.ui.foundation.shape.DrawShape
@@ -104,7 +104,7 @@
@Composable
private fun Ui(recordedClicks: MutableList<ClickData>) {
- WithDensity {
+ with(DensityAmbient.current) {
Column {
for (i in first..last) {
TestTag(tag = "$tag$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 68adf03..847a76d 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
@@ -19,10 +19,10 @@
import androidx.compose.Composable
import androidx.test.filters.MediumTest
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.PointerInputHandler
import androidx.ui.core.PointerInput
import androidx.ui.core.TestTag
-import androidx.ui.core.WithDensity
import androidx.ui.core.gesture.DoubleTapGestureDetector
import androidx.ui.foundation.shape.DrawShape
import androidx.ui.foundation.shape.RectangleShape
@@ -57,7 +57,7 @@
Semantics(container = true) {
DoubleTapGestureDetector( {
PointerInput(pointerInputHandler = onPointerInput, cancelHandler = {}) {
- WithDensity {
+ with(DensityAmbient.current) {
Container(width = width.toDp(), height = height.toDp()) {
DrawShape(RectangleShape, 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 7257caa..f9c557c 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
@@ -19,9 +19,9 @@
import androidx.compose.Composable
import androidx.test.filters.MediumTest
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.PointerInput
import androidx.ui.core.TestTag
-import androidx.ui.core.WithDensity
import androidx.ui.core.gesture.LongPressGestureDetector
import androidx.ui.core.gesture.LongPressTimeout
import androidx.ui.foundation.shape.DrawShape
@@ -60,7 +60,7 @@
pointerInputHandler = recorder::onPointerInput,
cancelHandler = {}
) {
- WithDensity {
+ with(DensityAmbient.current) {
Container(width = width.toDp(), height = height.toDp()) {
DrawShape(RectangleShape, Color.Yellow)
}
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 85500e9..83e8cdb 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
@@ -20,9 +20,9 @@
import androidx.compose.remember
import androidx.test.filters.MediumTest
import androidx.ui.core.Alignment
+import androidx.ui.core.DensityAmbient
import androidx.ui.core.Draw
import androidx.ui.core.PointerInput
-import androidx.ui.core.WithDensity
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.graphics.Paint
@@ -155,7 +155,7 @@
pointerInputHandler = recorder::onPointerInput,
cancelHandler = {}
) {
- WithDensity {
+ with(DensityAmbient.current) {
Container(width = 500.px.toDp(), height = 500.px.toDp()) {
Draw { canvas, size ->
bounds = Rect(0f, 0f, size.width.value, size.height.value)
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 a3be2c7..197af1e 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
@@ -18,13 +18,11 @@
import androidx.compose.Composable
import androidx.ui.unit.Density
-import androidx.ui.unit.DensityScope
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.unit.withDensity
import androidx.ui.layout.DpConstraints
import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Stack
@@ -86,7 +84,7 @@
/**
* Small utility class to provide convenient assertion for width and height for some [PxSize].
- * It also provides [DensityScope] while asserting.
+ * It also provides [Density] while asserting.
*
* @see ComposeTestRule.setContentAndCollectSizes
*/
@@ -99,24 +97,24 @@
fun assertIsSquareWithSize(expectedSize: Dp) = assertIsSquareWithSize { expectedSize.toIntPx() }
- fun assertWidthEqualsTo(expectedWidthPx: DensityScope.() -> IntPx): CollectedSizes {
- val widthPx = withDensity(density) {
+ fun assertWidthEqualsTo(expectedWidthPx: Density.() -> IntPx): CollectedSizes {
+ val widthPx = with(density) {
expectedWidthPx()
}
assertSize(size.width.round(), widthPx)
return this
}
- fun assertHeightEqualsTo(expectedHeightPx: DensityScope.() -> IntPx): CollectedSizes {
- val heightPx = withDensity(density) {
+ fun assertHeightEqualsTo(expectedHeightPx: Density.() -> IntPx): CollectedSizes {
+ val heightPx = with(density) {
expectedHeightPx()
}
assertSize(size.height.round(), heightPx)
return this
}
- fun assertIsSquareWithSize(expectedSquarePx: DensityScope.() -> IntPx): CollectedSizes {
- val squarePx = withDensity(density) {
+ fun assertIsSquareWithSize(expectedSquarePx: Density.() -> IntPx): CollectedSizes {
+ val squarePx = with(density) {
expectedSquarePx()
}
assertSize(size.width.round(), squarePx)
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
index ef1e4c6..a21ee43 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
@@ -33,7 +33,6 @@
import androidx.ui.unit.TextUnit
import androidx.ui.unit.px
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
import org.junit.Test
@@ -78,7 +77,7 @@
@Test
fun didExceedMaxLines_withLineWrap() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 50.sp
// Each line has the space only for 1 character
val width = fontSize.toPx().value
@@ -137,7 +136,7 @@
@Test
fun getPathForRange() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("ab", "c", "de")
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -200,7 +199,7 @@
@Test
fun getOffsetForPosition() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val lineLength = 2
val text = createAnnotatedString(List(3) { "a".repeat(lineLength) })
@@ -233,7 +232,7 @@
@Test
fun getBoundingBox() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val lineLength = 2
val text = createAnnotatedString(List(3) { "a".repeat(lineLength) })
@@ -283,7 +282,7 @@
@Test
fun getHorizontalPosition() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val paragraphCount = 3
val lineLength = 2
val text = createAnnotatedString(List(paragraphCount) { "a".repeat(lineLength) })
@@ -417,7 +416,7 @@
@Test
fun getBidiRunDirection() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("a\u05D0", "\u05D0a")
val paragraph = simpleMultiParagraph(text = text)
@@ -502,7 +501,7 @@
@Test
fun getCursorRect() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val paragraphCount = 3
val lineLength = 2
// A text with 3 lines and each line has 2 characters.
@@ -598,7 +597,7 @@
@Test
fun getLineLeft() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("aa", "\u05D0\u05D0")
val fontSize = 50.sp
@@ -635,7 +634,7 @@
@Test
fun getLineRight() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("aa", "\u05D0\u05D0")
val fontSize = 50.sp
@@ -672,7 +671,7 @@
@Test
fun getLineBottom() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("a", "a", "a")
val fontSize = 50.sp
@@ -709,7 +708,7 @@
@Test
fun getLineHeight() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("a", "a", "a")
val fontSize = 50.sp
@@ -801,7 +800,7 @@
@Test
fun textAlign_center_textIsCentered() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "aa"
val textRtl = "\u05D0\u05D0"
val text = createAnnotatedString(textLtr, textRtl)
@@ -857,7 +856,7 @@
@Test
@SdkSuppress(maxSdkVersion = 27, minSdkVersion = 26)
fun textAlign_justify_justifies_underApi28() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "a a a"
val textRtl = "\u05D0 \u05D0 \u05D0"
val text = createAnnotatedString(textLtr, textRtl)
@@ -933,7 +932,7 @@
@Test
fun textDirectionAlgorithm_defaultValue() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "a ."
val textRtl = "\u05D0 ."
val textNeutral = " ."
@@ -964,7 +963,7 @@
@Test
fun textDirectionAlgorithm_contentOrLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "a ."
val textRtl = "\u05D0 ."
val textNeutral = " ."
@@ -996,7 +995,7 @@
@Test
fun textDirectionAlgorithm_contentOrRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "a ."
val textRtl = "\u05D0 ."
val textNeutral = " ."
@@ -1028,7 +1027,7 @@
@Test
fun textDirectionAlgorithm_forceLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "a ."
val textRtl = "\u05D0 ."
val textNeutral = " ."
@@ -1060,7 +1059,7 @@
@Test
fun textDirectionAlgorithm_forceRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLtr = "a ."
val textRtl = "\u05D0 ."
val textNeutral = " ."
@@ -1092,7 +1091,7 @@
@Test
fun lineHeight_returnsSameAsGiven() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("a\na\na", "a\na\na")
// Need to specify font size in case the asserted line height happens to be the default
// line height corresponding to the font size.
@@ -1116,7 +1115,7 @@
@Test
fun textIndent_onFirstLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("aaa", "\u05D0\u05D0\u05D0")
val indent = 20.sp
val indentInPx = indent.toPx().value
@@ -1146,7 +1145,7 @@
@Test
fun textIndent_onRestLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = createAnnotatedString("aaa", "\u05D0\u05D0\u05D0")
val indent = 20.sp
val indentInPx = indent.toPx().value
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
index ca8fb29..3b8e744 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
@@ -44,7 +44,6 @@
import androidx.ui.unit.em
import androidx.ui.unit.px
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
import org.junit.Test
@@ -69,7 +68,7 @@
@Test
fun empty_string() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
val text = ""
@@ -92,7 +91,7 @@
@Test
fun single_line_default_values() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -119,7 +118,7 @@
@Test
fun line_break_default_values() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -152,7 +151,7 @@
@Test
fun newline_default_values() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -183,7 +182,7 @@
@Test
fun newline_and_line_break_default_values() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -215,7 +214,7 @@
@Test
fun getOffsetForPosition_ltr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -237,7 +236,7 @@
@Test
fun getOffsetForPosition_rtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -259,7 +258,7 @@
@Test
fun getOffsetForPosition_ltr_multiline() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val firstLine = "abc"
val secondLine = "def"
val text = firstLine + secondLine
@@ -285,7 +284,7 @@
@Test
fun getOffsetForPosition_rtl_multiline() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val firstLine = "\u05D0\u05D1\u05D2"
val secondLine = "\u05D3\u05D4\u05D5"
val text = firstLine + secondLine
@@ -311,7 +310,7 @@
@Test
fun getOffsetForPosition_ltr_width_outOfBounds() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -335,7 +334,7 @@
@Test
fun getOffsetForPosition_ltr_height_outOfBounds() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -359,7 +358,7 @@
@Test
fun getBoundingBox_ltr_singleLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -382,7 +381,7 @@
@Test
fun getBoundingBox_ltr_multiLines() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val firstLine = "abc"
val secondLine = "def"
val text = firstLine + secondLine
@@ -409,7 +408,7 @@
@Test
fun getBoundingBox_ltr_textPosition_negative() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -431,7 +430,7 @@
@Test(expected = java.lang.IndexOutOfBoundsException::class)
@SdkSuppress(minSdkVersion = 26)
fun getBoundingBox_ltr_textPosition_larger_than_length_throw_exception() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -448,7 +447,7 @@
@Test(expected = java.lang.AssertionError::class)
fun getCursorRect_larger_than_length_throw_exception() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -464,7 +463,7 @@
@Test(expected = java.lang.AssertionError::class)
fun getCursorRect_negative_throw_exception() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -480,7 +479,7 @@
@Test
fun getCursorRect_ltr_singleLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -507,7 +506,7 @@
@Test
fun getCursorRect_ltr_multiLines() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcdef"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -546,7 +545,7 @@
@Test
fun getCursorRect_ltr_newLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\ndef"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -579,7 +578,7 @@
@Test
fun getCursorRect_ltr_newLine_last_char() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -612,7 +611,7 @@
@Test
fun getCursorRect_rtl_singleLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -638,7 +637,7 @@
@Test
fun getCursorRect_rtl_multiLines() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -677,7 +676,7 @@
@Test
fun getCursorRect_rtl_newLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -712,7 +711,7 @@
@Test
@SdkSuppress(minSdkVersion = 23)
fun getCursorRect_rtl_newLine_last_char() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -746,7 +745,7 @@
@Test
fun getHorizontalPositionForOffset_primary_ltr_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -765,7 +764,7 @@
@Test
fun getHorizontalPositionForOffset_primary_rtl_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -785,7 +784,7 @@
@Test
fun getHorizontalPositionForOffset_primary_Bidi_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -815,7 +814,7 @@
@Test
fun getHorizontalPositionForOffset_primary_ltr_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -842,7 +841,7 @@
@Test
fun getHorizontalPositionForOffset_primary_rtl_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -870,7 +869,7 @@
@Test
fun getHorizontalPositionForOffset_primary_Bidi_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -903,7 +902,7 @@
@Test
fun getHorizontalPositionForOffset_primary_Bidi_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -935,7 +934,7 @@
@Test
fun getHorizontalPositionForOffset_primary_ltr_newLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -954,7 +953,7 @@
// The behavior of getPrimaryHorizontal on API 19 to API 22 was wrong. Suppress this test.
@SdkSuppress(minSdkVersion = 23)
fun getHorizontalPositionForOffset_primary_rtl_newLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -971,7 +970,7 @@
@Test
fun getHorizontalPositionForOffset_primary_ltr_newLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -992,7 +991,7 @@
@Test
fun getHorizontalPositionForOffset_primary_rtl_newLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1012,7 +1011,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_ltr_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1031,7 +1030,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_rtl_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1051,7 +1050,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_Bidi_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1078,7 +1077,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_ltr_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1106,7 +1105,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_rtl_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1133,7 +1132,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_Bidi_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1166,7 +1165,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_Bidi_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1199,7 +1198,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_ltr_newLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1218,7 +1217,7 @@
@SdkSuppress(minSdkVersion = 23)
// The behavior of getSecondaryHorizontal on API 19 to API 22 was wrong. Suppress this test.
fun getHorizontalPositionForOffset_notPrimary_rtl_newLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1235,7 +1234,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_ltr_newLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1256,7 +1255,7 @@
@Test
fun getHorizontalPositionForOffset_notPrimary_rtl_newLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1276,7 +1275,7 @@
@Test
fun getParagraphDirection_ltr_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1295,7 +1294,7 @@
@Test
fun getParagraphDirection_ltr_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1317,7 +1316,7 @@
@Test
fun getParagraphDirection_rtl_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1336,7 +1335,7 @@
@Test
fun getParagraphDirection_rtl_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1358,7 +1357,7 @@
@Test
fun getParagraphDirection_Bidi_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1379,7 +1378,7 @@
@Test
fun getParagraphDirection_Bidi_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1403,7 +1402,7 @@
@Test
fun getParagraphDirection_Bidi_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1427,7 +1426,7 @@
@Test
fun getBidiRunDirection_ltr_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1446,7 +1445,7 @@
@Test
fun getBidiRunDirection_ltr_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1468,7 +1467,7 @@
@Test
fun getBidiRunDirection_rtl_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1487,7 +1486,7 @@
@Test
fun getBidiRunDirection_rtl_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2\n"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1510,7 +1509,7 @@
@Test
fun getBidiRunDirection_Bidi_singleLine_textDirectionDefault() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1535,7 +1534,7 @@
@Test
fun getBidiRunDirection_Bidi_singleLine_textDirectionLtr() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1563,7 +1562,7 @@
@Test
fun getBidiRunDirection_Bidi_singleLine_textDirectionRtl() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val ltrText = "abc"
val rtlText = "\u05D0\u05D1\u05D2"
val text = ltrText + rtlText
@@ -1591,7 +1590,7 @@
@Test
fun locale_withCJK_shouldNotDrawSame() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u82B1"
val fontSize = 10.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1647,7 +1646,7 @@
@Test
fun maxLines_withMaxLineSmallerThanTextLines_clipHeight() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a\na\na"
val fontSize = 100.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1666,7 +1665,7 @@
@Test
fun maxLines_withMaxLineSmallerThanTextLines_haveCorrectBaselines() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a\na\na"
val fontSize = 100.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1688,7 +1687,7 @@
@Test
fun maxLines_withMaxLineEqualsTextLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a\na\na"
val fontSize = 100.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1706,7 +1705,7 @@
@Test
fun maxLines_withMaxLineGreaterThanTextLines() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a\na\na"
val fontSize = 100.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1726,7 +1725,7 @@
@Test
fun maxLines_paintDifferently() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a\na\na"
val fontSize = 100.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1804,7 +1803,7 @@
@Test
fun didExceedMaxLines_withMaxLinesSmallerThanTextLines_withLineWrap_returnsTrue() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "aa"
val fontSize = 50.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1835,7 +1834,7 @@
@Test
fun didExceedMaxLines_withMaxLinesGreaterThanTextLines_withLineWrap_returnsFalse() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "aa"
val maxLines = 3
val fontSize = 50.sp
@@ -1854,7 +1853,7 @@
@Test
fun textAlign_defaultValue_alignsStart() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLTR = "aa"
val textRTL = "\u05D0\u05D0"
val fontSize = 20.sp
@@ -1882,7 +1881,7 @@
@Test
fun textAlign_whenAlignLeft_returnsZeroForGetLineLeft() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val texts = listOf("aa", "\u05D0\u05D0")
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1905,7 +1904,7 @@
@Test
fun textAlign_whenAlignRight_returnsLayoutWidthForGetLineRight() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val texts = listOf("aa", "\u05D0\u05D0")
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1929,7 +1928,7 @@
@Test
fun textAlign_whenAlignCenter_textIsCentered() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val texts = listOf("aa", "\u05D0\u05D0")
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1954,7 +1953,7 @@
@Test
fun textAlign_whenAlignStart_withLTR_returnsZeroForGetLineLeft() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "aa"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1975,7 +1974,7 @@
@Test
fun textAlign_whenAlignEnd_withLTR_returnsLayoutWidthForGetLineRight() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "aa"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -1996,7 +1995,7 @@
@Test
fun textAlign_whenAlignStart_withRTL_returnsLayoutWidthForGetLineRight() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D0"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2017,7 +2016,7 @@
@Test
fun textAlign_whenAlignEnd_withRTL_returnsZeroForGetLineLeft() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D0"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2042,7 +2041,7 @@
// We have to test justification above API 28 because of this bug b/68009059, where devices
// before API 28 may have an extra space at the end of line.
fun textAlign_whenAlignJustify_justifies() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a a a"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2066,7 +2065,7 @@
@Test
fun textDirection_whenLTR_dotIsOnRight() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a.."
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2090,7 +2089,7 @@
@Test
fun textDirection_whenRTL_dotIsOnLeft() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a.."
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2114,7 +2113,7 @@
@Test
fun textDirection_whenDefault_withoutStrongChar_directionIsLTR() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "..."
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2137,7 +2136,7 @@
@Test
fun textDirection_whenDefault_withFirstStrongCharLTR_directionIsLTR() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a\u05D0."
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2160,7 +2159,7 @@
@Test
fun textDirection_whenDefault_withFirstStrongCharRTL_directionIsRTL() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0a."
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2181,7 +2180,7 @@
@Test
fun getLineBottom() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "aaa\nbbb"
val fontSize = 50.sp
@@ -2198,7 +2197,7 @@
@Test
fun lineHeight_inSp() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcdefgh"
val fontSize = 20f
// Make the layout 4 lines
@@ -2227,7 +2226,7 @@
@Test
fun lineHeight_InEm() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcdefgh"
val fontSize = 20f
// Make the layout 4 lines
@@ -2254,7 +2253,7 @@
@Test
fun testAnnotatedString_setFontSizeOnWholeText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2276,7 +2275,7 @@
@Test
fun testAnnotatedString_setFontSizeOnPartOfText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2303,7 +2302,7 @@
@Test
fun testAnnotatedString_seFontSizeTwice_lastOneOverwrite() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2333,7 +2332,7 @@
@Test
fun testAnnotatedString_fontSizeScale() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2353,7 +2352,7 @@
@Test
fun testAnnotatedString_fontSizeScaleNested() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2379,7 +2378,7 @@
@Test
fun testAnnotatedString_fontSizeScaleWithFontSizeFirst() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val paragraphFontSize = 20.sp
@@ -2406,7 +2405,7 @@
@Test
fun testAnnotatedString_fontSizeScaleWithFontSizeSecond() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val paragraphFontSize = 20.sp
@@ -2432,7 +2431,7 @@
@Test
fun testAnnotatedString_fontSizeScaleWithFontSizeNested() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val paragraphFontSize = 20.sp
@@ -2463,7 +2462,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inEm_OnWholeText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2486,7 +2485,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inSp_OnWholeText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2509,7 +2508,7 @@
@Test
fun testAnnotatedString_setLetterSpacingOnPartText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2532,7 +2531,7 @@
@Test
fun testAnnotatedString_setLetterSpacingTwice_lastOneOverwrite() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2562,7 +2561,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inEm_withFontSize() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2594,7 +2593,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inEm_withScaleX() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2625,7 +2624,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inSp_withFontSize() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2658,7 +2657,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inSp_withScaleX() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2690,7 +2689,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inSp_after_inEm() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20f
@@ -2720,7 +2719,7 @@
@Test
fun testAnnotatedString_setLetterSpacing_inEm_after_inSp() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20f
@@ -2749,7 +2748,7 @@
@Test
fun textIndent_inSp_onSingleLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2775,7 +2774,7 @@
@Test
fun textIndent_inSp_onFirstLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcdef"
val fontSize = 20f
val indent = 15f
@@ -2798,7 +2797,7 @@
@Test
fun textIndent_inSp_onRestLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20f
val indent = 20f
@@ -2821,7 +2820,7 @@
@Test
fun textIndent_inEm_onSingleLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 20f
val indent = 1.5f
@@ -2841,7 +2840,7 @@
@Test
fun textIndent_inEm_onFirstLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcdef"
val fontSize = 20f
val indent = 1.5f
@@ -2865,7 +2864,7 @@
@Test
fun textIndent_inEm_onRestLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcdef"
val fontSize = 20f
val indent = 1.5f
@@ -2889,7 +2888,7 @@
}
@Test
fun testAnnotatedString_fontFamily_changesMeasurement() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "ad"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2918,7 +2917,7 @@
@Test
fun testAnnotatedString_fontFeature_turnOffKern() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "AaAa"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2945,7 +2944,7 @@
@Test
fun testAnnotatedString_shadow() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -2978,7 +2977,7 @@
@Test
fun testDefaultSpanStyle_setColor() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
// FontSize doesn't matter here, but it should be big enough for bitmap comparison.
val fontSize = 100.sp
@@ -3007,7 +3006,7 @@
@Test
fun testDefaultSpanStyle_setLetterSpacing() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
// FontSize doesn't matter here, but it should be big enough for bitmap comparison.
val fontSize = 100.sp
@@ -3029,7 +3028,7 @@
@Test
fun testGetPathForRange_singleLine() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3063,7 +3062,7 @@
@Test
fun testGetPathForRange_multiLines() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\nabc"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3107,7 +3106,7 @@
@Test
fun testGetPathForRange_Bidi() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val textLTR = "Hello"
val textRTL = "שלום"
val text = textLTR + textRTL
@@ -3186,7 +3185,7 @@
@Test
fun testGetPathForRange_Surrogate_Pair_Start_Middle_Second_Character_Selected() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\uD834\uDD1E\uD834\uDD1F"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3212,7 +3211,7 @@
@Test
fun testGetPathForRange_Surrogate_Pair_End_Middle_Second_Character_Selected() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\uD834\uDD1E\uD834\uDD1F"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3238,7 +3237,7 @@
@Test
fun testGetPathForRange_Surrogate_Pair_Start_Middle_End_Same_Character_Returns_Line_Segment() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\uD834\uDD1E\uD834\uDD1F"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3264,7 +3263,7 @@
@Test
fun testGetPathForRange_Emoji_Sequence() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u1F600\u1F603\u1F604\u1F606"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3298,7 +3297,7 @@
@Test
fun testGetPathForRange_Unicode_200D_Return_Line_Segment() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u200D"
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3325,7 +3324,7 @@
@Test
fun testGetPathForRange_Unicode_2066_Return_Line_Segment() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u2066"
val fontSize = 20f.sp
val fontSizeInPx = fontSize.toPx().value
@@ -3412,7 +3411,7 @@
@Test
fun minInstrinsicWidth_includes_white_space() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 12.sp
val text = "b "
val paragraph = simpleParagraph(
@@ -3427,7 +3426,7 @@
@Test
fun minInstrinsicWidth_returns_longest_word_width() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
// create words with length 1, 2, 3... 50; and append all with space.
val maxWordLength = 50
val text = (1..maxWordLength).fold("") { string, next ->
@@ -3447,7 +3446,7 @@
@Test
fun minInstrinsicWidth_withStyledText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a bb ccc"
val fontSize = 12.sp
val styledFontSize = fontSize * 2
@@ -3498,7 +3497,7 @@
@Test
fun createParagraph_with_ParagraphIntrinsics() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 14.sp
val fontSizeInPx = fontSize.toPx().value
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntrinsicIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntrinsicIntegrationTest.kt
index 322e2dc..206097e 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntrinsicIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntrinsicIntegrationTest.kt
@@ -23,7 +23,6 @@
import androidx.ui.unit.Density
import androidx.ui.unit.TextUnit
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
@@ -38,16 +37,14 @@
@Test
fun maxIntrinsicWidth_empty_string_is_zero() {
- withDensity(defaultDensity) {
- val paragraphIntrinsics = paragraphIntrinsics(text = "")
+ val paragraphIntrinsics = paragraphIntrinsics(text = "")
- assertThat(paragraphIntrinsics.maxIntrinsicWidth).isZero()
- }
+ assertThat(paragraphIntrinsics.maxIntrinsicWidth).isZero()
}
@Test
fun maxIntrinsicWidth_with_rtl_string() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
@@ -63,7 +60,7 @@
@Test
fun maxIntrinsicWidth_with_ltr_string() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
@@ -78,7 +75,7 @@
@Test
fun maxIntrinsicWidth_with_line_feed() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc\nabc"
val fontSize = 50.sp
val paragraphIntrinsics = paragraphIntrinsics(
@@ -93,7 +90,7 @@
@Test
fun maxInstrinsicWidth_withStyledText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a bb ccc"
val fontSize = 12.sp
val styledFontSize = 24.sp
@@ -118,16 +115,14 @@
@Test
fun minIntrinsicWidth_empty_string_is_zero() {
- withDensity(defaultDensity) {
- val paragraphIntrinsics = paragraphIntrinsics(text = "")
+ val paragraphIntrinsics = paragraphIntrinsics(text = "")
- assertThat(paragraphIntrinsics.minIntrinsicWidth).isZero()
- }
+ assertThat(paragraphIntrinsics.minIntrinsicWidth).isZero()
}
@Test
fun minIntrinsicWidth_with_rtl_string() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "\u05D0\u05D1\u05D2"
val fontSize = 50.sp
@@ -143,7 +138,7 @@
@Test
fun minIntrinsicWidth_with_ltr_string() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 50.sp
@@ -159,7 +154,7 @@
@Test
fun minInstrinsicWidth_returns_longest_word_width() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
// create words with length 1, 2, 3... 50; and append all with space.
val maxWordLength = 50
val text = (1..maxWordLength).fold("") { string, next ->
@@ -179,7 +174,7 @@
@Test
fun minInstrinsicWidth_withStyledText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "a bb ccc"
val fontSize = 12.sp
val styledFontSize = 24.sp
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/TextDelegateIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/TextDelegateIntegrationTest.kt
index a3b3c32..b3815a3 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/TextDelegateIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/TextDelegateIntegrationTest.kt
@@ -31,7 +31,6 @@
import androidx.ui.unit.Density
import androidx.ui.unit.ipx
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
@@ -48,7 +47,7 @@
@Test
fun minIntrinsicWidth_getter() {
- withDensity(density) {
+ with(density) {
val fontSize = 20.sp
val text = "Hello"
val spanStyle = SpanStyle(fontSize = fontSize, fontFamily = fontFamily)
@@ -56,7 +55,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
@@ -69,7 +68,7 @@
@Test
fun maxIntrinsicWidth_getter() {
- withDensity(density) {
+ with(density) {
val fontSize = 20.sp
val text = "Hello"
val spanStyle = SpanStyle(fontSize = fontSize, fontFamily = fontFamily)
@@ -77,7 +76,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
@@ -91,7 +90,7 @@
@Test
fun testBackgroundPaint_paint_wrap_multiLines() {
- withDensity(density) {
+ with(density) {
// Setup test.
val fontSize = 20.sp
val fontSizeInPx = fontSize.toPx().value
@@ -101,7 +100,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
@@ -151,7 +150,7 @@
@Test
fun testBackgroundPaint_paint_with_default_color() {
- withDensity(density) {
+ with(density) {
// Setup test.
val selectionStart = 0
val selectionEnd = 3
@@ -163,7 +162,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
@@ -203,7 +202,7 @@
@Test
fun testBackgroundPaint_paint_with_default_color_bidi() {
- withDensity(density) {
+ with(density) {
// Setup test.
val textLTR = "Hello"
// From right to left: שלום
@@ -218,7 +217,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
@@ -270,7 +269,7 @@
@Test
fun testBackgroundPaint_paint_with_customized_color() {
- withDensity(density) {
+ with(density) {
// Setup test.
val selectionStart = 0
val selectionEnd = 3
@@ -283,7 +282,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt
index b1ebcd9..409f75a 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt
@@ -29,7 +29,6 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.px
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
@@ -46,7 +45,7 @@
@Test
fun width_getter() {
- withDensity(density) {
+ with(density) {
val fontSize = 20.sp
val text = "Hello"
val spanStyle = SpanStyle(fontSize = fontSize, fontFamily = fontFamily)
@@ -54,7 +53,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
@@ -88,7 +87,7 @@
@Test
fun height_getter() {
- withDensity(density) {
+ with(density) {
val fontSize = 20.sp
val spanStyle = SpanStyle(fontSize = fontSize, fontFamily = fontFamily)
val text = "hello"
@@ -96,7 +95,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
@@ -146,7 +145,7 @@
@Test
fun getPositionForOffset_other_Character() {
- withDensity(density) {
+ with(density) {
val fontSize = 20.sp
val characterIndex = 2 // Start from 0.
val text = "Hello"
@@ -159,7 +158,7 @@
val textDelegate = TextDelegate(
text = annotatedString,
style = TextStyle.Empty,
- density = density,
+ density = this,
resourceLoader = resourceLoader,
layoutDirection = LayoutDirection.Ltr
)
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
index 7fe398d..f41bb9d 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
@@ -48,7 +48,6 @@
import androidx.ui.unit.em
import androidx.ui.unit.px
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.eq
@@ -75,7 +74,7 @@
@Test
fun draw_with_newline_and_line_break_default_values() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 50.sp
for (text in arrayOf("abc\ndef", "\u05D0\u05D1\u05D2\n\u05D3\u05D4\u05D5")) {
val paragraphAndroid = simpleParagraph(
@@ -233,7 +232,7 @@
@Test
fun testAnnotatedString_setFontSizeOnWholeText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val paragraphWidth = text.length * fontSize.toPx().value
@@ -251,7 +250,7 @@
@Test
fun testAnnotatedString_setFontSizeOnPartText() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val paragraphWidth = text.length * fontSize.toPx().value
@@ -269,7 +268,7 @@
@Test
fun testAnnotatedString_setFontSizeTwice_lastOneOverwrite() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 20.sp
val fontSizeOverwrite = 30.sp
@@ -898,7 +897,7 @@
@Test
fun testEllipsis_withMaxLineEqualsNull_doesNotEllipsis() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 20.sp
val paragraphWidth = (text.length - 1) * fontSize.toPx().value
@@ -920,7 +919,7 @@
@Test
fun testEllipsis_withMaxLinesLessThanTextLines_doesEllipsis() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abcde"
val fontSize = 100.sp
// Note that on API 21, if the next line only contains 1 character, ellipsis won't work
@@ -942,7 +941,7 @@
@Test
fun testEllipsis_withMaxLinesMoreThanTextLines_doesNotEllipsis() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val text = "abc"
val fontSize = 100.sp
val paragraphWidth = (text.length - 1) * fontSize.toPx().value
@@ -966,7 +965,7 @@
@Test
fun testSpanStyle_fontSize_appliedOnTextPaint() {
- withDensity(defaultDensity) {
+ with(defaultDensity) {
val fontSize = 100.sp
val paragraph = simpleParagraph(
text = "",
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt
index a9732d9..6ec7f2a 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraphHelper.kt
@@ -46,7 +46,6 @@
import androidx.ui.unit.TextUnit
import androidx.ui.unit.TextUnitType
import androidx.ui.unit.sp
-import androidx.ui.unit.withDensity
import androidx.ui.graphics.toArgb
import androidx.ui.text.AnnotatedString
import androidx.ui.text.Locale
@@ -71,7 +70,7 @@
): SpanStyle {
when (style.fontSize.type) {
- TextUnitType.Sp -> withDensity(density) {
+ TextUnitType.Sp -> with(density) {
textSize = style.fontSize.toPx().value
}
TextUnitType.Em -> {
@@ -173,7 +172,7 @@
val deferredSpans = mutableListOf<Triple<Any, Int, Int>>()
when (lineHeight.type) {
- TextUnitType.Sp -> withDensity(density) {
+ TextUnitType.Sp -> with(density) {
spannableString.setSpan(
LineHeightSpan(ceil(lineHeight.toPx().value).toInt()),
0,
@@ -195,7 +194,7 @@
textIndent?.let { indent ->
if (indent.firstLine == 0.sp && indent.restLine == 0.sp) return@let
if (indent.firstLine.isInherit || indent.restLine.isInherit) return@let
- withDensity(density) {
+ with(density) {
val firstLine = when (indent.firstLine.type) {
TextUnitType.Sp -> indent.firstLine.toPx().value
TextUnitType.Em -> indent.firstLine.value * contextFontSize
@@ -265,7 +264,7 @@
}
when (style.fontSize.type) {
- TextUnitType.Sp -> withDensity(density) {
+ TextUnitType.Sp -> with(density) {
spannableString.setSpan(
AbsoluteSizeSpan(style.fontSize.toPx().value.roundToInt(), true),
start,
@@ -325,7 +324,7 @@
}
when (style.letterSpacing.type) {
- TextUnitType.Sp -> withDensity(density) {
+ TextUnitType.Sp -> with(density) {
deferredSpans.add(
Triple(LetterSpacingSpanPx(style.letterSpacing.toPx().value), start, end)
)
diff --git a/ui/ui-unit/api/0.1.0-dev05.txt b/ui/ui-unit/api/0.1.0-dev05.txt
index 905d27a0..95030e4 100644
--- a/ui/ui-unit/api/0.1.0-dev05.txt
+++ b/ui/ui-unit/api/0.1.0-dev05.txt
@@ -14,23 +14,9 @@
method public androidx.ui.unit.Dp getTop();
}
- public final class Density {
- ctor public Density(float density, float fontScale);
- method public float component1();
- method public float component2();
- method public androidx.ui.unit.Density copy(float density, float fontScale);
+ public interface Density {
method public float getDensity();
method public float getFontScale();
- }
-
- public final class DensityKt {
- method public static androidx.ui.unit.Density Density(android.content.Context context);
- method public static androidx.ui.unit.DensityScope DensityScope(androidx.ui.unit.Density density);
- method public static inline <R> R! withDensity(androidx.ui.unit.Density density, kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,? extends R> block);
- }
-
- public interface DensityScope {
- method public androidx.ui.unit.Density getDensity();
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.TextUnit);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.Px);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.IntPx);
@@ -47,7 +33,13 @@
method public default androidx.ui.unit.TextUnit toSp(androidx.ui.unit.IntPx);
method public default androidx.ui.unit.TextUnit toSp(float);
method public default androidx.ui.unit.TextUnit toSp(int);
- property public abstract androidx.ui.unit.Density density;
+ property public abstract float density;
+ property public abstract float fontScale;
+ }
+
+ public final class DensityKt {
+ method public static androidx.ui.unit.Density Density(android.content.Context context);
+ method public static androidx.ui.unit.Density Density(float density, float fontScale = 1f);
}
public final class Dp implements java.lang.Comparable<androidx.ui.unit.Dp> {
diff --git a/ui/ui-unit/api/current.txt b/ui/ui-unit/api/current.txt
index 905d27a0..95030e4 100644
--- a/ui/ui-unit/api/current.txt
+++ b/ui/ui-unit/api/current.txt
@@ -14,23 +14,9 @@
method public androidx.ui.unit.Dp getTop();
}
- public final class Density {
- ctor public Density(float density, float fontScale);
- method public float component1();
- method public float component2();
- method public androidx.ui.unit.Density copy(float density, float fontScale);
+ public interface Density {
method public float getDensity();
method public float getFontScale();
- }
-
- public final class DensityKt {
- method public static androidx.ui.unit.Density Density(android.content.Context context);
- method public static androidx.ui.unit.DensityScope DensityScope(androidx.ui.unit.Density density);
- method public static inline <R> R! withDensity(androidx.ui.unit.Density density, kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,? extends R> block);
- }
-
- public interface DensityScope {
- method public androidx.ui.unit.Density getDensity();
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.TextUnit);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.Px);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.IntPx);
@@ -47,7 +33,13 @@
method public default androidx.ui.unit.TextUnit toSp(androidx.ui.unit.IntPx);
method public default androidx.ui.unit.TextUnit toSp(float);
method public default androidx.ui.unit.TextUnit toSp(int);
- property public abstract androidx.ui.unit.Density density;
+ property public abstract float density;
+ property public abstract float fontScale;
+ }
+
+ public final class DensityKt {
+ method public static androidx.ui.unit.Density Density(android.content.Context context);
+ method public static androidx.ui.unit.Density Density(float density, float fontScale = 1f);
}
public final class Dp implements java.lang.Comparable<androidx.ui.unit.Dp> {
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev05.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev05.txt
index 905d27a0..95030e4 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev05.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev05.txt
@@ -14,23 +14,9 @@
method public androidx.ui.unit.Dp getTop();
}
- public final class Density {
- ctor public Density(float density, float fontScale);
- method public float component1();
- method public float component2();
- method public androidx.ui.unit.Density copy(float density, float fontScale);
+ public interface Density {
method public float getDensity();
method public float getFontScale();
- }
-
- public final class DensityKt {
- method public static androidx.ui.unit.Density Density(android.content.Context context);
- method public static androidx.ui.unit.DensityScope DensityScope(androidx.ui.unit.Density density);
- method public static inline <R> R! withDensity(androidx.ui.unit.Density density, kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,? extends R> block);
- }
-
- public interface DensityScope {
- method public androidx.ui.unit.Density getDensity();
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.TextUnit);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.Px);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.IntPx);
@@ -47,7 +33,13 @@
method public default androidx.ui.unit.TextUnit toSp(androidx.ui.unit.IntPx);
method public default androidx.ui.unit.TextUnit toSp(float);
method public default androidx.ui.unit.TextUnit toSp(int);
- property public abstract androidx.ui.unit.Density density;
+ property public abstract float density;
+ property public abstract float fontScale;
+ }
+
+ public final class DensityKt {
+ method public static androidx.ui.unit.Density Density(android.content.Context context);
+ method public static androidx.ui.unit.Density Density(float density, float fontScale = 1f);
}
public final class Dp implements java.lang.Comparable<androidx.ui.unit.Dp> {
diff --git a/ui/ui-unit/api/public_plus_experimental_current.txt b/ui/ui-unit/api/public_plus_experimental_current.txt
index 905d27a0..95030e4 100644
--- a/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -14,23 +14,9 @@
method public androidx.ui.unit.Dp getTop();
}
- public final class Density {
- ctor public Density(float density, float fontScale);
- method public float component1();
- method public float component2();
- method public androidx.ui.unit.Density copy(float density, float fontScale);
+ public interface Density {
method public float getDensity();
method public float getFontScale();
- }
-
- public final class DensityKt {
- method public static androidx.ui.unit.Density Density(android.content.Context context);
- method public static androidx.ui.unit.DensityScope DensityScope(androidx.ui.unit.Density density);
- method public static inline <R> R! withDensity(androidx.ui.unit.Density density, kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,? extends R> block);
- }
-
- public interface DensityScope {
- method public androidx.ui.unit.Density getDensity();
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.TextUnit);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.Px);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.IntPx);
@@ -47,7 +33,13 @@
method public default androidx.ui.unit.TextUnit toSp(androidx.ui.unit.IntPx);
method public default androidx.ui.unit.TextUnit toSp(float);
method public default androidx.ui.unit.TextUnit toSp(int);
- property public abstract androidx.ui.unit.Density density;
+ property public abstract float density;
+ property public abstract float fontScale;
+ }
+
+ public final class DensityKt {
+ method public static androidx.ui.unit.Density Density(android.content.Context context);
+ method public static androidx.ui.unit.Density Density(float density, float fontScale = 1f);
}
public final class Dp implements java.lang.Comparable<androidx.ui.unit.Dp> {
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev05.txt b/ui/ui-unit/api/restricted_0.1.0-dev05.txt
index 905d27a0..95030e4 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev05.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev05.txt
@@ -14,23 +14,9 @@
method public androidx.ui.unit.Dp getTop();
}
- public final class Density {
- ctor public Density(float density, float fontScale);
- method public float component1();
- method public float component2();
- method public androidx.ui.unit.Density copy(float density, float fontScale);
+ public interface Density {
method public float getDensity();
method public float getFontScale();
- }
-
- public final class DensityKt {
- method public static androidx.ui.unit.Density Density(android.content.Context context);
- method public static androidx.ui.unit.DensityScope DensityScope(androidx.ui.unit.Density density);
- method public static inline <R> R! withDensity(androidx.ui.unit.Density density, kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,? extends R> block);
- }
-
- public interface DensityScope {
- method public androidx.ui.unit.Density getDensity();
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.TextUnit);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.Px);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.IntPx);
@@ -47,7 +33,13 @@
method public default androidx.ui.unit.TextUnit toSp(androidx.ui.unit.IntPx);
method public default androidx.ui.unit.TextUnit toSp(float);
method public default androidx.ui.unit.TextUnit toSp(int);
- property public abstract androidx.ui.unit.Density density;
+ property public abstract float density;
+ property public abstract float fontScale;
+ }
+
+ public final class DensityKt {
+ method public static androidx.ui.unit.Density Density(android.content.Context context);
+ method public static androidx.ui.unit.Density Density(float density, float fontScale = 1f);
}
public final class Dp implements java.lang.Comparable<androidx.ui.unit.Dp> {
diff --git a/ui/ui-unit/api/restricted_current.txt b/ui/ui-unit/api/restricted_current.txt
index 905d27a0..95030e4 100644
--- a/ui/ui-unit/api/restricted_current.txt
+++ b/ui/ui-unit/api/restricted_current.txt
@@ -14,23 +14,9 @@
method public androidx.ui.unit.Dp getTop();
}
- public final class Density {
- ctor public Density(float density, float fontScale);
- method public float component1();
- method public float component2();
- method public androidx.ui.unit.Density copy(float density, float fontScale);
+ public interface Density {
method public float getDensity();
method public float getFontScale();
- }
-
- public final class DensityKt {
- method public static androidx.ui.unit.Density Density(android.content.Context context);
- method public static androidx.ui.unit.DensityScope DensityScope(androidx.ui.unit.Density density);
- method public static inline <R> R! withDensity(androidx.ui.unit.Density density, kotlin.jvm.functions.Function1<? super androidx.ui.unit.DensityScope,? extends R> block);
- }
-
- public interface DensityScope {
- method public androidx.ui.unit.Density getDensity();
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.TextUnit);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.Px);
method public default androidx.ui.unit.Dp toDp(androidx.ui.unit.IntPx);
@@ -47,7 +33,13 @@
method public default androidx.ui.unit.TextUnit toSp(androidx.ui.unit.IntPx);
method public default androidx.ui.unit.TextUnit toSp(float);
method public default androidx.ui.unit.TextUnit toSp(int);
- property public abstract androidx.ui.unit.Density density;
+ property public abstract float density;
+ property public abstract float fontScale;
+ }
+
+ public final class DensityKt {
+ method public static androidx.ui.unit.Density Density(android.content.Context context);
+ method public static androidx.ui.unit.Density Density(float density, float fontScale = 1f);
}
public final class Dp implements java.lang.Comparable<androidx.ui.unit.Dp> {
diff --git a/ui/ui-unit/integration-tests/samples/build.gradle b/ui/ui-unit/integration-tests/samples/build.gradle
index 9b97a89..7730d39 100644
--- a/ui/ui-unit/integration-tests/samples/build.gradle
+++ b/ui/ui-unit/integration-tests/samples/build.gradle
@@ -34,6 +34,7 @@
implementation project(":compose:compose-runtime")
implementation project(":ui:ui-unit")
+ implementation project(":ui:ui-framework")
}
android {
diff --git a/ui/ui-unit/integration-tests/samples/src/main/java/androidx/ui/unit/samples/DensitySample.kt b/ui/ui-unit/integration-tests/samples/src/main/java/androidx/ui/unit/samples/DensitySample.kt
index d2a0e7d..521771b 100644
--- a/ui/ui-unit/integration-tests/samples/src/main/java/androidx/ui/unit/samples/DensitySample.kt
+++ b/ui/ui-unit/integration-tests/samples/src/main/java/androidx/ui/unit/samples/DensitySample.kt
@@ -18,13 +18,12 @@
import androidx.annotation.Sampled
import androidx.compose.Composable
-import androidx.ui.core.ambientDensity
-import androidx.ui.core.dp
-import androidx.ui.core.withDensity
+import androidx.ui.core.DensityAmbient
+import androidx.ui.unit.dp
@Sampled
@Composable
@Suppress("UNUSED_VARIABLE")
fun WithDensitySample() {
- val sizeInPx = withDensity(ambientDensity()) { 16.dp.toPx() }
+ val sizeInPx = with(DensityAmbient.current) { 16.dp.toPx() }
}
diff --git a/ui/ui-unit/src/androidTest/java/androidx/ui/unit/DpDeviceTest.kt b/ui/ui-unit/src/androidTest/java/androidx/ui/unit/DpDeviceTest.kt
index 5cb44e6..a4b9e3b 100644
--- a/ui/ui-unit/src/androidTest/java/androidx/ui/unit/DpDeviceTest.kt
+++ b/ui/ui-unit/src/androidTest/java/androidx/ui/unit/DpDeviceTest.kt
@@ -44,7 +44,7 @@
fun dimensionCalculation() {
val dm = activity.resources.displayMetrics
val dp10InPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f, dm)
- withDensity(Density(activity)) {
+ with(Density(activity)) {
assertEquals(dp10InPx, 10.dp.toPx().value, 0.01f)
}
}
diff --git a/ui/ui-unit/src/androidTest/java/androidx/ui/unit/SpDeviceTest.kt b/ui/ui-unit/src/androidTest/java/androidx/ui/unit/SpDeviceTest.kt
index 1ba9d16..d531808 100644
--- a/ui/ui-unit/src/androidTest/java/androidx/ui/unit/SpDeviceTest.kt
+++ b/ui/ui-unit/src/androidTest/java/androidx/ui/unit/SpDeviceTest.kt
@@ -44,7 +44,7 @@
fun convertSpPx() {
val dm = activity.resources.displayMetrics
val sp10InPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10f, dm)
- withDensity(Density(activity)) {
+ with(Density(activity)) {
assertEquals(sp10InPx, 10.sp.toPx().value, 0.01f)
assertEquals(10f, Px(sp10InPx).toSp().value, 0.01f)
}
@@ -52,7 +52,7 @@
@Test
fun convertSpDp() {
- withDensity(Density(activity)) {
+ with(Density(activity)) {
val px10InSp = Px(10f).toSp()
val px10InDp = Px(10f).toDp()
assertEquals(px10InDp.value, px10InSp.toDp().value, 0.01f)
diff --git a/ui/ui-unit/src/main/java/androidx/ui/unit/Density.kt b/ui/ui-unit/src/main/java/androidx/ui/unit/Density.kt
index 86cf078..839168d 100644
--- a/ui/ui-unit/src/main/java/androidx/ui/unit/Density.kt
+++ b/ui/ui-unit/src/main/java/androidx/ui/unit/Density.kt
@@ -20,15 +20,10 @@
import androidx.ui.geometry.Rect
/**
- * A density of the screen. Used for convert [Dp] to pixels.
- */
-data class Density(val density: Float, val fontScale: Float = 1f)
-
-/**
- * Creates a [Density] from this [Context]
+ * Creates a [Density] for this [Context].
*
+ * @param context density values will be extracted from this [Context]
*/
-// TODO(Andrey): Move to android specific module
fun Density(context: Context): Density =
Density(
context.resources.displayMetrics.density,
@@ -36,29 +31,40 @@
)
/**
- * If you have a [Density] object and you want to perform some conversions use this.
+ * A density of the screen. Used for convert [Dp] to pixels.
+ *
+ * @param density The logical density of the display. This is a scaling factor for the [Dp] unit.
+ * @param fontScale Current user preference for the scaling factor for fonts.
+ */
+fun Density(density: Float, fontScale: Float = 1f): Density =
+ DensityImpl(density, fontScale)
+
+private data class DensityImpl(
+ override val density: Float,
+ override val fontScale: Float
+) : Density
+
+/**
+ * A density of the screen. Used for the conversions between [Dp], [Px], [IntPx] and [TextUnit].
*
* @sample androidx.ui.unit.samples.WithDensitySample
*/
-inline fun <R> withDensity(density: Density, block: DensityScope.() -> R) =
- DensityScope(density).block()
-
-/**
- * Used to add density resolution logic within a receiver scope.
- *
- * @see [withDensity] for a simple usage
- */
-interface DensityScope {
+interface Density {
/**
- * A [Density] object. Useful if you need to pass it as a param.
+ * The logical density of the display. This is a scaling factor for the [Dp] unit.
*/
- val density: Density
+ val density: Float
/**
- * Convert [Dp] to [Px]. Pixels are used to paint to [Canvas].
+ * Current user preference for the scaling factor for fonts.
*/
- fun Dp.toPx(): Px = Px(value * density.density)
+ val fontScale: Float
+
+ /**
+ * Convert [Dp] to [Px]. Pixels are used to paint to Canvas.
+ */
+ fun Dp.toPx(): Px = Px(value * density)
/**
* Convert [Dp] to [IntPx] by rounding
@@ -68,15 +74,15 @@
/**
* Convert [Dp] to Sp. Sp is used for font size, etc.
*/
- fun Dp.toSp(): TextUnit = TextUnit.Sp(value / density.fontScale)
+ fun Dp.toSp(): TextUnit = TextUnit.Sp(value / fontScale)
/**
- * Convert Sp to [Px]. Pixels are used to paint to [Canvas].
- * @throws ArithmeticException if TextUnit other than SP unit is specified.
+ * Convert Sp to [Px]. Pixels are used to paint to Canvas.
+ * @throws IllegalStateException if TextUnit other than SP unit is specified.
*/
fun TextUnit.toPx(): Px {
- require(type == TextUnitType.Sp) { "Only Sp can convert to Px" }
- return Px(value * density.fontScale * density.density)
+ check(type == TextUnitType.Sp) { "Only Sp can convert to Px" }
+ return Px(value * fontScale * density)
}
/**
@@ -86,38 +92,38 @@
/**
* Convert Sp to [Dp].
- * @throws ArithmeticException if TextUnit other than SP unit is specified.
+ * @throws IllegalStateException if TextUnit other than SP unit is specified.
*/
fun TextUnit.toDp(): Dp {
- require(type == TextUnitType.Sp) { "Only Sp can convert to Px" }
- return Dp(value * density.fontScale)
+ check(type == TextUnitType.Sp) { "Only Sp can convert to Px" }
+ return Dp(value * fontScale)
}
/**
* Convert [Px] to [Dp].
*/
- fun Px.toDp(): Dp = (value / density.density).dp
+ fun Px.toDp(): Dp = (value / density).dp
/**
* Convert [Px] to Sp.
*/
- fun Px.toSp(): TextUnit = (value / (density.fontScale * density.density)).sp
+ fun Px.toSp(): TextUnit = (value / (fontScale * density)).sp
/**
* Convert [IntPx] to [Dp].
*/
- fun IntPx.toDp(): Dp = (value / density.density).dp
+ fun IntPx.toDp(): Dp = (value / density).dp
/**
* Convert [IntPx] to Sp.
*/
- fun IntPx.toSp(): TextUnit = (value / (density.fontScale * density.density)).sp
+ fun IntPx.toSp(): TextUnit = (value / (fontScale * density)).sp
/** Convert a [Float] pixel value to a Dp */
- fun Float.toDp(): Dp = (this / density.density).dp
+ fun Float.toDp(): Dp = (this / density).dp
/** Convert a [Float] pixel value to a Sp */
- fun Float.toSp(): TextUnit = (this / (density.fontScale * density.density)).sp
+ fun Float.toSp(): TextUnit = (this / (fontScale * density)).sp
/** Convert a [Int] pixel value to a Dp */
fun Int.toDp(): Dp = toFloat().toDp()
@@ -143,13 +149,3 @@
)
}
}
-
-/**
- * Returns a [DensityScope] reflecting [density].
- */
-fun DensityScope(density: Density): DensityScope = DensityScopeImpl(density)
-
-/**
- * A simple implementation for [DensityScope].
- */
-private class DensityScopeImpl(override val density: Density) : DensityScope
diff --git a/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt b/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt
index 52942ef..fd6a4f3 100644
--- a/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt
+++ b/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt
@@ -32,7 +32,7 @@
* Dimension value represented in pixels (px). Component APIs specify their
* dimensions such as line thickness in DP with Dp objects, while drawing and layout are done
* in pixel dimensions. When specific pixel dimensions are required, create a Px and convert
- * it to Dp using [DensityScope.toDp]. Px are normally defined using [px], which can be applied to
+ * it to Dp using [Density.toDp]. Px are normally defined using [px], which can be applied to
* [Int], [Double], and [Float].
* val leftMargin = 10.px
* val rightMargin = 10f.px