Removal of Px usages part 1 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: Iede0b310a8a8f4a39ba6ae4a99c753f7f590d8ed
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureFilterTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureFilterTest.kt
index fdc7d4d..e8cfed8 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureFilterTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/ScaleGestureFilterTest.kt
@@ -27,8 +27,7 @@
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.layout.Stack
-import androidx.ui.unit.Px
-import androidx.ui.unit.ceil
+import androidx.ui.unit.ipx
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.inOrder
import com.nhaarman.mockitokotlin2.spy
@@ -42,6 +41,7 @@
import org.junit.runners.JUnit4
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
+import kotlin.math.ceil
// TODO(shepshapard): Test that all events related to scaling are consumed.
@@ -52,7 +52,7 @@
val activityTestRule = ActivityTestRule<TestActivity>(TestActivity::class.java)
private lateinit var scaleObserver: ScaleObserver
private lateinit var view: View
- private var touchSlop: Px = Px(Float.NEGATIVE_INFINITY)
+ private var touchSlop: Float = Float.NEGATIVE_INFINITY
private val LayoutDimensionFactor = 7
private val TinyNum = .01f
@@ -68,13 +68,13 @@
activityTestRule.runOnUiThreadIR {
activity.setContent {
Stack {
- touchSlop = with(DensityAmbient.current) { TouchSlop.toPx() }
+ touchSlop = with(DensityAmbient.current) { TouchSlop.toPx().value }
Layout(
modifier = Modifier.scaleGestureFilter(scaleObserver),
measureBlock = { _, _, _ ->
layout(
- (touchSlop * LayoutDimensionFactor).ceil(),
- (touchSlop * LayoutDimensionFactor).ceil()
+ ceil(touchSlop * LayoutDimensionFactor).toInt().ipx,
+ ceil(touchSlop * LayoutDimensionFactor).toInt().ipx
) {
setupLatch.countDown()
}
@@ -92,7 +92,7 @@
@Test
fun ui_pointerMovementWithinTouchSlop_noCallbacksCalled() {
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down1 = MotionEvent(
0,
@@ -168,7 +168,7 @@
@Test
fun ui_pointerMovementBeyondTouchSlop_correctCallbacksInOrder() {
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down1 = MotionEvent(
0,
@@ -249,7 +249,7 @@
@Test
fun ui_downMoveBeyondSlopCancel_correctCallbacksInOrder() {
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down1 = MotionEvent(
0,
@@ -317,7 +317,7 @@
@Test
fun ui_pointerMovementScalesUp_scaleValueCorrect() {
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down1 = MotionEvent(
0,
@@ -365,7 +365,7 @@
@Test
fun ui_pointerMovementScalesDown_scaleValueCorrect() {
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down1 = MotionEvent(
0,
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
index 35cf846..096b3eb 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
@@ -26,7 +26,6 @@
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.layout.Stack
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.px
@@ -51,7 +50,7 @@
val activityTestRule = ActivityTestRule<TestActivity>(TestActivity::class.java)
private lateinit var dragObserver: DragObserver
private lateinit var view: View
- private var touchSlop: Px = Px(Float.NEGATIVE_INFINITY)
+ private var touchSlop: Float = Float.NEGATIVE_INFINITY
private val TinyNum = .01f
@@ -59,7 +58,7 @@
fun ui_pointerMovementWithinTouchSlop_noCallbacksCalled() {
setup(false)
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down = MotionEvent(
0,
@@ -98,7 +97,7 @@
fun ui_pointerDownMovementBeyondTouchSlopUp_correctCallbacksInOrder() {
setup(false)
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down = MotionEvent(
0,
@@ -145,7 +144,7 @@
fun ui_pointerDownMovementBeyondTouchSlopCancel_correctCallbacksInOrder() {
setup(false)
- val touchSlop = touchSlop.value
+ val touchSlop = touchSlop
val down = MotionEvent(
0,
@@ -216,7 +215,7 @@
setup(false)
// Guaranteed to be over slop
- val movement = (touchSlop.value + 1 * 2).toInt()
+ val movement = (touchSlop + 1 * 2).toInt()
val down = MotionEvent(
0,
@@ -253,7 +252,7 @@
activityTestRule.runOnUiThreadIR {
activity.setContent {
Stack {
- touchSlop = with(DensityAmbient.current) { TouchSlop.toPx() }
+ touchSlop = with(DensityAmbient.current) { TouchSlop.toPx().value }
Layout(
modifier = Modifier.dragGestureFilter(
dragObserver,
diff --git a/ui/ui-core/src/main/java/androidx/ui/graphics/vector/VectorPainter.kt b/ui/ui-core/src/main/java/androidx/ui/graphics/vector/VectorPainter.kt
index ada060d..dc87953 100644
--- a/ui/ui-core/src/main/java/androidx/ui/graphics/vector/VectorPainter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/graphics/vector/VectorPainter.kt
@@ -28,7 +28,6 @@
import androidx.ui.graphics.drawscope.drawCanvas
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
-import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import kotlin.math.ceil
import kotlin.math.roundToInt
@@ -63,11 +62,11 @@
children: @Composable VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
): VectorPainter {
val density = DensityAmbient.current
- val widthPx = with(density) { defaultWidth.toPx() }
- val heightPx = with(density) { defaultHeight.toPx() }
+ val widthPx = with(density) { defaultWidth.toPx().value }
+ val heightPx = with(density) { defaultHeight.toPx().value }
- val vpWidth = if (viewportWidth.isNaN()) widthPx.value else viewportWidth
- val vpHeight = if (viewportHeight.isNaN()) heightPx.value else viewportHeight
+ val vpWidth = if (viewportWidth.isNaN()) widthPx else viewportWidth
+ val vpHeight = if (viewportHeight.isNaN()) heightPx else viewportHeight
return VectorPainter(
createVector(
@@ -110,8 +109,8 @@
private var currentColorFilter: ColorFilter? = null
override val intrinsicSize: PxSize = PxSize(
- IntPx(ceil(vector.defaultWidth.value).roundToInt()),
- IntPx(ceil(vector.defaultHeight.value).roundToInt())
+ IntPx(ceil(vector.defaultWidth).roundToInt()),
+ IntPx(ceil(vector.defaultHeight).roundToInt())
)
override fun DrawScope.onDraw() {
@@ -132,10 +131,10 @@
@Composable
private fun createVector(
name: String,
- defaultWidth: Px,
- defaultHeight: Px,
- viewportWidth: Float = defaultWidth.value,
- viewportHeight: Float = defaultHeight.value,
+ defaultWidth: Float,
+ defaultHeight: Float,
+ viewportWidth: Float = defaultWidth,
+ viewportHeight: Float = defaultHeight,
children: @Composable VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit
): VectorComponent {
val vector =
diff --git a/ui/ui-foundation/api/0.1.0-dev12.txt b/ui/ui-foundation/api/0.1.0-dev12.txt
index 8ce1530..1b8423b 100644
--- a/ui/ui-foundation/api/0.1.0-dev12.txt
+++ b/ui/ui-foundation/api/0.1.0-dev12.txt
@@ -369,7 +369,7 @@
method public abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
- method public abstract androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
@@ -381,9 +381,8 @@
}
public final class CornerSizeKt {
+ method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@IntRange(from=0, to=50) int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@FloatRange(from=0.0, to=50.0) float percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
@@ -391,33 +390,33 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class CutCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
}
public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class RoundedCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape getCircleShape();
}
diff --git a/ui/ui-foundation/api/current.txt b/ui/ui-foundation/api/current.txt
index 8ce1530..1b8423b 100644
--- a/ui/ui-foundation/api/current.txt
+++ b/ui/ui-foundation/api/current.txt
@@ -369,7 +369,7 @@
method public abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
- method public abstract androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
@@ -381,9 +381,8 @@
}
public final class CornerSizeKt {
+ method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@IntRange(from=0, to=50) int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@FloatRange(from=0.0, to=50.0) float percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
@@ -391,33 +390,33 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class CutCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
}
public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class RoundedCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape getCircleShape();
}
diff --git a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev12.txt b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev12.txt
index 8ce1530..1b8423b 100644
--- a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev12.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev12.txt
@@ -369,7 +369,7 @@
method public abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
- method public abstract androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
@@ -381,9 +381,8 @@
}
public final class CornerSizeKt {
+ method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@IntRange(from=0, to=50) int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@FloatRange(from=0.0, to=50.0) float percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
@@ -391,33 +390,33 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class CutCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
}
public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class RoundedCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape getCircleShape();
}
diff --git a/ui/ui-foundation/api/public_plus_experimental_current.txt b/ui/ui-foundation/api/public_plus_experimental_current.txt
index 8ce1530..1b8423b 100644
--- a/ui/ui-foundation/api/public_plus_experimental_current.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_current.txt
@@ -369,7 +369,7 @@
method public abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
- method public abstract androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
@@ -381,9 +381,8 @@
}
public final class CornerSizeKt {
+ method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@IntRange(from=0, to=50) int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@FloatRange(from=0.0, to=50.0) float percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
@@ -391,33 +390,33 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class CutCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
}
public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class RoundedCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape getCircleShape();
}
diff --git a/ui/ui-foundation/api/restricted_0.1.0-dev12.txt b/ui/ui-foundation/api/restricted_0.1.0-dev12.txt
index 8ce1530..1b8423b 100644
--- a/ui/ui-foundation/api/restricted_0.1.0-dev12.txt
+++ b/ui/ui-foundation/api/restricted_0.1.0-dev12.txt
@@ -369,7 +369,7 @@
method public abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
- method public abstract androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
@@ -381,9 +381,8 @@
}
public final class CornerSizeKt {
+ method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@IntRange(from=0, to=50) int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@FloatRange(from=0.0, to=50.0) float percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
@@ -391,33 +390,33 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class CutCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
}
public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class RoundedCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape getCircleShape();
}
diff --git a/ui/ui-foundation/api/restricted_current.txt b/ui/ui-foundation/api/restricted_current.txt
index 8ce1530..1b8423b 100644
--- a/ui/ui-foundation/api/restricted_current.txt
+++ b/ui/ui-foundation/api/restricted_current.txt
@@ -369,7 +369,7 @@
method public abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
- method public abstract androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
@@ -381,9 +381,8 @@
}
public final class CornerSizeKt {
+ method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@IntRange(from=0, to=50) int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize(@FloatRange(from=0.0, to=50.0) float percent);
- method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize CornerSize-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
@@ -391,33 +390,33 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class CutCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CutCornerShape CutCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
}
public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline createOutline-45bKZN0(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, float topLeft, float topRight, float bottomRight, float bottomLeft);
}
public final class RoundedCornerShapeKt {
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(float topLeft = 0.0f, float topRight = 0.0f, float bottomRight = 0.0f, float bottomLeft = 0.0f);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(@IntRange(from=0, to=50) int topLeftPercent = 0, @IntRange(from=0, to=50) int topRightPercent = 0, @IntRange(from=0, to=50) int bottomRightPercent = 0, @IntRange(from=0, to=50) int bottomLeftPercent = 0);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-NgWp0Z8(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-ipo6vVg(float size);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-rIHlIKc(float topLeft = 0.dp, float topRight = 0.dp, float bottomRight = 0.dp, float bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape-wHlpFhg(float topLeft = 0.px, float topRight = 0.px, float bottomRight = 0.px, float bottomLeft = 0.px);
method public static androidx.ui.foundation.shape.corner.RoundedCornerShape getCircleShape();
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt
index fc481a4..190b511 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BorderTest.kt
@@ -37,7 +37,6 @@
import androidx.ui.test.createComposeRule
import androidx.ui.test.findByTag
import androidx.ui.unit.Density
-import androidx.ui.unit.px
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -52,7 +51,7 @@
@JvmStatic
@Parameterized.Parameters(name = "{0}")
fun initShapes(): Array<Any> = arrayOf(
- RectangleShape, CircleShape, RoundedCornerShape(5.px)
+ RectangleShape, CircleShape, RoundedCornerShape(5.0f)
)
}
@@ -66,9 +65,9 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ Modifier.preferredSize(40.0f.toDp(), 40.0f.toDp())
.drawBackground(Color.Blue, shape)
- .drawBorder(Border(10.px.toDp(), Color.Red), shape)
+ .drawBorder(Border(10.0f.toDp(), Color.Red), shape)
) {}
}
@@ -79,10 +78,10 @@
backgroundColor = Color.Red,
shape = shape,
backgroundShape = shape,
- shapeSizeX = 20.px,
- shapeSizeY = 20.px,
+ shapeSizeX = 20.0f,
+ shapeSizeY = 20.0f,
shapeColor = Color.Blue,
- shapeOverlapPixelCount = 3.px
+ shapeOverlapPixelCount = 3.0f
)
}
@@ -91,10 +90,10 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ Modifier.preferredSize(40.0f.toDp(), 40.0f.toDp())
.drawBackground(Color.Blue, shape)
.drawBorder(
- Border(10.px.toDp(), SolidColor(Color.Red)),
+ Border(10.0f.toDp(), SolidColor(Color.Red)),
shape
)
) {}
@@ -106,10 +105,10 @@
backgroundColor = Color.Red,
shape = shape,
backgroundShape = shape,
- shapeSizeX = 20.px,
- shapeSizeY = 20.px,
+ shapeSizeX = 20.0f,
+ shapeSizeY = 20.0f,
shapeColor = Color.Blue,
- shapeOverlapPixelCount = 3.px
+ shapeOverlapPixelCount = 3.0f
)
}
@@ -118,9 +117,9 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ Modifier.preferredSize(40.0f.toDp(), 40.0f.toDp())
.drawBackground(Color.Blue, shape)
- .drawBorder(Border(1500.px.toDp(), Color.Red), shape)
+ .drawBorder(Border(1500.0f.toDp(), Color.Red), shape)
) {}
}
}
@@ -131,7 +130,7 @@
shapeColor = Color.Red,
shape = shape,
backgroundShape = shape,
- shapeOverlapPixelCount = 2.px
+ shapeOverlapPixelCount = 2.0f
)
}
@@ -140,9 +139,9 @@
composeTestRule.setContent {
SemanticParent {
Stack(
- Modifier.preferredSize(40.px.toDp(), 40.px.toDp())
+ Modifier.preferredSize(40.0f.toDp(), 40.0f.toDp())
.drawBackground(Color.Blue, shape)
- .drawBorder(Border(-5.px.toDp(), Color.Red), shape)
+ .drawBorder(Border(-5.0f.toDp(), Color.Red), shape)
) {}
}
}
@@ -153,7 +152,7 @@
shapeColor = Color.Blue,
shape = shape,
backgroundShape = shape,
- shapeOverlapPixelCount = 2.px
+ shapeOverlapPixelCount = 2.0f
)
}
@@ -162,12 +161,12 @@
composeTestRule.setContent {
SemanticParent {
Box(
- Modifier.preferredSize(40.px.toDp(), 40.px.toDp()),
+ Modifier.preferredSize(40.0f.toDp(), 40.0f.toDp()),
backgroundColor = Color.White
) {
Stack(
- Modifier.preferredSize(0.px.toDp(), 40.px.toDp())
- .drawBorder(Border(4.px.toDp(), Color.Red), shape)
+ Modifier.preferredSize(0.0f.toDp(), 40.0f.toDp())
+ .drawBorder(Border(4.0f.toDp(), Color.Red), shape)
) {}
}
}
@@ -178,7 +177,7 @@
backgroundColor = Color.White,
shapeColor = Color.White,
shape = RectangleShape,
- shapeOverlapPixelCount = 1.px
+ shapeOverlapPixelCount = 1.0f
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
index 54597c6..f927e06 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
@@ -46,7 +46,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
@@ -287,8 +286,8 @@
shape = RectangleShape,
shapeColor = Color.Blue,
backgroundColor = Color.Red,
- shapeSizeX = size.toPx() - padding.toPx() - padding.toPx(),
- shapeSizeY = size.toPx() - padding.toPx() - padding.toPx()
+ shapeSizeX = (size.toPx() - padding.toPx() - padding.toPx()).value,
+ shapeSizeY = (size.toPx() - padding.toPx() - padding.toPx()).value
)
}
}
@@ -315,9 +314,9 @@
shape = CircleShape,
shapeColor = Color.Blue,
backgroundColor = Color.Red,
- shapeSizeX = size.toPx() - padding.toPx() - padding.toPx(),
- shapeSizeY = size.toPx() - padding.toPx() - padding.toPx(),
- shapeOverlapPixelCount = 2.px
+ shapeSizeX = (size.toPx() - padding.toPx() - padding.toPx()).value,
+ shapeSizeY = (size.toPx() - padding.toPx() - padding.toPx()).value,
+ shapeOverlapPixelCount = 2.0f
)
}
}
@@ -342,9 +341,9 @@
shape = RectangleShape,
shapeColor = Color.Blue,
backgroundColor = Color.Red,
- shapeSizeX = size.toPx() - borderSize.toPx() * 2,
- shapeSizeY = size.toPx() - borderSize.toPx() * 2,
- shapeOverlapPixelCount = 2.px
+ shapeSizeX = (size.toPx() - borderSize.toPx() * 2).value,
+ shapeSizeY = (size.toPx() - borderSize.toPx() * 2).value,
+ shapeOverlapPixelCount = 2.0f
)
}
}
@@ -375,7 +374,7 @@
shape = CircleShape,
shapeColor = Color.Blue,
backgroundColor = Color.Red,
- shapeOverlapPixelCount = 2.px
+ shapeOverlapPixelCount = 2.0f
)
}
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
index d00c380..ea4e260c 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
@@ -43,7 +43,6 @@
import androidx.ui.unit.Density
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import com.google.common.truth.Truth
import org.junit.Assert
import org.junit.Assert.assertTrue
@@ -216,9 +215,9 @@
backgroundColor = Color.Red,
shapeColor = Color.Blue,
shape = CircleShape,
- shapeSizeX = 20.px,
- shapeSizeY = 20.px,
- shapeOverlapPixelCount = 2.px
+ shapeSizeX = 20.0f,
+ shapeSizeY = 20.0f,
+ shapeOverlapPixelCount = 2.0f
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt
index 8505d8a..95e1d89 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DrawBackgroundTest.kt
@@ -68,8 +68,8 @@
density = composeTestRule.density,
backgroundColor = Color.Magenta,
shape = RectangleShape,
- shapeSizeX = 20.px,
- shapeSizeY = 20.px,
+ shapeSizeX = 20.0f,
+ shapeSizeY = 20.0f,
shapeColor = Color.White
)
}
@@ -94,8 +94,8 @@
density = composeTestRule.density,
backgroundColor = Color.Magenta,
shape = RectangleShape,
- shapeSizeX = 20.px,
- shapeSizeY = 20.px,
+ shapeSizeX = 20.0f,
+ shapeSizeY = 20.0f,
shapeColor = Color.White
)
}
@@ -117,7 +117,7 @@
backgroundColor = Color.Magenta,
shape = CircleShape,
shapeColor = Color.White,
- shapeOverlapPixelCount = 2.px
+ shapeOverlapPixelCount = 2.0f
)
}
@@ -141,7 +141,7 @@
backgroundColor = Color.Magenta,
shape = CircleShape,
shapeColor = Color.White,
- shapeOverlapPixelCount = 2.px
+ shapeOverlapPixelCount = 2.0f
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldTest.kt
index 408b108..e80e1f4 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldTest.kt
@@ -60,7 +60,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.argumentCaptor
@@ -441,7 +440,7 @@
shape = RectangleShape,
shapeColor = Color.White,
backgroundColor = Color.White,
- shapeOverlapPixelCount = 0.px
+ shapeOverlapPixelCount = 0.0f
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerBasedShapeTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerBasedShapeTest.kt
index cac90d8..bb48fb2 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerBasedShapeTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerBasedShapeTest.kt
@@ -20,10 +20,8 @@
import androidx.ui.geometry.RRect
import androidx.ui.graphics.Outline
import androidx.ui.unit.Density
-import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import androidx.ui.unit.toRect
import com.google.common.truth.Truth.assertThat
import org.junit.Test
@@ -37,23 +35,23 @@
@Test
fun createOutlineCalledWithCorrectParams() {
val density = Density(2f, 1f)
- val passedSize = PxSize(100.px, 50.px)
+ val passedSize = PxSize(100.0f, 50.0f)
var assertionExecuted = false
val assertSizes = { size: PxSize,
- topLeft: Px,
- topRight: Px,
- bottomRight: Px,
- bottomLeft: Px ->
+ topLeft: Float,
+ topRight: Float,
+ bottomRight: Float,
+ bottomLeft: Float ->
assertThat(size).isEqualTo(passedSize)
- assertThat(topLeft).isEqualTo(4.px)
- assertThat(topRight).isEqualTo(3.px)
- assertThat(bottomRight).isEqualTo(6.px)
- assertThat(bottomLeft).isEqualTo(25.px)
+ assertThat(topLeft).isEqualTo(4.0f)
+ assertThat(topRight).isEqualTo(3.0f)
+ assertThat(bottomRight).isEqualTo(6.0f)
+ assertThat(bottomLeft).isEqualTo(25.0f)
assertionExecuted = true
}
val impl = Impl(
- topLeft = CornerSize(4.px),
- topRight = CornerSize(3.px),
+ topLeft = CornerSize(4.0f),
+ topRight = CornerSize(3.0f),
bottomRight = CornerSize(3.dp),
bottomLeft = CornerSize(50),
>
@@ -68,27 +66,27 @@
@Test
fun cornersSizesAreNotLargerThenMinDimension() {
val density = Density(2f, 1f)
- val sizeWithLargerWidth = PxSize(6.px, 4.px)
- val sizeWithLargerHeight = PxSize(4.px, 6.px)
+ val sizeWithLargerWidth = PxSize(6.0f, 4.0f)
+ val sizeWithLargerHeight = PxSize(4.0f, 6.0f)
val sizesList = mutableListOf<PxSize>()
val assertSizes = { size: PxSize,
- topLeft: Px,
- topRight: Px,
- bottomRight: Px,
- bottomLeft: Px ->
+ topLeft: Float,
+ topRight: Float,
+ bottomRight: Float,
+ bottomLeft: Float ->
sizesList.add(size)
- assertThat(topLeft).isEqualTo(2.px)
- assertThat(topRight).isEqualTo(2.px)
- assertThat(bottomRight).isEqualTo(1.px)
- assertThat(bottomLeft).isEqualTo(2.px)
+ assertThat(topLeft).isEqualTo(2.0f)
+ assertThat(topRight).isEqualTo(2.0f)
+ assertThat(bottomRight).isEqualTo(1.0f)
+ assertThat(bottomLeft).isEqualTo(2.0f)
}
val impl = Impl(
- topLeft = CornerSize(10.px),
+ topLeft = CornerSize(10.0f),
topRight = CornerSize(6.dp),
- bottomRight = CornerSize(1.px),
- bottomLeft = CornerSize(2.px),
+ bottomRight = CornerSize(1.0f),
+ bottomLeft = CornerSize(2.0f),
>
)
@@ -103,14 +101,14 @@
@Suppress("ReplaceCallWithBinaryOperator")
assertThat(
Impl2(
- topLeft = CornerSize(4.px),
- topRight = CornerSize(3.px),
+ topLeft = CornerSize(4.0f),
+ topRight = CornerSize(3.0f),
bottomRight = CornerSize(3.dp),
bottomLeft = CornerSize(50)
).equals(
Impl2(
- topLeft = CornerSize(4.px),
- topRight = CornerSize(3.px),
+ topLeft = CornerSize(4.0f),
+ topRight = CornerSize(3.0f),
bottomRight = CornerSize(3.dp),
bottomLeft = CornerSize(50)
)
@@ -123,14 +121,14 @@
@Suppress("ReplaceCallWithBinaryOperator")
assertThat(
Impl(
- topLeft = CornerSize(4.px),
- topRight = CornerSize(3.px),
+ topLeft = CornerSize(4.0f),
+ topRight = CornerSize(3.0f),
bottomRight = CornerSize(3.dp),
bottomLeft = CornerSize(50)
).equals(
Impl2(
- topLeft = CornerSize(4.px),
- topRight = CornerSize(3.px),
+ topLeft = CornerSize(4.0f),
+ topRight = CornerSize(3.0f),
bottomRight = CornerSize(3.dp),
bottomLeft = CornerSize(50)
)
@@ -141,8 +139,8 @@
@Test
fun copyingUsesCorrectDefaults() {
val impl = Impl(
- topLeft = CornerSize(4.px),
- topRight = CornerSize(3.px),
+ topLeft = CornerSize(4.0f),
+ topRight = CornerSize(3.0f),
bottomRight = CornerSize(3.dp),
bottomLeft = CornerSize(50)
)
@@ -156,15 +154,15 @@
topRight: CornerSize,
bottomRight: CornerSize,
bottomLeft: CornerSize,
- private val onOutlineRequested: ((PxSize, Px, Px, Px, Px) -> Unit)? = null
+ private val onOutlineRequested: ((PxSize, Float, Float, Float, Float) -> Unit)? = null
) : CornerBasedShape(topLeft, topRight, bottomRight, bottomLeft) {
override fun createOutline(
size: PxSize,
- topLeft: Px,
- topRight: Px,
- bottomRight: Px,
- bottomLeft: Px
+ topLeft: Float,
+ topRight: Float,
+ bottomRight: Float,
+ bottomLeft: Float
): Outline {
onOutlineRequested?.invoke(size, topLeft, topRight, bottomRight, bottomLeft)
return Outline.Rectangle(size.toRect())
@@ -187,10 +185,10 @@
override fun createOutline(
size: PxSize,
- topLeft: Px,
- topRight: Px,
- bottomRight: Px,
- bottomLeft: Px
+ topLeft: Float,
+ topRight: Float,
+ bottomRight: Float,
+ bottomLeft: Float
): Outline {
return Outline.Rounded(RRect(size.toRect()))
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerSizeTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerSizeTest.kt
index 637f0d1..f6eea7f 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerSizeTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerSizeTest.kt
@@ -35,46 +35,35 @@
@Test
fun pxCorners() {
- val corner = CornerSize(24.px)
- assertThat(corner.toPx(size, density)).isEqualTo(24.px)
+ val corner = CornerSize(24.0f)
+ assertThat(corner.toPx(size, density)).isEqualTo(24.0f)
}
@Test
fun dpCorners() {
val corner = CornerSize(5.dp)
- assertThat(corner.toPx(size, density)).isEqualTo(12.5.px)
+ assertThat(corner.toPx(size, density)).isEqualTo(12.5f)
}
@Test
fun intPercentCorners() {
val corner = CornerSize(15)
- assertThat(corner.toPx(size, density)).isEqualTo(22.5.px)
- }
-
- @Test
- fun floatPercentCorners() {
- val corner = CornerSize(21.6f)
- assertThat(corner.toPx(PxSize(1000.px, 120.px), density)).isEqualTo(25.92.px)
+ assertThat(corner.toPx(size, density)).isEqualTo(22.5f)
}
@Test
fun zeroCorners() {
val corner = ZeroCornerSize
- assertThat(corner.toPx(size, density)).isEqualTo(0.px)
+ assertThat(corner.toPx(size, density)).isEqualTo(0.0f)
}
@Test
fun pxCornersAreEquals() {
- assertThat(CornerSize(24.px)).isEqualTo(CornerSize(24.px))
+ assertThat(CornerSize(24.0f)).isEqualTo(CornerSize(24.0f))
}
@Test
fun dpCornersAreEquals() {
assertThat(CornerSize(8.dp)).isEqualTo(CornerSize(8.dp))
}
-
- @Test
- fun percentCornersAreEquals() {
- assertThat(CornerSize(20f)).isEqualTo(CornerSize(20))
- }
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CutCornerShapeTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CutCornerShapeTest.kt
index 2b92be5..a3a034d 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CutCornerShapeTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CutCornerShapeTest.kt
@@ -41,7 +41,7 @@
@Test
fun cutCornersUniformCorners() {
- val cut = CutCornerShape(10.px)
+ val cut = CutCornerShape(10.0f)
val outline = cut.toOutline() as Outline.Generic
assertPathsEquals(outline.path, Path().apply {
@@ -63,7 +63,7 @@
val size2 = 22f
val size3 = 32f
val size4 = 42f
- val cut = CutCornerShape(size1.px, size2.px, size3.px, size4.px)
+ val cut = CutCornerShape(size1, size2, size3, size4)
val outline = cut.toOutline() as Outline.Generic
assertPathsEquals(outline.path, Path().apply {
@@ -81,7 +81,7 @@
@Test
fun createsRectangleOutlineForZeroSizedCorners() {
- val rounded = CutCornerShape(0.px, 0.px, 0.px, 0.px)
+ val rounded = CutCornerShape(0.0f, 0.0f, 0.0f, 0.0f)
assertThat(rounded.toOutline())
.isEqualTo(Outline.Rectangle(size.toRect()))
@@ -89,25 +89,25 @@
@Test
fun cutCornerShapesAreEquals() {
- assertThat(CutCornerShape(10.px))
- .isEqualTo(CutCornerShape(10.px))
+ assertThat(CutCornerShape(10.0f))
+ .isEqualTo(CutCornerShape(10.0f))
}
@Test
fun cutCornerUpdateAllCornerSize() {
- assertThat(CutCornerShape(10.px).copy(CornerSize(5.px)))
- .isEqualTo(CutCornerShape(5.px))
+ assertThat(CutCornerShape(10.0f).copy(CornerSize(5.0f)))
+ .isEqualTo(CutCornerShape(5.0f))
}
@Test
fun cutCornerUpdateTwoCornerSizes() {
- assertThat(CutCornerShape(10.px).copy(
+ assertThat(CutCornerShape(10.0f).copy(
topRight = CornerSize(3.dp),
bottomLeft = CornerSize(50)
)).isEqualTo(CutCornerShape(
- topLeft = CornerSize(10.px),
+ topLeft = CornerSize(10.0f),
topRight = CornerSize(3.dp),
- bottomRight = CornerSize(10.px),
+ bottomRight = CornerSize(10.0f),
bottomLeft = CornerSize(50)
))
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/RoundedCornerShapeTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/RoundedCornerShapeTest.kt
index 559b8f5..5195ced 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/RoundedCornerShapeTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/RoundedCornerShapeTest.kt
@@ -27,6 +27,7 @@
import androidx.ui.unit.px
import androidx.ui.unit.toRect
import com.google.common.truth.Truth.assertThat
+import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@@ -57,7 +58,7 @@
val radius2 = 22f
val radius3 = 32f
val radius4 = 42f
- val rounded = RoundedCornerShape(radius1.px, radius2.px, radius3.px, radius4.px)
+ val rounded = RoundedCornerShape(radius1, radius2, radius3, radius4)
val outline = rounded.toOutline() as Outline.Rounded
assertThat(outline.rrect).isEqualTo(
@@ -73,7 +74,7 @@
@Test
fun createsRectangleOutlineForZeroSizedCorners() {
- val rounded = RoundedCornerShape(0.px, 0.px, 0.px, 0.px)
+ val rounded = RoundedCornerShape(0.0f, 0.0f, 0.0f, 0.0f)
assertThat(rounded.toOutline())
.isEqualTo(Outline.Rectangle(size.toRect()))
@@ -87,19 +88,28 @@
@Test
fun roundedCornerUpdateAllCornerSize() {
- assertThat(RoundedCornerShape(10.px).copy(CornerSize(5.dp)))
+ assertThat(RoundedCornerShape(10.0f).copy(CornerSize(5.dp)))
.isEqualTo(RoundedCornerShape(5.dp))
}
@Test
fun roundedCornerUpdateTwoCornerSizes() {
- assertThat(RoundedCornerShape(10.px).copy(
+ val original = RoundedCornerShape(10.0f).copy(
+ topLeft = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ )
+
+ assertEquals(CornerSize(3.dp), original.topLeft)
+ assertEquals(CornerSize(10.0f), original.topRight)
+ assertEquals(CornerSize(10.0f), original.bottomRight)
+ assertEquals(CornerSize(50), original.bottomLeft)
+ assertThat(RoundedCornerShape(10.0f).copy(
topLeft = CornerSize(3.dp),
bottomLeft = CornerSize(50)
)).isEqualTo(RoundedCornerShape(
topLeft = CornerSize(3.dp),
- topRight = CornerSize(10.px),
- bottomRight = CornerSize(10.px),
+ topRight = CornerSize(10.0f),
+ bottomRight = CornerSize(10.0f),
bottomLeft = CornerSize(50)
))
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
index 336e47f..1ac765d 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
@@ -17,7 +17,6 @@
package androidx.ui.foundation.gestures
import androidx.ui.core.Direction
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
/**
@@ -27,21 +26,21 @@
sealed class DragDirection {
// TODO: remove internals for children when b/137357249 is ready
- internal abstract val xProjection: (Px) -> Float
- internal abstract val yProjection: (Px) -> Float
+ internal abstract val xProjection: (Float) -> Float
+ internal abstract val yProjection: (Float) -> Float
internal abstract val isDraggableInDirection: (
direction: Direction,
currentValue: Float
) -> Boolean
- internal open fun project(pos: PxPosition) = xProjection(pos.x) + yProjection(pos.y)
+ internal open fun project(pos: PxPosition) = xProjection(pos.x.value) + yProjection(pos.y.value)
/**
* Horizontal direction of dragging in [draggable] or [scrollable].
*/
object Horizontal : DragDirection() {
- internal override val xProjection: (Px) -> Float = { it.value }
- internal override val yProjection: (Px) -> Float = { 0f }
+ internal override val xProjection: (Float) -> Float = { it }
+ internal override val yProjection: (Float) -> Float = { 0f }
internal override val isDraggableInDirection:
(direction: Direction, currentValue: Float) -> Boolean =
{ direction, _ ->
@@ -57,8 +56,8 @@
* Vertical direction of dragging in [draggable] or [scrollable].
*/
object Vertical : DragDirection() {
- internal override val xProjection: (Px) -> Float = { 0f }
- internal override val yProjection: (Px) -> Float = { it.value }
+ internal override val xProjection: (Float) -> Float = { 0f }
+ internal override val yProjection: (Float) -> Float = { it }
internal override val isDraggableInDirection: (
direction: Direction,
currentValue: Float
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
index f080388..d5debc10 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
@@ -89,8 +89,8 @@
dragState.value = dragState.value + consumed
val fractionConsumed = if (projected == 0f) 0f else consumed / projected
return PxPosition(
- dragDirection.xProjection(dragDistance.x).px * fractionConsumed,
- dragDirection.yProjection(dragDistance.y).px * fractionConsumed
+ dragDirection.xProjection(dragDistance.x.value).px * fractionConsumed,
+ dragDirection.yProjection(dragDistance.y.value).px * fractionConsumed
)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
index 655e5ec..f65dd6b 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
@@ -185,8 +185,8 @@
scrollableState.value = scrollableState.value + consumed
val fractionConsumed = if (projected == 0f) 0f else consumed / projected
return PxPosition(
- dragDirection.xProjection(dragDistance.x).px * fractionConsumed,
- dragDirection.yProjection(dragDistance.y).px * fractionConsumed
+ dragDirection.xProjection(dragDistance.x.value).px * fractionConsumed,
+ dragDirection.yProjection(dragDistance.y.value).px * fractionConsumed
)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerBasedShape.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerBasedShape.kt
index a1f00f5..d157b0e 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerBasedShape.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerBasedShape.kt
@@ -19,11 +19,9 @@
import androidx.ui.graphics.Outline
import androidx.ui.graphics.Shape
import androidx.ui.unit.Density
-import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
-import androidx.ui.unit.min
import androidx.ui.unit.minDimension
-import androidx.ui.unit.px
+import kotlin.math.min
/**
* Base class for [Shape]s defined by four [CornerSize]s.
@@ -43,12 +41,12 @@
) : Shape {
final override fun createOutline(size: PxSize, density: Density): Outline {
- val halfMinDimension = size.minDimension / 2f
+ val halfMinDimension = size.minDimension.value / 2f
val topLeft = min(topLeft.toPx(size, density), halfMinDimension)
val topRight = min(topRight.toPx(size, density), halfMinDimension)
val bottomRight = min(bottomRight.toPx(size, density), halfMinDimension)
val bottomLeft = min(bottomLeft.toPx(size, density), halfMinDimension)
- require(topLeft >= 0.px && topRight >= 0.px && bottomRight >= 0.px && bottomLeft >= 0.px) {
+ require(topLeft >= 0.0f && topRight >= 0.0f && bottomRight >= 0.0f && bottomLeft >= 0.0f) {
"Corner size in Px can't be negative(topLeft = $topLeft, topRight = $topRight, " +
"bottomRight = $bottomRight, bottomLeft = $bottomLeft)!"
}
@@ -66,10 +64,10 @@
*/
abstract fun createOutline(
size: PxSize,
- topLeft: Px,
- topRight: Px,
- bottomRight: Px,
- bottomLeft: Px
+ topLeft: Float,
+ topRight: Float,
+ bottomRight: Float,
+ bottomLeft: Float
): Outline
/**
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt
index e0ddd4f..1d8acc2 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSize.kt
@@ -20,24 +20,22 @@
import androidx.annotation.IntRange
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
-import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import androidx.ui.unit.minDimension
-import androidx.ui.unit.px
/**
- * Defines size of a corner in [Px]. For example for rounded shape it can be a corner radius.
+ * Defines size of a corner in pixels. For example for rounded shape it can be a corner radius.
*/
interface CornerSize {
/**
- * Converts the [CornerSize] to [Px].
+ * Converts the [CornerSize] to pixels.
*
* @param shapeSize the size of the shape
* @param density the current density of the screen.
*
- * @return resolved size of the corner in [Px]
+ * @return resolved size of the corner in pixels
*/
- fun toPx(shapeSize: PxSize, density: Density): Px
+ fun toPx(shapeSize: PxSize, density: Density): Float
}
/**
@@ -48,16 +46,16 @@
private data class DpCornerSize(private val size: Dp) : CornerSize {
override fun toPx(shapeSize: PxSize, density: Density) =
- with(density) { size.toPx() }
+ with(density) { size.toPx().value }
}
/**
* Creates [CornerSize] with provided size.
- * @param size the corner size defined in [Px].
+ * @param size the corner size defined in pixels.
*/
-fun CornerSize(size: Px): CornerSize = PxCornerSize(size)
+fun CornerSize(size: Float): CornerSize = PxCornerSize(size)
-private data class PxCornerSize(private val size: Px) : CornerSize {
+private data class PxCornerSize(private val size: Float) : CornerSize {
override fun toPx(shapeSize: PxSize, density: Density) = size
}
@@ -66,18 +64,17 @@
* @param percent the corner size defined in percents of the shape's smaller side.
* Can't be negative or larger then 50 percents.
*/
-fun /*inline*/ CornerSize(@IntRange(from = 0, to = 50) percent: Int) =
- CornerSize(percent.toFloat())
+fun CornerSize(@IntRange(from = 0, to = 50) percent: Int): CornerSize =
+ PercentCornerSize(percent.toFloat())
/**
* Creates [CornerSize] with provided size.
* @param percent the corner size defined in float percents of the shape's smaller side.
* Can't be negative or larger then 50 percents.
*/
-fun CornerSize(@FloatRange(from = 0.0, to = 50.0) percent: Float): CornerSize =
- PercentCornerSize(percent)
-
-private data class PercentCornerSize(private val percent: Float) : CornerSize {
+private data class PercentCornerSize(
+ @FloatRange(from = 0.0, to = 50.0) private val percent: Float
+) : CornerSize {
init {
if (percent < 0 || percent > 50) {
throw IllegalArgumentException("The percent should be in the range of [0, 50]")
@@ -85,12 +82,12 @@
}
override fun toPx(shapeSize: PxSize, density: Density) =
- shapeSize.minDimension * (percent / 100f)
+ shapeSize.minDimension.value * (percent / 100f)
}
/**
* [CornerSize] always equals to zero.
*/
val ZeroCornerSize: CornerSize = object : CornerSize {
- override fun toPx(shapeSize: PxSize, density: Density) = 0.px
+ override fun toPx(shapeSize: PxSize, density: Density) = 0.0f
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CutCornerShape.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CutCornerShape.kt
index 77cbd2a..623be98 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CutCornerShape.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CutCornerShape.kt
@@ -23,7 +23,6 @@
import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import androidx.ui.unit.toRect
/**
@@ -44,23 +43,23 @@
override fun createOutline(
size: PxSize,
- topLeft: Px,
- topRight: Px,
- bottomRight: Px,
- bottomLeft: Px
- ) = if (topLeft + topRight + bottomLeft + bottomRight == 0.px) {
+ topLeft: Float,
+ topRight: Float,
+ bottomRight: Float,
+ bottomLeft: Float
+ ) = if (topLeft + topRight + bottomLeft + bottomRight == 0.0f) {
Outline.Rectangle(size.toRect())
} else Outline.Generic(Path().apply {
- var cornerSize = topLeft.value
+ var cornerSize = topLeft
moveTo(0f, cornerSize)
lineTo(cornerSize, 0f)
- cornerSize = topRight.value
+ cornerSize = topRight
lineTo(size.width.value - cornerSize, 0f)
lineTo(size.width.value, cornerSize)
- cornerSize = bottomRight.value
+ cornerSize = bottomRight
lineTo(size.width.value, size.height.value - cornerSize)
lineTo(size.width.value - cornerSize, size.height.value)
- cornerSize = bottomLeft.value
+ cornerSize = bottomLeft
lineTo(cornerSize, size.height.value)
lineTo(0f, size.height.value - cornerSize)
close()
@@ -100,7 +99,7 @@
* Creates [CutCornerShape] with the same size applied for all four corners.
* @param size Size in [Px] to apply.
*/
-/*inline*/ fun CutCornerShape(size: Px) = CutCornerShape(CornerSize(size))
+/*inline*/ fun CutCornerShape(size: Float) = CutCornerShape(CornerSize(size))
/**
* Creates [CutCornerShape] with the same size applied for all four corners.
@@ -124,13 +123,13 @@
)
/**
- * Creates [CutCornerShape] with sizes defined in [Px].
+ * Creates [CutCornerShape] with sizes defined in float.
*/
/*inline*/ fun CutCornerShape(
- topLeft: Px = 0.px,
- topRight: Px = 0.px,
- bottomRight: Px = 0.px,
- bottomLeft: Px = 0.px
+ topLeft: Float = 0.0f,
+ topRight: Float = 0.0f,
+ bottomRight: Float = 0.0f,
+ bottomLeft: Float = 0.0f
) = CutCornerShape(
CornerSize(topLeft),
CornerSize(topRight),
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/RoundedCornerShape.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/RoundedCornerShape.kt
index 67c3851..170ccdc 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/RoundedCornerShape.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/RoundedCornerShape.kt
@@ -22,10 +22,8 @@
import androidx.ui.graphics.Outline
import androidx.ui.graphics.Shape
import androidx.ui.unit.Dp
-import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import androidx.ui.unit.toRect
/**
@@ -45,11 +43,11 @@
override fun createOutline(
size: PxSize,
- topLeft: Px,
- topRight: Px,
- bottomRight: Px,
- bottomLeft: Px
- ) = if (topLeft + topRight + bottomLeft + bottomRight == 0.px) {
+ topLeft: Float,
+ topRight: Float,
+ bottomRight: Float,
+ bottomLeft: Float
+ ) = if (topLeft + topRight + bottomLeft + bottomRight == 0.0f) {
Outline.Rectangle(size.toRect())
} else {
Outline.Rounded(
@@ -80,7 +78,7 @@
"$bottomRight, bottomLeft = $bottomLeft)"
}
- private /*inline*/ fun Px.toRadius() = Radius.circular(this.value)
+ private /*inline*/ fun Float.toRadius() = Radius.circular(this)
}
/**
@@ -103,15 +101,16 @@
/**
* Creates [RoundedCornerShape] with the same size applied for all four corners.
- * @param size Size in [Px] to apply.
+ * @param size Size in pixels to apply.
*/
-/*inline*/ fun RoundedCornerShape(size: Px) = RoundedCornerShape(CornerSize(size))
+/*inline*/ fun RoundedCornerShape(size: Float) = RoundedCornerShape(CornerSize(size))
/**
* Creates [RoundedCornerShape] with the same size applied for all four corners.
* @param percent Size in percents to apply.
*/
-/*inline*/ fun RoundedCornerShape(percent: Int) = RoundedCornerShape(CornerSize(percent))
+/*inline*/ fun RoundedCornerShape(percent: Int) =
+ RoundedCornerShape(CornerSize(percent))
/**
* Creates [RoundedCornerShape] with sizes defined in [Dp].
@@ -129,13 +128,13 @@
)
/**
- * Creates [RoundedCornerShape] with sizes defined in [Px].
+ * Creates [RoundedCornerShape] with sizes defined in pixels.
*/
/*inline*/ fun RoundedCornerShape(
- topLeft: Px = 0.px,
- topRight: Px = 0.px,
- bottomRight: Px = 0.px,
- bottomLeft: Px = 0.px
+ topLeft: Float = 0.0f,
+ topRight: Float = 0.0f,
+ bottomRight: Float = 0.0f,
+ bottomLeft: Float = 0.0f
) = RoundedCornerShape(
CornerSize(topLeft),
CornerSize(topRight),
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 bf7ecb0..fd5cb83 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
@@ -310,7 +310,7 @@
shape = shape,
shapeColor = primary,
backgroundColor = surface,
- shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx() }
+ shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx().value }
)
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
index 34be44d..e291e2d 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
@@ -75,7 +75,7 @@
shape = shape,
shapeColor = cardColor,
backgroundColor = background,
- shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx() }
+ shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx().value }
)
}
}
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 581ff52..781e846 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
@@ -659,7 +659,7 @@
shapeColor = Color.White,
shape = RectangleShape,
// avoid elevation artifacts
- shapeOverlapPixelCount = with(testRule.density) { 3.dp.toPx() }
+ shapeOverlapPixelCount = with(testRule.density) { 3.dp.toPx().value }
)
}
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 90ef1f2..0024298 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
@@ -167,7 +167,7 @@
shape = realShape,
shapeColor = fabColor,
backgroundColor = surface,
- shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx() }
+ shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx().value }
)
}
@@ -199,7 +199,7 @@
shape = realShape,
shapeColor = fabColor,
backgroundColor = surface,
- shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx() }
+ shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx().value }
)
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt
index dfdfc6a..635d669 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/RippleTest.kt
@@ -57,7 +57,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
@@ -106,8 +105,8 @@
density = composeTestRule.density,
backgroundColor = Color.Blue,
shape = RectangleShape,
- shapeSizeX = 10.dp.toPx(),
- shapeSizeY = 10.dp.toPx(),
+ shapeSizeX = 10.dp.toPx().value,
+ shapeSizeY = 10.dp.toPx().value,
shapeColor = Color.Red
)
}
@@ -144,8 +143,8 @@
density = composeTestRule.density,
backgroundColor = Color.Blue,
shape = RectangleShape,
- shapeSizeX = 20.dp.toPx(),
- shapeSizeY = 20.dp.toPx(),
+ shapeSizeX = 20.dp.toPx().value,
+ shapeSizeY = 20.dp.toPx().value,
shapeColor = Color.Red
)
}
@@ -175,8 +174,8 @@
density = composeTestRule.density,
backgroundColor = Color.Red,
shape = RectangleShape,
- shapeSizeX = 0.px,
- shapeSizeY = 0.px,
+ shapeSizeX = 0.0f,
+ shapeSizeY = 0.0f,
shapeColor = Color.Red
)
}
@@ -210,8 +209,8 @@
density = composeTestRule.density,
backgroundColor = Color.Blue,
shape = RectangleShape,
- shapeSizeX = 10.dp.toPx(),
- shapeSizeY = 10.dp.toPx(),
+ shapeSizeX = 10.0.dp.toPx().value,
+ shapeSizeY = 10.0.dp.toPx().value,
shapeColor = Color.Red
)
}
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 be5f66a..fcef76c 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
@@ -354,7 +354,7 @@
shape = shape,
shapeColor = snackBarColor,
backgroundColor = background,
- shapeOverlapPixelCount = with(composeTestRule.density) { 2.dp.toPx() }
+ shapeOverlapPixelCount = with(composeTestRule.density) { 2.dp.toPx().value }
)
}
}
\ No newline at end of file
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 38ae930..a0beaa0 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
@@ -29,22 +29,20 @@
import androidx.compose.mutableStateOf
import androidx.compose.setValue
import androidx.ui.animation.PxPositionPropKey
-import androidx.ui.animation.PxPropKey
import androidx.ui.graphics.Color
import androidx.ui.graphics.drawscope.DrawScope
import androidx.ui.graphics.drawscope.clipRect
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.PxSize
import androidx.ui.unit.center
import androidx.ui.unit.dp
import androidx.ui.unit.getDistance
import androidx.ui.unit.inMilliseconds
-import androidx.ui.unit.max
import androidx.ui.unit.milliseconds
import androidx.ui.unit.toOffset
+import kotlin.math.max
/**
* Used to specify this type of [RippleEffect] for [ripple].
@@ -111,7 +109,7 @@
val surfaceSize = size
val startRadius = getRippleStartRadius(surfaceSize)
val targetRadius = with(density) {
- radius?.toPx() ?: getRippleEndRadius(clipped, surfaceSize)
+ radius?.toPx()?.value ?: getRippleEndRadius(clipped, surfaceSize)
}
val center = size.center()
@@ -151,7 +149,7 @@
}
val centerOffset = animation[RippleTransition.Center].toOffset()
- val radius = animation[RippleTransition.Radius].value
+ val radius = animation[RippleTransition.Radius]
val modulatedColor = color.copy(alpha = color.alpha * alpha)
if (clipped) {
@@ -183,12 +181,12 @@
private val FadeOutDuration = 150.milliseconds
val Alpha = FloatPropKey()
- val Radius = PxPropKey()
+ val Radius = FloatPropKey()
val Center = PxPositionPropKey()
fun definition(
- startRadius: Px,
- endRadius: Px,
+ startRadius: Float,
+ endRadius: Float,
startCenter: PxPosition,
endCenter: PxPosition
) = transitionDefinition {
@@ -241,17 +239,17 @@
* surface it belongs to.
*/
internal fun getRippleStartRadius(size: PxSize) =
- max(size.width, size.height) * 0.3f
+ max(size.width.value, size.height.value) * 0.3f
/**
* According to specs the ending radius
* - expands to 10dp beyond the border of the surface it belongs to for bounded ripples
* - fits within the border of the surface it belongs to for unbounded ripples
*/
-internal fun Density.getRippleEndRadius(bounded: Boolean, size: PxSize): Px {
- val radiusCoveringBounds = PxPosition(size.width, size.height).getDistance() / 2f
+internal fun Density.getRippleEndRadius(bounded: Boolean, size: PxSize): Float {
+ val radiusCoveringBounds = (PxPosition(size.width, size.height).getDistance() / 2f).value
return if (bounded) {
- radiusCoveringBounds + BoundedRippleExtraRadius.toPx()
+ radiusCoveringBounds + BoundedRippleExtraRadius.toPx().value
} else {
radiusCoveringBounds
}
diff --git a/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt b/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt
index 52ee794..8a7f868 100644
--- a/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt
+++ b/ui/ui-material/src/test/java/androidx/ui/material/ripple/DefaultRippleEffectTest.kt
@@ -31,7 +31,7 @@
@Test
fun testStartRadius() {
val size = PxSize(10.px, 30.px)
- val expectedRadius = 9.px // 30% of 30
+ val expectedRadius = 9.0f // 30% of 30
// Top-level functions are not resolved properly in IR modules
val result = getRippleStartRadius(size)
@@ -49,7 +49,7 @@
halfDistance(width, height) + 10.dp.toPx().value
}
val result = with(density) { getRippleEndRadius(true, size) }
- assertThat(result).isEqualTo(expectedRadius.px)
+ assertThat(result).isEqualTo(expectedRadius)
}
@Test
@@ -59,7 +59,7 @@
val size = PxSize(width.px, height.px)
val expectedRadius = halfDistance(width, height)
val result = with(Density(1f)) { getRippleEndRadius(false, size) }
- assertThat(result).isEqualTo(expectedRadius.px)
+ assertThat(result).isEqualTo(expectedRadius)
}
private fun halfDistance(width: Float, height: Float) =
diff --git a/ui/ui-test/api/0.1.0-dev12.txt b/ui/ui-test/api/0.1.0-dev12.txt
index a4490d8..997932e 100644
--- a/ui/ui-test/api/0.1.0-dev12.txt
+++ b/ui/ui-test/api/0.1.0-dev12.txt
@@ -53,8 +53,8 @@
public final class BitmapHelpersKt {
method public static void assertPixelColor-9bBi3KA(android.graphics.Bitmap, long expected, int x, int y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,java.lang.String> error = { color -> return "Pixel(" + x + ", " + y + ") expected to be " + expected + ", but was " + color });
method public static void assertPixels(android.graphics.Bitmap, androidx.ui.unit.IntPxSize? expectedSize = null, kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPxPosition,androidx.ui.graphics.Color> expectedColorProvider);
- method public static void assertShape-2l1GYV8(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.px);
- method public static void assertShape-nbwoFSQ(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat().px, float sizeY = height.toFloat().px, float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width.px / 2.0, float centerY = height.px / 2.0, float shapeOverlapPixelCount = 1.px);
+ method public static void assertShape--mmofgM(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.0f);
+ method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(android.view.View);
method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
diff --git a/ui/ui-test/api/current.txt b/ui/ui-test/api/current.txt
index a4490d8..997932e 100644
--- a/ui/ui-test/api/current.txt
+++ b/ui/ui-test/api/current.txt
@@ -53,8 +53,8 @@
public final class BitmapHelpersKt {
method public static void assertPixelColor-9bBi3KA(android.graphics.Bitmap, long expected, int x, int y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,java.lang.String> error = { color -> return "Pixel(" + x + ", " + y + ") expected to be " + expected + ", but was " + color });
method public static void assertPixels(android.graphics.Bitmap, androidx.ui.unit.IntPxSize? expectedSize = null, kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPxPosition,androidx.ui.graphics.Color> expectedColorProvider);
- method public static void assertShape-2l1GYV8(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.px);
- method public static void assertShape-nbwoFSQ(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat().px, float sizeY = height.toFloat().px, float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width.px / 2.0, float centerY = height.px / 2.0, float shapeOverlapPixelCount = 1.px);
+ method public static void assertShape--mmofgM(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.0f);
+ method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(android.view.View);
method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
diff --git a/ui/ui-test/api/public_plus_experimental_0.1.0-dev12.txt b/ui/ui-test/api/public_plus_experimental_0.1.0-dev12.txt
index a4490d8..997932e 100644
--- a/ui/ui-test/api/public_plus_experimental_0.1.0-dev12.txt
+++ b/ui/ui-test/api/public_plus_experimental_0.1.0-dev12.txt
@@ -53,8 +53,8 @@
public final class BitmapHelpersKt {
method public static void assertPixelColor-9bBi3KA(android.graphics.Bitmap, long expected, int x, int y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,java.lang.String> error = { color -> return "Pixel(" + x + ", " + y + ") expected to be " + expected + ", but was " + color });
method public static void assertPixels(android.graphics.Bitmap, androidx.ui.unit.IntPxSize? expectedSize = null, kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPxPosition,androidx.ui.graphics.Color> expectedColorProvider);
- method public static void assertShape-2l1GYV8(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.px);
- method public static void assertShape-nbwoFSQ(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat().px, float sizeY = height.toFloat().px, float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width.px / 2.0, float centerY = height.px / 2.0, float shapeOverlapPixelCount = 1.px);
+ method public static void assertShape--mmofgM(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.0f);
+ method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(android.view.View);
method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
diff --git a/ui/ui-test/api/public_plus_experimental_current.txt b/ui/ui-test/api/public_plus_experimental_current.txt
index a4490d8..997932e 100644
--- a/ui/ui-test/api/public_plus_experimental_current.txt
+++ b/ui/ui-test/api/public_plus_experimental_current.txt
@@ -53,8 +53,8 @@
public final class BitmapHelpersKt {
method public static void assertPixelColor-9bBi3KA(android.graphics.Bitmap, long expected, int x, int y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,java.lang.String> error = { color -> return "Pixel(" + x + ", " + y + ") expected to be " + expected + ", but was " + color });
method public static void assertPixels(android.graphics.Bitmap, androidx.ui.unit.IntPxSize? expectedSize = null, kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPxPosition,androidx.ui.graphics.Color> expectedColorProvider);
- method public static void assertShape-2l1GYV8(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.px);
- method public static void assertShape-nbwoFSQ(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat().px, float sizeY = height.toFloat().px, float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width.px / 2.0, float centerY = height.px / 2.0, float shapeOverlapPixelCount = 1.px);
+ method public static void assertShape--mmofgM(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.0f);
+ method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(android.view.View);
method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
diff --git a/ui/ui-test/api/restricted_0.1.0-dev12.txt b/ui/ui-test/api/restricted_0.1.0-dev12.txt
index a4490d8..997932e 100644
--- a/ui/ui-test/api/restricted_0.1.0-dev12.txt
+++ b/ui/ui-test/api/restricted_0.1.0-dev12.txt
@@ -53,8 +53,8 @@
public final class BitmapHelpersKt {
method public static void assertPixelColor-9bBi3KA(android.graphics.Bitmap, long expected, int x, int y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,java.lang.String> error = { color -> return "Pixel(" + x + ", " + y + ") expected to be " + expected + ", but was " + color });
method public static void assertPixels(android.graphics.Bitmap, androidx.ui.unit.IntPxSize? expectedSize = null, kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPxPosition,androidx.ui.graphics.Color> expectedColorProvider);
- method public static void assertShape-2l1GYV8(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.px);
- method public static void assertShape-nbwoFSQ(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat().px, float sizeY = height.toFloat().px, float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width.px / 2.0, float centerY = height.px / 2.0, float shapeOverlapPixelCount = 1.px);
+ method public static void assertShape--mmofgM(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.0f);
+ method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(android.view.View);
method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
diff --git a/ui/ui-test/api/restricted_current.txt b/ui/ui-test/api/restricted_current.txt
index a4490d8..997932e 100644
--- a/ui/ui-test/api/restricted_current.txt
+++ b/ui/ui-test/api/restricted_current.txt
@@ -53,8 +53,8 @@
public final class BitmapHelpersKt {
method public static void assertPixelColor-9bBi3KA(android.graphics.Bitmap, long expected, int x, int y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.Color,java.lang.String> error = { color -> return "Pixel(" + x + ", " + y + ") expected to be " + expected + ", but was " + color });
method public static void assertPixels(android.graphics.Bitmap, androidx.ui.unit.IntPxSize? expectedSize = null, kotlin.jvm.functions.Function1<? super androidx.ui.unit.IntPxPosition,androidx.ui.graphics.Color> expectedColorProvider);
- method public static void assertShape-2l1GYV8(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.px);
- method public static void assertShape-nbwoFSQ(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat().px, float sizeY = height.toFloat().px, float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width.px / 2.0, float centerY = height.px / 2.0, float shapeOverlapPixelCount = 1.px);
+ method public static void assertShape--mmofgM(android.graphics.Bitmap, androidx.ui.unit.Density density, float horizontalPadding, float verticalPadding, long backgroundColor, long shapeColor, androidx.ui.graphics.Shape shape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float shapeOverlapPixelCount = 1.0f);
+ method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static android.graphics.Bitmap captureToBitmap(android.view.View);
method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
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 c8f1e9f..1fa6734 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
@@ -26,9 +26,7 @@
import androidx.ui.layout.preferredSize
import androidx.ui.semantics.ScrollTo
import androidx.ui.semantics.Semantics
-import androidx.ui.unit.Px
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import com.google.common.truth.Truth
import org.junit.Assert
import org.junit.Rule
@@ -74,9 +72,9 @@
@Test
fun checkSemanticsAction_scrollTo_coordAreCorrect() {
- var currentScrollPositionY = 0.px
- var currentScrollPositionX = 0.px
- var elementHeight = 0.px
+ var currentScrollPositionY = 0.0f
+ var currentScrollPositionX = 0.0f
+ var elementHeight = 0.0f
val tag = "myTag"
val drawRect = @Composable { color: Color ->
@@ -84,7 +82,7 @@
Canvas(Modifier.preferredSize(100.dp)) {
drawRect(color)
- elementHeight = Px(size.height)
+ elementHeight = size.height
}
}
}
@@ -94,8 +92,8 @@
// doesn't try to include the padding
Semantics(container = true, properties = {
ScrollTo(action = { x, y ->
- currentScrollPositionY = y
- currentScrollPositionX = x
+ currentScrollPositionY = y.value
+ currentScrollPositionX = x.value
return@ScrollTo true
})
}) {
@@ -114,8 +112,8 @@
}
runOnIdleCompose {
- Truth.assertThat(currentScrollPositionY).isEqualTo(0.px)
- Truth.assertThat(currentScrollPositionX).isEqualTo(0.px)
+ Truth.assertThat(currentScrollPositionY).isEqualTo(0.0f)
+ Truth.assertThat(currentScrollPositionX).isEqualTo(0.0f)
}
findByTag(tag)
@@ -124,7 +122,7 @@
runOnIdleCompose {
val expected = elementHeight * 2
Truth.assertThat(currentScrollPositionY).isEqualTo(expected)
- Truth.assertThat(currentScrollPositionX).isEqualTo(0.px)
+ Truth.assertThat(currentScrollPositionX).isEqualTo(0.0f)
}
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt
index 9798582..149cac1 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt
@@ -39,7 +39,6 @@
import androidx.ui.test.util.ClickableTestBox
import androidx.ui.test.util.RecordingFilter
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -50,7 +49,7 @@
private const val numberOfSquares = 5
private const val first = 0
private const val last = numberOfSquares - 1
-private val squareSize = 10.px
+private val squareSize = 10.0f
private val center = PxPosition(squareSize / 2, squareSize / 2)
private val colors = listOf(Color.Red, Color.Yellow, Color.Blue, Color.Green, Color.Cyan)
@@ -175,8 +174,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(0.px, squareSize - 1.px)) {
- for (y in listOf(0.px, squareSize - 1.px)) {
+ for (x in listOf(0.0f, squareSize - 1.0f)) {
+ for (y in listOf(0.0f, squareSize - 1.0f)) {
add(TestConfig(PxPosition(x, y), ComponentActivity::class.java))
add(TestConfig(PxPosition(x, y), ActivityWithActionBar::class.java))
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt
index 049380a..a7c701d 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt
@@ -30,7 +30,6 @@
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.unit.PxPosition
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -38,8 +37,8 @@
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
-private val width = 200.px
-private val height = 200.px
+private val width = 200.0f
+private val height = 200.0f
private val expectedDelay = 145.milliseconds
private const val tag = "widget"
@@ -110,8 +109,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(1.px, 33.px, 99.px)) {
- for (y in listOf(1.px, 33.px, 99.px)) {
+ for (x in listOf(1.0f, 33.0f, 99.0f)) {
+ for (y in listOf(1.0f, 33.0f, 99.0f)) {
add(TestConfig(PxPosition(x, y)))
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt
index 87d315f7..6f0377e 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt
@@ -37,7 +37,6 @@
import androidx.ui.test.util.recordedDuration
import androidx.ui.unit.PxPosition
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -46,8 +45,8 @@
import org.junit.runners.Parameterized
private const val tag = "widget"
-private val width = 100.px
-private val height = 100.px
+private val width = 100.0f
+private val height = 100.0f
private val expectedDuration = LongPressTimeout + 100.milliseconds
/**
@@ -119,8 +118,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(1.px, width / 4)) {
- for (y in listOf(1.px, height / 4)) {
+ for (x in listOf(1.0f, width / 4)) {
+ for (y in listOf(1.0f, height / 4)) {
add(TestConfig(PxPosition(x, y)))
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
index 2c49a65..1ce3782 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
@@ -40,7 +40,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.getDistance
import androidx.ui.unit.inMilliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -95,10 +94,10 @@
private const val tag = "widget"
- private val boxSize = 500.px
- private val boxStart = 1.px
+ private val boxSize = 500.0f
+ private val boxStart = 1.0f
private val boxMiddle = boxSize / 2
- private val boxEnd = boxSize - 1.px
+ private val boxEnd = boxSize - 1.0f
}
private val start get() = config.direction.from
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/ClickableTestBox.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/ClickableTestBox.kt
index e6ea4f2..280ca74 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/ClickableTestBox.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/ClickableTestBox.kt
@@ -27,11 +27,9 @@
import androidx.ui.test.util.ClickableTestBox.defaultColor
import androidx.ui.test.util.ClickableTestBox.defaultSize
import androidx.ui.test.util.ClickableTestBox.defaultTag
-import androidx.ui.unit.Px
-import androidx.ui.unit.px
object ClickableTestBox {
- val defaultSize = 100.px
+ val defaultSize = 100.0f
val defaultColor = Color.Yellow
const val defaultTag = "ClickableTestBox"
}
@@ -39,8 +37,8 @@
@Composable
fun ClickableTestBox(
modifier: Modifier = Modifier,
- width: Px = defaultSize,
- height: Px = defaultSize,
+ width: Float = defaultSize,
+ height: Float = defaultSize,
color: Color = defaultColor,
tag: String = defaultTag
) {
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt b/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt
index 0173dce..65a66b2 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt
@@ -37,14 +37,12 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.Px
import androidx.ui.unit.PxSize
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
-import androidx.ui.unit.round
import androidx.ui.unit.toRect
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
+import kotlin.math.roundToInt
/**
* Captures the underlying component's surface into bitmap.
@@ -188,26 +186,26 @@
shapeColor: Color,
backgroundColor: Color,
backgroundShape: Shape = RectangleShape,
- sizeX: Px = width.toFloat().px,
- sizeY: Px = height.toFloat().px,
- shapeSizeX: Px = sizeX,
- shapeSizeY: Px = sizeY,
- centerX: Px = width.px / 2f,
- centerY: Px = height.px / 2f,
- shapeOverlapPixelCount: Px = 1.px
+ sizeX: Float = width.toFloat(),
+ sizeY: Float = height.toFloat(),
+ shapeSizeX: Float = sizeX,
+ shapeSizeY: Float = sizeY,
+ centerX: Float = width / 2f,
+ centerY: Float = height / 2f,
+ shapeOverlapPixelCount: Float = 1.0f
) {
- val width = width.px
- val height = height.px
+ val width = width
+ val height = height
assertTrue(centerX + sizeX / 2 <= width)
- assertTrue(centerX - sizeX / 2 >= 0.px)
+ assertTrue(centerX - sizeX / 2 >= 0.0f)
assertTrue(centerY + sizeY / 2 <= height)
- assertTrue(centerY - sizeY / 2 >= 0.px)
+ assertTrue(centerY - sizeY / 2 >= 0.0f)
val outline = shape.createOutline(PxSize(shapeSizeX, shapeSizeY), density)
val path = Path()
path.addOutline(outline)
val shapeOffset = Offset(
- (centerX - shapeSizeX / 2f).value,
- (centerY - shapeSizeY / 2f).value
+ (centerX - shapeSizeX / 2f),
+ (centerY - shapeSizeY / 2f)
)
val backgroundPath = Path()
backgroundPath.addOutline(backgroundShape.createOutline(PxSize(sizeX, sizeY), density))
@@ -272,34 +270,34 @@
backgroundColor: Color,
shapeColor: Color,
shape: Shape = RectangleShape,
- shapeOverlapPixelCount: Px = 1.px
+ shapeOverlapPixelCount: Float = 1.0f
) {
- val fullHorizontalPadding = with(density) { horizontalPadding.toPx() * 2 }
- val fullVerticalPadding = with(density) { verticalPadding.toPx() * 2 }
+ val fullHorizontalPadding = with(density) { horizontalPadding.toPx().value * 2 }
+ val fullVerticalPadding = with(density) { verticalPadding.toPx().value * 2 }
return assertShape(
density = density,
shape = shape,
shapeColor = shapeColor,
backgroundColor = backgroundColor,
backgroundShape = RectangleShape,
- shapeSizeX = width.toFloat().px - fullHorizontalPadding,
- shapeSizeY = height.toFloat().px - fullVerticalPadding,
+ shapeSizeX = width.toFloat() - fullHorizontalPadding,
+ shapeSizeY = height.toFloat() - fullVerticalPadding,
shapeOverlapPixelCount = shapeOverlapPixelCount
)
}
-private infix fun Px.until(until: Px): IntRange {
- val from = this.round().value
- val to = until.round().value
+private infix fun Float.until(until: Float): IntRange {
+ val from = this.roundToInt()
+ val to = until.roundToInt()
if (from <= Int.MIN_VALUE) return IntRange.EMPTY
- return from..(to - 1).toInt()
+ return from..(to - 1)
}
-private fun pixelCloserToCenter(offset: Offset, shapeSizeX: Px, shapeSizeY: Px, delta: Px):
+private fun pixelCloserToCenter(offset: Offset, shapeSizeX: Float, shapeSizeY: Float, delta: Float):
Offset {
- val centerX = shapeSizeX.value / 2f
- val centerY = shapeSizeY.value / 2f
- val d = delta.value
+ val centerX = shapeSizeX / 2f
+ val centerY = shapeSizeY / 2f
+ val d = delta
val x = when {
offset.dx > centerX -> offset.dx - d
offset.dx < centerX -> offset.dx + d
@@ -313,11 +311,15 @@
return Offset(x, y)
}
-private fun pixelFartherFromCenter(offset: Offset, shapeSizeX: Px, shapeSizeY: Px, delta: Px):
- Offset {
- val centerX = shapeSizeX.value / 2f
- val centerY = shapeSizeY.value / 2f
- val d = delta.value
+private fun pixelFartherFromCenter(
+ offset: Offset,
+ shapeSizeX: Float,
+ shapeSizeY: Float,
+ delta: Float
+): Offset {
+ val centerX = shapeSizeX / 2f
+ val centerY = shapeSizeY / 2f
+ val d = delta
val x = when {
offset.dx > centerX -> offset.dx + d
offset.dx < centerX -> offset.dx - d
diff --git a/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt b/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt
index 83a0940..0849678 100644
--- a/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt
+++ b/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt
@@ -23,9 +23,7 @@
import androidx.ui.text.font.Font
import androidx.ui.text.style.TextDirection
import androidx.ui.unit.Density
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import kotlin.math.max
/**
@@ -193,8 +191,8 @@
endIndex = paragraphInfo.endIndex,
startLineIndex = startLineIndex,
endLineIndex = endLineIndex,
- top = paragraphTop.px,
- bottom = paragraphBottom.px
+ top = paragraphTop,
+ bottom = paragraphBottom
)
)
@@ -269,7 +267,7 @@
val paragraphIndex = when {
position.y.value <= 0f -> 0
position.y.value >= height -> paragraphInfoList.lastIndex
- else -> findParagraphByY(paragraphInfoList, position.y)
+ else -> findParagraphByY(paragraphInfoList, position.y.value)
}
return with(paragraphInfoList[paragraphIndex]) {
if (length == 0) {
@@ -592,7 +590,7 @@
* of [0, [MultiParagraph.height]].
* @return The index of the target [ParagraphInfo] in [paragraphInfoList].
*/
-internal fun findParagraphByY(paragraphInfoList: List<ParagraphInfo>, y: Px): Int {
+internal fun findParagraphByY(paragraphInfoList: List<ParagraphInfo>, y: Float): Int {
return paragraphInfoList.binarySearch { paragraphInfo ->
when {
paragraphInfo.top > y -> 1
@@ -643,8 +641,8 @@
val endIndex: Int,
var startLineIndex: Int = -1,
var endLineIndex: Int = -1,
- var top: Px = (-1).px,
- var bottom: Px = (-1).px
+ var top: Float = -1.0f,
+ var bottom: Float = -1.0f
) {
/**
@@ -689,7 +687,7 @@
* parent [MultiParagraph].
*/
fun Float.toGlobalYPosition(): Float {
- return this + top.value
+ return this + top
}
/**
@@ -697,7 +695,7 @@
* relative to the [paragraph].
*/
fun PxPosition.toLocal(): PxPosition {
- return PxPosition(x = x, y = y - top)
+ return PxPosition(x = x.value, y = y.value - top)
}
/**
@@ -705,7 +703,7 @@
* [MultiParagraph].
*/
fun Rect.toGlobal(): Rect {
- return shift(Offset(dx = 0f, dy = this@ParagraphInfo.top.value))
+ return shift(Offset(dx = 0f, dy = this@ParagraphInfo.top))
}
/**
@@ -715,7 +713,7 @@
* Notice that this function changes the input value.
*/
fun Path.toGlobal(): Path {
- shift(Offset(dx = 0f, dy = top.value))
+ shift(Offset(dx = 0f, dy = top))
return this
}
diff --git a/ui/ui-text-core/src/main/java/androidx/ui/text/TextLayoutResult.kt b/ui/ui-text-core/src/main/java/androidx/ui/text/TextLayoutResult.kt
index bab9260..8df36d1 100644
--- a/ui/ui-text-core/src/main/java/androidx/ui/text/TextLayoutResult.kt
+++ b/ui/ui-text-core/src/main/java/androidx/ui/text/TextLayoutResult.kt
@@ -25,9 +25,7 @@
import androidx.ui.text.style.TextOverflow
import androidx.ui.unit.Density
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
/**
* The data class which holds the set of parameters of the text layout computation.
@@ -115,12 +113,12 @@
/**
* The distance from the top to the alphabetic baseline of the first line.
*/
- val firstBaseline: Px = multiParagraph.firstBaseline.px
+ val firstBaseline: Float = multiParagraph.firstBaseline
/**
* The distance from the top to the alphabetic baseline of the last line.
*/
- val lastBaseline: Px = multiParagraph.lastBaseline.px
+ val lastBaseline: Float = multiParagraph.lastBaseline
/**
* Returns true if the text is too tall and couldn't fit with given height.
@@ -171,7 +169,7 @@
* @param lineIndex the line number
* @return the line top y coordinate
*/
- fun getLineTop(lineIndex: Int): Px = multiParagraph.getLineTop(lineIndex).px
+ fun getLineTop(lineIndex: Int): Float = multiParagraph.getLineTop(lineIndex)
/**
* Returns the bottom y coordinate of the given line.
@@ -179,7 +177,7 @@
* @param lineIndex the line number
* @return the line bottom y coordinate
*/
- fun getLineBottom(lineIndex: Int): Px = multiParagraph.getLineBottom(lineIndex).px
+ fun getLineBottom(lineIndex: Int): Float = multiParagraph.getLineBottom(lineIndex)
/**
* Returns the line number on which the specified text offset appears.
@@ -210,8 +208,8 @@
* @return the relative distance from the text starting edge.
* @see MultiParagraph.getHorizontalPosition
*/
- fun getHorizontalPosition(offset: Int, usePrimaryDirection: Boolean): Px =
- multiParagraph.getHorizontalPosition(offset, usePrimaryDirection).px
+ fun getHorizontalPosition(offset: Int, usePrimaryDirection: Boolean): Float =
+ multiParagraph.getHorizontalPosition(offset, usePrimaryDirection)
/**
* Get the text direction of the paragraph containing the given offset.
diff --git a/ui/ui-text-core/src/test/java/androidx/ui/text/MultiParagraphTest.kt b/ui/ui-text-core/src/test/java/androidx/ui/text/MultiParagraphTest.kt
index b20e5fc..a2dff3c 100644
--- a/ui/ui-text-core/src/test/java/androidx/ui/text/MultiParagraphTest.kt
+++ b/ui/ui-text-core/src/test/java/androidx/ui/text/MultiParagraphTest.kt
@@ -16,7 +16,6 @@
package androidx.ui.text
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.mock
import org.junit.Test
@@ -63,16 +62,16 @@
fun findParagraphByYPosition() {
val paragraphNumber = 5
val paragraphHeight = 10
- var top = 0
+ var top = 0.0f
val paragraphInfoList = List(paragraphNumber) {
val bottom = top + paragraphHeight
// StartIndex and endIndex doesn't matter in this test
- ParagraphInfo(mock(), 0, 0, top = top.px, bottom = bottom.px)
+ ParagraphInfo(mock(), 0, 0, top = top, bottom = bottom)
.also { top = bottom }
}
for (i in 0 until paragraphNumber * paragraphHeight) {
- assertThat(findParagraphByY(paragraphInfoList, i.px))
+ assertThat(findParagraphByY(paragraphInfoList, i.toFloat()))
.isEqualTo(i / paragraphHeight)
}
}
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt b/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
index a167011..3808723 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
@@ -48,8 +48,8 @@
import androidx.ui.unit.max
import androidx.ui.unit.min
import androidx.ui.unit.px
-import androidx.ui.unit.round
import kotlin.math.floor
+import kotlin.math.roundToInt
/** The default selection color if none is specified. */
internal val DefaultSelectionColor = Color(0x6633B5E5)
@@ -227,8 +227,8 @@
// round.
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/android/graphics/Paint.cpp;l=635?q=Paint.cpp
mapOf(
- FirstBaseline to layoutResult.firstBaseline.round(),
- LastBaseline to layoutResult.lastBaseline.round()
+ FirstBaseline to layoutResult.firstBaseline.roundToInt().ipx,
+ LastBaseline to layoutResult.lastBaseline.roundToInt().ipx
)
) {
for (placeable in placeables) {
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt b/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt
index 8054dea..1163973 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt
@@ -48,7 +48,8 @@
import androidx.ui.semantics.Semantics
import androidx.ui.semantics.onClick
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.round
+import androidx.ui.unit.ipx
+import kotlin.math.roundToInt
/**
* The common TextField implementation.
@@ -236,8 +237,8 @@
width,
height,
mapOf(
- FirstBaseline to result.firstBaseline.round(),
- LastBaseline to result.lastBaseline.round()
+ FirstBaseline to result.firstBaseline.roundToInt().ipx,
+ LastBaseline to result.lastBaseline.roundToInt().ipx
)
) {}
}
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt b/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
index eaaa01e..c726621 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
@@ -16,7 +16,7 @@
package androidx.ui.text.selection
-import androidx.ui.unit.PxBounds
+import androidx.ui.geometry.Rect
import androidx.ui.unit.PxPosition
/**
@@ -30,36 +30,36 @@
*/
Vertical {
override fun isSelected(
- bounds: PxBounds,
+ bounds: Rect,
start: PxPosition,
end: PxPosition
): Boolean {
// When the end of the selection is above the top of the composable, the composable is outside
// of the selection range.
- if (end.y < bounds.top) return false
+ if (end.y.value < bounds.top) return false
// When the end of the selection is on the left of the composable, and not below the bottom
// of composable, the composable is outside of the selection range.
- if (end.x < bounds.left && end.y < bounds.bottom) return false
+ if (end.x.value < bounds.left && end.y.value < bounds.bottom) return false
// When the start of the selection is below the bottom of the composable, the composable is
// outside of the selection range.
- if (start.y >= bounds.bottom) return false
+ if (start.y.value >= bounds.bottom) return false
// When the start of the selection is on the right of the composable, and not above the top
// of the composable, the composable is outside of the selection range.
- if (start.x >= bounds.right && start.y >= bounds.top) return false
+ if (start.x.value >= bounds.right && start.y.value >= bounds.top) return false
return true
}
override fun areHandlesCrossed(
- bounds: PxBounds,
+ bounds: Rect,
start: PxPosition,
end: PxPosition
): Boolean {
- if (start.y >= bounds.top && start.y < bounds.bottom &&
- end.y >= bounds.top && end.y < bounds.bottom
+ if (start.y.value >= bounds.top && start.y.value < bounds.bottom &&
+ end.y.value >= bounds.top && end.y.value < bounds.bottom
) {
// When the start and end of the selection are in the same row of widgets, check if
// x coordinates of the start and end are crossed each other.
@@ -79,36 +79,36 @@
*/
Horizontal {
override fun isSelected(
- bounds: PxBounds,
+ bounds: Rect,
start: PxPosition,
end: PxPosition
): Boolean {
// When the end of the selection is on the left of the composable, the composable is outside of
// the selection range.
- if (end.x < bounds.left) return false
+ if (end.x.value < bounds.left) return false
// When the end of the selection is on the top of the composable, and the not on the right
// of the composable, the composable is outside of the selection range.
- if (end.y < bounds.top && end.x < bounds.right) return false
+ if (end.y.value < bounds.top && end.x.value < bounds.right) return false
// When the start of the selection is on the right of the composable, the composable is outside
// of the selection range.
- if (start.x >= bounds.right) return false
+ if (start.x.value >= bounds.right) return false
// When the start of the selection is below the composable, and not on the left of the
// composable, the composable is outside of the selection range.
- if (start.y >= bounds.bottom && start.x >= bounds.left) return false
+ if (start.y.value >= bounds.bottom && start.x.value >= bounds.left) return false
return true
}
override fun areHandlesCrossed(
- bounds: PxBounds,
+ bounds: Rect,
start: PxPosition,
end: PxPosition
): Boolean {
- if (start.x >= bounds.left && start.x < bounds.right &&
- end.x >= bounds.left && end.x < bounds.right
+ if (start.x.value >= bounds.left && start.x.value < bounds.right &&
+ end.x.value >= bounds.left && end.x.value < bounds.right
) {
// When the start and end of the selection are in the same column of widgets,
// check if y coordinates of the start and end are crossed each other.
@@ -130,7 +130,7 @@
* @param end The end coordinates of the selection, in SelectionContainer range.
*/
internal abstract fun isSelected(
- bounds: PxBounds,
+ bounds: Rect,
start: PxPosition,
end: PxPosition
): Boolean
@@ -145,7 +145,7 @@
* @param end The end coordinates of the selection, in SelectionContainer range.
*/
internal abstract fun areHandlesCrossed(
- bounds: PxBounds,
+ bounds: Rect,
start: PxPosition,
end: PxPosition
): Boolean
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt b/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
index 45c28ff..0a7e678 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
@@ -24,11 +24,8 @@
import androidx.ui.text.AnnotatedString
import androidx.ui.text.TextLayoutResult
import androidx.ui.text.TextRange
-import androidx.ui.unit.Px
-import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
import androidx.ui.unit.toPx
-import androidx.ui.unit.toRect
import kotlin.math.max
internal class TextSelectionDelegate(
@@ -138,20 +135,20 @@
val startPosition = selectionCoordinates.first
val endPosition = selectionCoordinates.second
- val bounds = PxBounds(
- Px.Zero,
- Px.Zero,
- textLayoutResult.size.width.toPx(),
- textLayoutResult.size.height.toPx()
+ val bounds = Rect(
+ 0.0f,
+ 0.0f,
+ textLayoutResult.size.width.toPx().value,
+ textLayoutResult.size.height.toPx().value
)
val lastOffset = textLayoutResult.layoutInput.text.text.length
val containsWholeSelectionStart =
- bounds.toRect().contains(Offset(startPosition.x.value, startPosition.y.value))
+ bounds.contains(Offset(startPosition.x.value, startPosition.y.value))
val containsWholeSelectionEnd =
- bounds.toRect().contains(Offset(endPosition.x.value, endPosition.y.value))
+ bounds.contains(Offset(endPosition.x.value, endPosition.y.value))
val rawStartOffset =
if (containsWholeSelectionStart)
@@ -217,7 +214,7 @@
containsWholeSelectionEnd: Boolean,
startPosition: PxPosition,
endPosition: PxPosition,
- bounds: PxBounds,
+ bounds: Rect,
textLayoutResult: TextLayoutResult,
lastOffset: Int,
selectable: Selectable,
@@ -374,7 +371,7 @@
rawStartOffset: Int,
rawEndOffset: Int,
lastOffset: Int,
- bounds: PxBounds,
+ bounds: Rect,
containsWholeSelectionStart: Boolean,
containsWholeSelectionEnd: Boolean
): Triple<Int, Int, Boolean> {
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt
index 64dc4b3..f015172 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt
@@ -17,9 +17,8 @@
package androidx.ui.text.selection
import androidx.test.filters.SmallTest
-import androidx.ui.unit.PxBounds
+import androidx.ui.geometry.Rect
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
@@ -28,12 +27,12 @@
@RunWith(JUnit4::class)
@SmallTest
class SelectionModeTest {
- private val left = 0.px
- private val right = 100.px
- private val top = 0.px
- private val bottom = 100.px
+ private val left = 0.0f
+ private val right = 100.0f
+ private val top = 0.0f
+ private val bottom = 100.0f
- private val shift = 10.px
+ private val shift = 10.0f
private val smallerThanLeft = left - shift
private val betweenLeftAndRight = left + (right - left) / 2
@@ -43,7 +42,7 @@
private val betweenTopAndBottom = top + (bottom - top) / 2
private val largerThanBottom = bottom + shift
- private val bounds = PxBounds(left = left, top = top, right = right, bottom = bottom)
+ private val bounds = Rect(left = left, top = top, right = right, bottom = bottom)
@Test
fun isSelected_Vertical_contains_start_return_true() {
diff --git a/ui/ui-unit/api/0.1.0-dev12.txt b/ui/ui-unit/api/0.1.0-dev12.txt
index c15982c..a66bda0 100644
--- a/ui/ui-unit/api/0.1.0-dev12.txt
+++ b/ui/ui-unit/api/0.1.0-dev12.txt
@@ -505,7 +505,9 @@
public final class PxKt {
method public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
+ method public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
method public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
+ method public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method public static inline float abs-NgWp0Z8(float x);
method public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
diff --git a/ui/ui-unit/api/current.txt b/ui/ui-unit/api/current.txt
index c15982c..a66bda0 100644
--- a/ui/ui-unit/api/current.txt
+++ b/ui/ui-unit/api/current.txt
@@ -505,7 +505,9 @@
public final class PxKt {
method public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
+ method public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
method public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
+ method public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method public static inline float abs-NgWp0Z8(float x);
method public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev12.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev12.txt
index c15982c..a66bda0 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev12.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev12.txt
@@ -505,7 +505,9 @@
public final class PxKt {
method public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
+ method public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
method public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
+ method public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method public static inline float abs-NgWp0Z8(float x);
method public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
diff --git a/ui/ui-unit/api/public_plus_experimental_current.txt b/ui/ui-unit/api/public_plus_experimental_current.txt
index c15982c..a66bda0 100644
--- a/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -505,7 +505,9 @@
public final class PxKt {
method public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
+ method public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
method public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
+ method public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method public static inline float abs-NgWp0Z8(float x);
method public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev12.txt b/ui/ui-unit/api/restricted_0.1.0-dev12.txt
index 2b23c8f..a01b3de 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev12.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev12.txt
@@ -509,7 +509,9 @@
public final class PxKt {
method public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
+ method public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
method public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
+ method public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method public static inline float abs-NgWp0Z8(float x);
method public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
diff --git a/ui/ui-unit/api/restricted_current.txt b/ui/ui-unit/api/restricted_current.txt
index 2b23c8f..a01b3de 100644
--- a/ui/ui-unit/api/restricted_current.txt
+++ b/ui/ui-unit/api/restricted_current.txt
@@ -509,7 +509,9 @@
public final class PxKt {
method public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
+ method public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
method public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
+ method public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method public static inline float abs-NgWp0Z8(float x);
method public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
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 36c4444..d4af92c 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
@@ -495,6 +495,11 @@
}
/**
+ * Constructs a [PxSize] from width and height Float values.
+ */
+inline fun PxSize(width: Float, height: Float): PxSize = PxSize(packFloats(width, height))
+
+/**
* Constructs a [PxSize] from width and height [Px] values.
*/
inline fun PxSize(width: Px, height: Px): PxSize = PxSize(packFloats(width.value, height.value))
@@ -581,6 +586,11 @@
}
/**
+ * Constructs a [PxPosition] from [x] and [y] position float values.
+ */
+inline fun PxPosition(x: Float, y: Float): PxPosition = PxPosition(packFloats(x, y))
+
+/**
* Constructs a [PxPosition] from [x] and [y] position [Px] values.
*/
inline fun PxPosition(x: Px, y: Px): PxPosition = PxPosition(packFloats(x.value, y.value))
diff --git a/ui/ui-vector/api/0.1.0-dev12.txt b/ui/ui-vector/api/0.1.0-dev12.txt
index 85a63f89..b0e4ee8 100644
--- a/ui/ui-vector/api/0.1.0-dev12.txt
+++ b/ui/ui-vector/api/0.1.0-dev12.txt
@@ -84,6 +84,7 @@
}
public final class VectorComponent extends androidx.ui.graphics.vector.VNode {
+ ctor public VectorComponent(float viewportWidth, float viewportHeight, float defaultWidth, float defaultHeight, String name);
method public void draw(androidx.ui.graphics.Canvas canvas, float alpha, androidx.ui.graphics.ColorFilter? colorFilter);
method public void draw(androidx.ui.graphics.Canvas canvas);
method public float getDefaultHeight();
@@ -93,8 +94,8 @@
method public int getSize();
method public float getViewportHeight();
method public float getViewportWidth();
- method public void setDefaultHeight-NgWp0Z8(float p);
- method public void setDefaultWidth-NgWp0Z8(float p);
+ method public void setDefaultHeight(float p);
+ method public void setDefaultWidth(float p);
method public void setViewportHeight(float p);
method public void setViewportWidth(float p);
property public final androidx.ui.graphics.vector.GroupComponent root;
diff --git a/ui/ui-vector/api/current.txt b/ui/ui-vector/api/current.txt
index 85a63f89..b0e4ee8 100644
--- a/ui/ui-vector/api/current.txt
+++ b/ui/ui-vector/api/current.txt
@@ -84,6 +84,7 @@
}
public final class VectorComponent extends androidx.ui.graphics.vector.VNode {
+ ctor public VectorComponent(float viewportWidth, float viewportHeight, float defaultWidth, float defaultHeight, String name);
method public void draw(androidx.ui.graphics.Canvas canvas, float alpha, androidx.ui.graphics.ColorFilter? colorFilter);
method public void draw(androidx.ui.graphics.Canvas canvas);
method public float getDefaultHeight();
@@ -93,8 +94,8 @@
method public int getSize();
method public float getViewportHeight();
method public float getViewportWidth();
- method public void setDefaultHeight-NgWp0Z8(float p);
- method public void setDefaultWidth-NgWp0Z8(float p);
+ method public void setDefaultHeight(float p);
+ method public void setDefaultWidth(float p);
method public void setViewportHeight(float p);
method public void setViewportWidth(float p);
property public final androidx.ui.graphics.vector.GroupComponent root;
diff --git a/ui/ui-vector/api/public_plus_experimental_0.1.0-dev12.txt b/ui/ui-vector/api/public_plus_experimental_0.1.0-dev12.txt
index 85a63f89..b0e4ee8 100644
--- a/ui/ui-vector/api/public_plus_experimental_0.1.0-dev12.txt
+++ b/ui/ui-vector/api/public_plus_experimental_0.1.0-dev12.txt
@@ -84,6 +84,7 @@
}
public final class VectorComponent extends androidx.ui.graphics.vector.VNode {
+ ctor public VectorComponent(float viewportWidth, float viewportHeight, float defaultWidth, float defaultHeight, String name);
method public void draw(androidx.ui.graphics.Canvas canvas, float alpha, androidx.ui.graphics.ColorFilter? colorFilter);
method public void draw(androidx.ui.graphics.Canvas canvas);
method public float getDefaultHeight();
@@ -93,8 +94,8 @@
method public int getSize();
method public float getViewportHeight();
method public float getViewportWidth();
- method public void setDefaultHeight-NgWp0Z8(float p);
- method public void setDefaultWidth-NgWp0Z8(float p);
+ method public void setDefaultHeight(float p);
+ method public void setDefaultWidth(float p);
method public void setViewportHeight(float p);
method public void setViewportWidth(float p);
property public final androidx.ui.graphics.vector.GroupComponent root;
diff --git a/ui/ui-vector/api/public_plus_experimental_current.txt b/ui/ui-vector/api/public_plus_experimental_current.txt
index 85a63f89..b0e4ee8 100644
--- a/ui/ui-vector/api/public_plus_experimental_current.txt
+++ b/ui/ui-vector/api/public_plus_experimental_current.txt
@@ -84,6 +84,7 @@
}
public final class VectorComponent extends androidx.ui.graphics.vector.VNode {
+ ctor public VectorComponent(float viewportWidth, float viewportHeight, float defaultWidth, float defaultHeight, String name);
method public void draw(androidx.ui.graphics.Canvas canvas, float alpha, androidx.ui.graphics.ColorFilter? colorFilter);
method public void draw(androidx.ui.graphics.Canvas canvas);
method public float getDefaultHeight();
@@ -93,8 +94,8 @@
method public int getSize();
method public float getViewportHeight();
method public float getViewportWidth();
- method public void setDefaultHeight-NgWp0Z8(float p);
- method public void setDefaultWidth-NgWp0Z8(float p);
+ method public void setDefaultHeight(float p);
+ method public void setDefaultWidth(float p);
method public void setViewportHeight(float p);
method public void setViewportWidth(float p);
property public final androidx.ui.graphics.vector.GroupComponent root;
diff --git a/ui/ui-vector/api/restricted_0.1.0-dev12.txt b/ui/ui-vector/api/restricted_0.1.0-dev12.txt
index 85a63f89..b0e4ee8 100644
--- a/ui/ui-vector/api/restricted_0.1.0-dev12.txt
+++ b/ui/ui-vector/api/restricted_0.1.0-dev12.txt
@@ -84,6 +84,7 @@
}
public final class VectorComponent extends androidx.ui.graphics.vector.VNode {
+ ctor public VectorComponent(float viewportWidth, float viewportHeight, float defaultWidth, float defaultHeight, String name);
method public void draw(androidx.ui.graphics.Canvas canvas, float alpha, androidx.ui.graphics.ColorFilter? colorFilter);
method public void draw(androidx.ui.graphics.Canvas canvas);
method public float getDefaultHeight();
@@ -93,8 +94,8 @@
method public int getSize();
method public float getViewportHeight();
method public float getViewportWidth();
- method public void setDefaultHeight-NgWp0Z8(float p);
- method public void setDefaultWidth-NgWp0Z8(float p);
+ method public void setDefaultHeight(float p);
+ method public void setDefaultWidth(float p);
method public void setViewportHeight(float p);
method public void setViewportWidth(float p);
property public final androidx.ui.graphics.vector.GroupComponent root;
diff --git a/ui/ui-vector/api/restricted_current.txt b/ui/ui-vector/api/restricted_current.txt
index 85a63f89..b0e4ee8 100644
--- a/ui/ui-vector/api/restricted_current.txt
+++ b/ui/ui-vector/api/restricted_current.txt
@@ -84,6 +84,7 @@
}
public final class VectorComponent extends androidx.ui.graphics.vector.VNode {
+ ctor public VectorComponent(float viewportWidth, float viewportHeight, float defaultWidth, float defaultHeight, String name);
method public void draw(androidx.ui.graphics.Canvas canvas, float alpha, androidx.ui.graphics.ColorFilter? colorFilter);
method public void draw(androidx.ui.graphics.Canvas canvas);
method public float getDefaultHeight();
@@ -93,8 +94,8 @@
method public int getSize();
method public float getViewportHeight();
method public float getViewportWidth();
- method public void setDefaultHeight-NgWp0Z8(float p);
- method public void setDefaultWidth-NgWp0Z8(float p);
+ method public void setDefaultHeight(float p);
+ method public void setDefaultWidth(float p);
method public void setViewportHeight(float p);
method public void setViewportWidth(float p);
property public final androidx.ui.graphics.vector.GroupComponent root;
diff --git a/ui/ui-vector/src/main/java/androidx/ui/graphics/vector/Vector.kt b/ui/ui-vector/src/main/java/androidx/ui/graphics/vector/Vector.kt
index f61c4ae..a5d08ed 100644
--- a/ui/ui-vector/src/main/java/androidx/ui/graphics/vector/Vector.kt
+++ b/ui/ui-vector/src/main/java/androidx/ui/graphics/vector/Vector.kt
@@ -30,7 +30,6 @@
import androidx.ui.graphics.StrokeCap
import androidx.ui.graphics.StrokeJoin
import androidx.ui.graphics.withSave
-import androidx.ui.unit.Px
import kotlin.math.ceil
const val DefaultGroupName = ""
@@ -93,16 +92,16 @@
class VectorComponent(
var viewportWidth: Float,
var viewportHeight: Float,
- var defaultWidth: Px,
- var defaultHeight: Px,
+ var defaultWidth: Float,
+ var defaultHeight: Float,
val name: String = ""
) : VNode() {
val root = GroupComponent(this@VectorComponent.name).apply {
pivotX = 0.0f
pivotY = 0.0f
- scaleX = defaultWidth.value / viewportWidth
- scaleY = defaultHeight.value / viewportHeight
+ scaleX = defaultWidth / viewportWidth
+ scaleY = defaultHeight / viewportHeight
invalidateListener = {
isDirty = true
}
@@ -126,8 +125,8 @@
var targetImage = cachedImage
if (targetImage == null) {
targetImage = ImageAsset(
- ceil(defaultWidth.value).toInt(),
- ceil(defaultHeight.value).toInt()
+ ceil(defaultWidth).toInt(),
+ ceil(defaultHeight).toInt()
)
cachedImage = targetImage
}