Shape theming
Modified out shape theming system to follow specs: https://material.io/design/shape/applying-shape-to-ui.html#baseline-shape-values
Relnote: Shape theming system is updated according to the Material design specification. Now you can provide small, medium and large shapes to be used by most of the components
Bug: 146347651
Bug: 136804052
Test: manually, new tests
Change-Id: Ifb4d152de62f71c6b1759c73702752673aa27c7d
diff --git a/ui/ui-foundation/api/0.1.0-dev09.txt b/ui/ui-foundation/api/0.1.0-dev09.txt
index c8bb322..f651fbb3 100644
--- a/ui/ui-foundation/api/0.1.0-dev09.txt
+++ b/ui/ui-foundation/api/0.1.0-dev09.txt
@@ -340,8 +340,14 @@
public abstract class CornerBasedShape implements androidx.ui.graphics.Shape {
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 abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
public interface CornerSize {
@@ -358,16 +364,8 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.foundation.shape.corner.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.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Generic createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class CutCornerShapeKt {
@@ -382,16 +380,8 @@
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.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Rounded createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class RoundedCornerShapeKt {
diff --git a/ui/ui-foundation/api/current.txt b/ui/ui-foundation/api/current.txt
index c8bb322..f651fbb3 100644
--- a/ui/ui-foundation/api/current.txt
+++ b/ui/ui-foundation/api/current.txt
@@ -340,8 +340,14 @@
public abstract class CornerBasedShape implements androidx.ui.graphics.Shape {
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 abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
public interface CornerSize {
@@ -358,16 +364,8 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.foundation.shape.corner.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.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Generic createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class CutCornerShapeKt {
@@ -382,16 +380,8 @@
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.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Rounded createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class RoundedCornerShapeKt {
diff --git a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev09.txt b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev09.txt
index c8bb322..f651fbb3 100644
--- a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev09.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev09.txt
@@ -340,8 +340,14 @@
public abstract class CornerBasedShape implements androidx.ui.graphics.Shape {
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 abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
public interface CornerSize {
@@ -358,16 +364,8 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.foundation.shape.corner.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.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Generic createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class CutCornerShapeKt {
@@ -382,16 +380,8 @@
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.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Rounded createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class RoundedCornerShapeKt {
diff --git a/ui/ui-foundation/api/public_plus_experimental_current.txt b/ui/ui-foundation/api/public_plus_experimental_current.txt
index c8bb322..f651fbb3 100644
--- a/ui/ui-foundation/api/public_plus_experimental_current.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_current.txt
@@ -340,8 +340,14 @@
public abstract class CornerBasedShape implements androidx.ui.graphics.Shape {
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 abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
public interface CornerSize {
@@ -358,16 +364,8 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.foundation.shape.corner.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.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Generic createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class CutCornerShapeKt {
@@ -382,16 +380,8 @@
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.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Rounded createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class RoundedCornerShapeKt {
diff --git a/ui/ui-foundation/api/restricted_0.1.0-dev09.txt b/ui/ui-foundation/api/restricted_0.1.0-dev09.txt
index c8bb322..f651fbb3 100644
--- a/ui/ui-foundation/api/restricted_0.1.0-dev09.txt
+++ b/ui/ui-foundation/api/restricted_0.1.0-dev09.txt
@@ -340,8 +340,14 @@
public abstract class CornerBasedShape implements androidx.ui.graphics.Shape {
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 abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
public interface CornerSize {
@@ -358,16 +364,8 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.foundation.shape.corner.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.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Generic createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class CutCornerShapeKt {
@@ -382,16 +380,8 @@
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.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Rounded createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class RoundedCornerShapeKt {
diff --git a/ui/ui-foundation/api/restricted_current.txt b/ui/ui-foundation/api/restricted_current.txt
index c8bb322..f651fbb3 100644
--- a/ui/ui-foundation/api/restricted_current.txt
+++ b/ui/ui-foundation/api/restricted_current.txt
@@ -340,8 +340,14 @@
public abstract class CornerBasedShape implements androidx.ui.graphics.Shape {
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 abstract androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft = topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight = topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight = bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft = bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerBasedShape copy(androidx.ui.foundation.shape.corner.CornerSize all);
method public final androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Density density);
method public abstract androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getBottomRight();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopLeft();
+ method public final androidx.ui.foundation.shape.corner.CornerSize getTopRight();
}
public interface CornerSize {
@@ -358,16 +364,8 @@
public final class CutCornerShape extends androidx.ui.foundation.shape.corner.CornerBasedShape {
ctor public CutCornerShape(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.foundation.shape.corner.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.CutCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Generic createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class CutCornerShapeKt {
@@ -382,16 +380,8 @@
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.RoundedCornerShape copy(androidx.ui.foundation.shape.corner.CornerSize topLeft, androidx.ui.foundation.shape.corner.CornerSize topRight, androidx.ui.foundation.shape.corner.CornerSize bottomRight, androidx.ui.foundation.shape.corner.CornerSize bottomLeft);
- method public androidx.ui.graphics.Outline.Rounded createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.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();
+ method public androidx.ui.graphics.Outline createOutline(androidx.ui.unit.PxSize size, androidx.ui.unit.Px topLeft, androidx.ui.unit.Px topRight, androidx.ui.unit.Px bottomRight, androidx.ui.unit.Px bottomLeft);
}
public final class RoundedCornerShapeKt {
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
new file mode 100644
index 0000000..cac90d8
--- /dev/null
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/shape/corner/CornerBasedShapeTest.kt
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2020 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.test.filters.SmallTest
+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
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@SmallTest
+@RunWith(JUnit4::class)
+class CornerBasedShapeTest {
+
+ @Test
+ fun createOutlineCalledWithCorrectParams() {
+ val density = Density(2f, 1f)
+ val passedSize = PxSize(100.px, 50.px)
+ var assertionExecuted = false
+ val assertSizes = { size: PxSize,
+ topLeft: Px,
+ topRight: Px,
+ bottomRight: Px,
+ bottomLeft: Px ->
+ assertThat(size).isEqualTo(passedSize)
+ assertThat(topLeft).isEqualTo(4.px)
+ assertThat(topRight).isEqualTo(3.px)
+ assertThat(bottomRight).isEqualTo(6.px)
+ assertThat(bottomLeft).isEqualTo(25.px)
+ assertionExecuted = true
+ }
+ val impl = Impl(
+ topLeft = CornerSize(4.px),
+ topRight = CornerSize(3.px),
+ bottomRight = CornerSize(3.dp),
+ bottomLeft = CornerSize(50),
+ onOutlineRequested = assertSizes
+ )
+
+ assertThat(impl.createOutline(passedSize, density))
+ .isEqualTo(Outline.Rectangle(passedSize.toRect()))
+
+ assertThat(assertionExecuted).isTrue()
+ }
+
+ @Test
+ fun cornersSizesAreNotLargerThenMinDimension() {
+ val density = Density(2f, 1f)
+ val sizeWithLargerWidth = PxSize(6.px, 4.px)
+ val sizeWithLargerHeight = PxSize(4.px, 6.px)
+
+ val sizesList = mutableListOf<PxSize>()
+ val assertSizes = { size: PxSize,
+ topLeft: Px,
+ topRight: Px,
+ bottomRight: Px,
+ bottomLeft: Px ->
+ sizesList.add(size)
+ assertThat(topLeft).isEqualTo(2.px)
+ assertThat(topRight).isEqualTo(2.px)
+ assertThat(bottomRight).isEqualTo(1.px)
+ assertThat(bottomLeft).isEqualTo(2.px)
+ }
+
+ val impl = Impl(
+ topLeft = CornerSize(10.px),
+ topRight = CornerSize(6.dp),
+ bottomRight = CornerSize(1.px),
+ bottomLeft = CornerSize(2.px),
+ onOutlineRequested = assertSizes
+ )
+
+ impl.createOutline(sizeWithLargerWidth, density)
+ impl.createOutline(sizeWithLargerHeight, density)
+
+ assertThat(sizesList).isEqualTo(mutableListOf(sizeWithLargerWidth, sizeWithLargerHeight))
+ }
+
+ @Test
+ fun theSameImplsWithTheSameCornersAreEquals() {
+ @Suppress("ReplaceCallWithBinaryOperator")
+ assertThat(
+ Impl2(
+ topLeft = CornerSize(4.px),
+ topRight = CornerSize(3.px),
+ bottomRight = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ ).equals(
+ Impl2(
+ topLeft = CornerSize(4.px),
+ topRight = CornerSize(3.px),
+ bottomRight = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ )
+ )
+ ).isTrue()
+ }
+
+ @Test
+ fun differentImplWithTheSameCornersAreNotEquals() {
+ @Suppress("ReplaceCallWithBinaryOperator")
+ assertThat(
+ Impl(
+ topLeft = CornerSize(4.px),
+ topRight = CornerSize(3.px),
+ bottomRight = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ ).equals(
+ Impl2(
+ topLeft = CornerSize(4.px),
+ topRight = CornerSize(3.px),
+ bottomRight = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ )
+ )
+ ).isFalse()
+ }
+
+ @Test
+ fun copyingUsesCorrectDefaults() {
+ val impl = Impl(
+ topLeft = CornerSize(4.px),
+ topRight = CornerSize(3.px),
+ bottomRight = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ )
+ assertThat(impl)
+ .isEqualTo(impl.copy(bottomRight = CornerSize(3.dp)))
+ }
+}
+
+private class Impl(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize,
+ private val onOutlineRequested: ((PxSize, Px, Px, Px, Px) -> Unit)? = null
+) : CornerBasedShape(topLeft, topRight, bottomRight, bottomLeft) {
+
+ override fun createOutline(
+ size: PxSize,
+ topLeft: Px,
+ topRight: Px,
+ bottomRight: Px,
+ bottomLeft: Px
+ ): Outline {
+ onOutlineRequested?.invoke(size, topLeft, topRight, bottomRight, bottomLeft)
+ return Outline.Rectangle(size.toRect())
+ }
+
+ override fun copy(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize
+ ) = Impl(topLeft, topRight, bottomRight, bottomLeft, onOutlineRequested)
+}
+
+private class Impl2(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize
+) : CornerBasedShape(topLeft, topRight, bottomRight, bottomLeft) {
+
+ override fun createOutline(
+ size: PxSize,
+ topLeft: Px,
+ topRight: Px,
+ bottomRight: Px,
+ bottomLeft: Px
+ ): Outline {
+ return Outline.Rounded(RRect(size.toRect()))
+ }
+
+ override fun copy(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize
+ ) = Impl2(topLeft, topRight, bottomRight, bottomLeft)
+}
\ No newline at end of file
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 1508553..2b92be5 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
@@ -23,7 +23,9 @@
import androidx.ui.graphics.Shape
import androidx.ui.unit.Density
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.Assert
import org.junit.Test
@@ -78,11 +80,38 @@
}
@Test
+ fun createsRectangleOutlineForZeroSizedCorners() {
+ val rounded = CutCornerShape(0.px, 0.px, 0.px, 0.px)
+
+ assertThat(rounded.toOutline())
+ .isEqualTo(Outline.Rectangle(size.toRect()))
+ }
+
+ @Test
fun cutCornerShapesAreEquals() {
assertThat(CutCornerShape(10.px))
.isEqualTo(CutCornerShape(10.px))
}
+ @Test
+ fun cutCornerUpdateAllCornerSize() {
+ assertThat(CutCornerShape(10.px).copy(CornerSize(5.px)))
+ .isEqualTo(CutCornerShape(5.px))
+ }
+
+ @Test
+ fun cutCornerUpdateTwoCornerSizes() {
+ assertThat(CutCornerShape(10.px).copy(
+ topRight = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ )).isEqualTo(CutCornerShape(
+ topLeft = CornerSize(10.px),
+ topRight = CornerSize(3.dp),
+ bottomRight = CornerSize(10.px),
+ bottomLeft = CornerSize(50)
+ ))
+ }
+
private fun Shape.toOutline() = createOutline(size, density)
}
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 398b9d8..559b8f5 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
@@ -72,10 +72,37 @@
}
@Test
+ fun createsRectangleOutlineForZeroSizedCorners() {
+ val rounded = RoundedCornerShape(0.px, 0.px, 0.px, 0.px)
+
+ assertThat(rounded.toOutline())
+ .isEqualTo(Outline.Rectangle(size.toRect()))
+ }
+
+ @Test
fun roundedCornerShapesAreEquals() {
assertThat(RoundedCornerShape(12.dp))
.isEqualTo(RoundedCornerShape(12.dp))
}
+ @Test
+ fun roundedCornerUpdateAllCornerSize() {
+ assertThat(RoundedCornerShape(10.px).copy(CornerSize(5.dp)))
+ .isEqualTo(RoundedCornerShape(5.dp))
+ }
+
+ @Test
+ fun roundedCornerUpdateTwoCornerSizes() {
+ assertThat(RoundedCornerShape(10.px).copy(
+ topLeft = CornerSize(3.dp),
+ bottomLeft = CornerSize(50)
+ )).isEqualTo(RoundedCornerShape(
+ topLeft = CornerSize(3.dp),
+ topRight = CornerSize(10.px),
+ bottomRight = CornerSize(10.px),
+ bottomLeft = CornerSize(50)
+ ))
+ }
+
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 b09310c..a1f00f5 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
@@ -21,8 +21,9 @@
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 androidx.ui.unit.toRect
/**
* Base class for [Shape]s defined by four [CornerSize]s.
@@ -35,25 +36,23 @@
* @param bottomLeft a size of the bottom right corner
*/
abstract class CornerBasedShape(
- private val topLeft: CornerSize,
- private val topRight: CornerSize,
- private val bottomRight: CornerSize,
- private val bottomLeft: CornerSize
+ val topLeft: CornerSize,
+ val topRight: CornerSize,
+ val bottomRight: CornerSize,
+ val bottomLeft: CornerSize
) : Shape {
final override fun createOutline(size: PxSize, density: Density): Outline {
- val topLeft = topLeft.toPx(size, density)
- val topRight = topRight.toPx(size, density)
- val bottomRight = bottomRight.toPx(size, density)
- val bottomLeft = bottomLeft.toPx(size, density)
+ val halfMinDimension = size.minDimension / 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) {
- "Corner size in Px can't be negative!"
+ "Corner size in Px can't be negative(topLeft = $topLeft, topRight = $topRight, " +
+ "bottomRight = $bottomRight, bottomLeft = $bottomLeft)!"
}
- return if (topLeft + topRight + bottomLeft + bottomRight == 0.px) {
- Outline.Rectangle(size.toRect())
- } else {
- createOutline(size, topLeft, topRight, bottomRight, bottomLeft)
- }
+ return createOutline(size, topLeft, topRight, bottomRight, bottomLeft)
}
/**
@@ -72,4 +71,49 @@
bottomRight: Px,
bottomLeft: Px
): Outline
+
+ /**
+ * Creates a copy of this Shape with a new 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 fun copy(
+ topLeft: CornerSize = this.topLeft,
+ topRight: CornerSize = this.topRight,
+ bottomRight: CornerSize = this.bottomRight,
+ bottomLeft: CornerSize = this.bottomLeft
+ ): CornerBasedShape
+
+ /**
+ * Creates a copy of this Shape with a new corner size.
+ * @param all a size to apply for all four corners
+ */
+ fun copy(all: CornerSize): CornerBasedShape = copy(all, all, all, all)
+
+ // Implementations can't be data classes as we defined the abstract copy() method and the data
+ // class code generation is not compatible with it, so we provide our hashCode() and equals()
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (javaClass != other?.javaClass) return false
+
+ other as CornerBasedShape
+
+ if (topLeft != other.topLeft) return false
+ if (topRight != other.topRight) return false
+ if (bottomRight != other.bottomRight) return false
+ if (bottomLeft != other.bottomLeft) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = topLeft.hashCode()
+ result = 31 * result + topRight.hashCode()
+ result = 31 * result + bottomRight.hashCode()
+ result = 31 * result + bottomLeft.hashCode()
+ return result
+ }
}
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 166af33..77cbd2a 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
@@ -24,6 +24,7 @@
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
import androidx.ui.unit.px
+import androidx.ui.unit.toRect
/**
* A shape describing the rectangle with cut corners.
@@ -34,11 +35,11 @@
* @param bottomRight a size of the bottom left corner
* @param bottomLeft a size of the bottom right corner
*/
-data class CutCornerShape(
- val topLeft: CornerSize,
- val topRight: CornerSize,
- val bottomRight: CornerSize,
- val bottomLeft: CornerSize
+class CutCornerShape(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize
) : CornerBasedShape(topLeft, topRight, bottomRight, bottomLeft) {
override fun createOutline(
@@ -47,7 +48,9 @@
topRight: Px,
bottomRight: Px,
bottomLeft: Px
- ) = Outline.Generic(Path().apply {
+ ) = if (topLeft + topRight + bottomLeft + bottomRight == 0.px) {
+ Outline.Rectangle(size.toRect())
+ } else Outline.Generic(Path().apply {
var cornerSize = topLeft.value
moveTo(0f, cornerSize)
lineTo(cornerSize, 0f)
@@ -62,6 +65,23 @@
lineTo(0f, size.height.value - cornerSize)
close()
})
+
+ override fun copy(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize
+ ) = CutCornerShape(
+ topLeft = topLeft,
+ topRight = topRight,
+ bottomRight = bottomRight,
+ bottomLeft = bottomLeft
+ )
+
+ override fun toString(): String {
+ return "CutCornerShape(topLeft = $topLeft, topRight = $topRight, bottomRight = " +
+ "$bottomRight, bottomLeft = $bottomLeft)"
+ }
}
/**
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 7ef46c1f..67c3851 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
@@ -36,11 +36,11 @@
* @param bottomRight a size of the bottom left corner
* @param bottomLeft a size of the bottom right corner
*/
-data class RoundedCornerShape(
- val topLeft: CornerSize,
- val topRight: CornerSize,
- val bottomRight: CornerSize,
- val bottomLeft: CornerSize
+class RoundedCornerShape(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize
) : CornerBasedShape(topLeft, topRight, bottomRight, bottomLeft) {
override fun createOutline(
@@ -49,7 +49,10 @@
topRight: Px,
bottomRight: Px,
bottomLeft: Px
- ) = Outline.Rounded(
+ ) = if (topLeft + topRight + bottomLeft + bottomRight == 0.px) {
+ Outline.Rectangle(size.toRect())
+ } else {
+ Outline.Rounded(
RRect(
rect = size.toRect(),
topLeft = topLeft.toRadius(),
@@ -58,6 +61,24 @@
bottomLeft = bottomLeft.toRadius()
)
)
+ }
+
+ override fun copy(
+ topLeft: CornerSize,
+ topRight: CornerSize,
+ bottomRight: CornerSize,
+ bottomLeft: CornerSize
+ ) = RoundedCornerShape(
+ topLeft = topLeft,
+ topRight = topRight,
+ bottomRight = bottomRight,
+ bottomLeft = bottomLeft
+ )
+
+ override fun toString(): String {
+ return "RoundedCornerShape(topLeft = $topLeft, topRight = $topRight, bottomRight = " +
+ "$bottomRight, bottomLeft = $bottomLeft)"
+ }
private /*inline*/ fun Px.toRadius() = Radius.circular(this.value)
}
diff --git a/ui/ui-material/api/0.1.0-dev09.txt b/ui/ui-material/api/0.1.0-dev09.txt
index 104a003..7c984a3 100644
--- a/ui/ui-material/api/0.1.0-dev09.txt
+++ b/ui/ui-material/api/0.1.0-dev09.txt
@@ -7,8 +7,8 @@
}
public final class AlertDialogKt {
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide);
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide, androidx.ui.graphics.Shape shape = medium);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons, androidx.ui.graphics.Shape shape = medium);
}
public final class AppBarKt {
@@ -43,13 +43,13 @@
}
public final class ButtonKt {
- method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CardKt {
- method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = card, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = medium, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CheckboxKt {
@@ -168,8 +168,8 @@
}
public final class FloatingActionButtonKt {
- method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
- method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
+ method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class IconButtonKt {
@@ -195,7 +195,7 @@
}
public final class MaterialThemeKt {
- method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), androidx.ui.material.Shapes shapes = MaterialTheme.shapes, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ProgressIndicatorKt {
@@ -242,17 +242,19 @@
method public void setDrawerState(androidx.ui.material.DrawerState p);
}
- public final class ShapeKt {
+ public final class Shapes {
+ ctor public Shapes(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ ctor public Shapes();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component1();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component2();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component3();
+ method public androidx.ui.material.Shapes copy(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getLarge();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getMedium();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getSmall();
}
- public final class Shapes {
- ctor public Shapes(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- ctor public Shapes();
- method public androidx.ui.graphics.Shape component1();
- method public androidx.ui.graphics.Shape component2();
- method public androidx.ui.material.Shapes copy(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- method public androidx.ui.graphics.Shape getButton();
- method public androidx.ui.graphics.Shape getCard();
+ public final class ShapesKt {
}
public final class SliderKt {
@@ -269,7 +271,7 @@
}
public final class SnackbarKt {
- method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false);
+ method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false, androidx.ui.graphics.Shape shape = small, androidx.ui.unit.Dp elevation = 6.dp);
method public static androidx.ui.graphics.Color snackbarPrimaryColorFor(androidx.ui.material.ColorPalette colors);
}
diff --git a/ui/ui-material/api/current.txt b/ui/ui-material/api/current.txt
index 104a003..7c984a3 100644
--- a/ui/ui-material/api/current.txt
+++ b/ui/ui-material/api/current.txt
@@ -7,8 +7,8 @@
}
public final class AlertDialogKt {
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide);
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide, androidx.ui.graphics.Shape shape = medium);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons, androidx.ui.graphics.Shape shape = medium);
}
public final class AppBarKt {
@@ -43,13 +43,13 @@
}
public final class ButtonKt {
- method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CardKt {
- method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = card, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = medium, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CheckboxKt {
@@ -168,8 +168,8 @@
}
public final class FloatingActionButtonKt {
- method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
- method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
+ method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class IconButtonKt {
@@ -195,7 +195,7 @@
}
public final class MaterialThemeKt {
- method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), androidx.ui.material.Shapes shapes = MaterialTheme.shapes, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ProgressIndicatorKt {
@@ -242,17 +242,19 @@
method public void setDrawerState(androidx.ui.material.DrawerState p);
}
- public final class ShapeKt {
+ public final class Shapes {
+ ctor public Shapes(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ ctor public Shapes();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component1();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component2();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component3();
+ method public androidx.ui.material.Shapes copy(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getLarge();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getMedium();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getSmall();
}
- public final class Shapes {
- ctor public Shapes(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- ctor public Shapes();
- method public androidx.ui.graphics.Shape component1();
- method public androidx.ui.graphics.Shape component2();
- method public androidx.ui.material.Shapes copy(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- method public androidx.ui.graphics.Shape getButton();
- method public androidx.ui.graphics.Shape getCard();
+ public final class ShapesKt {
}
public final class SliderKt {
@@ -269,7 +271,7 @@
}
public final class SnackbarKt {
- method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false);
+ method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false, androidx.ui.graphics.Shape shape = small, androidx.ui.unit.Dp elevation = 6.dp);
method public static androidx.ui.graphics.Color snackbarPrimaryColorFor(androidx.ui.material.ColorPalette colors);
}
diff --git a/ui/ui-material/api/public_plus_experimental_0.1.0-dev09.txt b/ui/ui-material/api/public_plus_experimental_0.1.0-dev09.txt
index 104a003..7c984a3 100644
--- a/ui/ui-material/api/public_plus_experimental_0.1.0-dev09.txt
+++ b/ui/ui-material/api/public_plus_experimental_0.1.0-dev09.txt
@@ -7,8 +7,8 @@
}
public final class AlertDialogKt {
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide);
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide, androidx.ui.graphics.Shape shape = medium);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons, androidx.ui.graphics.Shape shape = medium);
}
public final class AppBarKt {
@@ -43,13 +43,13 @@
}
public final class ButtonKt {
- method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CardKt {
- method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = card, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = medium, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CheckboxKt {
@@ -168,8 +168,8 @@
}
public final class FloatingActionButtonKt {
- method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
- method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
+ method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class IconButtonKt {
@@ -195,7 +195,7 @@
}
public final class MaterialThemeKt {
- method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), androidx.ui.material.Shapes shapes = MaterialTheme.shapes, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ProgressIndicatorKt {
@@ -242,17 +242,19 @@
method public void setDrawerState(androidx.ui.material.DrawerState p);
}
- public final class ShapeKt {
+ public final class Shapes {
+ ctor public Shapes(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ ctor public Shapes();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component1();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component2();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component3();
+ method public androidx.ui.material.Shapes copy(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getLarge();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getMedium();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getSmall();
}
- public final class Shapes {
- ctor public Shapes(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- ctor public Shapes();
- method public androidx.ui.graphics.Shape component1();
- method public androidx.ui.graphics.Shape component2();
- method public androidx.ui.material.Shapes copy(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- method public androidx.ui.graphics.Shape getButton();
- method public androidx.ui.graphics.Shape getCard();
+ public final class ShapesKt {
}
public final class SliderKt {
@@ -269,7 +271,7 @@
}
public final class SnackbarKt {
- method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false);
+ method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false, androidx.ui.graphics.Shape shape = small, androidx.ui.unit.Dp elevation = 6.dp);
method public static androidx.ui.graphics.Color snackbarPrimaryColorFor(androidx.ui.material.ColorPalette colors);
}
diff --git a/ui/ui-material/api/public_plus_experimental_current.txt b/ui/ui-material/api/public_plus_experimental_current.txt
index 104a003..7c984a3 100644
--- a/ui/ui-material/api/public_plus_experimental_current.txt
+++ b/ui/ui-material/api/public_plus_experimental_current.txt
@@ -7,8 +7,8 @@
}
public final class AlertDialogKt {
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide);
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide, androidx.ui.graphics.Shape shape = medium);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons, androidx.ui.graphics.Shape shape = medium);
}
public final class AppBarKt {
@@ -43,13 +43,13 @@
}
public final class ButtonKt {
- method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CardKt {
- method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = card, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = medium, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CheckboxKt {
@@ -168,8 +168,8 @@
}
public final class FloatingActionButtonKt {
- method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
- method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
+ method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class IconButtonKt {
@@ -195,7 +195,7 @@
}
public final class MaterialThemeKt {
- method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), androidx.ui.material.Shapes shapes = MaterialTheme.shapes, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ProgressIndicatorKt {
@@ -242,17 +242,19 @@
method public void setDrawerState(androidx.ui.material.DrawerState p);
}
- public final class ShapeKt {
+ public final class Shapes {
+ ctor public Shapes(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ ctor public Shapes();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component1();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component2();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component3();
+ method public androidx.ui.material.Shapes copy(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getLarge();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getMedium();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getSmall();
}
- public final class Shapes {
- ctor public Shapes(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- ctor public Shapes();
- method public androidx.ui.graphics.Shape component1();
- method public androidx.ui.graphics.Shape component2();
- method public androidx.ui.material.Shapes copy(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- method public androidx.ui.graphics.Shape getButton();
- method public androidx.ui.graphics.Shape getCard();
+ public final class ShapesKt {
}
public final class SliderKt {
@@ -269,7 +271,7 @@
}
public final class SnackbarKt {
- method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false);
+ method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false, androidx.ui.graphics.Shape shape = small, androidx.ui.unit.Dp elevation = 6.dp);
method public static androidx.ui.graphics.Color snackbarPrimaryColorFor(androidx.ui.material.ColorPalette colors);
}
diff --git a/ui/ui-material/api/restricted_0.1.0-dev09.txt b/ui/ui-material/api/restricted_0.1.0-dev09.txt
index 104a003..7c984a3 100644
--- a/ui/ui-material/api/restricted_0.1.0-dev09.txt
+++ b/ui/ui-material/api/restricted_0.1.0-dev09.txt
@@ -7,8 +7,8 @@
}
public final class AlertDialogKt {
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide);
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide, androidx.ui.graphics.Shape shape = medium);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons, androidx.ui.graphics.Shape shape = medium);
}
public final class AppBarKt {
@@ -43,13 +43,13 @@
}
public final class ButtonKt {
- method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CardKt {
- method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = card, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = medium, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CheckboxKt {
@@ -168,8 +168,8 @@
}
public final class FloatingActionButtonKt {
- method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
- method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
+ method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class IconButtonKt {
@@ -195,7 +195,7 @@
}
public final class MaterialThemeKt {
- method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), androidx.ui.material.Shapes shapes = MaterialTheme.shapes, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ProgressIndicatorKt {
@@ -242,17 +242,19 @@
method public void setDrawerState(androidx.ui.material.DrawerState p);
}
- public final class ShapeKt {
+ public final class Shapes {
+ ctor public Shapes(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ ctor public Shapes();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component1();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component2();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component3();
+ method public androidx.ui.material.Shapes copy(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getLarge();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getMedium();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getSmall();
}
- public final class Shapes {
- ctor public Shapes(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- ctor public Shapes();
- method public androidx.ui.graphics.Shape component1();
- method public androidx.ui.graphics.Shape component2();
- method public androidx.ui.material.Shapes copy(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- method public androidx.ui.graphics.Shape getButton();
- method public androidx.ui.graphics.Shape getCard();
+ public final class ShapesKt {
}
public final class SliderKt {
@@ -269,7 +271,7 @@
}
public final class SnackbarKt {
- method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false);
+ method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false, androidx.ui.graphics.Shape shape = small, androidx.ui.unit.Dp elevation = 6.dp);
method public static androidx.ui.graphics.Color snackbarPrimaryColorFor(androidx.ui.material.ColorPalette colors);
}
diff --git a/ui/ui-material/api/restricted_current.txt b/ui/ui-material/api/restricted_current.txt
index 104a003..7c984a3 100644
--- a/ui/ui-material/api/restricted_current.txt
+++ b/ui/ui-material/api/restricted_current.txt
@@ -7,8 +7,8 @@
}
public final class AlertDialogKt {
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide);
- method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> confirmButton, kotlin.jvm.functions.Function0<kotlin.Unit>? dismissButton = null, androidx.ui.material.AlertDialogButtonLayout buttonLayout = androidx.ui.material.AlertDialogButtonLayout.SideBySide, androidx.ui.graphics.Shape shape = medium);
+ method public static void AlertDialog(kotlin.jvm.functions.Function0<kotlin.Unit> onCloseRequest, kotlin.jvm.functions.Function0<kotlin.Unit>? title = null, kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> buttons, androidx.ui.graphics.Shape shape = medium);
}
public final class AppBarKt {
@@ -43,13 +43,13 @@
}
public final class ButtonKt {
- method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = button, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Button(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 2.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void OutlinedButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = Border(1.dp, MaterialTheme.colors.onSurface.copy(OutlinedStrokeOpacity)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = Button.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static inline void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, boolean enabled = true, androidx.ui.unit.Dp elevation = 0.dp, androidx.ui.graphics.Shape shape = small, androidx.ui.foundation.Border? border = null, androidx.ui.graphics.Color backgroundColor = Color.Transparent, androidx.ui.graphics.Color contentColor = MaterialTheme.colors.primary, androidx.ui.layout.EdgeInsets innerPadding = TextButton.DefaultInnerPadding, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CardKt {
- method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = card, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void Card(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = medium, androidx.ui.graphics.Color color = MaterialTheme.colors.surface, androidx.ui.graphics.Color contentColor = contentColorFor(color), androidx.ui.foundation.Border? border = null, androidx.ui.unit.Dp elevation = 1.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class CheckboxKt {
@@ -168,8 +168,8 @@
}
public final class FloatingActionButtonKt {
- method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
- method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = CircleShape, androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void ExtendedFloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp);
+ method public static void FloatingActionButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), androidx.ui.graphics.Color backgroundColor = MaterialTheme.colors.primary, androidx.ui.graphics.Color contentColor = contentColorFor(backgroundColor), androidx.ui.unit.Dp elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class IconButtonKt {
@@ -195,7 +195,7 @@
}
public final class MaterialThemeKt {
- method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), kotlin.jvm.functions.Function0<kotlin.Unit> children);
+ method public static void MaterialTheme(androidx.ui.material.ColorPalette colors = lightColorPalette(), androidx.ui.material.Typography typography = androidx.ui.material.Typography(), androidx.ui.material.Shapes shapes = MaterialTheme.shapes, kotlin.jvm.functions.Function0<kotlin.Unit> children);
}
public final class ProgressIndicatorKt {
@@ -242,17 +242,19 @@
method public void setDrawerState(androidx.ui.material.DrawerState p);
}
- public final class ShapeKt {
+ public final class Shapes {
+ ctor public Shapes(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ ctor public Shapes();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component1();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component2();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape component3();
+ method public androidx.ui.material.Shapes copy(androidx.ui.foundation.shape.corner.CornerBasedShape small, androidx.ui.foundation.shape.corner.CornerBasedShape medium, androidx.ui.foundation.shape.corner.CornerBasedShape large);
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getLarge();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getMedium();
+ method public androidx.ui.foundation.shape.corner.CornerBasedShape getSmall();
}
- public final class Shapes {
- ctor public Shapes(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- ctor public Shapes();
- method public androidx.ui.graphics.Shape component1();
- method public androidx.ui.graphics.Shape component2();
- method public androidx.ui.material.Shapes copy(androidx.ui.graphics.Shape button, androidx.ui.graphics.Shape card);
- method public androidx.ui.graphics.Shape getButton();
- method public androidx.ui.graphics.Shape getCard();
+ public final class ShapesKt {
}
public final class SliderKt {
@@ -269,7 +271,7 @@
}
public final class SnackbarKt {
- method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false);
+ method public static void Snackbar(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit>? action = null, androidx.ui.core.Modifier modifier = Modifier.None, boolean actionOnNewLine = false, androidx.ui.graphics.Shape shape = small, androidx.ui.unit.Dp elevation = 6.dp);
method public static androidx.ui.graphics.Color snackbarPrimaryColorFor(androidx.ui.material.ColorPalette colors);
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
index a301e16..78049ae 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
@@ -17,6 +17,7 @@
package androidx.ui.material
import androidx.compose.Composable
+import androidx.compose.Providers
import androidx.compose.state
import androidx.test.filters.MediumTest
import androidx.ui.core.LayoutCoordinates
@@ -24,13 +25,19 @@
import androidx.ui.core.TestTag
import androidx.ui.core.onChildPositioned
import androidx.ui.core.onPositioned
+import androidx.ui.foundation.Box
import androidx.ui.foundation.Text
import androidx.ui.foundation.currentTextStyle
+import androidx.ui.foundation.shape.corner.CutCornerShape
+import androidx.ui.graphics.Color
import androidx.ui.layout.Column
import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.test.assertHasClickAction
import androidx.ui.test.assertHasNoClickAction
import androidx.ui.test.assertSemanticsIsEqualTo
+import androidx.ui.test.assertShape
+import androidx.ui.test.captureToBitmap
import androidx.ui.test.createComposeRule
import androidx.ui.test.createFullSemantics
import androidx.ui.test.doClick
@@ -284,6 +291,36 @@
}
}
+ @Test
+ fun buttonTest_shapeAndColorFromThemeIsUsed() {
+ val shape = CutCornerShape(10.dp)
+ var surface = Color.Transparent
+ var primary = Color.Transparent
+ composeTestRule.setMaterialContent {
+ Stack {
+ surface = MaterialTheme.colors.surface
+ primary = MaterialTheme.colors.primary
+ Providers(ShapesAmbient provides Shapes(small = shape)) {
+ TestTag(tag = "myButton") {
+ Button(onClick = {}, elevation = 0.dp) {
+ Box(Modifier.preferredSize(10.dp, 10.dp))
+ }
+ }
+ }
+ }
+ }
+
+ findByTag("myButton")
+ .captureToBitmap()
+ .assertShape(
+ density = composeTestRule.density,
+ shape = shape,
+ shapeColor = primary,
+ backgroundColor = surface,
+ shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx() }
+ )
+ }
+
private fun assertLeftPaddingIs(
padding: Dp,
button: @Composable() (@Composable() () -> Unit) -> Unit
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
new file mode 100644
index 0000000..ab133e6
--- /dev/null
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2020 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.material
+
+import androidx.compose.Providers
+import androidx.test.filters.MediumTest
+import androidx.ui.core.Modifier
+import androidx.ui.core.TestTag
+import androidx.ui.foundation.Box
+import androidx.ui.foundation.shape.corner.CutCornerShape
+import androidx.ui.graphics.Color
+import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
+import androidx.ui.semantics.Semantics
+import androidx.ui.test.assertShape
+import androidx.ui.test.captureToBitmap
+import androidx.ui.test.createComposeRule
+import androidx.ui.test.findByTag
+import androidx.ui.unit.dp
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@MediumTest
+@RunWith(JUnit4::class)
+class CardTest {
+
+ @get:Rule
+ val composeTestRule = createComposeRule()
+
+ @Test
+ fun shapeAndColorFromThemeIsUsed() {
+ val shape = CutCornerShape(8.dp)
+ val background = Color.Yellow
+ var cardColor = Color.Transparent
+ composeTestRule.setMaterialContent {
+ Surface(color = background) {
+ Stack {
+ cardColor = MaterialTheme.colors.surface
+ Providers(ShapesAmbient provides Shapes(medium = shape)) {
+ TestTag(tag = "card") {
+ Semantics(container = true, mergeAllDescendants = true) {
+ Card(elevation = 0.dp) {
+ Box(Modifier.preferredSize(50.dp, 50.dp))
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ findByTag("card")
+ .captureToBitmap()
+ .assertShape(
+ density = composeTestRule.density,
+ shape = shape,
+ shapeColor = cardColor,
+ backgroundColor = background,
+ shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx() }
+ )
+ }
+}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
index ef0c05f..3378675 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
@@ -16,12 +16,27 @@
package androidx.ui.material
+import androidx.compose.Providers
import androidx.test.filters.MediumTest
+import androidx.ui.core.Modifier
+import androidx.ui.core.TestTag
+import androidx.ui.foundation.Box
import androidx.ui.foundation.Icon
import androidx.ui.foundation.Text
+import androidx.ui.foundation.shape.corner.CutCornerShape
+import androidx.ui.graphics.Color
+import androidx.ui.layout.Stack
+import androidx.ui.layout.preferredSize
import androidx.ui.material.icons.Icons
import androidx.ui.material.icons.filled.Favorite
+import androidx.ui.test.assertSemanticsIsEqualTo
+import androidx.ui.test.assertShape
+import androidx.ui.test.captureToBitmap
import androidx.ui.test.createComposeRule
+import androidx.ui.test.createFullSemantics
+import androidx.ui.test.doClick
+import androidx.ui.test.findByTag
+import androidx.ui.test.findByText
import androidx.ui.unit.dp
import androidx.ui.unit.round
import com.google.common.truth.Truth.assertThat
@@ -37,6 +52,46 @@
@get:Rule
val composeTestRule = createComposeRule()
+ private val defaultButtonSemantics = createFullSemantics(
+ isEnabled = true
+ )
+
+ @Test
+ fun fabDefaultSemantics() {
+ composeTestRule.setMaterialContent {
+ Stack {
+ TestTag(tag = "myButton") {
+ FloatingActionButton(onClick = {}) {
+ Icon(Icons.Filled.Favorite)
+ }
+ }
+ }
+ }
+
+ findByTag("myButton")
+ .assertSemanticsIsEqualTo(defaultButtonSemantics)
+ }
+
+ @Test
+ fun extendedFab_findByTextAndClick() {
+ var counter = 0
+ val onClick: () -> Unit = { ++counter }
+ val text = "myButton"
+
+ composeTestRule.setMaterialContent {
+ Stack {
+ ExtendedFloatingActionButton(text = { Text(text) }, onClick = onClick)
+ }
+ }
+
+ findByText(text)
+ .doClick()
+
+ composeTestRule.runOnIdleCompose {
+ assertThat(counter).isEqualTo(1)
+ }
+ }
+
@Test
fun defaultFabHasSizeFromSpec() {
composeTestRule
@@ -78,4 +133,35 @@
assertThat(size.height.round()).isEqualTo(48.dp.toIntPx())
}
}
+
+ @Test
+ fun fab_shapeAndColorFromThemeIsUsed() {
+ val themeShape = CutCornerShape(4.dp)
+ val realShape = CutCornerShape(50)
+ var surface = Color.Transparent
+ var primary = Color.Transparent
+ composeTestRule.setMaterialContent {
+ Stack {
+ surface = MaterialTheme.colors.surface
+ primary = MaterialTheme.colors.primary
+ Providers(ShapesAmbient provides Shapes(small = themeShape)) {
+ TestTag(tag = "myButton") {
+ FloatingActionButton(onClick = {}, elevation = 0.dp) {
+ Box(Modifier.preferredSize(10.dp, 10.dp))
+ }
+ }
+ }
+ }
+ }
+
+ findByTag("myButton")
+ .captureToBitmap()
+ .assertShape(
+ density = composeTestRule.density,
+ shape = realShape,
+ shapeColor = primary,
+ backgroundColor = surface,
+ shapeOverlapPixelCount = with(composeTestRule.density) { 1.dp.toPx() }
+ )
+ }
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
index de41ad5..93830d1 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
@@ -16,18 +16,27 @@
package androidx.ui.material
+import androidx.compose.Providers
import androidx.test.filters.MediumTest
import androidx.ui.core.FirstBaseline
import androidx.ui.core.LastBaseline
import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.Modifier
+import androidx.ui.core.TestTag
import androidx.ui.core.globalPosition
import androidx.ui.core.onPositioned
import androidx.ui.foundation.Text
+import androidx.ui.foundation.shape.corner.CutCornerShape
+import androidx.ui.graphics.Color
+import androidx.ui.graphics.compositeOver
import androidx.ui.layout.DpConstraints
import androidx.ui.layout.Stack
+import androidx.ui.semantics.Semantics
+import androidx.ui.test.assertShape
+import androidx.ui.test.captureToBitmap
import androidx.ui.test.createComposeRule
import androidx.ui.test.doClick
+import androidx.ui.test.findByTag
import androidx.ui.test.findByText
import androidx.ui.test.positionInParent
import androidx.ui.unit.IntPx
@@ -310,4 +319,37 @@
}
}
}
+
+ @Test
+ fun shapeAndColorFromThemeIsUsed() {
+ val shape = CutCornerShape(8.dp)
+ var background = Color.Yellow
+ var snackBarColor = Color.Transparent
+ composeTestRule.setMaterialContent {
+ Stack {
+ background = MaterialTheme.colors.surface
+ // Snackbar has a background color of onSurface with an alpha applied blended
+ // on top of surface
+ snackBarColor = MaterialTheme.colors.onSurface.copy(alpha = 0.8f)
+ .compositeOver(background)
+ Providers(ShapesAmbient provides Shapes(medium = shape)) {
+ TestTag(tag = "snackbar") {
+ Semantics(container = true, mergeAllDescendants = true) {
+ Snackbar(text = { Text("") })
+ }
+ }
+ }
+ }
+ }
+
+ findByTag("snackbar")
+ .captureToBitmap()
+ .assertShape(
+ density = composeTestRule.density,
+ shape = shape,
+ shapeColor = snackBarColor,
+ backgroundColor = background,
+ shapeOverlapPixelCount = with(composeTestRule.density) { 2.dp.toPx() }
+ )
+ }
}
\ No newline at end of file
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 8cbaca2..f51e152 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
@@ -22,7 +22,7 @@
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.Dialog
import androidx.ui.foundation.ProvideTextStyle
-import androidx.ui.foundation.shape.corner.RoundedCornerShape
+import androidx.ui.graphics.Shape
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
import androidx.ui.layout.ColumnAlign
@@ -62,7 +62,7 @@
* @param dismissButton A button which is meant to dismiss the dialog.
* @param buttonLayout An enum which specifies how the buttons are positioned inside the dialog:
* SideBySide or Stacked.
- *
+ * @param shape Defines the Dialog's shape
*/
@Composable
fun AlertDialog(
@@ -71,7 +71,8 @@
text: @Composable() () -> Unit,
confirmButton: @Composable() () -> Unit,
dismissButton: @Composable() (() -> Unit)? = null,
- buttonLayout: AlertDialogButtonLayout = SideBySide
+ buttonLayout: AlertDialogButtonLayout = SideBySide,
+ shape: Shape = MaterialTheme.shapes.medium
) {
AlertDialog(
onCloseRequest = onCloseRequest,
@@ -83,7 +84,8 @@
dismissButton = dismissButton,
buttonLayout = buttonLayout
)
- }
+ },
+ shape = shape
)
}
@@ -102,13 +104,15 @@
* @param text The text which presents the details regarding the Dialog's purpose. Provided text
* style will be [Typography.body1].
* @param buttons Function that emits the layout with the buttons
+ * @param shape Defines the Dialog's shape
*/
@Composable
fun AlertDialog(
onCloseRequest: () -> Unit,
title: (@Composable() () -> Unit)? = null,
text: @Composable() () -> Unit,
- buttons: @Composable() () -> Unit
+ buttons: @Composable() () -> Unit,
+ shape: Shape = MaterialTheme.shapes.medium
) {
// TODO: Find a cleaner way to pass the properties of the MaterialTheme
val currentColors = MaterialTheme.colors
@@ -117,7 +121,7 @@
MaterialTheme(colors = currentColors, typography = currentTypography) {
Surface(
modifier = AlertDialogWidth,
- shape = AlertDialogShape
+ shape = shape
) {
val emphasisLevels = MaterialTheme.emphasisLevels
Column {
@@ -201,6 +205,4 @@
private val TitlePadding = Modifier.padding(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 0.dp)
// The height difference of the padding between a Dialog with a title and one without a title
private val NoTitleExtraHeight = Modifier.preferredHeight(2.dp)
-private val TextToButtonsHeight = Modifier.preferredHeight(28.dp)
-// TODO: The corner radius should be customizable
-private val AlertDialogShape = RoundedCornerShape(4.dp)
\ No newline at end of file
+private val TextToButtonsHeight = Modifier.preferredHeight(28.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 f50704f..2733cbc 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
@@ -69,7 +69,7 @@
modifier: Modifier = Modifier.None,
enabled: Boolean = true,
elevation: Dp = 2.dp,
- shape: Shape = MaterialTheme.shapes.button,
+ shape: Shape = MaterialTheme.shapes.small,
border: Border? = null,
backgroundColor: Color = MaterialTheme.colors.primary,
contentColor: Color = contentColorFor(backgroundColor),
@@ -147,7 +147,7 @@
modifier: Modifier = Modifier.None,
enabled: Boolean = true,
elevation: Dp = 0.dp,
- shape: Shape = MaterialTheme.shapes.button,
+ shape: Shape = MaterialTheme.shapes.small,
border: Border? = Border(
1.dp, MaterialTheme.colors.onSurface.copy(alpha = OutlinedStrokeOpacity)
),
@@ -203,7 +203,7 @@
modifier: Modifier = Modifier.None,
enabled: Boolean = true,
elevation: Dp = 0.dp,
- shape: Shape = MaterialTheme.shapes.button,
+ shape: Shape = MaterialTheme.shapes.small,
border: Border? = null,
backgroundColor: Color = Color.Transparent,
contentColor: Color = MaterialTheme.colors.primary,
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Card.kt b/ui/ui-material/src/main/java/androidx/ui/material/Card.kt
index 3f0eb38..ca72384 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Card.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Card.kt
@@ -43,7 +43,7 @@
@Composable
fun Card(
modifier: Modifier = Modifier.None,
- shape: Shape = MaterialTheme.shapes.card,
+ shape: Shape = MaterialTheme.shapes.medium,
color: Color = MaterialTheme.colors.surface,
contentColor: Color = contentColorFor(color),
border: Border? = null,
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 7e2ec1c..cec474e 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
@@ -27,7 +27,7 @@
import androidx.ui.foundation.Clickable
import androidx.ui.foundation.ContentGravity
import androidx.ui.foundation.ProvideTextStyle
-import androidx.ui.foundation.shape.corner.CircleShape
+import androidx.ui.foundation.shape.corner.CornerSize
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shape
import androidx.ui.layout.Row
@@ -36,6 +36,7 @@
import androidx.ui.layout.preferredSizeIn
import androidx.ui.layout.preferredWidth
import androidx.ui.material.ripple.ripple
+import androidx.ui.semantics.Semantics
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
@@ -65,26 +66,30 @@
fun FloatingActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier.None,
- shape: Shape = CircleShape,
+ shape: Shape = MaterialTheme.shapes.small.copy(CornerSize(percent = 50)),
backgroundColor: Color = MaterialTheme.colors.primary,
contentColor: Color = contentColorFor(backgroundColor),
elevation: Dp = 6.dp,
children: @Composable() () -> Unit
) {
- Surface(
- modifier = modifier,
- shape = shape,
- color = backgroundColor,
- contentColor = contentColor,
- elevation = elevation
- ) {
- Clickable(onClick, modifier = Modifier.ripple()) {
- ProvideTextStyle(MaterialTheme.typography.button) {
- Box(
- modifier = MinimumFabSizeModifier,
- gravity = ContentGravity.Center,
- children = children
- )
+ // Since we're adding layouts in between the clickable layer and the content, we need to
+ // merge all descendants, or we'll get multiple nodes
+ Semantics(container = true, mergeAllDescendants = true) {
+ Surface(
+ modifier = modifier,
+ shape = shape,
+ color = backgroundColor,
+ contentColor = contentColor,
+ elevation = elevation
+ ) {
+ Clickable(onClick, modifier = Modifier.ripple()) {
+ ProvideTextStyle(MaterialTheme.typography.button) {
+ Box(
+ modifier = MinimumFabSizeModifier,
+ gravity = ContentGravity.Center,
+ children = children
+ )
+ }
}
}
}
@@ -117,7 +122,7 @@
onClick: () -> Unit,
modifier: Modifier = Modifier.None,
icon: @Composable() (() -> Unit)? = null,
- shape: Shape = CircleShape,
+ shape: Shape = MaterialTheme.shapes.small.copy(CornerSize(percent = 50)),
backgroundColor: Color = MaterialTheme.colors.primary,
contentColor: Color = contentColorFor(backgroundColor),
elevation: Dp = 6.dp
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 69259f7..7719ff5 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
@@ -38,15 +38,20 @@
*
* @param colors A complete definition of the Material Color theme for this hierarchy
* @param typography A set of text styles to be used as this hierarchy's typography system
+ * @param shapes A set of shapes to be used by the components in this hierarchy
*/
@Composable
fun MaterialTheme(
colors: ColorPalette = lightColorPalette(),
typography: Typography = Typography(),
+ shapes: Shapes = MaterialTheme.shapes,
children: @Composable() () -> Unit
) {
ProvideColorPalette(colors) {
- Providers(TypographyAmbient provides typography) {
+ Providers(
+ TypographyAmbient provides typography,
+ ShapesAmbient provides shapes
+ ) {
ProvideTextStyle(value = typography.body1, children = children)
}
}
@@ -80,7 +85,7 @@
*/
@Composable
val shapes: Shapes
- get() = ShapeAmbient.current
+ get() = ShapesAmbient.current
/**
* Retrieves the current [EmphasisLevels] at the call site's position in the hierarchy.
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Shape.kt b/ui/ui-material/src/main/java/androidx/ui/material/Shape.kt
deleted file mode 100644
index d5b9383..0000000
--- a/ui/ui-material/src/main/java/androidx/ui/material/Shape.kt
+++ /dev/null
@@ -1,45 +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.material
-
-import androidx.compose.staticAmbientOf
-import androidx.ui.foundation.shape.RectangleShape
-import androidx.ui.foundation.shape.corner.RoundedCornerShape
-import androidx.ui.graphics.Shape
-import androidx.ui.unit.dp
-
-/**
- * Data class holding current shapes for common surfaces like Button or Card.
- */
-// TODO(Andrey): should have small, medium, large components categories. b/129278276
-// See https://material.io/design/shape/applying-shape-to-ui.html#baseline-shape-values
-data class Shapes(
- /**
- * Shape used for [Button]
- */
- val button: Shape = RoundedCornerShape(4.dp),
- /**
- * Shape used for [androidx.ui.material.surface.Card]
- */
- val card: Shape = RectangleShape
- // TODO(Andrey): Add shapes for other surfaces? will see what we need.
-)
-
-/**
- * Ambient used to specify the default shapes for the surfaces.
- */
-internal val ShapeAmbient = staticAmbientOf { Shapes() }
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Shapes.kt b/ui/ui-material/src/main/java/androidx/ui/material/Shapes.kt
new file mode 100644
index 0000000..82b25db
--- /dev/null
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Shapes.kt
@@ -0,0 +1,55 @@
+/*
+ * 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.material
+
+import androidx.compose.staticAmbientOf
+import androidx.ui.foundation.shape.corner.CornerBasedShape
+import androidx.ui.foundation.shape.corner.RoundedCornerShape
+import androidx.ui.unit.dp
+
+/**
+ * Components are grouped into shape categories based on their size. These categories provide a
+ * way to change multiple component values at once, by changing the category’s values.
+ * Shape categories include:
+ * - Small components
+ * - Medium components
+ * - Large components
+ *
+ * See [Material shape specification](https://material.io/design/shape/applying-shape-to-ui
+ * .html#)
+ */
+data class Shapes(
+ /**
+ * Shape used by small components like [Button] or [Snackbar]. Components like
+ * [FloatingActionButton], [ExtendedFloatingActionButton] use this shape, but override
+ * the corner size to be 50%.
+ */
+ val small: CornerBasedShape = RoundedCornerShape(4.dp),
+ /**
+ * Shape used by medium components like [Card] or [AlertDialog].
+ */
+ val medium: CornerBasedShape = RoundedCornerShape(4.dp),
+ /**
+ * Shape used by large components.
+ */
+ val large: CornerBasedShape = RoundedCornerShape(0.dp)
+)
+
+/**
+ * Ambient used to specify the default shapes for the surfaces.
+ */
+internal val ShapesAmbient = staticAmbientOf { Shapes() }
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt b/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt
index 3cbf972..8af083d 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Snackbar.kt
@@ -24,14 +24,15 @@
import androidx.ui.core.tag
import androidx.ui.foundation.Box
import androidx.ui.foundation.ProvideTextStyle
-import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
+import androidx.ui.graphics.Shape
import androidx.ui.graphics.compositeOver
import androidx.ui.layout.AlignmentLineOffset
import androidx.ui.layout.Column
import androidx.ui.layout.ColumnAlign
import androidx.ui.layout.fillMaxWidth
import androidx.ui.layout.padding
+import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -57,13 +58,18 @@
* @param modifier modifiers for the the Snackbar layout
* @param actionOnNewLine whether or not action should be put on the separate line. Recommended
* for action with long action text
+ * @param shape Defines the Snackbar's shape as well as its shadow
+ * @param elevation The z-coordinate at which to place the SnackBar. This controls the size
+ * of the shadow below the SnackBar
*/
@Composable
fun Snackbar(
text: @Composable() () -> Unit,
action: @Composable() (() -> Unit)? = null,
modifier: Modifier = Modifier.None,
- actionOnNewLine: Boolean = false
+ actionOnNewLine: Boolean = false,
+ shape: Shape = MaterialTheme.shapes.small,
+ elevation: Dp = 6.dp
) {
val colors = MaterialTheme.colors
// Snackbar has a background color of onSurface with an alpha applied blended on top of surface
@@ -71,8 +77,8 @@
val snackbarColor = snackbarOverlayColor.compositeOver(colors.surface)
Surface(
modifier = modifier,
- shape = SnackbarShape,
- elevation = SnackbarElevation,
+ shape = shape,
+ elevation = elevation,
color = snackbarColor,
contentColor = colors.surface
) {
@@ -214,8 +220,6 @@
}
private const val SnackbarOverlayAlpha = 0.8f
-private val SnackbarShape = RoundedCornerShape(4.dp)
-private val SnackbarElevation = 6.dp
private val MinHeightOneLine = 48.dp
private val MinHeightTwoLines = 68.dp