Removal of Px usages part 6 of n
Relnote: "Replaced usage of Px class in various
compose classes as part of the large
refactoring effort to only rely on Dp
and primitive types for pixel parameters"
Bug: 156681014
Test: re-ran compose tests
Change-Id: I086f4744d1eb51f0f31356e36991c2a8d4433059
diff --git a/ui/ui-animation/api/0.1.0-dev14.txt b/ui/ui-animation/api/0.1.0-dev14.txt
index 5f89483..2eaf1a9 100644
--- a/ui/ui-animation/api/0.1.0-dev14.txt
+++ b/ui/ui-animation/api/0.1.0-dev14.txt
@@ -66,7 +66,7 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getPxToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
@@ -79,12 +79,12 @@
property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
}
- public final class PxPropKey implements androidx.animation.PropKey<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> {
+ public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
ctor public PxPropKey(String label);
ctor public PxPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> typeConverter;
+ method public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> typeConverter;
}
public final class RectPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> {
@@ -102,6 +102,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.Bounds animate(androidx.ui.unit.Bounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.Bounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Bounds,kotlin.Unit>? endListener = null);
+ method @androidx.compose.Composable public static float animate(float target, androidx.animation.AnimationBuilder<java.lang.Float> animBuilder = remember({
+ return <init>()
+}), kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
@@ -132,9 +135,6 @@
method @androidx.compose.Composable public static long animate-90dr43Y(long target, androidx.animation.AnimationBuilder<androidx.ui.graphics.Color> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static float animate-aPXp8Ng(float target, androidx.animation.AnimationBuilder<androidx.ui.unit.Px> animBuilder = remember({
- return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Px,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static int animate-gxe4dkU(int target, androidx.animation.AnimationBuilder<androidx.ui.unit.IntPx> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPx,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/current.txt b/ui/ui-animation/api/current.txt
index 5f89483..2eaf1a9 100644
--- a/ui/ui-animation/api/current.txt
+++ b/ui/ui-animation/api/current.txt
@@ -66,7 +66,7 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getPxToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
@@ -79,12 +79,12 @@
property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
}
- public final class PxPropKey implements androidx.animation.PropKey<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> {
+ public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
ctor public PxPropKey(String label);
ctor public PxPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> typeConverter;
+ method public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> typeConverter;
}
public final class RectPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> {
@@ -102,6 +102,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.Bounds animate(androidx.ui.unit.Bounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.Bounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Bounds,kotlin.Unit>? endListener = null);
+ method @androidx.compose.Composable public static float animate(float target, androidx.animation.AnimationBuilder<java.lang.Float> animBuilder = remember({
+ return <init>()
+}), kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
@@ -132,9 +135,6 @@
method @androidx.compose.Composable public static long animate-90dr43Y(long target, androidx.animation.AnimationBuilder<androidx.ui.graphics.Color> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static float animate-aPXp8Ng(float target, androidx.animation.AnimationBuilder<androidx.ui.unit.Px> animBuilder = remember({
- return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Px,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static int animate-gxe4dkU(int target, androidx.animation.AnimationBuilder<androidx.ui.unit.IntPx> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPx,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt
index 5f89483..2eaf1a9 100644
--- a/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt
@@ -66,7 +66,7 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getPxToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
@@ -79,12 +79,12 @@
property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
}
- public final class PxPropKey implements androidx.animation.PropKey<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> {
+ public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
ctor public PxPropKey(String label);
ctor public PxPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> typeConverter;
+ method public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> typeConverter;
}
public final class RectPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> {
@@ -102,6 +102,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.Bounds animate(androidx.ui.unit.Bounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.Bounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Bounds,kotlin.Unit>? endListener = null);
+ method @androidx.compose.Composable public static float animate(float target, androidx.animation.AnimationBuilder<java.lang.Float> animBuilder = remember({
+ return <init>()
+}), kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
@@ -132,9 +135,6 @@
method @androidx.compose.Composable public static long animate-90dr43Y(long target, androidx.animation.AnimationBuilder<androidx.ui.graphics.Color> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static float animate-aPXp8Ng(float target, androidx.animation.AnimationBuilder<androidx.ui.unit.Px> animBuilder = remember({
- return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Px,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static int animate-gxe4dkU(int target, androidx.animation.AnimationBuilder<androidx.ui.unit.IntPx> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPx,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/public_plus_experimental_current.txt b/ui/ui-animation/api/public_plus_experimental_current.txt
index 5f89483..2eaf1a9 100644
--- a/ui/ui-animation/api/public_plus_experimental_current.txt
+++ b/ui/ui-animation/api/public_plus_experimental_current.txt
@@ -66,7 +66,7 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getPxToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
@@ -79,12 +79,12 @@
property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
}
- public final class PxPropKey implements androidx.animation.PropKey<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> {
+ public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
ctor public PxPropKey(String label);
ctor public PxPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> typeConverter;
+ method public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> typeConverter;
}
public final class RectPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> {
@@ -102,6 +102,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.Bounds animate(androidx.ui.unit.Bounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.Bounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Bounds,kotlin.Unit>? endListener = null);
+ method @androidx.compose.Composable public static float animate(float target, androidx.animation.AnimationBuilder<java.lang.Float> animBuilder = remember({
+ return <init>()
+}), kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
@@ -132,9 +135,6 @@
method @androidx.compose.Composable public static long animate-90dr43Y(long target, androidx.animation.AnimationBuilder<androidx.ui.graphics.Color> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static float animate-aPXp8Ng(float target, androidx.animation.AnimationBuilder<androidx.ui.unit.Px> animBuilder = remember({
- return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Px,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static int animate-gxe4dkU(int target, androidx.animation.AnimationBuilder<androidx.ui.unit.IntPx> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPx,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/restricted_0.1.0-dev14.txt b/ui/ui-animation/api/restricted_0.1.0-dev14.txt
index 5f89483..2eaf1a9 100644
--- a/ui/ui-animation/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-animation/api/restricted_0.1.0-dev14.txt
@@ -66,7 +66,7 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getPxToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
@@ -79,12 +79,12 @@
property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
}
- public final class PxPropKey implements androidx.animation.PropKey<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> {
+ public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
ctor public PxPropKey(String label);
ctor public PxPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> typeConverter;
+ method public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> typeConverter;
}
public final class RectPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> {
@@ -102,6 +102,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.Bounds animate(androidx.ui.unit.Bounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.Bounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Bounds,kotlin.Unit>? endListener = null);
+ method @androidx.compose.Composable public static float animate(float target, androidx.animation.AnimationBuilder<java.lang.Float> animBuilder = remember({
+ return <init>()
+}), kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
@@ -132,9 +135,6 @@
method @androidx.compose.Composable public static long animate-90dr43Y(long target, androidx.animation.AnimationBuilder<androidx.ui.graphics.Color> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static float animate-aPXp8Ng(float target, androidx.animation.AnimationBuilder<androidx.ui.unit.Px> animBuilder = remember({
- return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Px,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static int animate-gxe4dkU(int target, androidx.animation.AnimationBuilder<androidx.ui.unit.IntPx> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPx,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/restricted_current.txt b/ui/ui-animation/api/restricted_current.txt
index 5f89483..2eaf1a9 100644
--- a/ui/ui-animation/api/restricted_current.txt
+++ b/ui/ui-animation/api/restricted_current.txt
@@ -66,7 +66,7 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getPxToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
@@ -79,12 +79,12 @@
property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
}
- public final class PxPropKey implements androidx.animation.PropKey<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> {
+ public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
ctor public PxPropKey(String label);
ctor public PxPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.Px,androidx.animation.AnimationVector1D> typeConverter;
+ method public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> typeConverter;
}
public final class RectPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> {
@@ -102,6 +102,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.Bounds animate(androidx.ui.unit.Bounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.Bounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Bounds,kotlin.Unit>? endListener = null);
+ method @androidx.compose.Composable public static float animate(float target, androidx.animation.AnimationBuilder<java.lang.Float> animBuilder = remember({
+ return <init>()
+}), kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
@@ -132,9 +135,6 @@
method @androidx.compose.Composable public static long animate-90dr43Y(long target, androidx.animation.AnimationBuilder<androidx.ui.graphics.Color> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static float animate-aPXp8Ng(float target, androidx.animation.AnimationBuilder<androidx.ui.unit.Px> animBuilder = remember({
- return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.Px,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static int animate-gxe4dkU(int target, androidx.animation.AnimationBuilder<androidx.ui.unit.IntPx> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPx,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt b/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt
index 9b5c822..43a1252 100644
--- a/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt
+++ b/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt
@@ -39,12 +39,10 @@
import androidx.ui.unit.Bounds
import androidx.ui.unit.Dp
import androidx.ui.unit.Position
-import androidx.ui.unit.Px
import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import androidx.ui.util.lerp
import org.junit.Assert.assertEquals
@@ -62,12 +60,12 @@
@Test
fun animate1DTest() {
- val startVal: Int = 20
- val endVal: Int = 250
+ val startVal = 20f
+ val endVal = 250f
- var floatValue = startVal.toFloat()
+ var floatValue = startVal
var dpValue = startVal.dp
- var pxValue = startVal.px
+ var pxValue = startVal
val animConfig: TweenBuilder<*>.() -> Unit = {
easing = FastOutSlowInEasing
@@ -75,7 +73,7 @@
}
val children: @Composable() (Boolean) -> Unit = { enabled ->
floatValue = animate(
- if (enabled) endVal.toFloat() else startVal.toFloat(),
+ if (enabled) endVal else startVal,
TweenBuilder<Float>().apply(animConfig)
)
@@ -85,8 +83,8 @@
)
pxValue = animate(
- if (enabled) endVal.px else startVal.px,
- TweenBuilder<Px>().apply(animConfig)
+ if (enabled) endVal else startVal,
+ TweenBuilder<Float>().apply(animConfig)
)
}
@@ -98,7 +96,7 @@
)
assertEquals(value, floatValue)
assertEquals(value.dp, dpValue)
- assertEquals(value.px, pxValue)
+ assertEquals(value, pxValue)
composeTestRule.clockTestRule.advanceClock(50)
waitForIdle()
}
diff --git a/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt b/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
index 03c260c..ab47f19 100644
--- a/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
+++ b/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
@@ -33,7 +33,6 @@
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.Position
-import androidx.ui.unit.Px
import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
import androidx.ui.unit.PxSize
@@ -43,11 +42,11 @@
import kotlin.math.roundToInt
/**
- * Built-in property key for [Px] properties.
+ * Built-in property key for pixel properties.
*
* @param label Label for distinguishing different prop keys in Android Studio.
*/
-class PxPropKey(override val label: String = "PxPropKey") : PropKey<Px, AnimationVector1D> {
+class PxPropKey(override val label: String = "PxPropKey") : PropKey<Float, AnimationVector1D> {
override val typeConverter = PxToVectorConverter
}
@@ -171,11 +170,11 @@
)
/**
- * A type converter that converts a [Px] to a [AnimationVector1D], and vice versa.
+ * A type converter that converts a pixel to a [AnimationVector1D], and vice versa.
*/
-val PxToVectorConverter: TwoWayConverter<Px, AnimationVector1D> = TwoWayConverter(
- convertToVector = { AnimationVector1D(it.value) },
- convertFromVector = { Px(it.value) }
+val PxToVectorConverter: TwoWayConverter<Float, AnimationVector1D> = TwoWayConverter(
+ convertToVector = { AnimationVector1D(it) },
+ convertFromVector = { it.value }
)
/**
@@ -192,7 +191,7 @@
*/
val PxSizeToVectorConverter: TwoWayConverter<PxSize, AnimationVector2D> =
TwoWayConverter(
- convertToVector = { AnimationVector2D(it.width.value, it.height.value) },
+ convertToVector = { AnimationVector2D(it.width, it.height) },
convertFromVector = { PxSize(it.v1.px, it.v2.px) }
)
@@ -202,12 +201,12 @@
val PxBoundsToVectorConverter: TwoWayConverter<PxBounds, AnimationVector4D> =
TwoWayConverter(
convertToVector = {
- AnimationVector4D(it.left.value, it.top.value, it.right.value, it.bottom.value) },
- convertFromVector = { PxBounds(it.v1.px, it.v2.px, it.v3.px, it.v4.px) }
+ AnimationVector4D(it.left, it.top, it.right, it.bottom) },
+ convertFromVector = { PxBounds(it.v1, it.v2, it.v3, it.v4) }
)
/**
- * A type converter that converts a [Px] to a [AnimationVector1D], and vice versa.
+ * A type converter that converts a pixel to a [AnimationVector1D], and vice versa.
*/
val IntPxToVectorConverter: TwoWayConverter<IntPx, AnimationVector1D> = TwoWayConverter(
convertToVector = { AnimationVector1D(it.value.toFloat()) },
diff --git a/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt b/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt
index 14b4d78..daece9f 100644
--- a/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt
+++ b/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt
@@ -37,7 +37,6 @@
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.Position
-import androidx.ui.unit.Px
import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
import androidx.ui.unit.PxSize
@@ -246,14 +245,14 @@
}
/**
- * Fire-and-forget animation [Composable] for [Px]. Once such an animation is created, it will be
+ * Fire-and-forget animation [Composable] for pixels. Once such an animation is created, it will be
* positionally memoized, like other @[Composable]s. To trigger the animation, or alter the
* course of the animation, simply supply a different [target] to the [Composable].
*
* Note, [animate] is for simple animations that cannot be canceled. For cancellable animations
* see [animatedValue].
*
- * val height : Px = animate(if (collapsed) 10.px else 20.px)
+ * val height : Float = animate(if (collapsed) 10f else 20f)
*
* @param target Target value of the animation
* @param animBuilder The animation that will be used to change the value through time. Physics
@@ -262,10 +261,10 @@
*/
@Composable
fun animate(
- target: Px,
- animBuilder: AnimationBuilder<Px> = remember { PhysicsBuilder() },
- endListener: ((Px) -> Unit)? = null
-): Px {
+ target: Float,
+ animBuilder: AnimationBuilder<Float> = remember { PhysicsBuilder() },
+ endListener: ((Float) -> Unit)? = null
+): Float {
return animate(target, PxToVectorConverter, animBuilder, PxVisibilityThreshold1D, endListener)
}
diff --git a/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt b/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
index cc245b4..4853a3a 100644
--- a/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
+++ b/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
@@ -24,7 +24,6 @@
import androidx.ui.graphics.colorspace.ColorSpaces
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import junit.framework.TestCase.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -54,10 +53,10 @@
@Test
fun testPxConverter() {
val value = Random.nextFloat()
- assertEquals(PxToVectorConverter.convertFromVector(AnimationVector1D(value)), value.px)
+ assertEquals(PxToVectorConverter.convertFromVector(AnimationVector1D(value)), value)
val value2 = Random.nextFloat()
- assertEquals(PxToVectorConverter.convertToVector(value2.px), AnimationVector1D(value2))
+ assertEquals(PxToVectorConverter.convertToVector(value2), AnimationVector1D(value2))
}
@Test
diff --git a/ui/ui-core/api/0.1.0-dev14.txt b/ui/ui-core/api/0.1.0-dev14.txt
index 1151dec..617c8ce 100644
--- a/ui/ui-core/api/0.1.0-dev14.txt
+++ b/ui/ui-core/api/0.1.0-dev14.txt
@@ -2161,10 +2161,10 @@
public static final class SemanticsActions.Companion {
method public androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> getCustomActions();
method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> getOnClick();
- method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> getScrollTo();
+ method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> getScrollTo();
property public final androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> CustomActions;
property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> OnClick;
- property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> ScrollTo;
+ property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> ScrollTo;
}
public final class SemanticsKt {
@@ -2190,7 +2190,7 @@
}
public final class SemanticsPropertiesKt {
- method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super androidx.ui.unit.Px,? super androidx.ui.unit.Px,java.lang.Boolean> action);
+ method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> action);
method public static String getAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getAccessibilityValue(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityRangeInfo getAccessibilityValueRange(androidx.ui.semantics.SemanticsPropertyReceiver);
@@ -2199,7 +2199,7 @@
method public static boolean getHidden(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> getOnClick(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static boolean getPopup(androidx.ui.semantics.SemanticsPropertyReceiver);
- method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
+ method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getTestTag(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static void onClick(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function0<java.lang.Boolean> action);
method public static void setAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
@@ -2210,7 +2210,7 @@
method public static void setHidden(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
method public static void setOnClick(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> p);
method public static void setPopup(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
- method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> p);
+ method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> p);
method public static void setTestTag(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
}
diff --git a/ui/ui-core/api/current.txt b/ui/ui-core/api/current.txt
index 1151dec..617c8ce 100644
--- a/ui/ui-core/api/current.txt
+++ b/ui/ui-core/api/current.txt
@@ -2161,10 +2161,10 @@
public static final class SemanticsActions.Companion {
method public androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> getCustomActions();
method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> getOnClick();
- method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> getScrollTo();
+ method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> getScrollTo();
property public final androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> CustomActions;
property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> OnClick;
- property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> ScrollTo;
+ property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> ScrollTo;
}
public final class SemanticsKt {
@@ -2190,7 +2190,7 @@
}
public final class SemanticsPropertiesKt {
- method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super androidx.ui.unit.Px,? super androidx.ui.unit.Px,java.lang.Boolean> action);
+ method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> action);
method public static String getAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getAccessibilityValue(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityRangeInfo getAccessibilityValueRange(androidx.ui.semantics.SemanticsPropertyReceiver);
@@ -2199,7 +2199,7 @@
method public static boolean getHidden(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> getOnClick(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static boolean getPopup(androidx.ui.semantics.SemanticsPropertyReceiver);
- method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
+ method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getTestTag(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static void onClick(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function0<java.lang.Boolean> action);
method public static void setAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
@@ -2210,7 +2210,7 @@
method public static void setHidden(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
method public static void setOnClick(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> p);
method public static void setPopup(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
- method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> p);
+ method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> p);
method public static void setTestTag(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
}
diff --git a/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
index 66b69a3..1fa269f 100644
--- a/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
@@ -2163,10 +2163,10 @@
public static final class SemanticsActions.Companion {
method public androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> getCustomActions();
method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> getOnClick();
- method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> getScrollTo();
+ method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> getScrollTo();
property public final androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> CustomActions;
property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> OnClick;
- property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> ScrollTo;
+ property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> ScrollTo;
}
public final class SemanticsKt {
@@ -2192,7 +2192,7 @@
}
public final class SemanticsPropertiesKt {
- method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super androidx.ui.unit.Px,? super androidx.ui.unit.Px,java.lang.Boolean> action);
+ method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> action);
method public static String getAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getAccessibilityValue(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityRangeInfo getAccessibilityValueRange(androidx.ui.semantics.SemanticsPropertyReceiver);
@@ -2201,7 +2201,7 @@
method public static boolean getHidden(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> getOnClick(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static boolean getPopup(androidx.ui.semantics.SemanticsPropertyReceiver);
- method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
+ method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getTestTag(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static void onClick(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function0<java.lang.Boolean> action);
method public static void setAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
@@ -2212,7 +2212,7 @@
method public static void setHidden(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
method public static void setOnClick(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> p);
method public static void setPopup(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
- method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> p);
+ method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> p);
method public static void setTestTag(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
}
diff --git a/ui/ui-core/api/public_plus_experimental_current.txt b/ui/ui-core/api/public_plus_experimental_current.txt
index 66b69a3..1fa269f 100644
--- a/ui/ui-core/api/public_plus_experimental_current.txt
+++ b/ui/ui-core/api/public_plus_experimental_current.txt
@@ -2163,10 +2163,10 @@
public static final class SemanticsActions.Companion {
method public androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> getCustomActions();
method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> getOnClick();
- method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> getScrollTo();
+ method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> getScrollTo();
property public final androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> CustomActions;
property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> OnClick;
- property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> ScrollTo;
+ property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> ScrollTo;
}
public final class SemanticsKt {
@@ -2192,7 +2192,7 @@
}
public final class SemanticsPropertiesKt {
- method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super androidx.ui.unit.Px,? super androidx.ui.unit.Px,java.lang.Boolean> action);
+ method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> action);
method public static String getAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getAccessibilityValue(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityRangeInfo getAccessibilityValueRange(androidx.ui.semantics.SemanticsPropertyReceiver);
@@ -2201,7 +2201,7 @@
method public static boolean getHidden(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> getOnClick(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static boolean getPopup(androidx.ui.semantics.SemanticsPropertyReceiver);
- method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
+ method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getTestTag(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static void onClick(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function0<java.lang.Boolean> action);
method public static void setAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
@@ -2212,7 +2212,7 @@
method public static void setHidden(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
method public static void setOnClick(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> p);
method public static void setPopup(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
- method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> p);
+ method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> p);
method public static void setTestTag(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
}
diff --git a/ui/ui-core/api/restricted_0.1.0-dev14.txt b/ui/ui-core/api/restricted_0.1.0-dev14.txt
index 8d478ee..e266052 100644
--- a/ui/ui-core/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-core/api/restricted_0.1.0-dev14.txt
@@ -2226,10 +2226,10 @@
public static final class SemanticsActions.Companion {
method public androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> getCustomActions();
method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> getOnClick();
- method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> getScrollTo();
+ method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> getScrollTo();
property public final androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> CustomActions;
property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> OnClick;
- property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> ScrollTo;
+ property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> ScrollTo;
}
public final class SemanticsKt {
@@ -2255,7 +2255,7 @@
}
public final class SemanticsPropertiesKt {
- method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super androidx.ui.unit.Px,? super androidx.ui.unit.Px,java.lang.Boolean> action);
+ method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> action);
method public static String getAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getAccessibilityValue(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityRangeInfo getAccessibilityValueRange(androidx.ui.semantics.SemanticsPropertyReceiver);
@@ -2264,7 +2264,7 @@
method public static boolean getHidden(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> getOnClick(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static boolean getPopup(androidx.ui.semantics.SemanticsPropertyReceiver);
- method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
+ method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getTestTag(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static void onClick(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function0<java.lang.Boolean> action);
method public static void setAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
@@ -2275,7 +2275,7 @@
method public static void setHidden(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
method public static void setOnClick(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> p);
method public static void setPopup(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
- method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> p);
+ method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> p);
method public static void setTestTag(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
}
diff --git a/ui/ui-core/api/restricted_current.txt b/ui/ui-core/api/restricted_current.txt
index 8d478ee..e266052 100644
--- a/ui/ui-core/api/restricted_current.txt
+++ b/ui/ui-core/api/restricted_current.txt
@@ -2226,10 +2226,10 @@
public static final class SemanticsActions.Companion {
method public androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> getCustomActions();
method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> getOnClick();
- method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> getScrollTo();
+ method public androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> getScrollTo();
property public final androidx.ui.semantics.SemanticsPropertyKey<java.util.List<androidx.ui.semantics.CustomAccessibilityAction>> CustomActions;
property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>>> OnClick;
- property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>>> ScrollTo;
+ property public final androidx.ui.semantics.SemanticsPropertyKey<androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>>> ScrollTo;
}
public final class SemanticsKt {
@@ -2255,7 +2255,7 @@
}
public final class SemanticsPropertiesKt {
- method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super androidx.ui.unit.Px,? super androidx.ui.unit.Px,java.lang.Boolean> action);
+ method public static void ScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> action);
method public static String getAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getAccessibilityValue(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityRangeInfo getAccessibilityValueRange(androidx.ui.semantics.SemanticsPropertyReceiver);
@@ -2264,7 +2264,7 @@
method public static boolean getHidden(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> getOnClick(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static boolean getPopup(androidx.ui.semantics.SemanticsPropertyReceiver);
- method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
+ method public static androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> getScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static String getTestTag(androidx.ui.semantics.SemanticsPropertyReceiver);
method public static void onClick(androidx.ui.semantics.SemanticsPropertyReceiver, String? label = null, kotlin.jvm.functions.Function0<java.lang.Boolean> action);
method public static void setAccessibilityLabel(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
@@ -2275,7 +2275,7 @@
method public static void setHidden(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
method public static void setOnClick(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function0<java.lang.Boolean>> p);
method public static void setPopup(androidx.ui.semantics.SemanticsPropertyReceiver, boolean p);
- method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<androidx.ui.unit.Px,androidx.ui.unit.Px,java.lang.Boolean>> p);
+ method public static void setScrollTo(androidx.ui.semantics.SemanticsPropertyReceiver, androidx.ui.semantics.AccessibilityAction<kotlin.jvm.functions.Function2<java.lang.Float,java.lang.Float,java.lang.Boolean>> p);
method public static void setTestTag(androidx.ui.semantics.SemanticsPropertyReceiver, String p);
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
index 2b0aedd6..a5a6d81 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
@@ -33,7 +33,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.height
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import androidx.ui.unit.width
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
@@ -82,13 +81,13 @@
activity.runOnUiThread {
assertEquals(PxPosition(10f, 10f), layoutCoordinates.positionInRoot)
val bounds = layoutCoordinates.boundsInRoot
- assertEquals(PxBounds(10.px, 10.px, 40.px, 40.px), bounds)
+ assertEquals(PxBounds(10f, 10f, 40f, 40f), bounds)
val global = layoutCoordinates.globalBounds
val position = layoutCoordinates.globalPosition
- assertEquals(position.x, global.left.value)
- assertEquals(position.y, global.top.value)
- assertEquals(30.px, global.width)
- assertEquals(30.px, global.height)
+ assertEquals(position.x, global.left)
+ assertEquals(position.y, global.top)
+ assertEquals(30f, global.width)
+ assertEquals(30f, global.height)
}
}
@@ -109,7 +108,7 @@
assertTrue(positionLatch.await(1, TimeUnit.SECONDS))
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
- assertEquals(PxBounds(5.px, 0.px, 25.px, 30.px), bounds)
+ assertEquals(PxBounds(5f, 0f, 25f, 30f), bounds)
assertEquals(PxPosition(5f, 0f), layoutCoordinates.positionInRoot)
}
}
@@ -131,7 +130,7 @@
assertTrue(positionLatch.await(1, TimeUnit.SECONDS))
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
- assertEquals(PxBounds(0.px, 10.px, 30.px, 20.px), bounds)
+ assertEquals(PxBounds(0f, 10f, 30f, 20f), bounds)
assertEquals(PxPosition(30f, 10f), layoutCoordinates.positionInRoot)
}
}
@@ -154,7 +153,7 @@
assertTrue(positionLatch.await(1, TimeUnit.SECONDS))
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
- assertEquals(PxBounds(20.px, 10.px, 30.px, 20.px), bounds)
+ assertEquals(PxBounds(20f, 10f, 30f, 20f), bounds)
assertEquals(PxPosition(30f, 10f), layoutCoordinates.positionInRoot)
}
}
@@ -177,7 +176,7 @@
assertTrue(positionLatch.await(1, TimeUnit.SECONDS))
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
- assertEquals(PxBounds(15.px, 18.px, 25.px, 28.px), bounds)
+ assertEquals(PxBounds(15f, 18f, 25f, 28f), bounds)
assertEquals(PxPosition(15f, 18f), layoutCoordinates.positionInRoot)
}
}
@@ -201,7 +200,7 @@
assertTrue(positionLatch.await(1, TimeUnit.SECONDS))
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
- assertEquals(PxBounds(10.px, 10.px, 20.px, 20.px), bounds)
+ assertEquals(PxBounds(10f, 10f, 20f, 20f), bounds)
// Positions aren't clipped
assertEquals(PxPosition(5f, 10f), layoutCoordinates.positionInRoot)
}
@@ -228,8 +227,8 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
// should be completely clipped out
- assertEquals(0.px, bounds.width)
- assertEquals(0.px, bounds.height)
+ assertEquals(0f, bounds.width)
+ assertEquals(0f, bounds.height)
}
}
}
\ No newline at end of file
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
index f1ce65a..77fec16 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
@@ -34,7 +34,6 @@
import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import androidx.ui.unit.toPx
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
@@ -66,8 +65,8 @@
val size = 50.ipx
var index by mutableStateOf(0)
var latch = CountDownLatch(2)
- var wrap1Position = 0.px
- var wrap2Position = 0.px
+ var wrap1Position = 0f
+ var wrap2Position = 0f
rule.runOnUiThread {
activity.setContent {
SimpleRow {
@@ -77,7 +76,7 @@
minWidth = size,
minHeight = size,
modifier = Modifier.onPositioned { coordinates ->
- wrap1Position = coordinates.globalPosition.x.px
+ wrap1Position = coordinates.globalPosition.x
latch.countDown()
}
)
@@ -86,7 +85,7 @@
minWidth = size,
minHeight = size,
modifier = Modifier.onPositioned { coordinates ->
- wrap2Position = coordinates.globalPosition.x.px
+ wrap2Position = coordinates.globalPosition.x
latch.countDown()
}
)
@@ -96,15 +95,15 @@
}
}
assertTrue(latch.await(1, TimeUnit.SECONDS))
- assertEquals(0.px, wrap1Position)
- assertEquals(size.toPx(), wrap2Position)
+ assertEquals(0f, wrap1Position)
+ assertEquals(size.toPx().value, wrap2Position)
latch = CountDownLatch(2)
rule.runOnUiThread {
index = 1
}
assertTrue(latch.await(1, TimeUnit.SECONDS))
- assertEquals(size.toPx(), wrap1Position)
- assertEquals(0.px, wrap2Position)
+ assertEquals(size.toPx().value, wrap1Position)
+ assertEquals(0f, wrap2Position)
}
@Test
@@ -290,14 +289,14 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
rule.runOnUiThread {
- assertEquals(PxBounds(5.px, 5.px, 15.px, 15.px), coordinates!!.boundsInParent)
+ assertEquals(PxBounds(5f, 5f, 15f, 15f), coordinates!!.boundsInParent)
var root = coordinates!!
while (root.parentCoordinates != null) {
root = root.parentCoordinates!!
}
- assertEquals(PxBounds(0.px, 0.px, 20.px, 20.px), root.boundsInParent)
+ assertEquals(PxBounds(0f, 0f, 20f, 20f), root.boundsInParent)
}
}
}
\ No newline at end of file
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RootNodeLayoutTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RootNodeLayoutTest.kt
index 64c5d88..5e5ca89 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RootNodeLayoutTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RootNodeLayoutTest.kt
@@ -32,7 +32,6 @@
import androidx.ui.layout.fillMaxSize
import androidx.ui.unit.PxBounds
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.Assert.assertNotNull
@@ -96,7 +95,7 @@
assertTrue(latch.await(1, TimeUnit.SECONDS))
assertNotNull(coordinates)
- assertEquals(PxBounds(left = 0.px, top = 0.px, right = 10.px, bottom = 10.px),
+ assertEquals(PxBounds(left = 0f, top = 0f, right = 10f, bottom = 10f),
coordinates!!.boundsInRoot)
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt b/ui/ui-core/src/main/java/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
index df42734..51d2b3d 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
@@ -128,10 +128,10 @@
try {
info.setBoundsInScreen(
android.graphics.Rect(
- semanticsNode.globalBounds.left.value.toInt(),
- semanticsNode.globalBounds.top.value.toInt(),
- semanticsNode.globalBounds.right.value.toInt(),
- semanticsNode.globalBounds.bottom.value.toInt()
+ semanticsNode.globalBounds.left.toInt(),
+ semanticsNode.globalBounds.top.toInt(),
+ semanticsNode.globalBounds.right.toInt(),
+ semanticsNode.globalBounds.bottom.toInt()
)
)
} catch (e: IllegalStateException) {
@@ -471,8 +471,8 @@
private fun getVirtualViewAt(x: Float, y: Float): Int {
var node = view.semanticsOwner.rootSemanticsNode
- var id = findVirtualViewAt(x + node.globalBounds.left.value,
- y + node.globalBounds.top.value, node)
+ var id = findVirtualViewAt(x + node.globalBounds.left,
+ y + node.globalBounds.top, node)
if (id == node.id) {
return AccessibilityNodeProviderCompat.HOST_VIEW_ID
}
@@ -488,8 +488,8 @@
}
}
- if (node.globalBounds.left.value < x && node.globalBounds.right.value > x && node
- .globalBounds.top.value < y && node.globalBounds.bottom.value > y) {
+ if (node.globalBounds.left < x && node.globalBounds.right > x && node
+ .globalBounds.top < y && node.globalBounds.bottom > y) {
return node.id
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
index 881107a..1a44ca0 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
@@ -20,8 +20,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
-import androidx.ui.unit.toPx
/**
* A holder of the measured bounds for the layout (MeasureBox).
@@ -112,7 +110,7 @@
*/
val LayoutCoordinates.boundsInParent: PxBounds
get() = parentCoordinates?.childBoundingBox(this)
- ?: PxBounds(0.px, 0.px, size.width.toPx(), size.height.toPx())
+ ?: PxBounds(0f, 0f, size.width.value.toFloat(), size.height.value.toFloat())
/**
* The global boundaries of this layout inside.
@@ -123,10 +121,10 @@
val rootPosition = root.localToGlobal(PxPosition.Origin)
val bounds = root.childBoundingBox(this)
return PxBounds(
- left = bounds.left + rootPosition.x.px,
- top = bounds.top + rootPosition.y.px,
- right = bounds.right + rootPosition.x.px,
- bottom = bounds.bottom + rootPosition.y.px
+ left = bounds.left + rootPosition.x,
+ top = bounds.top + rootPosition.y,
+ right = bounds.right + rootPosition.x,
+ bottom = bounds.bottom + rootPosition.y
)
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
index cb16418..0140b8a 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
@@ -29,7 +29,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import androidx.ui.unit.toPxPosition
/**
@@ -282,10 +281,10 @@
wrapper = parent
}
return PxBounds(
- left = bounds.left.px,
- top = bounds.top.px,
- right = bounds.right.px,
- bottom = bounds.bottom.px
+ left = bounds.left,
+ top = bounds.top,
+ right = bounds.right,
+ bottom = bounds.bottom
)
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/semantics/SemanticsProperties.kt b/ui/ui-core/src/main/java/androidx/ui/semantics/SemanticsProperties.kt
index 1873937..8c393f6 100644
--- a/ui/ui-core/src/main/java/androidx/ui/semantics/SemanticsProperties.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/semantics/SemanticsProperties.kt
@@ -16,7 +16,6 @@
package androidx.ui.semantics
-import androidx.ui.unit.Px
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
@@ -70,7 +69,7 @@
// action to scroll to a specified position
val ScrollTo =
- SemanticsPropertyKey<AccessibilityAction<(x: Px, y: Px) -> Boolean>>("ScrollTo")
+ SemanticsPropertyKey<AccessibilityAction<(x: Float, y: Float) -> Boolean>>("ScrollTo")
// custom actions which are defined by app developers
val CustomActions =
@@ -202,7 +201,10 @@
this[SemanticsActions.OnClick] = AccessibilityAction(label, action)
}
-fun SemanticsPropertyReceiver.ScrollTo(label: String? = null, action: (x: Px, y: Px) -> Boolean) {
+fun SemanticsPropertyReceiver.ScrollTo(
+ label: String? = null,
+ action: (x: Float, y: Float) -> Boolean
+) {
this[SemanticsActions.ScrollTo] = AccessibilityAction(label, action)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
index 592c12b..8ef06e3 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
@@ -285,9 +285,9 @@
// when b/156389287 is fixed, this should be proper scrollTo with reverse handling
ScrollTo(action = { x, y ->
if (isVertical) {
- scrollerPosition.scrollBy(y.value)
+ scrollerPosition.scrollBy(y)
} else {
- scrollerPosition.scrollBy(x.value)
+ scrollerPosition.scrollBy(x)
}
return@ScrollTo true
})
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
index d5e06eb..0c1ef72 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
@@ -165,8 +165,8 @@
.wrapContentSize(Alignment.TopStart)
.offsetPx(state { offsetX }, state { offsetY })
.onPositioned { coordinates: LayoutCoordinates ->
- positionX = coordinates.globalPosition.x.roundToInt().toFloat()
- positionY = coordinates.globalPosition.y.roundToInt().toFloat()
+ positionX = coordinates.globalPosition.x
+ positionY = coordinates.globalPosition.y
}
) {
// TODO(popam): this box should not be needed after b/154758475 is fixed.
@@ -177,9 +177,8 @@
findByTag("stack").assertExists()
runOnIdleCompose {
Assert.assertEquals(
- containerWidth.toIntPx().value.toFloat() -
- offsetX.roundToInt().toFloat() - boxSize,
- positionX.roundToInt().toFloat()
+ containerWidth.toIntPx().value - offsetX.roundToInt() - boxSize,
+ positionX
)
Assert.assertEquals(offsetY, positionY)
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
index d657203..f7e2304 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
@@ -248,21 +248,21 @@
actual as PxSize
assertEquals(
- "Expected width ${expected.width.value} but obtained ${actual.width.value}",
- expected.width.value,
- actual.width.value,
+ "Expected width ${expected.width} but obtained ${actual.width}",
+ expected.width,
+ actual.width,
0f
)
assertEquals(
- "Expected height ${expected.height.value} but obtained ${actual.height.value}",
- expected.height.value,
- actual.height.value,
+ "Expected height ${expected.height} but obtained ${actual.height}",
+ expected.height,
+ actual.height,
0f
)
- if (actual.width.value != actual.width.value.toInt().toFloat()) {
+ if (actual.width != actual.width.toInt().toFloat()) {
fail("Expected integer width")
}
- if (actual.height.value != actual.height.value.toInt().toFloat()) {
+ if (actual.height != actual.height.toInt().toFloat()) {
fail("Expected integer height")
}
}
diff --git a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
index 20b3a72..209d646 100644
--- a/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
+++ b/ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
@@ -298,8 +298,8 @@
transitionDefinition {
tabPositions.forEachIndexed { index, position ->
state(index) {
- this[indicatorStart] = position.left.toPx()
- this[indicatorEnd] = position.right.toPx()
+ this[indicatorStart] = position.left.toPx().value
+ this[indicatorEnd] = position.right.toPx().value
this[indicatorColor] = colors[index % colors.size]
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
index f60edec..307f43c 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
@@ -144,7 +144,7 @@
val actionPositionY = actionCoords!!.globalPosition.y
val actionExpectedPositionY = (appBarBottomEdgeY - AppBarStartAndEndPadding.toPx() -
FakeIconSize.toPx()
- ).roundToInt()
+ ).roundToInt().toFloat()
assertThat(actionPositionY).isEqualTo(actionExpectedPositionY)
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
index 4da8b00..30f953e 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
@@ -149,8 +149,7 @@
// Absolute y position of the text baseline
val absoluteTextBaseline = textCoords.globalPosition.y + relativeTextBaseline
- val itemBottom = itemCoords.size.height.toPx().value +
- itemCoords.globalPosition.y
+ val itemBottom = itemCoords.size.height.toPx().value + itemCoords.globalPosition.y
// Text baseline should be 12.dp from the bottom of the item
Truth.assertThat(absoluteTextBaseline).isEqualTo(itemBottom - textBaseline)
@@ -240,10 +239,10 @@
composeTestRule.runOnIdleComposeWithDensity {
// The icon should be centered in the item, as there is no text placeable provided
val iconExpectedX = (itemCoords.size.width.toPx() - iconCoords.size.width.toPx()) / 2
- val iconExpectedY = (itemCoords.size.height - iconCoords.size.height) / 2
+ val iconExpectedY = (itemCoords.size.height.toPx() - iconCoords.size.height.toPx()) / 2
Truth.assertThat(iconCoords.globalPosition.x).isWithin(1f).of(iconExpectedX.value)
- Truth.assertThat(iconCoords.globalPosition.y).isEqualTo(iconExpectedY.toPx().value)
+ Truth.assertThat(iconCoords.globalPosition.y).isEqualTo(iconExpectedY.value)
}
}
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 5514a48..15c907b 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
@@ -221,7 +221,7 @@
}
with(composeTestRule.density) {
- assertThat(realSize.height.value)
+ assertThat(realSize.height)
.isGreaterThan(36.dp.toIntPx().value.toFloat())
}
}
@@ -490,8 +490,8 @@
assertThat(contentBounds.width).isLessThan(buttonBounds.width)
assertThat(contentBounds.height).isLessThan(buttonBounds.height)
with(composeTestRule.density) {
- assertThat(contentBounds.width).isEqualTo(2.dp.toIntPx().toPx())
- assertThat(contentBounds.height).isEqualTo(2.dp.toIntPx().toPx())
+ assertThat(contentBounds.width).isEqualTo(2.dp.toIntPx().value.toFloat())
+ assertThat(contentBounds.height).isEqualTo(2.dp.toIntPx().value.toFloat())
}
assertWithinOnePixel(buttonBounds.center(), contentBounds.center())
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
index 8c75f3f..1020729 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
@@ -228,7 +228,7 @@
// Click on the left-center pixel of the drawer
findByTag("Drawer").doGesture {
val left = 1.0f
- val centerY = (globalBounds.height / 2).value
+ val centerY = (globalBounds.height / 2)
sendClick(PxPosition(left, centerY))
}
@@ -326,8 +326,8 @@
// Click on the bottom-center pixel of the drawer
findByTag("Drawer").doGesture {
val bounds = globalBounds
- val centerX = (bounds.width / 2).value
- val bottom = (bounds.height - 1.px).value
+ val centerX = bounds.width / 2
+ val bottom = bounds.height - 1.0f
sendClick(PxPosition(centerX, bottom))
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
index 6955ac6..3e77456 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
@@ -56,11 +56,9 @@
import androidx.ui.text.FirstBaseline
import androidx.ui.text.SoftwareKeyboardController
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import androidx.ui.unit.sp
import androidx.ui.unit.toPx
import com.google.common.truth.Truth.assertThat
@@ -238,10 +236,10 @@
assertThat(labelSize.value?.width).isGreaterThan(0.ipx)
// centered position
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx().value
+ ExpectedPadding.toIntPx().value.toFloat()
)
assertThat(labelPosition.value?.y).isEqualTo(
- ((height.toIntPx() - labelSize.value!!.height) / 2f).toPx().value
+ ((height.toIntPx() - labelSize.value!!.height) / 2f).value.toFloat()
)
}
}
@@ -262,7 +260,7 @@
labelPosition.value = it.globalPosition
labelSize.value = it.size
baseline.value =
- (it[FirstBaseline]!!.toPx() + labelPosition.value!!.y.px).value
+ it[FirstBaseline]!!.value.toFloat() + labelPosition.value!!.y
})
}
)
@@ -279,10 +277,10 @@
assertThat(labelSize.value?.width).isGreaterThan(0.ipx)
// label's top position
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx().value
+ ExpectedPadding.toIntPx().value.toFloat()
)
assertThat(baseline.value).isEqualTo(
- ExpectedBaselineOffset.toIntPx().toPx().value
+ ExpectedBaselineOffset.toIntPx().value.toFloat()
)
}
}
@@ -302,7 +300,7 @@
labelPosition.value = it.globalPosition
labelSize.value = it.size
baseline.value =
- (it[FirstBaseline]!!.toPx() + labelPosition.value!!.y.px).value
+ it[FirstBaseline]!!.value.toFloat() + labelPosition.value!!.y
})
}
)
@@ -316,10 +314,10 @@
assertThat(labelSize.value?.width).isGreaterThan(0.ipx)
// label's top position
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx().value
+ ExpectedPadding.toIntPx().value.toFloat()
)
assertThat(baseline.value).isEqualTo(
- ExpectedBaselineOffset.toIntPx().toPx().value
+ ExpectedBaselineOffset.toIntPx().value.toFloat()
)
}
}
@@ -341,8 +339,8 @@
placeholderPosition.value = it.globalPosition
placeholderSize.value = it.size
placeholderBaseline.value =
- (it[FirstBaseline]!!.toPx() + placeholderPosition.value!!.y
- .px).value
+ it[FirstBaseline]!!.value.toFloat() +
+ placeholderPosition.value!!.y
})
}
)
@@ -358,10 +356,10 @@
assertThat(placeholderSize.value?.width).isGreaterThan(0.ipx)
// placeholder's position
assertThat(placeholderPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx().value
+ ExpectedPadding.toIntPx().value.toFloat()
)
assertThat(placeholderBaseline.value).isEqualTo(
- (ExpectedBaselineOffset.toIntPx().toPx() * 2).value
+ ExpectedBaselineOffset.toIntPx().value.toFloat() * 2
)
}
}
@@ -370,7 +368,7 @@
fun testPlaceholderPosition_whenNoLabel() {
val placeholderSize = Ref<IntPxSize>()
val placeholderPosition = Ref<PxPosition>()
- val placeholderBaseline = Ref<Px>()
+ val placeholderBaseline = Ref<Float>()
val height = 60.dp
testRule.setMaterialContent {
Box {
@@ -384,7 +382,8 @@
placeholderPosition.value = it.globalPosition
placeholderSize.value = it.size
placeholderBaseline.value =
- it[FirstBaseline]!!.toPx() + placeholderPosition.value!!.y.px
+ it[FirstBaseline]!!.value.toFloat() +
+ placeholderPosition.value!!.y
})
}
)
@@ -400,10 +399,10 @@
assertThat(placeholderSize.value?.width).isGreaterThan(0.ipx)
// centered position
assertThat(placeholderPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx().value
+ ExpectedPadding.toIntPx().value.toFloat()
)
assertThat(placeholderPosition.value?.y).isEqualTo(
- ((height.toIntPx() - placeholderSize.value!!.height) / 2f).toPx().value
+ ((height.toIntPx() - placeholderSize.value!!.height) / 2f).value.toFloat()
)
}
}
@@ -493,18 +492,18 @@
testRule.runOnIdleComposeWithDensity {
// leading
assertThat(leadingSize.value).isEqualTo(IntPxSize(size.toIntPx(), size.toIntPx()))
- assertThat(leadingPosition.value?.x).isEqualTo(IconPadding.toIntPx().toPx().value)
+ assertThat(leadingPosition.value?.x).isEqualTo(IconPadding.toIntPx().value.toFloat())
assertThat(leadingPosition.value?.y).isEqualTo(
- ((textFieldHeight.toIntPx() - leadingSize.value!!.height) / 2f).toPx().value
+ ((textFieldHeight.toIntPx() - leadingSize.value!!.height) / 2f).value.toFloat()
)
// trailing
assertThat(trailingSize.value).isEqualTo(IntPxSize(size.toIntPx(), size.toIntPx()))
assertThat(trailingPosition.value?.x).isEqualTo(
(textFieldWidth.toIntPx() - IconPadding.toIntPx() - trailingSize.value!!.width)
- .toPx().value
+ .value.toFloat()
)
assertThat(trailingPosition.value?.y).isEqualTo(
- ((textFieldHeight.toIntPx() - trailingSize.value!!.height) / 2f).toPx().value
+ ((textFieldHeight.toIntPx() - trailingSize.value!!.height) / 2f).value.toFloat()
)
}
}
@@ -533,8 +532,8 @@
testRule.runOnIdleComposeWithDensity {
assertThat(labelPosition.value?.x).isEqualTo(
- (ExpectedPadding.toIntPx() + IconPadding.toIntPx() + iconSize.toIntPx())
- .toPx().value
+ (ExpectedPadding.toIntPx() + IconPadding.toIntPx() + iconSize.toIntPx()).value
+ .toFloat()
)
}
}
@@ -562,7 +561,7 @@
testRule.runOnIdleComposeWithDensity {
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx().value
+ ExpectedPadding.toIntPx().value.toFloat()
)
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
index 68495e1..efc7277 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
@@ -45,8 +45,6 @@
import androidx.ui.unit.center
import androidx.ui.unit.dp
import androidx.ui.unit.height
-import androidx.ui.unit.px
-import androidx.ui.unit.round
import androidx.ui.unit.toPx
import androidx.ui.unit.width
import com.google.common.truth.Truth.assertThat
@@ -54,6 +52,7 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
+import kotlin.math.roundToInt
@MediumTest
@RunWith(JUnit4::class)
@@ -118,8 +117,8 @@
)
}
with(composeTestRule.density) {
- assertThat(size.height.round()).isEqualTo(48.dp.toIntPx())
- assertThat(size.width.round().value).isAtLeast(48.dp.toIntPx().value)
+ assertThat(size.height.roundToInt().toFloat()).isEqualTo(48.dp.toIntPx().value)
+ assertThat(size.width.roundToInt().toFloat()).isAtLeast(48.dp.toIntPx().value)
}
}
@@ -133,8 +132,8 @@
)
}
with(composeTestRule.density) {
- assertThat(size.width.round()).isEqualTo(48.dp.toIntPx())
- assertThat(size.height.round()).isEqualTo(48.dp.toIntPx())
+ assertThat(size.width.roundToInt().toFloat()).isEqualTo(48.dp.toIntPx().value)
+ assertThat(size.height.roundToInt().toFloat()).isEqualTo(48.dp.toIntPx().value)
}
}
@@ -225,8 +224,8 @@
assertThat(contentBounds.width).isLessThan(buttonBounds.width)
assertThat(contentBounds.height).isLessThan(buttonBounds.height)
with(composeTestRule.density) {
- assertThat(contentBounds.width).isEqualTo(2.dp.toIntPx().toPx())
- assertThat(contentBounds.height).isEqualTo(2.dp.toIntPx().toPx())
+ assertThat(contentBounds.width).isEqualTo(2.dp.toIntPx().value.toFloat())
+ assertThat(contentBounds.height).isEqualTo(2.dp.toIntPx().value.toFloat())
}
assertWithinOnePixel(buttonBounds.center(), contentBounds.center())
}
@@ -256,15 +255,15 @@
assertThat(contentBounds.width).isLessThan(buttonBounds.width)
assertThat(contentBounds.height).isLessThan(buttonBounds.height)
with(composeTestRule.density) {
- assertThat(contentBounds.width).isEqualTo(2.dp.toIntPx().toPx())
- assertThat(contentBounds.height).isEqualTo(2.dp.toIntPx().toPx())
+ assertThat(contentBounds.width).isEqualTo(2.dp.toIntPx().value.toFloat())
+ assertThat(contentBounds.height).isEqualTo(2.dp.toIntPx().value.toFloat())
}
assertWithinOnePixel(buttonBounds.center(), contentBounds.center())
}
}
@Test
- fun extendedFabTextAndIconArePossitionedCorrectly() {
+ fun extendedFabTextAndIconArePositionedCorrectly() {
var buttonCoordinates: LayoutCoordinates? = null
var textCoordinates: LayoutCoordinates? = null
var iconCoordinates: LayoutCoordinates? = null
@@ -292,17 +291,17 @@
val textBounds = textCoordinates!!.boundsInRoot
val iconBounds = iconCoordinates!!.boundsInRoot
with(composeTestRule.density) {
- assertThat(textBounds.width).isEqualTo(2.dp.toIntPx().toPx())
- assertThat(textBounds.height).isEqualTo(2.dp.toIntPx().toPx())
- assertThat(iconBounds.width).isEqualTo(10.dp.toIntPx().toPx())
- assertThat(iconBounds.height).isEqualTo(10.dp.toIntPx().toPx())
+ assertThat(textBounds.width).isEqualTo(2.dp.toIntPx().value.toFloat())
+ assertThat(textBounds.height).isEqualTo(2.dp.toIntPx().value.toFloat())
+ assertThat(iconBounds.width).isEqualTo(10.dp.toIntPx().value.toFloat())
+ assertThat(iconBounds.height).isEqualTo(10.dp.toIntPx().value.toFloat())
assertWithinOnePixel(buttonBounds.center().y, iconBounds.center().y)
assertWithinOnePixel(buttonBounds.center().y, textBounds.center().y)
- val halfPadding = 6.dp.toIntPx().toPx()
+ val halfPadding = 6.dp.toIntPx().toPx().value
assertWithinOnePixel(
- (iconBounds.center().x.px + iconBounds.width / 2 + halfPadding).value,
- (textBounds.center().x.px - textBounds.width / 2 - halfPadding).value
+ iconBounds.center().x + iconBounds.width / 2 + halfPadding,
+ textBounds.center().x - textBounds.width / 2 - halfPadding
)
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
index dd359ac..56c5ee5 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
@@ -32,7 +32,6 @@
import androidx.ui.test.find
import androidx.ui.test.isToggleable
import androidx.ui.unit.dp
-import androidx.ui.unit.toPx
import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
@@ -79,8 +78,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
// Icon should be centered inside the IconButton
- Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().toPx().value)
- Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().toPx().value)
+ Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().value.toFloat())
+ Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().value.toFloat())
}
}
@@ -104,8 +103,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
- val expectedX = ((48.dp - width) / 2).toIntPx().toPx().value
- val expectedY = ((48.dp - height) / 2).toIntPx().toPx().value
+ val expectedX = ((48.dp - width) / 2).toIntPx().value.toFloat()
+ val expectedY = ((48.dp - height) / 2).toIntPx().value.toFloat()
// Icon should be centered inside the IconButton
Truth.assertThat(iconX).isEqualTo(expectedX)
Truth.assertThat(iconY).isEqualTo(expectedY)
@@ -143,8 +142,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
// Icon should be centered inside the IconButton
- Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().toPx().value)
- Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().toPx().value)
+ Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().value.toFloat())
+ Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().value.toFloat())
}
}
@@ -167,8 +166,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
- val expectedX = ((48.dp - width) / 2).toIntPx().toPx().value
- val expectedY = ((48.dp - height) / 2).toIntPx().toPx().value
+ val expectedX = ((48.dp - width) / 2).toIntPx().value.toFloat()
+ val expectedY = ((48.dp - height) / 2).toIntPx().value.toFloat()
// Icon should be centered inside the IconButton
Truth.assertThat(iconX).isEqualTo(expectedX)
Truth.assertThat(iconY).isEqualTo(expectedY)
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
index 0db9b50..d35fb91 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
@@ -202,14 +202,14 @@
}
}
composeTestRule.runOnIdleComposeWithDensity {
- assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
- .toFloat())
+ assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx()
+ .value.toFloat())
assertThat(textPosition.value!!.y).isEqualTo(
((listItemHeight.toIntPx() - textSize.value!!.height) / 2).value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ dm.widthPixels - trailingSize.value!!.width.value -
expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingPosition.value!!.y).isEqualTo(
@@ -237,14 +237,15 @@
}
}
composeTestRule.runOnIdleComposeWithDensity {
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx()
- .value.toFloat())
+ assertThat(iconPosition.value!!.x).isEqualTo(
+ expectedLeftPadding.toIntPx().value.toFloat()
+ )
assertThat(iconPosition.value!!.y).isEqualTo(
((listItemHeight.toIntPx() - iconSize.value!!.height) / 2).value.toFloat()
)
assertThat(textPosition.value!!.x).isEqualTo(
expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ iconSize.value!!.width.value +
expectedTextLeftPadding.toIntPx().value.toFloat()
)
assertThat(textPosition.value!!.y).isEqualTo(
@@ -292,10 +293,12 @@
}
}
composeTestRule.runOnIdleComposeWithDensity {
- assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
- .toFloat())
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
- .toFloat())
+ assertThat(textPosition.value!!.x).isEqualTo(
+ expectedLeftPadding.toIntPx().value.toFloat()
+ )
+ assertThat(textBaseline.value!!).isEqualTo(
+ expectedTextBaseline.toIntPx().value.toFloat()
+ )
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
expectedLeftPadding.toIntPx().value.toFloat()
)
@@ -305,7 +308,7 @@
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ dm.widthPixels - trailingSize.value!!.width.value -
expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingBaseline.value!!).isEqualTo(
@@ -354,15 +357,15 @@
}
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ expectedLeftPadding.toIntPx().value.toFloat() + iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
- .toFloat())
+ assertThat(textBaseline.value!!).isEqualTo(
+ expectedTextBaseline.toIntPx().value.toFloat()
+ )
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
@@ -425,29 +428,30 @@
}
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ expectedLeftPadding.toIntPx().value.toFloat() + iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
- .toFloat())
+ assertThat(textBaseline.value!!).isEqualTo(
+ expectedTextBaseline.toIntPx().value.toFloat()
+ )
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
expectedTextBaseline.toIntPx().value.toFloat() +
expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
- .toFloat())
+ assertThat(iconPosition.value!!.x).isEqualTo(
+ expectedLeftPadding.toIntPx().value.toFloat()
+ )
assertThat(iconPosition.value!!.y).isEqualTo(
expectedIconTopPadding.toIntPx().value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ dm.widthPixels - trailingSize.value!!.width.value -
expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingPosition.value!!.y).isEqualTo(
@@ -503,23 +507,22 @@
}
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ expectedLeftPadding.toIntPx().value.toFloat() + iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
- .toFloat())
+ assertThat(textBaseline.value!!).isEqualTo(
+ expectedTextBaseline.toIntPx().value.toFloat()
+ )
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ expectedLeftPadding.toIntPx().value.toFloat() + iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
expectedTextBaseline.toIntPx().value.toFloat() +
expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
- .toFloat())
+ assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx()
+ .value.toFloat())
assertThat(iconPosition.value!!.y).isEqualTo(
expectedIconTopPadding.toIntPx().value.toFloat()
)
@@ -606,7 +609,7 @@
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(textBaseline.value!!).isEqualTo(
@@ -615,7 +618,7 @@
)
assertThat(overlineTextPosition.value!!.x).isEqualTo(
expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(overlineTextBaseline.value!!).isEqualTo(
@@ -623,7 +626,7 @@
)
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
expectedLeftPadding.toIntPx().value.toFloat() +
- iconSize.value!!.width.value.toFloat() +
+ iconSize.value!!.width.value +
expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
@@ -631,14 +634,15 @@
expectedTextBaselineOffset.toIntPx().value.toFloat() +
expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
- .toFloat())
+ assertThat(iconPosition.value!!.x).isEqualTo(
+ expectedLeftPadding.toIntPx().value.toFloat()
+ )
assertThat(iconPosition.value!!.y).isEqualTo(
expectedIconTopPadding.toIntPx().value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ dm.widthPixels - trailingSize.value!!.width.value -
expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingBaseline.value!!).isEqualTo(
@@ -656,7 +660,7 @@
): Modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
coords.value = coordinates.localToGlobal(PxPosition.Origin)
baseline.value = coordinates[FirstBaseline]?.value?.toFloat()?.let {
- (it + coords.value!!.y)
+ it + coords.value!!.y
}
size.value = coordinates.size
}
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 8b504e6..246686d 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
@@ -45,7 +45,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.toPx
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -261,8 +260,9 @@
localTextCoords[FirstBaseline]!!
).isEqualTo(30.dp.toIntPx())
- assertThat(buttonCenter)
- .isEqualTo((localSnackCoords.size.height / 2).value.toFloat())
+ assertThat(buttonCenter).isEqualTo(
+ (localSnackCoords.size.height / 2).value.toFloat()
+ )
}
}
}
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 c61b4b7..faf7797 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
@@ -151,7 +151,7 @@
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
+ val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
tabRowWidth to tabRowHeight
@@ -169,7 +169,8 @@
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
+ val expectedPositionY =
+ (tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
}
}
@@ -357,11 +358,11 @@
// Indicator should be placed in the bottom left of the first tab
val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
// Tabs in a scrollable tab row are offset 52.dp from each end
- val expectedPositionX = scrollableTabRowOffset.toIntPx().toPx().value
+ val expectedPositionX = scrollableTabRowOffset.toIntPx().value.toFloat()
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
+ val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
tabRowHeight
@@ -374,12 +375,13 @@
// should be in the middle of the TabRow
composeTestRule.runOnIdleComposeWithDensity {
val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
- val expectedPositionX = (scrollableTabRowOffset + minimumTabWidth).toIntPx()
- .toPx().value
+ val expectedPositionX =
+ (scrollableTabRowOffset + minimumTabWidth).toIntPx().value.toFloat()
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
+ val expectedPositionY =
+ (tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
}
}
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 41842d2..db43986 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
@@ -230,11 +230,11 @@
val cutoutOffset = with(density) { BottomAppBarCutoutOffset.toPx() }
val cutoutSize = Size(
- width = fabBounds.width.value + (cutoutOffset * 2),
- height = fabBounds.height.value + (cutoutOffset * 2)
+ width = fabBounds.width + (cutoutOffset * 2),
+ height = fabBounds.height + (cutoutOffset * 2)
)
- val cutoutStartX = fabBounds.left.value - cutoutOffset
+ val cutoutStartX = fabBounds.left - cutoutOffset
val cutoutEndX = cutoutStartX + cutoutSize.width
val cutoutRadius = cutoutSize.height / 2f
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 321f2fd..0318a14 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
@@ -239,7 +239,7 @@
* surface it belongs to.
*/
internal fun getRippleStartRadius(size: PxSize) =
- max(size.width.value, size.height.value) * 0.3f
+ max(size.width, size.height) * 0.3f
/**
* According to specs the ending radius
@@ -248,7 +248,7 @@
*/
internal fun Density.getRippleEndRadius(bounded: Boolean, size: PxSize): Float {
val radiusCoveringBounds =
- (PxPosition(size.width.value, size.height.value).getDistance() / 2f).value
+ (PxPosition(size.width, size.height).getDistance() / 2f).value
return if (bounded) {
radiusCoveringBounds + BoundedRippleExtraRadius.toPx()
} else {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
index d5c0c56..d59a833 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
@@ -86,8 +86,8 @@
Box(Modifier.semantics {
ScrollTo(action = { x, y ->
- currentScrollPositionY = y.value
- currentScrollPositionX = x.value
+ currentScrollPositionY = y
+ currentScrollPositionX = x
return@ScrollTo true
})
}) {
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt b/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
index 3608d7f..1f1ceb8 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
@@ -21,7 +21,6 @@
import androidx.ui.semantics.SemanticsActions
import androidx.ui.semantics.SemanticsPropertyKey
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
/**
* Performs a click action on the given component.
@@ -71,8 +70,8 @@
runOnUiThread {
scrollableSemanticsNode.config[SemanticsActions.ScrollTo].action(
- (globalPosition.x - position.x).px,
- (globalPosition.y - position.y).px
+ (globalPosition.x - position.x),
+ (globalPosition.y - position.y)
)
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/Assertions.kt b/ui/ui-test/src/main/java/androidx/ui/test/Assertions.kt
index 1dd7d7d..84a8f75 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/Assertions.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/Assertions.kt
@@ -315,12 +315,12 @@
return false
}
- return (globalRect.width > 0.px && globalRect.height > 0.px)
+ return (globalRect.width > 0f && globalRect.height > 0f)
}
private fun SemanticsNode.isInScreenBounds(): Boolean {
val nodeBounds = globalBounds
- if (nodeBounds.width == 0.px && nodeBounds.height == 0.px) {
+ if (nodeBounds.width == 0f && nodeBounds.height == 0f) {
return false
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/ErrorMessages.kt b/ui/ui-test/src/main/java/androidx/ui/test/ErrorMessages.kt
index 397761d..6014bad 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/ErrorMessages.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/ErrorMessages.kt
@@ -235,7 +235,7 @@
}
private fun pxBoundsToShortString(bounds: PxBounds): String {
- return "LTRB(${bounds.left}, ${bounds.top}, ${bounds.right}, ${bounds.bottom})"
+ return "LTRB(${bounds.left}.px, ${bounds.top}.px, ${bounds.right}.px, ${bounds.bottom}.px)"
}
private fun StringBuilder.appendConfigInfo(config: SemanticsConfiguration) {
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt b/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
index ce7d058..5cb47e8 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
@@ -98,7 +98,7 @@
*/
fun BaseGestureScope.localToGlobal(position: PxPosition): PxPosition {
val bounds = globalBounds
- return position + PxPosition(bounds.left.value, bounds.top.value)
+ return position + PxPosition(bounds.left, bounds.top)
}
/**
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 bd1134a..78492a5 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
@@ -27,9 +27,9 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.round
import androidx.ui.unit.toPxSize
import kotlin.math.abs
+import kotlin.math.roundToInt
/**
* Constant to emulate very big but finite constraints
@@ -96,33 +96,33 @@
fun assertWidthEqualsTo(expectedWidthPx: Density.() -> IntPx): CollectedSizes {
val widthPx = with(density) {
- expectedWidthPx()
+ expectedWidthPx().value
}
- assertSize(size.width.round(), widthPx)
+ assertSize(size.width.roundToInt(), widthPx)
return this
}
fun assertHeightEqualsTo(expectedHeightPx: Density.() -> IntPx): CollectedSizes {
val heightPx = with(density) {
- expectedHeightPx()
+ expectedHeightPx().value
}
- assertSize(size.height.round(), heightPx)
+ assertSize(size.height.roundToInt(), heightPx)
return this
}
fun assertIsSquareWithSize(expectedSquarePx: Density.() -> IntPx): CollectedSizes {
val squarePx = with(density) {
- expectedSquarePx()
+ expectedSquarePx().value
}
- assertSize(size.width.round(), squarePx)
- assertSize(size.height.round(), squarePx)
+ assertSize(size.width.roundToInt(), squarePx)
+ assertSize(size.height.roundToInt(), squarePx)
return this
}
}
-private fun assertSize(actual: IntPx, expected: IntPx) {
+private fun assertSize(actual: Int, expected: Int) {
// TODO: because if dp and ipx collision. Remove dp assertion later
- if (abs(actual.value - expected.value) > 1) {
+ if (abs(actual - expected) > 1) {
throw AssertionError("Found size: $actual pixels.\nExpected size $expected pixels")
}
}
\ No newline at end of file
diff --git a/ui/ui-tooling/src/main/java/androidx/ui/tooling/preview/ComposeViewAdapter.kt b/ui/ui-tooling/src/main/java/androidx/ui/tooling/preview/ComposeViewAdapter.kt
index 6b58080..68b02f1 100644
--- a/ui/ui-tooling/src/main/java/androidx/ui/tooling/preview/ComposeViewAdapter.kt
+++ b/ui/ui-tooling/src/main/java/androidx/ui/tooling/preview/ComposeViewAdapter.kt
@@ -43,7 +43,6 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxBounds
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.toPx
import androidx.ui.unit.toRect
import kotlin.reflect.KClass
@@ -214,10 +213,10 @@
if (it.hasBounds()) {
canvas?.apply {
val pxBounds = PxBounds(
- it.bounds.left.toPx(),
- it.bounds.top.toPx(),
- it.bounds.right.toPx(),
- it.bounds.bottom.toPx()
+ it.bounds.left.value.toFloat(),
+ it.bounds.top.value.toFloat(),
+ it.bounds.right.value.toFloat(),
+ it.bounds.bottom.value.toFloat()
)
drawRect(pxBounds.toRect().toAndroidRect(), debugBoundsPaint)
}
diff --git a/ui/ui-unit/api/0.1.0-dev14.txt b/ui/ui-unit/api/0.1.0-dev14.txt
index 2b523bc..14182cc 100644
--- a/ui/ui-unit/api/0.1.0-dev14.txt
+++ b/ui/ui-unit/api/0.1.0-dev14.txt
@@ -460,11 +460,12 @@
}
@androidx.compose.Immutable public final class PxBounds {
+ ctor public PxBounds(float left, float top, float right, float bottom);
method public float component1();
method public float component2();
method public float component3();
method public float component4();
- method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy-wHlpFhg(float left, float top, float right, float bottom);
+ method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy(float left, float top, float right, float bottom);
method public float getBottom();
method public float getLeft();
method public float getRight();
diff --git a/ui/ui-unit/api/current.txt b/ui/ui-unit/api/current.txt
index 2b523bc..14182cc 100644
--- a/ui/ui-unit/api/current.txt
+++ b/ui/ui-unit/api/current.txt
@@ -460,11 +460,12 @@
}
@androidx.compose.Immutable public final class PxBounds {
+ ctor public PxBounds(float left, float top, float right, float bottom);
method public float component1();
method public float component2();
method public float component3();
method public float component4();
- method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy-wHlpFhg(float left, float top, float right, float bottom);
+ method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy(float left, float top, float right, float bottom);
method public float getBottom();
method public float getLeft();
method public float getRight();
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
index 2b523bc..14182cc 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
@@ -460,11 +460,12 @@
}
@androidx.compose.Immutable public final class PxBounds {
+ ctor public PxBounds(float left, float top, float right, float bottom);
method public float component1();
method public float component2();
method public float component3();
method public float component4();
- method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy-wHlpFhg(float left, float top, float right, float bottom);
+ method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy(float left, float top, float right, float bottom);
method public float getBottom();
method public float getLeft();
method public float getRight();
diff --git a/ui/ui-unit/api/public_plus_experimental_current.txt b/ui/ui-unit/api/public_plus_experimental_current.txt
index 2b523bc..14182cc 100644
--- a/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -460,11 +460,12 @@
}
@androidx.compose.Immutable public final class PxBounds {
+ ctor public PxBounds(float left, float top, float right, float bottom);
method public float component1();
method public float component2();
method public float component3();
method public float component4();
- method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy-wHlpFhg(float left, float top, float right, float bottom);
+ method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy(float left, float top, float right, float bottom);
method public float getBottom();
method public float getLeft();
method public float getRight();
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev14.txt b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
index 2addb31..cd7cfe1 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
@@ -464,11 +464,12 @@
}
@androidx.compose.Immutable public final class PxBounds {
+ ctor public PxBounds(float left, float top, float right, float bottom);
method public float component1();
method public float component2();
method public float component3();
method public float component4();
- method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy-wHlpFhg(float left, float top, float right, float bottom);
+ method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy(float left, float top, float right, float bottom);
method public float getBottom();
method public float getLeft();
method public float getRight();
diff --git a/ui/ui-unit/api/restricted_current.txt b/ui/ui-unit/api/restricted_current.txt
index 2addb31..cd7cfe1 100644
--- a/ui/ui-unit/api/restricted_current.txt
+++ b/ui/ui-unit/api/restricted_current.txt
@@ -464,11 +464,12 @@
}
@androidx.compose.Immutable public final class PxBounds {
+ ctor public PxBounds(float left, float top, float right, float bottom);
method public float component1();
method public float component2();
method public float component3();
method public float component4();
- method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy-wHlpFhg(float left, float top, float right, float bottom);
+ method @androidx.compose.Immutable public androidx.ui.unit.PxBounds copy(float left, float top, float right, float bottom);
method public float getBottom();
method public float getLeft();
method public float getRight();
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
index 5826d71..de88bb7 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
@@ -501,15 +501,15 @@
* The horizontal aspect of the size in [Px].
*/
@Stable
- inline val width: Px
- get() = unpackFloat1(value).px
+ inline val width: Float
+ get() = unpackFloat1(value)
/**
* The vertical aspect of the size in [Px].
*/
@Stable
- inline val height: Px
- get() = unpackFloat2(value).px
+ inline val height: Float
+ get() = unpackFloat2(value)
/**
* Returns a PxSize scaled by multiplying [width] and [height] by [other]
@@ -559,13 +559,13 @@
* [PxSize] with zero values.
*/
@Stable
- val Zero = PxSize(0.px, 0.px)
+ val Zero = PxSize(0f, 0f)
/**
* Default value indicating no specified size
*/
@Stable
- val UnspecifiedSize = PxSize(Px.Infinity, Px.Infinity)
+ val UnspecifiedSize = PxSize(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY)
}
}
@@ -605,7 +605,7 @@
*/
@Stable
fun PxSize.center(): PxPosition {
- return PxPosition(width.value / 2f, height.value / 2f)
+ return PxPosition(width / 2f, height / 2f)
}
/**
@@ -714,43 +714,43 @@
PxPosition(lerp(start.x, stop.x, fraction), lerp(start.y, stop.y, fraction))
/**
- * A four dimensional bounds using [Px] for units
+ * A four dimensional bounds using pixels for units
*/
@Immutable
data class PxBounds(
- val left: Px,
- val top: Px,
- val right: Px,
- val bottom: Px
+ val left: Float,
+ val top: Float,
+ val right: Float,
+ val bottom: Float
)
@Stable
inline fun PxBounds(topLeft: PxPosition, size: PxSize) =
PxBounds(
- left = topLeft.x.px,
- top = topLeft.y.px,
- right = topLeft.x.px + size.width,
- bottom = topLeft.y.px + size.height
+ left = topLeft.x,
+ top = topLeft.y,
+ right = topLeft.x + size.width,
+ bottom = topLeft.y + size.height
)
/**
* A width of this PxBounds in [Px].
*/
@Stable
-inline val PxBounds.width: Px get() = right - left
+inline val PxBounds.width: Float get() = right - left
/**
* A height of this PxBounds in [Px].
*/
@Stable
-inline val PxBounds.height: Px get() = bottom - top
+inline val PxBounds.height: Float get() = bottom - top
/**
* Returns the [PxPosition] of the center of the [PxBounds].
*/
@Stable
inline fun PxBounds.center(): PxPosition {
- return PxPosition(left.value + width.value / 2f, top.value + height.value / 2f)
+ return PxPosition(left + width / 2f, top + height / 2f)
}
/**
@@ -767,7 +767,7 @@
*/
@Stable
fun PxSize.toBounds(): PxBounds {
- return PxBounds(0.px, 0.px, width, height)
+ return PxBounds(0f, 0f, width, height)
}
/**
@@ -776,10 +776,10 @@
@Stable
fun PxBounds.toRect(): Rect {
return Rect(
- left.value,
- top.value,
- right.value,
- bottom.value
+ left,
+ top,
+ right,
+ bottom
)
}
@@ -788,5 +788,5 @@
*/
@Stable
fun PxSize.toRect(): Rect {
- return Rect(0f, 0f, width.value, height.value)
+ return Rect(0f, 0f, width, height)
}
\ No newline at end of file
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
index 9748b08..0a19eea 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
@@ -224,7 +224,7 @@
@Test
fun createSize() {
- assertEquals(PxSize(10.px, 20.px), PxSize(10.ipx, 20.ipx))
+ assertEquals(PxSize(10f, 20f), PxSize(10.ipx, 20.ipx))
}
@Test
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
index ed228ad..9b5173d 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
@@ -375,60 +375,60 @@
@Test
fun boundsWidth() {
- val bounds = PxBounds(10.px, 5.px, 25.px, 15.px)
- assertEquals(15.px, bounds.width)
+ val bounds = PxBounds(10f, 5f, 25f, 15f)
+ assertEquals(15f, bounds.width)
}
@Test
fun boundsHeight() {
- val bounds = PxBounds(10.px, 5.px, 25.px, 15.px)
- assertEquals(10.px, bounds.height)
+ val bounds = PxBounds(10f, 5f, 25f, 15f)
+ assertEquals(10f, bounds.height)
}
@Test
fun toSize() {
- val size = PxSize(15.px, 10.px)
- val bounds = PxBounds(10.px, 5.px, 25.px, 15.px)
+ val size = PxSize(15f, 10f)
+ val bounds = PxBounds(10f, 5f, 25f, 15f)
assertEquals(size, bounds.toSize())
}
@Test
fun toBounds() {
- val size = PxSize(15.px, 10.px)
- val bounds = PxBounds(0.px, 0.px, 15.px, 10.px)
+ val size = PxSize(15f, 10f)
+ val bounds = PxBounds(0f, 0f, 15f, 10f)
assertEquals(bounds, size.toBounds())
}
@Test
fun sizeTimesInt() {
- assertEquals(PxSize(10.px, 10.px), PxSize(2.5.px, 2.5.px) * 4)
- assertEquals(PxSize(10.px, 10.px), 4 * PxSize(2.5.px, 2.5.px))
+ assertEquals(PxSize(10f, 10f), PxSize(2.5f, 2.5f) * 4)
+ assertEquals(PxSize(10f, 10f), 4 * PxSize(2.5f, 2.5f))
}
@Test
fun sizeDivInt() {
- assertEquals(PxSize(10.px, 10.px), PxSize(40.px, 40.px) / 4)
+ assertEquals(PxSize(10f, 10f), PxSize(40f, 40f) / 4)
}
@Test
fun sizeTimesFloat() {
- assertEquals(PxSize(10.px, 10.px), PxSize(4.px, 4.px) * 2.5f)
- assertEquals(PxSize(10.px, 10.px), 2.5f * PxSize(4.px, 4.px))
+ assertEquals(PxSize(10f, 10f), PxSize(4f, 4f) * 2.5f)
+ assertEquals(PxSize(10f, 10f), 2.5f * PxSize(4f, 4f))
}
@Test
fun sizeDivFloat() {
- assertEquals(PxSize(10.px, 10.px), PxSize(40.px, 40.px) / 4f)
+ assertEquals(PxSize(10f, 10f), PxSize(40f, 40f) / 4f)
}
@Test
fun sizeTimesDouble() {
- assertEquals(PxSize(10.px, 10.px), PxSize(4.px, 4.px) * 2.5)
- assertEquals(PxSize(10.px, 10.px), 2.5 * PxSize(4.px, 4.px))
+ assertEquals(PxSize(10f, 10f), PxSize(4f, 4f) * 2.5)
+ assertEquals(PxSize(10f, 10f), 2.5 * PxSize(4f, 4f))
}
@Test
fun sizeDivDouble() {
- assertEquals(PxSize(10.px, 10.px), PxSize(40.px, 40.px) / 4.0)
+ assertEquals(PxSize(10f, 10f), PxSize(40f, 40f) / 4.0)
}
}
\ No newline at end of file