Move ui-platform and ui-framework into ui-core
Move contents of ui-platform and ui-framework into
ui-core and other projects. Remove ui-platform
and ui-framework.
Test: ui-core connectedCheck and test
Change-Id: I70067aff78fb3c091541b8c736bacc92bd021529
diff --git a/ui/ui-unit/api/0.1.0-dev10.txt b/ui/ui-unit/api/0.1.0-dev10.txt
index 2f30c03..316ae69 100644
--- a/ui/ui-unit/api/0.1.0-dev10.txt
+++ b/ui/ui-unit/api/0.1.0-dev10.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static int hashCode-impl(long p);
+ method public static String toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/0.1.0-dev11.txt b/ui/ui-unit/api/0.1.0-dev11.txt
index 4df20e4..30a4329 100644
--- a/ui/ui-unit/api/0.1.0-dev11.txt
+++ b/ui/ui-unit/api/0.1.0-dev11.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static inline boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static inline int hashCode-impl(long p);
+ method public static inline String! toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/api_lint.ignore b/ui/ui-unit/api/api_lint.ignore
index e183b70..78507f6 100644
--- a/ui/ui-unit/api/api_lint.ignore
+++ b/ui/ui-unit/api/api_lint.ignore
@@ -1,4 +1,16 @@
// Baseline format: 1.0
+AcronymName: androidx.ui.core.Constraints#copy-Q13GOEE(int, int, int, int):
+ Acronyms should not be capitalized in method names: was `copy-Q13GOEE`, should this be `copy-Q13Goee`?
+AcronymName: androidx.ui.core.Constraints2Kt#getHasFixedHeight-ybNdgAI(long):
+ Acronyms should not be capitalized in method names: was `getHasFixedHeight-ybNdgAI`, should this be `getHasFixedHeight-ybNdgAi`?
+AcronymName: androidx.ui.core.Constraints2Kt#getHasFixedWidth-ybNdgAI(long):
+ Acronyms should not be capitalized in method names: was `getHasFixedWidth-ybNdgAI`, should this be `getHasFixedWidth-ybNdgAi`?
+AcronymName: androidx.ui.core.Constraints2Kt#isZero-ybNdgAI(long):
+ Acronyms should not be capitalized in method names: was `isZero-ybNdgAI`, should this be `isZero-ybNdgAi`?
+AcronymName: androidx.ui.core.Constraints2Kt#offset-xOKVbDg(long, int, int):
+ Acronyms should not be capitalized in method names: was `offset-xOKVbDg`, should this be `offset-xOkVbDg`?
+AcronymName: androidx.ui.core.ConstraintsKt#offset-3L2DHGc(androidx.ui.core.Constraints, int, int):
+ Acronyms should not be capitalized in method names: was `offset-3L2DHGc`, should this be `offset-3L2DhGc`?
AcronymName: androidx.ui.unit.Density#toPx-kAYDl8w(long):
Acronyms should not be capitalized in method names: was `toPx-kAYDl8w`, should this be `toPx-kAyDl8w`?
AcronymName: androidx.ui.unit.DpKt#center-kAYDl8w(long):
@@ -45,3 +57,7 @@
MethodNameUnits: androidx.ui.unit.Durations#inSeconds(androidx.ui.unit.Duration):
Returned time values must be in milliseconds, was `inSeconds`
+
+
+MissingNullability: androidx.ui.core.Constraints2#toString-impl(long):
+ Missing nullability on method `toString-impl` return
diff --git a/ui/ui-unit/api/current.txt b/ui/ui-unit/api/current.txt
index 4df20e4..30a4329 100644
--- a/ui/ui-unit/api/current.txt
+++ b/ui/ui-unit/api/current.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static inline boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static inline int hashCode-impl(long p);
+ method public static inline String! toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev10.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev10.txt
index 2f30c03..316ae69 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev10.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev10.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static int hashCode-impl(long p);
+ method public static String toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev11.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev11.txt
index 4df20e4..30a4329 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev11.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev11.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static inline boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static inline int hashCode-impl(long p);
+ method public static inline String! toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/public_plus_experimental_current.txt b/ui/ui-unit/api/public_plus_experimental_current.txt
index 4df20e4..30a4329 100644
--- a/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static inline boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static inline int hashCode-impl(long p);
+ method public static inline String! toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev10.txt b/ui/ui-unit/api/restricted_0.1.0-dev10.txt
index 2f30c03..316ae69 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev10.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev10.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static int hashCode-impl(long p);
+ method public static String toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev11.txt b/ui/ui-unit/api/restricted_0.1.0-dev11.txt
index 4df20e4..30a4329 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev11.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev11.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static inline boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static inline int hashCode-impl(long p);
+ method public static inline String! toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/api/restricted_current.txt b/ui/ui-unit/api/restricted_current.txt
index 4df20e4..30a4329 100644
--- a/ui/ui-unit/api/restricted_current.txt
+++ b/ui/ui-unit/api/restricted_current.txt
@@ -1,4 +1,79 @@
// Signature format: 3.0
+package androidx.ui.core {
+
+ public final class Constraints {
+ method public int component1();
+ method public int component2();
+ method public int component3();
+ method public int component4();
+ method public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ method public int getMaxHeight();
+ method public int getMaxWidth();
+ method public int getMinHeight();
+ method public int getMinWidth();
+ field public static final androidx.ui.core.Constraints.Companion! Companion;
+ }
+
+ public static final class Constraints.Companion {
+ method public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
+ method public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
+ method public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
+ }
+
+ public final inline class Constraints2 {
+ ctor public Constraints2();
+ method public static long constructor-impl(internal long value);
+ method public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method public static inline boolean equals-impl(long p, Object? p1);
+ method public static boolean equals-impl0(long p1, long p2);
+ method public static boolean getHasBoundedHeight-impl(long $this);
+ method public static boolean getHasBoundedWidth-impl(long $this);
+ method public static int getMaxHeight-impl(long $this);
+ method public static int getMaxWidth-impl(long $this);
+ method public static int getMinHeight-impl(long $this);
+ method public static int getMinWidth-impl(long $this);
+ method public static inline int hashCode-impl(long p);
+ method public static inline String! toString-impl(long p);
+ field public static final androidx.ui.core.Constraints2.Companion! Companion;
+ field public static final int Infinity = -1073741824; // 0xc0000000
+ }
+
+ public static final class Constraints2.Companion {
+ method public long fixed(int width, int height);
+ method public long fixedHeight(int height);
+ method public long fixedWidth(int width);
+ }
+
+ public final class Constraints2Kt {
+ method public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
+ method public static long constrain-M1ogGms(long, long size);
+ method public static long enforce-uQjoOwo(long, long otherConstraints);
+ method public static boolean getHasFixedHeight-ybNdgAI(long);
+ method public static boolean getHasFixedWidth-ybNdgAI(long);
+ method public static boolean isZero-ybNdgAI(long);
+ method public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
+ method public static boolean satisfiedBy-M1ogGms(long, long size);
+ }
+
+ public final class ConstraintsKt {
+ method public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method public static androidx.ui.core.Constraints enforce(androidx.ui.core.Constraints, androidx.ui.core.Constraints otherConstraints);
+ method public static boolean getHasBoundedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasBoundedWidth(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedHeight(androidx.ui.core.Constraints);
+ method public static boolean getHasFixedWidth(androidx.ui.core.Constraints);
+ method public static boolean isZero(androidx.ui.core.Constraints);
+ method public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
+ method public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ }
+
+ public enum LayoutDirection {
+ enum_constant public static final androidx.ui.core.LayoutDirection Ltr;
+ enum_constant public static final androidx.ui.core.LayoutDirection Rtl;
+ }
+
+}
+
package androidx.ui.unit {
public final class Bounds {
diff --git a/ui/ui-unit/samples/build.gradle b/ui/ui-unit/samples/build.gradle
index 7730d39..5922905 100644
--- a/ui/ui-unit/samples/build.gradle
+++ b/ui/ui-unit/samples/build.gradle
@@ -34,7 +34,7 @@
implementation project(":compose:compose-runtime")
implementation project(":ui:ui-unit")
- implementation project(":ui:ui-framework")
+ implementation project(":ui:ui-core")
}
android {
diff --git a/ui/ui-unit/src/main/java/androidx/ui/core/Constraints.kt b/ui/ui-unit/src/main/java/androidx/ui/core/Constraints.kt
new file mode 100644
index 0000000..5eeb2da
--- /dev/null
+++ b/ui/ui-unit/src/main/java/androidx/ui/core/Constraints.kt
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+@file:Suppress("NOTHING_TO_INLINE")
+package androidx.ui.core
+
+import androidx.compose.Immutable
+import androidx.ui.unit.IntPx
+import androidx.ui.unit.IntPxSize
+import androidx.ui.unit.coerceAtLeast
+import androidx.ui.unit.coerceIn
+import androidx.ui.unit.ipx
+import androidx.ui.unit.isFinite
+
+/**
+ * Immutable constraints used for measuring child [Layout]s or [LayoutModifier]s. A parent layout
+ * can measure their children using the measure method on the corresponding [Measurable]s,
+ * method which takes the [Constraints] the child has to follow. A measured child is then
+ * responsible to choose for themselves and return a size which satisfies the set of [Constraints]
+ * received from their parent:
+ * - minWidth <= chosenWidth <= maxWidth
+ * - minHeight <= chosenHeight <= maxHeight
+ * The parent can then access the child chosen size on the resulting [Placeable]. The parent is
+ * responsible of defining a valid positioning of the children according to their sizes, so the
+ * parent needs to measure the children with appropriate [Constraints], such that whatever valid
+ * sizes children choose, they can be laid out in a way that also respects the parent's incoming
+ * [Constraints]. Note that different children can be measured with different [Constraints].
+ * A child is allowed to choose a size that does not satisfy its constraints. However, when this
+ * happens, the parent will not read from the [Placeable] the real size of the child, but rather
+ * one that was coerced in the child's constraints; therefore, a parent can assume that its
+ * children will always respect the constraints in their layout algorithm. When this does not
+ * happen in reality, the position assigned to the child will be automatically offset to be centered
+ * on the space assigned by the parent under the assumption that constraints were respected.
+ * A set of [Constraints] can have infinite maxWidth and/or maxHeight. This is a trick often
+ * used by parents to ask their children for their preferred size: unbounded constraints force
+ * children whose default behavior is to fill the available space (always size to
+ * maxWidth/maxHeight) to have an opinion about their preferred size. Most commonly, when measured
+ * with unbounded [Constraints], these children will fallback to size themselves to wrap their
+ * content, instead of expanding to fill the available space (this is not always true
+ * as it depends on the child layout model, but is a common behavior for core layout components).
+ *
+ * @param minWidth The minimum width of a layout satisfying the constraints.
+ * @param maxWidth The maximum width of a layout satisfying the constraints.
+ * @param minHeight The minimum height of a layout satisfying the constraints.
+ * @param maxHeight The maximum height of a layout satisfying the constraints.
+ */
+@Immutable
+data class Constraints(
+ val minWidth: IntPx = IntPx.Zero,
+ val maxWidth: IntPx = IntPx.Infinity,
+ val minHeight: IntPx = IntPx.Zero,
+ val maxHeight: IntPx = IntPx.Infinity
+) {
+ init {
+ // TODO(mount/popam): This verification is costly. Can we avoid it sometimes or at least on production?
+ require(minWidth.isFinite()) { "minWidth $minWidth should be finite" }
+ require(minHeight.isFinite()) { "minHeight $minHeight should be finite" }
+ require(minWidth <= maxWidth) {
+ "Constraints should be satisfiable, but minWidth($minWidth) > maxWidth($maxWidth)"
+ }
+ require(minHeight <= maxHeight) {
+ "Constraints should be satisfiable, but minHeight($minHeight) > maxHeight($maxHeight)"
+ }
+ require(minWidth >= IntPx.Zero) { "minWidth $minWidth should be non-negative" }
+ require(maxWidth >= IntPx.Zero) { "maxWidth $maxWidth should be non-negative" }
+ require(minHeight >= IntPx.Zero) { "minHeight $minHeight should be non-negative" }
+ require(maxHeight >= IntPx.Zero) { "maxHeight $maxHeight should be non-negative" }
+ }
+
+ companion object {
+ /**
+ * Creates constraints for fixed size in both dimensions.
+ */
+ fun fixed(width: IntPx, height: IntPx) = Constraints(width, width, height, height)
+
+ /**
+ * Creates constraints for fixed width and unspecified height.
+ */
+ fun fixedWidth(width: IntPx) = Constraints(
+ minWidth = width,
+ maxWidth = width,
+ minHeight = IntPx.Zero,
+ maxHeight = IntPx.Infinity
+ )
+
+ /**
+ * Creates constraints for fixed height and unspecified width.
+ */
+ fun fixedHeight(height: IntPx) = Constraints(
+ minWidth = IntPx.Zero,
+ maxWidth = IntPx.Infinity,
+ minHeight = height,
+ maxHeight = height
+ )
+ }
+}
+
+/**
+ * Whether or not the upper bound on the maximum height.
+ * @see hasBoundedWidth
+ */
+val Constraints.hasBoundedHeight get() = maxHeight.isFinite()
+
+/**
+ * Whether or not the upper bound on the maximum width.
+ * @see hasBoundedHeight
+ */
+val Constraints.hasBoundedWidth get() = maxWidth.isFinite()
+
+/**
+ * Whether there is exactly one width value that satisfies the constraints.
+ */
+val Constraints.hasFixedWidth get() = maxWidth == minWidth
+
+/**
+ * Whether there is exactly one height value that satisfies the constraints.
+ */
+val Constraints.hasFixedHeight get() = maxHeight == minHeight
+
+/**
+ * Whether the area of a component respecting these constraints will definitely be 0.
+ * This is true when at least one of maxWidth and maxHeight are 0.
+ */
+val Constraints.isZero get() = maxWidth == IntPx.Zero || maxHeight == IntPx.Zero
+
+/**
+ * Returns the result of coercing the current constraints in a different set of constraints.
+ */
+fun Constraints.enforce(otherConstraints: Constraints) = Constraints(
+ minWidth = minWidth.coerceIn(otherConstraints.minWidth, otherConstraints.maxWidth),
+ maxWidth = maxWidth.coerceIn(otherConstraints.minWidth, otherConstraints.maxWidth),
+ minHeight = minHeight.coerceIn(otherConstraints.minHeight, otherConstraints.maxHeight),
+ maxHeight = maxHeight.coerceIn(otherConstraints.minHeight, otherConstraints.maxHeight)
+)
+
+/**
+ * Takes a size and returns the closest size to it that satisfies the constraints.
+ */
+fun Constraints.constrain(size: IntPxSize) = IntPxSize(
+ size.width.coerceIn(minWidth, maxWidth),
+ size.height.coerceIn(minHeight, maxHeight)
+)
+
+/**
+ * Takes a size and returns whether it satisfies the current constraints.
+ */
+fun Constraints.satisfiedBy(size: IntPxSize) =
+ minWidth <= size.width && size.width <= maxWidth &&
+ minHeight <= size.height && size.height <= maxHeight
+
+/**
+ * Returns the Constraints obtained by offsetting the current instance with the given values.
+ */
+fun Constraints.offset(horizontal: IntPx = 0.ipx, vertical: IntPx = 0.ipx) = Constraints(
+ (minWidth + horizontal).coerceAtLeast(0.ipx),
+ (maxWidth + horizontal).coerceAtLeast(0.ipx),
+ (minHeight + vertical).coerceAtLeast(0.ipx),
+ (maxHeight + vertical).coerceAtLeast(0.ipx)
+)
diff --git a/ui/ui-unit/src/main/java/androidx/ui/core/Constraints2.kt b/ui/ui-unit/src/main/java/androidx/ui/core/Constraints2.kt
new file mode 100644
index 0000000..4e22058
--- /dev/null
+++ b/ui/ui-unit/src/main/java/androidx/ui/core/Constraints2.kt
@@ -0,0 +1,460 @@
+/*
+ * 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.
+ */
+@file:Suppress("NOTHING_TO_INLINE")
+
+package androidx.ui.core
+
+import androidx.annotation.IntRange
+import androidx.compose.Immutable
+import androidx.ui.unit.IntSize
+import kotlin.math.max
+
+/**
+ * Immutable constraints used for measuring child Layouts or [LayoutModifier]s. A parent layout
+ * can measure their children using the measure method on the corresponding [Measurable]s,
+ * method which takes the [Constraints2] the child has to follow. A measured child is then
+ * responsible to choose for themselves and return a size which satisfies the set of [Constraints2]
+ * received from their parent:
+ * - minWidth <= chosenWidth <= maxWidth
+ * - minHeight <= chosenHeight <= maxHeight
+ * The parent can then access the child chosen size on the resulting [Placeable]. The parent is
+ * responsible of defining a valid positioning of the children according to their sizes, so the
+ * parent needs to measure the children with appropriate [Constraints2], such that whatever valid
+ * sizes children choose, they can be laid out in a way that also respects the parent's incoming
+ * [Constraints2]. Note that different children can be measured with different [Constraints2].
+ * A child is allowed to choose a size that does not satisfy its constraints. However, when this
+ * happens, the parent will not read from the [Placeable] the real size of the child, but rather
+ * one that was coerced in the child's constraints; therefore, a parent can assume that its
+ * children will always respect the constraints in their layout algorithm. When this does not
+ * happen in reality, the position assigned to the child will be automatically offset to be centered
+ * on the space assigned by the parent under the assumption that constraints were respected.
+ * A set of [Constraints2] can have infinite maxWidth and/or maxHeight. This is a trick often
+ * used by parents to ask their children for their preferred size: unbounded constraints force
+ * children whose default behavior is to fill the available space (always size to
+ * maxWidth/maxHeight) to have an opinion about their preferred size. Most commonly, when measured
+ * with unbounded [Constraints2], these children will fallback to size themselves to wrap their
+ * content, instead of expanding to fill the available space (this is not always true
+ * as it depends on the child layout model, but is a common behavior for core layout components).
+ *
+ * [Constraints2] uses a [Long] to represent four values, [minWidth], [minHeight], [maxWidth],
+ * and [maxHeight]. The range of the values varies to allow for at most 256K in one dimension.
+ * There are four possible maximum ranges, 13 bits/18 bits, and 15 bits/16 bits for either width
+ * or height, depending on the needs. For example, a width could range up to 18 bits
+ * and the height up to 13 bits. Alternatively, the width could range up to 16 bits and the height
+ * up to 15 bits. The height and width requirements can be reversed, with a height of up to 18 bits
+ * and width of 13 bits or height of 16 bits and width of 15 bits. Any constraints exceeding
+ * this range will fail.
+ */
+@Immutable
+inline class Constraints2(
+ @PublishedApi internal val value: Long
+) {
+ /**
+ * Indicates how the bits are assigned. One of:
+ * * MinFocusWidth
+ * * MaxFocusWidth
+ * * MinFocusHeight
+ * * MaxFocusHeight
+ */
+ private val focusIndex
+ get() = (value and FocusMask).toInt()
+
+ /**
+ * The minimum width that the measurement can take.
+ */
+ val minWidth: Int
+ @IntRange(from = 0)
+ get() {
+ val mask = WidthMask[focusIndex]
+ return ((value shr 2).toInt() and mask)
+ }
+
+ /**
+ * The maximum width that the measurement can take. This will either be
+ * a positive value greater than or equal to [minWidth] or [Constraints2.Infinity].
+ */
+ val maxWidth: Int
+ get() {
+ val mask = WidthMask[focusIndex]
+ val width = ((value shr 33).toInt() and mask)
+ return if (width == 0) Infinity else width - 1
+ }
+
+ /**
+ * The minimum height that the measurement can take.
+ */
+ val minHeight: Int
+ @IntRange(from = 0)
+ get() {
+ val focus = focusIndex
+ val mask = HeightMask[focus]
+ val offset = MinHeightOffsets[focus]
+ return (value shr offset).toInt() and mask
+ }
+
+ /**
+ * The maximum height that the measurement can take. This will either be
+ * a positive value greater than or equal to [minHeight] or [Constraints2.Infinity].
+ */
+ val maxHeight: Int
+ get() {
+ val focus = focusIndex
+ val mask = HeightMask[focus]
+ val offset = MinHeightOffsets[focus] + 31
+ val height = (value shr offset).toInt() and mask
+ return if (height == 0) Infinity else height - 1
+ }
+
+ /**
+ * Whether or not the upper bound on the maximum width.
+ * @see hasBoundedHeight
+ */
+ val hasBoundedWidth: Boolean
+ get() {
+ val mask = WidthMask[focusIndex]
+ return ((value shr 33).toInt() and mask) != 0
+ }
+
+ /**
+ * Whether or not the upper bound on the maximum height.
+ * @see hasBoundedWidth
+ */
+ val hasBoundedHeight: Boolean
+ get() {
+ val focus = focusIndex
+ val mask = HeightMask[focus]
+ val offset = MinHeightOffsets[focus] + 31
+ return ((value shr offset).toInt() and mask) != 0
+ }
+
+ /**
+ * Copies the existing [Constraints2], replacing some of [minWidth], [minHeight], [maxWidth],
+ * or [maxHeight] as desired. [minWidth] and [minHeight] must be positive and
+ * [maxWidth] and [maxHeight] must be greater than or equal to [minWidth] and [minHeight],
+ * respectively, or [Infinity].
+ */
+ fun copy(
+ minWidth: Int = this.minWidth,
+ maxWidth: Int = this.maxWidth,
+ minHeight: Int = this.minHeight,
+ maxHeight: Int = this.maxHeight
+ ): Constraints2 {
+ require(minHeight >= 0 && minWidth >= 0) {
+ "minHeight($minHeight) and minWidth($minWidth) must be >= 0"
+ }
+ require(maxWidth > minWidth || maxWidth == Infinity) {
+ "maxWidth($maxWidth) must be greater than minWidth($minWidth)"
+ }
+ require(maxHeight > minHeight || maxHeight == Infinity) {
+ "maxHeight($maxHeight) must be greater than minHeight($minHeight)"
+ }
+ return createConstraints(minWidth, maxWidth, minHeight, maxHeight)
+ }
+
+ companion object {
+ // Infinity is set to a negative value in the middle of the Int range so that
+ // errors can be more easily detected. Adding or subtracting from [Infinity] will
+ // not easily roll over into a valid constraint value.
+ /**
+ * A value that [maxWidth] or [maxHeight] will be set to when the constraint should
+ * be considered infinite. [hasBoundedHeight] or [hasBoundedWidth] will be
+ * `true` when [maxHeight] or [maxWidth] is [Infinity], respectively.
+ */
+ const val Infinity = Integer.MIN_VALUE / 2
+
+ /**
+ * The bit distribution when the focus of the bits should be on the width, but only
+ * a minimal difference in focus.
+ *
+ * 16 bits assigned to width, 15 bits assigned to height.
+ */
+ private const val MinFocusWidth = 0x00L
+
+ /**
+ * The bit distribution when the focus of the bits should be on the width, and a
+ * maximal number of bits assigned to the width.
+ *
+ * 18 bits assigned to width, 13 bits assigned to height.
+ */
+ private const val MaxFocusWidth = 0x01L
+
+ /**
+ * The bit distribution when the focus of the bits should be on the height, but only
+ * a minimal difference in focus.
+ *
+ * 15 bits assigned to width, 16 bits assigned to height.
+ */
+ private const val MinFocusHeight = 0x02L
+
+ /**
+ * The bit distribution when the focus of the bits should be on the height, and a
+ * a maximal number of bits assigned to the height.
+ *
+ * 13 bits assigned to width, 18 bits assigned to height.
+ */
+ private const val MaxFocusHeight = 0x03L
+
+ /**
+ * The mask to retrieve the focus ([MinFocusWidth], [MaxFocusWidth],
+ * [MinFocusHeight], [MaxFocusHeight]).
+ */
+ private const val FocusMask = 0x03L
+
+ /**
+ * The number of bits used for the focused dimension when there is minimal focus.
+ */
+ private const val MinFocusBits = 16
+
+ /**
+ * The mask to use for the focused dimension when there is minimal focus.
+ */
+ private const val MinFocusMask = 0xFFFF // 64K (16 bits)
+
+ /**
+ * The number of bits used for the non-focused dimension when there is minimal focus.
+ */
+ private const val MinNonFocusBits = 15
+
+ /**
+ * The mask to use for the non-focused dimension when there is minimal focus.
+ */
+ private const val MinNonFocusMask = 0x7FFF // 32K (15 bits)
+
+ /**
+ * The number of bits to use for the focused dimension when there is maximal focus.
+ */
+ private const val MaxFocusBits = 18
+
+ /**
+ * The mask to use for the focused dimension when there is maximal focus.
+ */
+ private const val MaxFocusMask = 0x3FFFF // 256K (18 bits)
+
+ /**
+ * The number of bits to use for the non-focused dimension when there is maximal focus.
+ */
+ private const val MaxNonFocusBits = 13
+
+ /**
+ * The mask to use for the non-focused dimension when there is maximal focus.
+ */
+ private const val MaxNonFocusMask = 0x1FFF // 8K (13 bits)
+
+ /**
+ * Minimum Height shift offsets into Long value, indexed by FocusMask
+ * Max offsets are these + 31
+ * Width offsets are always either 2 (min) or 33 (max)
+ */
+ private val MinHeightOffsets = intArrayOf(
+ 18, // MinFocusWidth: 2 + 16
+ 20, // MaxFocusWidth: 2 + 18
+ 17, // MinFocusHeight: 2 + 15
+ 15 // MaxFocusHeight: 2 + 13
+ )
+
+ /**
+ * The mask to use for both minimum and maximum width.
+ */
+ private val WidthMask = intArrayOf(
+ MinFocusMask, // MinFocusWidth (16 bits)
+ MaxFocusMask, // MaxFocusWidth (18 bits)
+ MinNonFocusMask, // MinFocusHeight (15 bits)
+ MaxNonFocusMask // MaxFocusHeight (13 bits)
+ )
+
+ /**
+ * The mask to use for both minimum and maximum height.
+ */
+ private val HeightMask = intArrayOf(
+ MinNonFocusMask, // MinFocusWidth (15 bits)
+ MaxNonFocusMask, // MaxFocusWidth (13 bits)
+ MinFocusMask, // MinFocusHeight (16 bits)
+ MaxFocusMask // MaxFocusHeight (18 bits)
+ )
+
+ /**
+ * Creates constraints for fixed size in both dimensions.
+ */
+ fun fixed(width: Int, height: Int): Constraints2 {
+ require(width >= 0 && height >= 0) {
+ "width($width) and height($height) must be >= 0"
+ }
+ return createConstraints(width, width, height, height)
+ }
+
+ /**
+ * Creates constraints for fixed width and unspecified height.
+ */
+ fun fixedWidth(width: Int): Constraints2 {
+ require(width >= 0) {
+ "width($width) must be >= 0"
+ }
+ return createConstraints(
+ minWidth = width,
+ maxWidth = width,
+ minHeight = 0,
+ maxHeight = Infinity
+ )
+ }
+
+ /**
+ * Creates constraints for fixed height and unspecified width.
+ */
+ fun fixedHeight(height: Int): Constraints2 {
+ require(height >= 0) {
+ "height($height) must be >= 0"
+ }
+ return createConstraints(
+ minWidth = 0,
+ maxWidth = Infinity,
+ minHeight = height,
+ maxHeight = height
+ )
+ }
+
+ /**
+ * Creates a [Constraints2], only checking that the values fit in the packed Long.
+ */
+ internal fun createConstraints(
+ minWidth: Int,
+ maxWidth: Int,
+ minHeight: Int,
+ maxHeight: Int
+ ): Constraints2 {
+ val heightVal = max(minHeight, maxHeight) // maxHeight can be Infinity
+ val heightBits = bitsNeedForSize(heightVal)
+
+ val widthVal = max(minWidth, maxWidth) // maxWidth can be Infinity
+ val widthBits = bitsNeedForSize(widthVal)
+
+ if (widthBits + heightBits > 31) {
+ throw IllegalArgumentException(
+ "Can't represent a width of $widthVal and height " +
+ "of $heightVal in Constraints"
+ )
+ }
+
+ val focus = when (widthBits) {
+ MinNonFocusBits -> MinFocusHeight
+ MinFocusBits -> MinFocusWidth
+ MaxNonFocusBits -> MaxFocusHeight
+ MaxFocusBits -> MaxFocusWidth
+ else -> throw IllegalStateException("Should only have the provided constants.")
+ }
+
+ val maxWidthValue = if (maxWidth == Infinity) 0 else maxWidth + 1
+ val maxHeightValue = if (maxHeight == Infinity) 0 else maxHeight + 1
+
+ val minHeightOffset = MinHeightOffsets[focus.toInt()]
+ val maxHeightOffset = minHeightOffset + 31
+
+ val value = focus or
+ (minWidth.toLong() shl 2) or
+ (maxWidthValue.toLong() shl 33) or
+ (minHeight.toLong() shl minHeightOffset) or
+ (maxHeightValue.toLong() shl maxHeightOffset)
+ return Constraints2(value)
+ }
+
+ private fun bitsNeedForSize(size: Int): Int {
+ return when {
+ size < MaxNonFocusMask -> MaxNonFocusBits
+ size < MinNonFocusMask -> MinNonFocusBits
+ size < MinFocusMask -> MinFocusBits
+ size < MaxFocusMask -> MaxFocusBits
+ else -> throw IllegalArgumentException(
+ "Can't represent a size of $size in " +
+ "Constraints"
+ )
+ }
+ }
+ }
+}
+
+/**
+ * Create a [Constraints2]. [minWidth] and [minHeight] must be positive and
+ * [maxWidth] and [maxHeight] must be greater than or equal to [minWidth] and [minHeight],
+ * respectively, or [Infinity][Constraints2.Infinity].
+ */
+fun Constraints2(
+ @IntRange(from = 0)
+ minWidth: Int = 0,
+ maxWidth: Int = Constraints2.Infinity,
+ @IntRange(from = 0)
+ minHeight: Int = 0,
+ maxHeight: Int = Constraints2.Infinity
+): Constraints2 {
+ require(maxWidth >= minWidth || maxWidth == Constraints2.Infinity) {
+ "maxWidth($maxWidth) must be >= than minWidth($minWidth)"
+ }
+ require(maxHeight >= minHeight || maxHeight == Constraints2.Infinity) {
+ "maxHeight($maxHeight) must be >= than minHeight($minHeight)"
+ }
+ require(minWidth >= 0 && minHeight >= 0) {
+ "minWidth($minWidth) and minHeight($minHeight) must be >= 0"
+ }
+ return Constraints2.createConstraints(minWidth, maxWidth, minHeight, maxHeight)
+}
+
+/**
+ * Whether there is exactly one width value that satisfies the constraints.
+ */
+val Constraints2.hasFixedWidth get() = maxWidth == minWidth
+
+/**
+ * Whether there is exactly one height value that satisfies the constraints.
+ */
+val Constraints2.hasFixedHeight get() = maxHeight == minHeight
+
+/**
+ * Whether the area of a component respecting these constraints will definitely be 0.
+ * This is true when at least one of maxWidth and maxHeight are 0.
+ */
+val Constraints2.isZero get() = maxWidth == 0 || maxHeight == 0
+
+/**
+ * Returns the result of coercing the current constraints in a different set of constraints.
+ */
+fun Constraints2.enforce(otherConstraints: Constraints2) = Constraints2(
+ minWidth = minWidth.coerceIn(otherConstraints.minWidth, otherConstraints.maxWidth),
+ maxWidth = maxWidth.coerceIn(otherConstraints.minWidth, otherConstraints.maxWidth),
+ minHeight = minHeight.coerceIn(otherConstraints.minHeight, otherConstraints.maxHeight),
+ maxHeight = maxHeight.coerceIn(otherConstraints.minHeight, otherConstraints.maxHeight)
+)
+
+/**
+ * Takes a size and returns the closest size to it that satisfies the constraints.
+ */
+fun Constraints2.constrain(size: IntSize) = IntSize(
+ width = size.width.coerceIn(minWidth, maxWidth),
+ height = size.height.coerceIn(minHeight, maxHeight)
+)
+
+/**
+ * Takes a size and returns whether it satisfies the current constraints.
+ */
+fun Constraints2.satisfiedBy(size: IntSize) =
+ size.width in minWidth..maxWidth && size.height in minHeight..maxHeight
+
+/**
+ * Returns the Constraints obtained by offsetting the current instance with the given values.
+ */
+fun Constraints2.offset(horizontal: Int = 0, vertical: Int = 0) = Constraints2(
+ (minWidth + horizontal).coerceAtLeast(0),
+ (maxWidth + horizontal).coerceAtLeast(0),
+ (minHeight + vertical).coerceAtLeast(0),
+ (maxHeight + vertical).coerceAtLeast(0)
+)
diff --git a/ui/ui-unit/src/main/java/androidx/ui/core/LayoutDirection.kt b/ui/ui-unit/src/main/java/androidx/ui/core/LayoutDirection.kt
new file mode 100644
index 0000000..f3adee4
--- /dev/null
+++ b/ui/ui-unit/src/main/java/androidx/ui/core/LayoutDirection.kt
@@ -0,0 +1,34 @@
+/*
+ * 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.core
+
+/**
+ * A class for defining layout directions.
+ *
+ * A layout direction can be left-to-right (LTR) or right-to-left (RTL).
+ */
+enum class LayoutDirection {
+ /**
+ * Horizontal layout direction is from Left to Right.
+ */
+ Ltr,
+
+ /**
+ * Horizontal layout direction is from Right to Left.
+ */
+ Rtl
+}
\ No newline at end of file
diff --git a/ui/ui-unit/src/main/java/androidx/ui/unit/IntSize.kt b/ui/ui-unit/src/main/java/androidx/ui/unit/IntSize.kt
index 255672b5d..2076ac6 100644
--- a/ui/ui-unit/src/main/java/androidx/ui/unit/IntSize.kt
+++ b/ui/ui-unit/src/main/java/androidx/ui/unit/IntSize.kt
@@ -43,6 +43,7 @@
/**
* Returns an IntSize scaled by multiplying [width] and [height] by [other]
*/
+
operator fun times(other: Int): IntSize =
IntSize(width = width * other, height = height * other)
diff --git a/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt b/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt
index 9f3a814..36c4444 100644
--- a/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt
+++ b/ui/ui-unit/src/main/java/androidx/ui/unit/Px.kt
@@ -430,7 +430,6 @@
/**
* A two dimensional size using [Px] for units
*/
-@OptIn(ExperimentalUnsignedTypes::class)
@Immutable
data class PxSize @PublishedApi internal constructor(@PublishedApi internal val value: Long) {
@@ -498,7 +497,6 @@
/**
* Constructs a [PxSize] from width and height [Px] values.
*/
-@OptIn(ExperimentalUnsignedTypes::class)
inline fun PxSize(width: Px, height: Px): PxSize = PxSize(packFloats(width.value, height.value))
/**
@@ -532,7 +530,6 @@
/**
* A two-dimensional position using [Px] for units
*/
-@OptIn(ExperimentalUnsignedTypes::class)
@Immutable
data class PxPosition @PublishedApi internal constructor(@PublishedApi internal val value: Long) {
/**
@@ -586,7 +583,6 @@
/**
* Constructs a [PxPosition] from [x] and [y] position [Px] values.
*/
-@OptIn(ExperimentalUnsignedTypes::class)
inline fun PxPosition(x: Px, y: Px): PxPosition = PxPosition(packFloats(x.value, y.value))
/**