[go: nahoru, domu]

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-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),