Merge "AndroidX Webkit: new ProxyRule class and return unmodifiable lists" into androidx-master-dev
diff --git a/room/guava/src/androidTest/java/androidx/room/guava/GuavaRoomTest.java b/room/guava/src/androidTest/java/androidx/room/guava/GuavaRoomTest.java
index 8ae5983..653a6b9 100644
--- a/room/guava/src/androidTest/java/androidx/room/guava/GuavaRoomTest.java
+++ b/room/guava/src/androidTest/java/androidx/room/guava/GuavaRoomTest.java
@@ -25,6 +25,7 @@
import androidx.room.InvalidationTracker;
import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
+import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
import com.google.common.util.concurrent.ListenableFuture;
@@ -37,6 +38,7 @@
public class GuavaRoomTest {
@Test
+ @SdkSuppress(minSdkVersion = 16)
public void queryIsCancelled() {
Executor executor = runnable -> { /* nothing to do */ };
diff --git a/ui/ui-foundation/api/1.0.0-alpha01.txt b/ui/ui-foundation/api/1.0.0-alpha01.txt
index 9a7392a..782f0c2 100644
--- a/ui/ui-foundation/api/1.0.0-alpha01.txt
+++ b/ui/ui-foundation/api/1.0.0-alpha01.txt
@@ -237,9 +237,9 @@
package androidx.ui.foundation.shape.corner {
public abstract class CornerBasedShape implements androidx.ui.engine.geometry.Shape {
- ctor public CornerBasedShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
+ ctor public CornerBasedShape(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 final androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
+ method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
}
public interface CornerSize {
@@ -255,60 +255,29 @@
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
- public final class CornerSizes {
- ctor public CornerSizes(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);
+ 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.CornerSize component1();
method public androidx.ui.foundation.shape.corner.CornerSize component2();
method public androidx.ui.foundation.shape.corner.CornerSize component3();
method public androidx.ui.foundation.shape.corner.CornerSize component4();
- method public androidx.ui.foundation.shape.corner.CornerSizes 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.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.engine.geometry.Outline.Rounded createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
- public final class CornerSizesKt {
- ctor public CornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.foundation.shape.corner.CornerSize allCornersSize);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(@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);
- }
-
- public final class PxCornerSizes {
- ctor public PxCornerSizes(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px component1();
- method public androidx.ui.core.Px component2();
- method public androidx.ui.core.Px component3();
- method public androidx.ui.core.Px component4();
- method public androidx.ui.foundation.shape.corner.PxCornerSizes copy(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px getBottomLeft();
- method public androidx.ui.core.Px getBottomRight();
- method public androidx.ui.core.Px getTopLeft();
- method public androidx.ui.core.Px getTopRight();
- }
-
- public final class PxCornerSizesKt {
- ctor public PxCornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.PxCornerSizes PxCornerSizes(androidx.ui.foundation.shape.corner.CornerSizes corners, androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public static boolean isEmpty(androidx.ui.foundation.shape.corner.PxCornerSizes);
- }
-
- public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Rounded createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
- }
-
public final class RoundedCornerShapeKt {
ctor public 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(androidx.ui.core.Dp size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ 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 getCircleShape();
}
diff --git a/ui/ui-foundation/api/current.txt b/ui/ui-foundation/api/current.txt
index 9a7392a..782f0c2 100644
--- a/ui/ui-foundation/api/current.txt
+++ b/ui/ui-foundation/api/current.txt
@@ -237,9 +237,9 @@
package androidx.ui.foundation.shape.corner {
public abstract class CornerBasedShape implements androidx.ui.engine.geometry.Shape {
- ctor public CornerBasedShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
+ ctor public CornerBasedShape(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 final androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
+ method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
}
public interface CornerSize {
@@ -255,60 +255,29 @@
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
- public final class CornerSizes {
- ctor public CornerSizes(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);
+ 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.CornerSize component1();
method public androidx.ui.foundation.shape.corner.CornerSize component2();
method public androidx.ui.foundation.shape.corner.CornerSize component3();
method public androidx.ui.foundation.shape.corner.CornerSize component4();
- method public androidx.ui.foundation.shape.corner.CornerSizes 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.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.engine.geometry.Outline.Rounded createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
- public final class CornerSizesKt {
- ctor public CornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.foundation.shape.corner.CornerSize allCornersSize);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(@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);
- }
-
- public final class PxCornerSizes {
- ctor public PxCornerSizes(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px component1();
- method public androidx.ui.core.Px component2();
- method public androidx.ui.core.Px component3();
- method public androidx.ui.core.Px component4();
- method public androidx.ui.foundation.shape.corner.PxCornerSizes copy(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px getBottomLeft();
- method public androidx.ui.core.Px getBottomRight();
- method public androidx.ui.core.Px getTopLeft();
- method public androidx.ui.core.Px getTopRight();
- }
-
- public final class PxCornerSizesKt {
- ctor public PxCornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.PxCornerSizes PxCornerSizes(androidx.ui.foundation.shape.corner.CornerSizes corners, androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public static boolean isEmpty(androidx.ui.foundation.shape.corner.PxCornerSizes);
- }
-
- public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Rounded createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
- }
-
public final class RoundedCornerShapeKt {
ctor public 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(androidx.ui.core.Dp size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ 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 getCircleShape();
}
diff --git a/ui/ui-foundation/api/restricted_1.0.0-alpha01.txt b/ui/ui-foundation/api/restricted_1.0.0-alpha01.txt
index 9a7392a..782f0c2 100644
--- a/ui/ui-foundation/api/restricted_1.0.0-alpha01.txt
+++ b/ui/ui-foundation/api/restricted_1.0.0-alpha01.txt
@@ -237,9 +237,9 @@
package androidx.ui.foundation.shape.corner {
public abstract class CornerBasedShape implements androidx.ui.engine.geometry.Shape {
- ctor public CornerBasedShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
+ ctor public CornerBasedShape(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 final androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
+ method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
}
public interface CornerSize {
@@ -255,60 +255,29 @@
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
- public final class CornerSizes {
- ctor public CornerSizes(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);
+ 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.CornerSize component1();
method public androidx.ui.foundation.shape.corner.CornerSize component2();
method public androidx.ui.foundation.shape.corner.CornerSize component3();
method public androidx.ui.foundation.shape.corner.CornerSize component4();
- method public androidx.ui.foundation.shape.corner.CornerSizes 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.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.engine.geometry.Outline.Rounded createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
- public final class CornerSizesKt {
- ctor public CornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.foundation.shape.corner.CornerSize allCornersSize);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(@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);
- }
-
- public final class PxCornerSizes {
- ctor public PxCornerSizes(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px component1();
- method public androidx.ui.core.Px component2();
- method public androidx.ui.core.Px component3();
- method public androidx.ui.core.Px component4();
- method public androidx.ui.foundation.shape.corner.PxCornerSizes copy(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px getBottomLeft();
- method public androidx.ui.core.Px getBottomRight();
- method public androidx.ui.core.Px getTopLeft();
- method public androidx.ui.core.Px getTopRight();
- }
-
- public final class PxCornerSizesKt {
- ctor public PxCornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.PxCornerSizes PxCornerSizes(androidx.ui.foundation.shape.corner.CornerSizes corners, androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public static boolean isEmpty(androidx.ui.foundation.shape.corner.PxCornerSizes);
- }
-
- public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Rounded createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
- }
-
public final class RoundedCornerShapeKt {
ctor public 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(androidx.ui.core.Dp size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ 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 getCircleShape();
}
diff --git a/ui/ui-foundation/api/restricted_current.txt b/ui/ui-foundation/api/restricted_current.txt
index 9a7392a..782f0c2 100644
--- a/ui/ui-foundation/api/restricted_current.txt
+++ b/ui/ui-foundation/api/restricted_current.txt
@@ -237,9 +237,9 @@
package androidx.ui.foundation.shape.corner {
public abstract class CornerBasedShape implements androidx.ui.engine.geometry.Shape {
- ctor public CornerBasedShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
+ ctor public CornerBasedShape(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 final androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
+ method public abstract androidx.ui.engine.geometry.Outline createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
}
public interface CornerSize {
@@ -255,60 +255,29 @@
method public static androidx.ui.foundation.shape.corner.CornerSize getZeroCornerSize();
}
- public final class CornerSizes {
- ctor public CornerSizes(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);
+ 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.CornerSize component1();
method public androidx.ui.foundation.shape.corner.CornerSize component2();
method public androidx.ui.foundation.shape.corner.CornerSize component3();
method public androidx.ui.foundation.shape.corner.CornerSize component4();
- method public androidx.ui.foundation.shape.corner.CornerSizes 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.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.engine.geometry.Outline.Rounded createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
- public final class CornerSizesKt {
- ctor public CornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.foundation.shape.corner.CornerSize allCornersSize);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px size);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(int percent);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
- method public static androidx.ui.foundation.shape.corner.CornerSizes CornerSizes(@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);
- }
-
- public final class PxCornerSizes {
- ctor public PxCornerSizes(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px component1();
- method public androidx.ui.core.Px component2();
- method public androidx.ui.core.Px component3();
- method public androidx.ui.core.Px component4();
- method public androidx.ui.foundation.shape.corner.PxCornerSizes copy(androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
- method public androidx.ui.core.Px getBottomLeft();
- method public androidx.ui.core.Px getBottomRight();
- method public androidx.ui.core.Px getTopLeft();
- method public androidx.ui.core.Px getTopRight();
- }
-
- public final class PxCornerSizesKt {
- ctor public PxCornerSizesKt();
- method public static androidx.ui.foundation.shape.corner.PxCornerSizes PxCornerSizes(androidx.ui.foundation.shape.corner.CornerSizes corners, androidx.ui.core.PxSize size, androidx.ui.core.Density density);
- method public static boolean isEmpty(androidx.ui.foundation.shape.corner.PxCornerSizes);
- }
-
- public final class RoundedCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public RoundedCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.foundation.shape.corner.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Rounded createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
- }
-
public final class RoundedCornerShapeKt {
ctor public 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(androidx.ui.core.Dp size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(int percent);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.foundation.shape.corner.RoundedCornerShape RoundedCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ 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 getCircleShape();
}
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 afba564..b9eb9d1 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
@@ -40,7 +40,7 @@
@Test
fun roundedUniformCorners() {
- val rounded = RoundedCornerShape(CornerSizes(25))
+ val rounded = RoundedCornerShape(25)
val expectedRadius = Radius.circular(25f)
val outline = rounded.toOutline() as Outline.Rounded
@@ -57,14 +57,7 @@
val radius2 = 22f
val radius3 = 32f
val radius4 = 42f
- val rounded = RoundedCornerShape(
- CornerSizes(
- CornerSize(radius1.px),
- CornerSize(radius2.px),
- CornerSize(radius3.px),
- CornerSize(radius4.px)
- )
- )
+ val rounded = RoundedCornerShape(radius1.px, radius2.px, radius3.px, radius4.px)
val outline = rounded.toOutline() as Outline.Rounded
assertThat(outline.rrect).isEqualTo(
@@ -80,8 +73,8 @@
@Test
fun roundedCornerShapesAreEquals() {
- assertThat(RoundedCornerShape(CornerSizes(12.dp)))
- .isEqualTo(RoundedCornerShape(CornerSizes(12.dp)))
+ assertThat(RoundedCornerShape(12.dp))
+ .isEqualTo(RoundedCornerShape(12.dp))
}
private fun Shape.toOutline() = createOutline(size, density)
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 7145a6d..89ec2be 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
@@ -17,36 +17,59 @@
package androidx.ui.foundation.shape.corner
import androidx.ui.core.Density
+import androidx.ui.core.Px
import androidx.ui.core.PxSize
+import androidx.ui.core.px
import androidx.ui.core.toRect
import androidx.ui.engine.geometry.Outline
import androidx.ui.engine.geometry.Shape
/**
- * Base class for [Shape]s defined by [CornerSizes].
+ * Base class for [Shape]s defined by four [CornerSize]s.
*
- * @see RoundedCornerShape for an example of the usage
+ * @see RoundedCornerShape for an example of the usage.
*
- * @param corners define all four corner sizes
+ * @param topLeft a size of the top left corner
+ * @param topRight a size of the top right corner
+ * @param bottomRight a size of the bottom left corner
+ * @param bottomLeft a size of the bottom right corner
*/
abstract class CornerBasedShape(
- private val corners: CornerSizes
+ private val topLeft: CornerSize,
+ private val topRight: CornerSize,
+ private val bottomRight: CornerSize,
+ private val bottomLeft: CornerSize
) : Shape {
final override fun createOutline(size: PxSize, density: Density): Outline {
- val corners = PxCornerSizes(corners, size, density)
- return if (corners.isEmpty()) {
+ val topLeft = topLeft.toPx(size, density)
+ val topRight = topRight.toPx(size, density)
+ val bottomRight = bottomRight.toPx(size, density)
+ val bottomLeft = bottomLeft.toPx(size, density)
+ require(topLeft >= 0.px && topRight >= 0.px && bottomRight >= 0.px && bottomLeft >= 0.px) {
+ "Corner size in Px can't be negative!"
+ }
+ return if (topLeft + topRight + bottomLeft + bottomRight == 0.px) {
Outline.Rectangle(size.toRect())
} else {
- createOutline(corners, size)
+ createOutline(size, topLeft, topRight, bottomRight, bottomLeft)
}
}
/**
- * @param corners the resolved sizes of all the four corners in pixels.
* @param size the size of the shape boundary.
+ * @param topLeft the resolved size of the top left corner
+ * @param topRight the resolved size for the top right corner
+ * @param bottomRight the resolved size for the bottom left corner
+ * @param bottomLeft the resolved size for the bottom right corner
*
* @return [Outline] of this shape for the given [size].
*/
- abstract fun createOutline(corners: PxCornerSizes, size: PxSize): Outline
+ abstract fun createOutline(
+ size: PxSize,
+ topLeft: Px,
+ topRight: Px,
+ bottomRight: Px,
+ bottomLeft: Px
+ ): Outline
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSizes.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSizes.kt
deleted file mode 100644
index b689b08..0000000
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/CornerSizes.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.ui.foundation.shape.corner
-
-import androidx.annotation.IntRange
-import androidx.ui.core.Dp
-import androidx.ui.core.Px
-import androidx.ui.core.dp
-import androidx.ui.core.px
-
-/**
- * Contains sizes of all four corner sizes for a shape.
- *
- * @param topLeft a size for the top left corner
- * @param topRight a size for the top right corner
- * @param bottomRight a size for the bottom left corner
- * @param bottomLeft a size for the bottom right corner
- */
-data class CornerSizes(
- val topLeft: CornerSize,
- val topRight: CornerSize,
- val bottomRight: CornerSize,
- val bottomLeft: CornerSize
-)
-
-/**
- * Creates [CornerSizes] with the same size applied for all four corners.
- */
-/*inline*/ fun CornerSizes(allCornersSize: CornerSize) = CornerSizes(
- allCornersSize,
- allCornersSize,
- allCornersSize,
- allCornersSize
-)
-
-/**
- * Creates [CornerSizes] with the same size applied for all four corners.
- */
-/*inline*/ fun CornerSizes(size: Dp) = CornerSizes(CornerSize(size))
-
-/**
- * Creates [CornerSizes] with the same size applied for all four corners.
- */
-/*inline*/ fun CornerSizes(size: Px) = CornerSizes(CornerSize(size))
-
-/**
- * Creates [CornerSizes] with the same size applied for all four corners.
- */
-/*inline*/ fun CornerSizes(percent: Int) = CornerSizes(CornerSize(percent))
-
-/**
- * Creates [CornerSizes] with sizes defined by [Dp].
- */
-/*inline*/ fun CornerSizes(
- topLeft: Dp = 0.dp,
- topRight: Dp = 0.dp,
- bottomRight: Dp = 0.dp,
- bottomLeft: Dp = 0.dp
-) = CornerSizes(
- CornerSize(topLeft),
- CornerSize(topRight),
- CornerSize(bottomRight),
- CornerSize(bottomLeft)
-)
-
-/**
- * Creates [CornerSizes] with sizes defined by [Px].
- */
-/*inline*/ fun CornerSizes(
- topLeft: Px = 0.px,
- topRight: Px = 0.px,
- bottomRight: Px = 0.px,
- bottomLeft: Px = 0.px
-) = CornerSizes(
- CornerSize(topLeft),
- CornerSize(topRight),
- CornerSize(bottomRight),
- CornerSize(bottomLeft)
-)
-
-/**
- * Creates [CornerSizes] with sizes defined by percents of the shape's smaller side.
- */
-/*inline*/ fun CornerSizes(
- @IntRange(from = 0, to = 50) topLeftPercent: Int = 0,
- @IntRange(from = 0, to = 50) topRightPercent: Int = 0,
- @IntRange(from = 0, to = 50) bottomRightPercent: Int = 0,
- @IntRange(from = 0, to = 50) bottomLeftPercent: Int = 0
-) = CornerSizes(
- CornerSize(topLeftPercent),
- CornerSize(topRightPercent),
- CornerSize(bottomRightPercent),
- CornerSize(bottomLeftPercent)
-)
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/PxCornerSizes.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/PxCornerSizes.kt
deleted file mode 100644
index f6d1b58..0000000
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/shape/corner/PxCornerSizes.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.ui.foundation.shape.corner
-
-import androidx.ui.core.Density
-import androidx.ui.core.Px
-import androidx.ui.core.PxSize
-import androidx.ui.core.px
-
-/**
- * Contains sizes of all four corner sizes for a shape resolved in Pixels
- *
- * @param topLeft a size for the top left corner
- * @param topRight a size for the top right corner
- * @param bottomRight a size for the bottom left corner
- * @param bottomLeft a size for the bottom right corner
- */
-data class PxCornerSizes(
- val topLeft: Px,
- val topRight: Px,
- val bottomRight: Px,
- val bottomLeft: Px
-) {
- init {
- if (topLeft < 0.px || topRight < 0.px || bottomRight < 0.px || bottomLeft < 0.px) {
- throw IllegalArgumentException("Corner size in Px can't be negative!")
- }
- }
-}
-
-/**
- * @return true if all the sizes are equals to 0 pixels.
- */
-/*inline*/ fun PxCornerSizes.isEmpty() =
- topLeft + topRight + bottomLeft + bottomRight == 0.px
-
-/**
- * @param corners define all four corner sizes
- * @param size the size of the shape
- * @param density the current density of the screen.
- *
- * @return resolved [PxCornerSizes].
- */
-/*inline*/ fun PxCornerSizes(
- corners: CornerSizes,
- size: PxSize,
- density: Density
-): PxCornerSizes = with(corners) {
- PxCornerSizes(
- topLeft = topLeft.toPx(size, density),
- topRight = topRight.toPx(size, density),
- bottomRight = bottomRight.toPx(size, density),
- bottomLeft = bottomLeft.toPx(size, density)
- )
-}
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 acbfd2d8..4c9c81f 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
@@ -16,8 +16,12 @@
package androidx.ui.foundation.shape.corner
+import androidx.annotation.IntRange
+import androidx.ui.core.Dp
import androidx.ui.core.Px
import androidx.ui.core.PxSize
+import androidx.ui.core.dp
+import androidx.ui.core.px
import androidx.ui.core.toRect
import androidx.ui.engine.geometry.Outline
import androidx.ui.engine.geometry.RRect
@@ -27,20 +31,31 @@
/**
* A shape describing the rectangle with rounded corners.
*
- * @param corners define all four corner sizes
+ * @param topLeft a size of the top left corner
+ * @param topRight a size of the top right corner
+ * @param bottomRight a size of the bottom left corner
+ * @param bottomLeft a size of the bottom right corner
*/
data class RoundedCornerShape(
- val corners: CornerSizes
-) : CornerBasedShape(corners) {
+ val topLeft: CornerSize,
+ val topRight: CornerSize,
+ val bottomRight: CornerSize,
+ val bottomLeft: CornerSize
+) : CornerBasedShape(topLeft, topRight, bottomRight, bottomLeft) {
- override fun createOutline(corners: PxCornerSizes, size: PxSize) =
- Outline.Rounded(
+ override fun createOutline(
+ size: PxSize,
+ topLeft: Px,
+ topRight: Px,
+ bottomRight: Px,
+ bottomLeft: Px
+ ) = Outline.Rounded(
RRect(
rect = size.toRect(),
- topLeft = corners.topLeft.toRadius(),
- topRight = corners.topRight.toRadius(),
- bottomRight = corners.bottomRight.toRadius(),
- bottomLeft = corners.bottomLeft.toRadius()
+ topLeft = topLeft.toRadius(),
+ topRight = topRight.toRadius(),
+ bottomRight = bottomRight.toRadius(),
+ bottomLeft = bottomLeft.toRadius()
)
)
@@ -48,14 +63,72 @@
}
/**
- * A shape describing the rectangle with rounded corners.
- *
- * @param corner size to apply for all four corners
- */
-/*inline*/ fun RoundedCornerShape(corner: CornerSize) =
- RoundedCornerShape(CornerSizes(corner))
-
-/**
* Circular [Shape] with all the corners sized as the 50 percent of the shape size.
*/
-val CircleShape = RoundedCornerShape(CornerSizes(CornerSize(50)))
+val CircleShape = RoundedCornerShape(50)
+
+/**
+ * Creates [RoundedCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun RoundedCornerShape(corner: CornerSize) =
+ RoundedCornerShape(corner, corner, corner, corner)
+
+/**
+ * Creates [RoundedCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun RoundedCornerShape(size: Dp) = RoundedCornerShape(CornerSize(size))
+
+/**
+ * Creates [RoundedCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun RoundedCornerShape(size: Px) = RoundedCornerShape(CornerSize(size))
+
+/**
+ * Creates [RoundedCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun RoundedCornerShape(percent: Int) = RoundedCornerShape(CornerSize(percent))
+
+/**
+ * Creates [RoundedCornerShape] with sizes defined by [Dp].
+ */
+/*inline*/ fun RoundedCornerShape(
+ topLeft: Dp = 0.dp,
+ topRight: Dp = 0.dp,
+ bottomRight: Dp = 0.dp,
+ bottomLeft: Dp = 0.dp
+) = RoundedCornerShape(
+ CornerSize(topLeft),
+ CornerSize(topRight),
+ CornerSize(bottomRight),
+ CornerSize(bottomLeft)
+)
+
+/**
+ * Creates [RoundedCornerShape] with sizes defined by [Px].
+ */
+/*inline*/ fun RoundedCornerShape(
+ topLeft: Px = 0.px,
+ topRight: Px = 0.px,
+ bottomRight: Px = 0.px,
+ bottomLeft: Px = 0.px
+) = RoundedCornerShape(
+ CornerSize(topLeft),
+ CornerSize(topRight),
+ CornerSize(bottomRight),
+ CornerSize(bottomLeft)
+)
+
+/**
+ * Creates [RoundedCornerShape] with sizes defined by percents of the shape's smaller side.
+ */
+/*inline*/ fun RoundedCornerShape(
+ @IntRange(from = 0, to = 50) topLeftPercent: Int = 0,
+ @IntRange(from = 0, to = 50) topRightPercent: Int = 0,
+ @IntRange(from = 0, to = 50) bottomRightPercent: Int = 0,
+ @IntRange(from = 0, to = 50) bottomLeftPercent: Int = 0
+) = RoundedCornerShape(
+ CornerSize(topLeftPercent),
+ CornerSize(topRightPercent),
+ CornerSize(bottomRightPercent),
+ CornerSize(bottomLeftPercent)
+)
diff --git a/ui/ui-material/api/1.0.0-alpha01.txt b/ui/ui-material/api/1.0.0-alpha01.txt
index 61a9c3f..f4bde5e 100644
--- a/ui/ui-material/api/1.0.0-alpha01.txt
+++ b/ui/ui-material/api/1.0.0-alpha01.txt
@@ -45,7 +45,7 @@
primary
}), androidx.ui.engine.geometry.Shape shape = +themeShape({
button
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 2.dp);
method public static androidx.ui.material.ButtonStyle OutlinedButtonStyle(androidx.ui.foundation.shape.border.Border border = Border(+themeColor({
onSurface.copy(OutlinedStrokeOpacity)
}), 1.dp), androidx.ui.graphics.Color color = +themeColor({
@@ -108,13 +108,13 @@
ctor public FloatingActionButtonKt();
method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.core.Dp minSize = FabSize, androidx.ui.engine.geometry.Shape shape = CircleShape, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.core.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
method public static void FloatingActionButton(androidx.ui.painting.Image icon, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static void FloatingActionButton(String text, androidx.ui.painting.Image? icon = null, androidx.ui.text.TextStyle? textStyle = null, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static androidx.ui.core.Dp getExtendedFabHeight();
method public static androidx.ui.core.Dp getExtendedFabIconPadding();
method public static androidx.ui.core.Dp getExtendedFabTextPadding();
@@ -349,11 +349,28 @@
package androidx.ui.material.shape {
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.material.shape.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Generic createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
+ 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.CornerSize component1();
+ method public androidx.ui.foundation.shape.corner.CornerSize component2();
+ method public androidx.ui.foundation.shape.corner.CornerSize component3();
+ method public androidx.ui.foundation.shape.corner.CornerSize component4();
+ method public androidx.ui.material.shape.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.engine.geometry.Outline.Generic createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
+ }
+
+ public final class CutCornerShapeKt {
+ ctor public CutCornerShapeKt();
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ method public static androidx.ui.material.shape.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);
}
}
@@ -364,7 +381,7 @@
ctor public CardKt();
method public static void Card(androidx.ui.engine.geometry.Shape shape = RectangleShape, androidx.ui.graphics.Color color = +themeColor({
surface
-}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class SurfaceKt {
diff --git a/ui/ui-material/api/current.txt b/ui/ui-material/api/current.txt
index 61a9c3f..f4bde5e 100644
--- a/ui/ui-material/api/current.txt
+++ b/ui/ui-material/api/current.txt
@@ -45,7 +45,7 @@
primary
}), androidx.ui.engine.geometry.Shape shape = +themeShape({
button
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 2.dp);
method public static androidx.ui.material.ButtonStyle OutlinedButtonStyle(androidx.ui.foundation.shape.border.Border border = Border(+themeColor({
onSurface.copy(OutlinedStrokeOpacity)
}), 1.dp), androidx.ui.graphics.Color color = +themeColor({
@@ -108,13 +108,13 @@
ctor public FloatingActionButtonKt();
method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.core.Dp minSize = FabSize, androidx.ui.engine.geometry.Shape shape = CircleShape, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.core.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
method public static void FloatingActionButton(androidx.ui.painting.Image icon, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static void FloatingActionButton(String text, androidx.ui.painting.Image? icon = null, androidx.ui.text.TextStyle? textStyle = null, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static androidx.ui.core.Dp getExtendedFabHeight();
method public static androidx.ui.core.Dp getExtendedFabIconPadding();
method public static androidx.ui.core.Dp getExtendedFabTextPadding();
@@ -349,11 +349,28 @@
package androidx.ui.material.shape {
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.material.shape.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Generic createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
+ 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.CornerSize component1();
+ method public androidx.ui.foundation.shape.corner.CornerSize component2();
+ method public androidx.ui.foundation.shape.corner.CornerSize component3();
+ method public androidx.ui.foundation.shape.corner.CornerSize component4();
+ method public androidx.ui.material.shape.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.engine.geometry.Outline.Generic createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
+ }
+
+ public final class CutCornerShapeKt {
+ ctor public CutCornerShapeKt();
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ method public static androidx.ui.material.shape.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);
}
}
@@ -364,7 +381,7 @@
ctor public CardKt();
method public static void Card(androidx.ui.engine.geometry.Shape shape = RectangleShape, androidx.ui.graphics.Color color = +themeColor({
surface
-}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class SurfaceKt {
diff --git a/ui/ui-material/api/restricted_1.0.0-alpha01.txt b/ui/ui-material/api/restricted_1.0.0-alpha01.txt
index 61a9c3f..f4bde5e 100644
--- a/ui/ui-material/api/restricted_1.0.0-alpha01.txt
+++ b/ui/ui-material/api/restricted_1.0.0-alpha01.txt
@@ -45,7 +45,7 @@
primary
}), androidx.ui.engine.geometry.Shape shape = +themeShape({
button
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 2.dp);
method public static androidx.ui.material.ButtonStyle OutlinedButtonStyle(androidx.ui.foundation.shape.border.Border border = Border(+themeColor({
onSurface.copy(OutlinedStrokeOpacity)
}), 1.dp), androidx.ui.graphics.Color color = +themeColor({
@@ -108,13 +108,13 @@
ctor public FloatingActionButtonKt();
method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.core.Dp minSize = FabSize, androidx.ui.engine.geometry.Shape shape = CircleShape, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.core.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
method public static void FloatingActionButton(androidx.ui.painting.Image icon, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static void FloatingActionButton(String text, androidx.ui.painting.Image? icon = null, androidx.ui.text.TextStyle? textStyle = null, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static androidx.ui.core.Dp getExtendedFabHeight();
method public static androidx.ui.core.Dp getExtendedFabIconPadding();
method public static androidx.ui.core.Dp getExtendedFabTextPadding();
@@ -349,11 +349,28 @@
package androidx.ui.material.shape {
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.material.shape.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Generic createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
+ 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.CornerSize component1();
+ method public androidx.ui.foundation.shape.corner.CornerSize component2();
+ method public androidx.ui.foundation.shape.corner.CornerSize component3();
+ method public androidx.ui.foundation.shape.corner.CornerSize component4();
+ method public androidx.ui.material.shape.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.engine.geometry.Outline.Generic createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
+ }
+
+ public final class CutCornerShapeKt {
+ ctor public CutCornerShapeKt();
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ method public static androidx.ui.material.shape.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);
}
}
@@ -364,7 +381,7 @@
ctor public CardKt();
method public static void Card(androidx.ui.engine.geometry.Shape shape = RectangleShape, androidx.ui.graphics.Color color = +themeColor({
surface
-}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class SurfaceKt {
diff --git a/ui/ui-material/api/restricted_current.txt b/ui/ui-material/api/restricted_current.txt
index 61a9c3f..f4bde5e 100644
--- a/ui/ui-material/api/restricted_current.txt
+++ b/ui/ui-material/api/restricted_current.txt
@@ -45,7 +45,7 @@
primary
}), androidx.ui.engine.geometry.Shape shape = +themeShape({
button
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 2.dp);
method public static androidx.ui.material.ButtonStyle OutlinedButtonStyle(androidx.ui.foundation.shape.border.Border border = Border(+themeColor({
onSurface.copy(OutlinedStrokeOpacity)
}), 1.dp), androidx.ui.graphics.Color color = +themeColor({
@@ -108,13 +108,13 @@
ctor public FloatingActionButtonKt();
method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.core.Dp minSize = FabSize, androidx.ui.engine.geometry.Shape shape = CircleShape, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.core.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
method public static void FloatingActionButton(androidx.ui.painting.Image icon, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static void FloatingActionButton(String text, androidx.ui.painting.Image? icon = null, androidx.ui.text.TextStyle? textStyle = null, kotlin.jvm.functions.Function0<kotlin.Unit>? onClick = null, androidx.ui.graphics.Color color = +themeColor({
primary
-}), androidx.ui.core.Dp elevation = 0.dp);
+}), androidx.ui.core.Dp elevation = 6.dp);
method public static androidx.ui.core.Dp getExtendedFabHeight();
method public static androidx.ui.core.Dp getExtendedFabIconPadding();
method public static androidx.ui.core.Dp getExtendedFabTextPadding();
@@ -349,11 +349,28 @@
package androidx.ui.material.shape {
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
- ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.foundation.shape.corner.CornerSizes component1();
- method public androidx.ui.material.shape.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSizes corners);
- method public androidx.ui.engine.geometry.Outline.Generic createOutline(androidx.ui.foundation.shape.corner.PxCornerSizes corners, androidx.ui.core.PxSize size);
- method public androidx.ui.foundation.shape.corner.CornerSizes getCorners();
+ 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.CornerSize component1();
+ method public androidx.ui.foundation.shape.corner.CornerSize component2();
+ method public androidx.ui.foundation.shape.corner.CornerSize component3();
+ method public androidx.ui.foundation.shape.corner.CornerSize component4();
+ method public androidx.ui.material.shape.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.engine.geometry.Outline.Generic createOutline(androidx.ui.core.PxSize size, androidx.ui.core.Px topLeft, androidx.ui.core.Px topRight, androidx.ui.core.Px bottomRight, androidx.ui.core.Px bottomLeft);
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public androidx.ui.foundation.shape.corner.CornerSize getTopRight();
+ }
+
+ public final class CutCornerShapeKt {
+ ctor public CutCornerShapeKt();
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize corner);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px size);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(int percent);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Dp topLeft = 0.dp, androidx.ui.core.Dp topRight = 0.dp, androidx.ui.core.Dp bottomRight = 0.dp, androidx.ui.core.Dp bottomLeft = 0.dp);
+ method public static androidx.ui.material.shape.CutCornerShape CutCornerShape(androidx.ui.core.Px topLeft = 0.px, androidx.ui.core.Px topRight = 0.px, androidx.ui.core.Px bottomRight = 0.px, androidx.ui.core.Px bottomLeft = 0.px);
+ method public static androidx.ui.material.shape.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);
}
}
@@ -364,7 +381,7 @@
ctor public CardKt();
method public static void Card(androidx.ui.engine.geometry.Shape shape = RectangleShape, androidx.ui.graphics.Color color = +themeColor({
surface
-}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 0.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+}), androidx.ui.foundation.shape.border.Border? border = null, androidx.ui.core.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class SurfaceKt {
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/RippleDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/RippleDemo.kt
index ebb0aa1..d93ad3f 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/RippleDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/RippleDemo.kt
@@ -24,7 +24,6 @@
import androidx.ui.core.dp
import androidx.ui.core.px
import androidx.ui.foundation.shape.border.Border
-import androidx.ui.foundation.shape.corner.CornerSizes
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.layout.Container
@@ -40,7 +39,7 @@
MaterialTheme {
Padding(padding = 50.dp) {
Card(
- shape = RoundedCornerShape(CornerSizes(100.px)),
+ shape = RoundedCornerShape(100.px),
border = Border(Color(0x80000000.toInt()), 1.dp)
) {
Ripple(bounded = true) {
diff --git a/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt b/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
index 058f62f..647f4c9 100644
--- a/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
+++ b/ui/ui-material/integration-tests/samples/src/main/java/androidx/ui/material/samples/TabSamples.kt
@@ -32,7 +32,6 @@
import androidx.ui.foundation.selection.MutuallyExclusiveSetItem
import androidx.ui.foundation.shape.border.Border
import androidx.ui.foundation.shape.border.DrawBorder
-import androidx.ui.foundation.shape.corner.CornerSizes
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.layout.Alignment
@@ -230,7 +229,7 @@
// Color is passed in as a parameter [color]
Padding(5.dp) {
Container(expanded = true) {
- DrawBorder(RoundedCornerShape(CornerSizes(5.dp)), Border(color, 2.dp))
+ DrawBorder(RoundedCornerShape(5.dp), Border(color, 2.dp))
}
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/shape/CutCornerShapeTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/shape/CutCornerShapeTest.kt
index ff8249b..4c1072d 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/shape/CutCornerShapeTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/shape/CutCornerShapeTest.kt
@@ -22,8 +22,6 @@
import androidx.ui.core.px
import androidx.ui.engine.geometry.Outline
import androidx.ui.engine.geometry.Shape
-import androidx.ui.foundation.shape.corner.CornerSize
-import androidx.ui.foundation.shape.corner.CornerSizes
import androidx.ui.painting.Path
import androidx.ui.painting.PathOperation
import com.google.common.truth.Truth.assertThat
@@ -41,13 +39,7 @@
@Test
fun cutCornersUniformCorners() {
- val cut = CutCornerShape(
- CornerSizes(
- CornerSize(
- 10.px
- )
- )
- )
+ val cut = CutCornerShape(10.px)
val outline = cut.toOutline() as Outline.Generic
assertPathsEquals(outline.path, Path().apply {
@@ -69,14 +61,7 @@
val size2 = 22f
val size3 = 32f
val size4 = 42f
- val cut = CutCornerShape(
- CornerSizes(
- CornerSize(size1.px),
- CornerSize(size2.px),
- CornerSize(size3.px),
- CornerSize(size4.px)
- )
- )
+ val cut = CutCornerShape(size1.px, size2.px, size3.px, size4.px)
val outline = cut.toOutline() as Outline.Generic
assertPathsEquals(outline.path, Path().apply {
@@ -94,8 +79,8 @@
@Test
fun cutCornerShapesAreEquals() {
- assertThat(CutCornerShape(CornerSizes(10.px)))
- .isEqualTo(CutCornerShape(CornerSizes(10.px)))
+ assertThat(CutCornerShape(10.px))
+ .isEqualTo(CutCornerShape(10.px))
}
private fun Shape.toOutline() = createOutline(size, density)
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt b/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
index 010118a..7b09461 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/AlertDialog.kt
@@ -23,8 +23,6 @@
import androidx.ui.core.CurrentTextStyleProvider
import androidx.ui.core.dp
import androidx.ui.foundation.Dialog
-import androidx.ui.foundation.shape.corner.CornerSize
-import androidx.ui.foundation.shape.corner.CornerSizes
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.layout.Alignment
import androidx.ui.layout.Column
@@ -176,6 +174,5 @@
// The height difference of the padding between a Dialog with a title and one without a title
private val NoTitleExtraHeight = 2.dp
private val TextToButtonsHeight = 28.dp
-private val ShapeCornerSize = CornerSizes(CornerSize(4.dp))
// TODO: The corner radius should be customizable
-private val AlertDialogShape = RoundedCornerShape(ShapeCornerSize)
\ No newline at end of file
+private val AlertDialogShape = RoundedCornerShape(4.dp)
\ No newline at end of file
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Button.kt b/ui/ui-material/src/main/java/androidx/ui/material/Button.kt
index 614ae7f..f8b7b54 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Button.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Button.kt
@@ -82,7 +82,7 @@
fun ContainedButtonStyle(
color: Color = +themeColor { primary },
shape: Shape = +themeShape { button },
- elevation: Dp = 0.dp // TODO update to 2.dp when DrawShadow will be ready
+ elevation: Dp = 2.dp
) = ButtonStyle(
color = color,
shape = shape,
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt b/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt
index 070a382..28a1e28 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/FloatingActionButton.kt
@@ -62,7 +62,7 @@
minSize: Dp = FabSize,
shape: Shape = CircleShape,
color: Color = +themeColor { primary },
- elevation: Dp = 0.dp, // TODO(Andrey) add the default elevation when it ready b/123215187
+ elevation: Dp = 6.dp,
children: @Composable() () -> Unit
) {
BaseButton(
@@ -99,7 +99,7 @@
icon: Image,
onClick: (() -> Unit)? = null,
color: Color = +themeColor { primary },
- elevation: Dp = 0.dp
+ elevation: Dp = 6.dp
) {
FloatingActionButton(onClick = onClick, color = color, elevation = elevation) {
SimpleImage(image = icon)
@@ -130,7 +130,7 @@
textStyle: TextStyle? = null,
onClick: (() -> Unit)? = null,
color: Color = +themeColor { primary },
- elevation: Dp = 0.dp
+ elevation: Dp = 6.dp
) {
FloatingActionButton(
onClick = onClick,
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/MaterialTheme.kt b/ui/ui-material/src/main/java/androidx/ui/material/MaterialTheme.kt
index 76ce952..a33fe12 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/MaterialTheme.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/MaterialTheme.kt
@@ -18,7 +18,6 @@
import androidx.annotation.CheckResult
import androidx.compose.Ambient
-import androidx.compose.Children
import androidx.compose.Composable
import androidx.compose.composer
import androidx.compose.ambient
@@ -30,7 +29,6 @@
import androidx.ui.core.sp
import androidx.ui.core.withDensity
import androidx.ui.engine.geometry.Shape
-import androidx.ui.foundation.shape.corner.CornerSizes
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.material.ripple.CurrentRippleTheme
@@ -289,7 +287,7 @@
fun MaterialButtonShapeTheme(children: @Composable() () -> Unit) {
val value = +withDensity {
Shapes(
- button = RoundedCornerShape(CornerSizes(4.dp))
+ button = RoundedCornerShape(4.dp)
)
}
CurrentShapeAmbient.Provider(value = value, children = children)
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/shape/CutCornerShape.kt b/ui/ui-material/src/main/java/androidx/ui/material/shape/CutCornerShape.kt
index 8f14f3d..5226f09 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/shape/CutCornerShape.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/shape/CutCornerShape.kt
@@ -16,37 +16,117 @@
package androidx.ui.material.shape
+import androidx.annotation.IntRange
+import androidx.ui.core.Dp
+import androidx.ui.core.Px
import androidx.ui.core.PxSize
+import androidx.ui.core.dp
+import androidx.ui.core.px
import androidx.ui.engine.geometry.Outline
import androidx.ui.foundation.shape.corner.CornerBasedShape
-import androidx.ui.foundation.shape.corner.CornerSizes
-import androidx.ui.foundation.shape.corner.PxCornerSizes
+import androidx.ui.foundation.shape.corner.CornerSize
import androidx.ui.painting.Path
/**
* A shape describing the rectangle with cut corners.
* Corner size is representing the cut length - the size of both legs of the cut's right triangle.
*
- * @param corners define all four corner sizes
+ * @param topLeft a size of the top left corner
+ * @param topRight a size of the top right corner
+ * @param bottomRight a size of the bottom left corner
+ * @param bottomLeft a size of the bottom right corner
*/
data class CutCornerShape(
- val corners: CornerSizes
-) : CornerBasedShape(corners) {
+ val topLeft: CornerSize,
+ val topRight: CornerSize,
+ val bottomRight: CornerSize,
+ val bottomLeft: CornerSize
+) : CornerBasedShape(topLeft, topRight, bottomRight, bottomLeft) {
- override fun createOutline(corners: PxCornerSizes, size: PxSize) =
- Outline.Generic(Path().apply {
- var cornerSize = corners.topLeft.value
- moveTo(0f, cornerSize)
- lineTo(cornerSize, 0f)
- cornerSize = corners.topRight.value
- lineTo(size.width.value - cornerSize, 0f)
- lineTo(size.width.value, cornerSize)
- cornerSize = corners.bottomRight.value
- lineTo(size.width.value, size.height.value - cornerSize)
- lineTo(size.width.value - cornerSize, size.height.value)
- cornerSize = corners.bottomLeft.value
- lineTo(cornerSize, size.height.value)
- lineTo(0f, size.height.value - cornerSize)
- close()
- })
+ override fun createOutline(
+ size: PxSize,
+ topLeft: Px,
+ topRight: Px,
+ bottomRight: Px,
+ bottomLeft: Px
+ ) = Outline.Generic(Path().apply {
+ var cornerSize = topLeft.value
+ moveTo(0f, cornerSize)
+ lineTo(cornerSize, 0f)
+ cornerSize = topRight.value
+ lineTo(size.width.value - cornerSize, 0f)
+ lineTo(size.width.value, cornerSize)
+ cornerSize = bottomRight.value
+ lineTo(size.width.value, size.height.value - cornerSize)
+ lineTo(size.width.value - cornerSize, size.height.value)
+ cornerSize = bottomLeft.value
+ lineTo(cornerSize, size.height.value)
+ lineTo(0f, size.height.value - cornerSize)
+ close()
+ })
}
+
+/**
+ * Creates [CutCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun CutCornerShape(corner: CornerSize) = CutCornerShape(corner, corner, corner, corner)
+
+/**
+ * Creates [CutCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun CutCornerShape(size: Dp) = CutCornerShape(CornerSize(size))
+
+/**
+ * Creates [CutCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun CutCornerShape(size: Px) = CutCornerShape(CornerSize(size))
+
+/**
+ * Creates [CutCornerShape] with the same size applied for all four corners.
+ */
+/*inline*/ fun CutCornerShape(percent: Int) = CutCornerShape(CornerSize(percent))
+
+/**
+ * Creates [CutCornerShape] with sizes defined by [Dp].
+ */
+/*inline*/ fun CutCornerShape(
+ topLeft: Dp = 0.dp,
+ topRight: Dp = 0.dp,
+ bottomRight: Dp = 0.dp,
+ bottomLeft: Dp = 0.dp
+) = CutCornerShape(
+ CornerSize(topLeft),
+ CornerSize(topRight),
+ CornerSize(bottomRight),
+ CornerSize(bottomLeft)
+)
+
+/**
+ * Creates [CutCornerShape] with sizes defined by [Px].
+ */
+/*inline*/ fun CutCornerShape(
+ topLeft: Px = 0.px,
+ topRight: Px = 0.px,
+ bottomRight: Px = 0.px,
+ bottomLeft: Px = 0.px
+) = CutCornerShape(
+ CornerSize(topLeft),
+ CornerSize(topRight),
+ CornerSize(bottomRight),
+ CornerSize(bottomLeft)
+)
+
+/**
+ * Creates [CutCornerShape] with sizes defined by percents of the shape's smaller side.
+ */
+/*inline*/ fun CutCornerShape(
+ @IntRange(from = 0, to = 50) topLeftPercent: Int = 0,
+ @IntRange(from = 0, to = 50) topRightPercent: Int = 0,
+ @IntRange(from = 0, to = 50) bottomRightPercent: Int = 0,
+ @IntRange(from = 0, to = 50) bottomLeftPercent: Int = 0
+) = CutCornerShape(
+ CornerSize(topLeftPercent),
+ CornerSize(topRightPercent),
+ CornerSize(bottomRightPercent),
+ CornerSize(bottomLeftPercent)
+)
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/surface/Card.kt b/ui/ui-material/src/main/java/androidx/ui/material/surface/Card.kt
index 544666b..8ec7d6a 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/surface/Card.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/surface/Card.kt
@@ -16,7 +16,6 @@
package androidx.ui.material.surface
-import androidx.compose.Children
import androidx.compose.Composable
import androidx.compose.composer
import androidx.compose.unaryPlus
@@ -48,12 +47,12 @@
shape: Shape = RectangleShape, // TODO (Andrey: Take the default shape from the theme)
color: Color = +themeColor { surface },
border: Border? = null,
- elevation: Dp = 0.dp,
+ elevation: Dp = 1.dp,
children: @Composable() () -> Unit
) {
// TODO(Andrey: This currently adds no logic on top of Surface, I just reserve the name
// for now. We will see what will be the additional Card specific logic later.
- // It will add the default shape with rounded corners, default 1px elevation, elevate on hover.
+ // It will add the default shape with rounded corners, elevate on hover.
Surface(
shape = shape,
color = color,
diff --git a/ui/ui-platform/api/1.0.0-alpha01.txt b/ui/ui-platform/api/1.0.0-alpha01.txt
index 9a2c483..63c6bd3 100644
--- a/ui/ui-platform/api/1.0.0-alpha01.txt
+++ b/ui/ui-platform/api/1.0.0-alpha01.txt
@@ -73,8 +73,8 @@
method public androidx.ui.core.RepaintBoundaryNode? getRepaintBoundary();
method public final void setDepth(int p);
method public final void setOwnerData(Object? p);
- method public final void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
- method public final void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
property protected androidx.ui.core.LayoutNode? containingLayoutNode;
property public final int count;
property public final int depth;
diff --git a/ui/ui-platform/api/current.txt b/ui/ui-platform/api/current.txt
index 9a2c483..63c6bd3 100644
--- a/ui/ui-platform/api/current.txt
+++ b/ui/ui-platform/api/current.txt
@@ -73,8 +73,8 @@
method public androidx.ui.core.RepaintBoundaryNode? getRepaintBoundary();
method public final void setDepth(int p);
method public final void setOwnerData(Object? p);
- method public final void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
- method public final void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
property protected androidx.ui.core.LayoutNode? containingLayoutNode;
property public final int count;
property public final int depth;
diff --git a/ui/ui-platform/api/restricted_1.0.0-alpha01.txt b/ui/ui-platform/api/restricted_1.0.0-alpha01.txt
index 887803c..58b0117 100644
--- a/ui/ui-platform/api/restricted_1.0.0-alpha01.txt
+++ b/ui/ui-platform/api/restricted_1.0.0-alpha01.txt
@@ -73,8 +73,8 @@
method public androidx.ui.core.RepaintBoundaryNode? getRepaintBoundary();
method public final void setDepth(int p);
method public final void setOwnerData(Object? p);
- method public final void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
- method public final void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
property protected androidx.ui.core.LayoutNode? containingLayoutNode;
property public final int count;
property public final int depth;
diff --git a/ui/ui-platform/api/restricted_current.txt b/ui/ui-platform/api/restricted_current.txt
index 887803c..58b0117 100644
--- a/ui/ui-platform/api/restricted_current.txt
+++ b/ui/ui-platform/api/restricted_current.txt
@@ -73,8 +73,8 @@
method public androidx.ui.core.RepaintBoundaryNode? getRepaintBoundary();
method public final void setDepth(int p);
method public final void setOwnerData(Object? p);
- method public final void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
- method public final void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildren(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
+ method public final inline void visitChildrenReverse(kotlin.jvm.functions.Function1<? super androidx.ui.core.ComponentNode,kotlin.Unit> block);
property protected androidx.ui.core.LayoutNode? containingLayoutNode;
property public final int count;
property public final int depth;
diff --git a/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt b/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
index 2833eb8..1ce1942 100644
--- a/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
+++ b/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
@@ -164,18 +164,18 @@
/**
* Execute [block] on all children of this ComponentNode.
*/
- fun visitChildren(block: (ComponentNode) -> Unit) {
- for (i in 0 until children.size) {
- block(children[i])
+ inline fun visitChildren(block: (ComponentNode) -> Unit) {
+ for (i in 0 until count) {
+ block(this[i])
}
}
/**
* Execute [block] on all children of this ComponentNode in reverse order.
*/
- fun visitChildrenReverse(block: (ComponentNode) -> Unit) {
- for (i in children.size - 1 downTo 0) {
- block(children[i])
+ inline fun visitChildrenReverse(block: (ComponentNode) -> Unit) {
+ for (i in count - 1 downTo 0) {
+ block(this[i])
}
}
diff --git a/viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java b/viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java
index 456786f..4d8e186 100644
--- a/viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java
+++ b/viewpager2/src/main/java/androidx/viewpager2/widget/ScrollEventAdapter.java
@@ -239,7 +239,6 @@
return;
}
- // TODO(123350297): automated test for this
MarginLayoutParams margin =
(firstVisibleView.getLayoutParams() instanceof MarginLayoutParams)
? (MarginLayoutParams) firstVisibleView.getLayoutParams()