Remove IntPx
Relnote: "Replaced usage of IntPx with Int. Replaced IntPxPosition
with IntOffset. Replaced IntPxSize with IntSize."
Test: ran many tests and demo app.
Bug: 148980115
Change-Id: Ib7b44d92ce3aff86c606753f0ac5c3122b71041d
diff --git a/ui/ui-unit/api/0.1.0-dev14.txt b/ui/ui-unit/api/0.1.0-dev14.txt
index f020b68..c91e1d5f 100644
--- a/ui/ui-unit/api/0.1.0-dev14.txt
+++ b/ui/ui-unit/api/0.1.0-dev14.txt
@@ -2,69 +2,42 @@
package androidx.ui.core {
@androidx.compose.Immutable public final class Constraints {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ ctor public Constraints(internal long value);
+ method public androidx.ui.core.Constraints copy(int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method @androidx.compose.Immutable public androidx.ui.core.Constraints copy(long value);
+ method public boolean getHasBoundedHeight();
+ method public boolean getHasBoundedWidth();
method public int getMaxHeight();
method public int getMaxWidth();
method public int getMinHeight();
method public int getMinWidth();
+ property public final boolean hasBoundedHeight;
+ property public final boolean hasBoundedWidth;
+ property public final int maxHeight;
+ property public final int maxWidth;
+ property public final int minHeight;
+ property public final int minWidth;
field public static final androidx.ui.core.Constraints.Companion! Companion;
+ field public static final int Infinity = 2147483647; // 0x7fffffff
}
public static final class Constraints.Companion {
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
- }
-
- @androidx.compose.Immutable public final inline class Constraints2 {
- ctor public Constraints2();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
- method @androidx.compose.Immutable 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 @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Immutable public static inline String! toString-impl(long p);
- field public static final androidx.ui.core.Constraints2.Companion! Companion;
- field @androidx.compose.Stable public static final int Infinity = -1073741824; // 0xc0000000
- }
-
- public static final class Constraints2.Companion {
- method @androidx.compose.Stable public long fixed(int width, int height);
- method @androidx.compose.Stable public long fixedHeight(int height);
- method @androidx.compose.Stable public long fixedWidth(int width);
- }
-
- public final class Constraints2Kt {
- method @androidx.compose.Stable public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
- method @androidx.compose.Stable public static long constrain-M1ogGms(long, long size);
- method @androidx.compose.Stable 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 @androidx.compose.Stable public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
- method @androidx.compose.Stable public static boolean satisfiedBy-M1ogGms(long, long size);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixed(int width, int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight(int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth(int width);
}
public final class ConstraintsKt {
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints Constraints(int minWidth = 0, int maxWidth = 2147483647, int minHeight = 0, int maxHeight = 2147483647);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static int constrainHeight(androidx.ui.core.Constraints, int height);
+ method @androidx.compose.Stable public static int constrainWidth(androidx.ui.core.Constraints, int width);
method @androidx.compose.Stable 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 @androidx.compose.Stable public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
- method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints offset(androidx.ui.core.Constraints, int horizontal = 0, int vertical = 0);
+ method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
}
public enum LayoutDirection {
@@ -95,18 +68,16 @@
@androidx.compose.Immutable public interface Density {
method public float getDensity();
method public float getFontScale();
- method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp(int);
- method @androidx.compose.Stable public default float toDp-gshw56o(int);
+ method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp-vVlMl6k(long);
method @androidx.compose.Stable public default int toIntPx-ipo6vVg(float);
method @androidx.compose.Stable public default int toIntPx-vVlMl6k(long);
method @androidx.compose.Stable public default float toPx-ipo6vVg(float);
method @androidx.compose.Stable public default float toPx-vVlMl6k(long);
method @androidx.compose.Stable public default androidx.ui.geometry.Rect toRect(androidx.ui.unit.Bounds);
- method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp(int);
- method @androidx.compose.Stable public default long toSp-gshw56o(int);
+ method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp-ipo6vVg(float);
property public abstract float density;
property public abstract float fontScale;
@@ -286,126 +257,58 @@
field public static final long SecondsPerMinute = 60L; // 0x3cL
}
- @androidx.compose.Immutable public final inline class IntPx implements java.lang.Comparable<androidx.ui.unit.IntPx> {
- ctor public IntPx();
- method @androidx.compose.Stable public operator int compareTo-gshw56o(int p);
- method @androidx.compose.Stable public static operator int compareTo-gshw56o(int $this, int other);
- method public static int constructor-impl(int value);
- method @androidx.compose.Stable public static operator int div-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(int p, Object? p1);
- method public static boolean equals-impl0(int p1, int p2);
- method public int getValue();
- method @androidx.compose.Immutable public static inline int hashCode-impl(int p);
- method @androidx.compose.Stable public static operator int minus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static operator int plus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static inline operator int rem-impl(int $this, int other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, int other);
- method @androidx.compose.Stable public static String toString-impl(int $this);
- method @androidx.compose.Stable public static operator int unaryMinus-impl(int $this);
- field public static final androidx.ui.unit.IntPx.Companion! Companion;
+ @androidx.compose.Immutable public final class IntOffset {
+ ctor public IntOffset(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method public int getX();
+ method public int getY();
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset minus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset plus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset unaryMinus();
+ property public final int x;
+ property public final int y;
+ field public static final androidx.ui.unit.IntOffset.Companion! Companion;
}
- public static final class IntPx.Companion {
- method public int getInfinity();
- method public int getZero();
- property public final int Infinity;
- property public final int Zero;
+ public static final class IntOffset.Companion {
+ method public androidx.ui.unit.IntOffset getOrigin();
+ property public final androidx.ui.unit.IntOffset Origin;
}
- @androidx.compose.Immutable public final class IntPxBounds {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxBounds copy-Q13GOEE(int left, int top, int right, int bottom);
- method public int getBottom();
- method public int getLeft();
- method public int getRight();
- method public int getTop();
+ public final class IntOffsetKt {
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset IntOffset(int x, int y);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntOffset lerp(androidx.ui.unit.IntOffset start, androidx.ui.unit.IntOffset stop, float fraction);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntOffset);
}
- public final class IntPxKt {
- method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size Size-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline int coerceAtLeast-rRMsBxU(int, int minimumValue);
- method @androidx.compose.Stable public static inline int coerceAtMost-rRMsBxU(int, int maximumValue);
- method @androidx.compose.Stable public static inline int coerceIn-qx1LT1w(int, int minimumValue, int maximumValue);
- method public static inline int getHeight(androidx.ui.unit.IntPxBounds);
- method public static inline int getIpx(int);
- method public static inline int getWidth(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline boolean isFinite-gshw56o(int);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition lerp(androidx.ui.unit.IntPxPosition start, androidx.ui.unit.IntPxPosition stop, float fraction);
- method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
- method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
- method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
- method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
- method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size toSize(androidx.ui.unit.IntPxSize);
+ @androidx.compose.Immutable public final class IntSize {
+ ctor public IntSize(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize div(int other);
+ method public int getHeight();
+ method public int getWidth();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize times(int other);
+ property public final int height;
+ property public final int width;
+ field public static final androidx.ui.unit.IntSize.Companion! Companion;
}
- @androidx.compose.Immutable public final class IntPxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxPosition copy(long value);
- method public inline int getX();
- method public inline int getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition unaryMinus();
- property public final inline int x;
- property public final inline int y;
- field public static final androidx.ui.unit.IntPxPosition.Companion! Companion;
- }
-
- public static final class IntPxPosition.Companion {
- method public androidx.ui.unit.IntPxPosition getOrigin();
- property public final androidx.ui.unit.IntPxPosition Origin;
- }
-
- @androidx.compose.Immutable public final class IntPxSize {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxSize copy(long value);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize div(int other);
- method public inline int getHeight();
- method public inline int getWidth();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize times(int other);
- property public final inline int height;
- property public final inline int width;
- field public static final androidx.ui.unit.IntPxSize.Companion! Companion;
- }
-
- public static final class IntPxSize.Companion {
- method public androidx.ui.unit.IntPxSize getZero();
- property public final androidx.ui.unit.IntPxSize Zero;
- }
-
- @androidx.compose.Immutable public final inline class IntSize {
- ctor public IntSize();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static operator long div-impl(long $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static int getHeight-impl(long $this);
- method public static int getWidth-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long times-impl(long $this, int other);
- method @androidx.compose.Stable public static String toString-impl(long $this);
+ public static final class IntSize.Companion {
+ method public androidx.ui.unit.IntSize getZero();
+ property public final androidx.ui.unit.IntSize Zero;
}
public final class IntSizeKt {
- method @androidx.compose.Stable public static long IntSize(int width, int height);
- method @androidx.compose.Stable public static operator long times-twsQOwo(int, long size);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize IntSize(int width, int height);
+ method public static androidx.ui.unit.IntOffset getCenter(androidx.ui.unit.IntSize);
+ method @androidx.compose.Stable public static operator androidx.ui.unit.IntSize times(int, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.IntSize);
}
@androidx.compose.Immutable public final inline class Position {
@@ -474,10 +377,9 @@
method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.PxBounds);
}
diff --git a/ui/ui-unit/api/current.txt b/ui/ui-unit/api/current.txt
index f020b68..c91e1d5f 100644
--- a/ui/ui-unit/api/current.txt
+++ b/ui/ui-unit/api/current.txt
@@ -2,69 +2,42 @@
package androidx.ui.core {
@androidx.compose.Immutable public final class Constraints {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ ctor public Constraints(internal long value);
+ method public androidx.ui.core.Constraints copy(int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method @androidx.compose.Immutable public androidx.ui.core.Constraints copy(long value);
+ method public boolean getHasBoundedHeight();
+ method public boolean getHasBoundedWidth();
method public int getMaxHeight();
method public int getMaxWidth();
method public int getMinHeight();
method public int getMinWidth();
+ property public final boolean hasBoundedHeight;
+ property public final boolean hasBoundedWidth;
+ property public final int maxHeight;
+ property public final int maxWidth;
+ property public final int minHeight;
+ property public final int minWidth;
field public static final androidx.ui.core.Constraints.Companion! Companion;
+ field public static final int Infinity = 2147483647; // 0x7fffffff
}
public static final class Constraints.Companion {
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
- }
-
- @androidx.compose.Immutable public final inline class Constraints2 {
- ctor public Constraints2();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
- method @androidx.compose.Immutable 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 @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Immutable public static inline String! toString-impl(long p);
- field public static final androidx.ui.core.Constraints2.Companion! Companion;
- field @androidx.compose.Stable public static final int Infinity = -1073741824; // 0xc0000000
- }
-
- public static final class Constraints2.Companion {
- method @androidx.compose.Stable public long fixed(int width, int height);
- method @androidx.compose.Stable public long fixedHeight(int height);
- method @androidx.compose.Stable public long fixedWidth(int width);
- }
-
- public final class Constraints2Kt {
- method @androidx.compose.Stable public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
- method @androidx.compose.Stable public static long constrain-M1ogGms(long, long size);
- method @androidx.compose.Stable 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 @androidx.compose.Stable public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
- method @androidx.compose.Stable public static boolean satisfiedBy-M1ogGms(long, long size);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixed(int width, int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight(int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth(int width);
}
public final class ConstraintsKt {
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints Constraints(int minWidth = 0, int maxWidth = 2147483647, int minHeight = 0, int maxHeight = 2147483647);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static int constrainHeight(androidx.ui.core.Constraints, int height);
+ method @androidx.compose.Stable public static int constrainWidth(androidx.ui.core.Constraints, int width);
method @androidx.compose.Stable 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 @androidx.compose.Stable public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
- method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints offset(androidx.ui.core.Constraints, int horizontal = 0, int vertical = 0);
+ method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
}
public enum LayoutDirection {
@@ -95,18 +68,16 @@
@androidx.compose.Immutable public interface Density {
method public float getDensity();
method public float getFontScale();
- method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp(int);
- method @androidx.compose.Stable public default float toDp-gshw56o(int);
+ method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp-vVlMl6k(long);
method @androidx.compose.Stable public default int toIntPx-ipo6vVg(float);
method @androidx.compose.Stable public default int toIntPx-vVlMl6k(long);
method @androidx.compose.Stable public default float toPx-ipo6vVg(float);
method @androidx.compose.Stable public default float toPx-vVlMl6k(long);
method @androidx.compose.Stable public default androidx.ui.geometry.Rect toRect(androidx.ui.unit.Bounds);
- method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp(int);
- method @androidx.compose.Stable public default long toSp-gshw56o(int);
+ method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp-ipo6vVg(float);
property public abstract float density;
property public abstract float fontScale;
@@ -286,126 +257,58 @@
field public static final long SecondsPerMinute = 60L; // 0x3cL
}
- @androidx.compose.Immutable public final inline class IntPx implements java.lang.Comparable<androidx.ui.unit.IntPx> {
- ctor public IntPx();
- method @androidx.compose.Stable public operator int compareTo-gshw56o(int p);
- method @androidx.compose.Stable public static operator int compareTo-gshw56o(int $this, int other);
- method public static int constructor-impl(int value);
- method @androidx.compose.Stable public static operator int div-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(int p, Object? p1);
- method public static boolean equals-impl0(int p1, int p2);
- method public int getValue();
- method @androidx.compose.Immutable public static inline int hashCode-impl(int p);
- method @androidx.compose.Stable public static operator int minus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static operator int plus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static inline operator int rem-impl(int $this, int other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, int other);
- method @androidx.compose.Stable public static String toString-impl(int $this);
- method @androidx.compose.Stable public static operator int unaryMinus-impl(int $this);
- field public static final androidx.ui.unit.IntPx.Companion! Companion;
+ @androidx.compose.Immutable public final class IntOffset {
+ ctor public IntOffset(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method public int getX();
+ method public int getY();
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset minus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset plus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset unaryMinus();
+ property public final int x;
+ property public final int y;
+ field public static final androidx.ui.unit.IntOffset.Companion! Companion;
}
- public static final class IntPx.Companion {
- method public int getInfinity();
- method public int getZero();
- property public final int Infinity;
- property public final int Zero;
+ public static final class IntOffset.Companion {
+ method public androidx.ui.unit.IntOffset getOrigin();
+ property public final androidx.ui.unit.IntOffset Origin;
}
- @androidx.compose.Immutable public final class IntPxBounds {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxBounds copy-Q13GOEE(int left, int top, int right, int bottom);
- method public int getBottom();
- method public int getLeft();
- method public int getRight();
- method public int getTop();
+ public final class IntOffsetKt {
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset IntOffset(int x, int y);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntOffset lerp(androidx.ui.unit.IntOffset start, androidx.ui.unit.IntOffset stop, float fraction);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntOffset);
}
- public final class IntPxKt {
- method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size Size-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline int coerceAtLeast-rRMsBxU(int, int minimumValue);
- method @androidx.compose.Stable public static inline int coerceAtMost-rRMsBxU(int, int maximumValue);
- method @androidx.compose.Stable public static inline int coerceIn-qx1LT1w(int, int minimumValue, int maximumValue);
- method public static inline int getHeight(androidx.ui.unit.IntPxBounds);
- method public static inline int getIpx(int);
- method public static inline int getWidth(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline boolean isFinite-gshw56o(int);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition lerp(androidx.ui.unit.IntPxPosition start, androidx.ui.unit.IntPxPosition stop, float fraction);
- method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
- method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
- method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
- method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
- method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size toSize(androidx.ui.unit.IntPxSize);
+ @androidx.compose.Immutable public final class IntSize {
+ ctor public IntSize(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize div(int other);
+ method public int getHeight();
+ method public int getWidth();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize times(int other);
+ property public final int height;
+ property public final int width;
+ field public static final androidx.ui.unit.IntSize.Companion! Companion;
}
- @androidx.compose.Immutable public final class IntPxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxPosition copy(long value);
- method public inline int getX();
- method public inline int getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition unaryMinus();
- property public final inline int x;
- property public final inline int y;
- field public static final androidx.ui.unit.IntPxPosition.Companion! Companion;
- }
-
- public static final class IntPxPosition.Companion {
- method public androidx.ui.unit.IntPxPosition getOrigin();
- property public final androidx.ui.unit.IntPxPosition Origin;
- }
-
- @androidx.compose.Immutable public final class IntPxSize {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxSize copy(long value);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize div(int other);
- method public inline int getHeight();
- method public inline int getWidth();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize times(int other);
- property public final inline int height;
- property public final inline int width;
- field public static final androidx.ui.unit.IntPxSize.Companion! Companion;
- }
-
- public static final class IntPxSize.Companion {
- method public androidx.ui.unit.IntPxSize getZero();
- property public final androidx.ui.unit.IntPxSize Zero;
- }
-
- @androidx.compose.Immutable public final inline class IntSize {
- ctor public IntSize();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static operator long div-impl(long $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static int getHeight-impl(long $this);
- method public static int getWidth-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long times-impl(long $this, int other);
- method @androidx.compose.Stable public static String toString-impl(long $this);
+ public static final class IntSize.Companion {
+ method public androidx.ui.unit.IntSize getZero();
+ property public final androidx.ui.unit.IntSize Zero;
}
public final class IntSizeKt {
- method @androidx.compose.Stable public static long IntSize(int width, int height);
- method @androidx.compose.Stable public static operator long times-twsQOwo(int, long size);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize IntSize(int width, int height);
+ method public static androidx.ui.unit.IntOffset getCenter(androidx.ui.unit.IntSize);
+ method @androidx.compose.Stable public static operator androidx.ui.unit.IntSize times(int, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.IntSize);
}
@androidx.compose.Immutable public final inline class Position {
@@ -474,10 +377,9 @@
method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.PxBounds);
}
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
index f020b68..c91e1d5f 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
@@ -2,69 +2,42 @@
package androidx.ui.core {
@androidx.compose.Immutable public final class Constraints {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ ctor public Constraints(internal long value);
+ method public androidx.ui.core.Constraints copy(int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method @androidx.compose.Immutable public androidx.ui.core.Constraints copy(long value);
+ method public boolean getHasBoundedHeight();
+ method public boolean getHasBoundedWidth();
method public int getMaxHeight();
method public int getMaxWidth();
method public int getMinHeight();
method public int getMinWidth();
+ property public final boolean hasBoundedHeight;
+ property public final boolean hasBoundedWidth;
+ property public final int maxHeight;
+ property public final int maxWidth;
+ property public final int minHeight;
+ property public final int minWidth;
field public static final androidx.ui.core.Constraints.Companion! Companion;
+ field public static final int Infinity = 2147483647; // 0x7fffffff
}
public static final class Constraints.Companion {
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
- }
-
- @androidx.compose.Immutable public final inline class Constraints2 {
- ctor public Constraints2();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
- method @androidx.compose.Immutable 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 @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Immutable public static inline String! toString-impl(long p);
- field public static final androidx.ui.core.Constraints2.Companion! Companion;
- field @androidx.compose.Stable public static final int Infinity = -1073741824; // 0xc0000000
- }
-
- public static final class Constraints2.Companion {
- method @androidx.compose.Stable public long fixed(int width, int height);
- method @androidx.compose.Stable public long fixedHeight(int height);
- method @androidx.compose.Stable public long fixedWidth(int width);
- }
-
- public final class Constraints2Kt {
- method @androidx.compose.Stable public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
- method @androidx.compose.Stable public static long constrain-M1ogGms(long, long size);
- method @androidx.compose.Stable 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 @androidx.compose.Stable public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
- method @androidx.compose.Stable public static boolean satisfiedBy-M1ogGms(long, long size);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixed(int width, int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight(int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth(int width);
}
public final class ConstraintsKt {
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints Constraints(int minWidth = 0, int maxWidth = 2147483647, int minHeight = 0, int maxHeight = 2147483647);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static int constrainHeight(androidx.ui.core.Constraints, int height);
+ method @androidx.compose.Stable public static int constrainWidth(androidx.ui.core.Constraints, int width);
method @androidx.compose.Stable 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 @androidx.compose.Stable public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
- method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints offset(androidx.ui.core.Constraints, int horizontal = 0, int vertical = 0);
+ method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
}
public enum LayoutDirection {
@@ -95,18 +68,16 @@
@androidx.compose.Immutable public interface Density {
method public float getDensity();
method public float getFontScale();
- method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp(int);
- method @androidx.compose.Stable public default float toDp-gshw56o(int);
+ method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp-vVlMl6k(long);
method @androidx.compose.Stable public default int toIntPx-ipo6vVg(float);
method @androidx.compose.Stable public default int toIntPx-vVlMl6k(long);
method @androidx.compose.Stable public default float toPx-ipo6vVg(float);
method @androidx.compose.Stable public default float toPx-vVlMl6k(long);
method @androidx.compose.Stable public default androidx.ui.geometry.Rect toRect(androidx.ui.unit.Bounds);
- method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp(int);
- method @androidx.compose.Stable public default long toSp-gshw56o(int);
+ method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp-ipo6vVg(float);
property public abstract float density;
property public abstract float fontScale;
@@ -286,126 +257,58 @@
field public static final long SecondsPerMinute = 60L; // 0x3cL
}
- @androidx.compose.Immutable public final inline class IntPx implements java.lang.Comparable<androidx.ui.unit.IntPx> {
- ctor public IntPx();
- method @androidx.compose.Stable public operator int compareTo-gshw56o(int p);
- method @androidx.compose.Stable public static operator int compareTo-gshw56o(int $this, int other);
- method public static int constructor-impl(int value);
- method @androidx.compose.Stable public static operator int div-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(int p, Object? p1);
- method public static boolean equals-impl0(int p1, int p2);
- method public int getValue();
- method @androidx.compose.Immutable public static inline int hashCode-impl(int p);
- method @androidx.compose.Stable public static operator int minus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static operator int plus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static inline operator int rem-impl(int $this, int other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, int other);
- method @androidx.compose.Stable public static String toString-impl(int $this);
- method @androidx.compose.Stable public static operator int unaryMinus-impl(int $this);
- field public static final androidx.ui.unit.IntPx.Companion! Companion;
+ @androidx.compose.Immutable public final class IntOffset {
+ ctor public IntOffset(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method public int getX();
+ method public int getY();
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset minus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset plus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset unaryMinus();
+ property public final int x;
+ property public final int y;
+ field public static final androidx.ui.unit.IntOffset.Companion! Companion;
}
- public static final class IntPx.Companion {
- method public int getInfinity();
- method public int getZero();
- property public final int Infinity;
- property public final int Zero;
+ public static final class IntOffset.Companion {
+ method public androidx.ui.unit.IntOffset getOrigin();
+ property public final androidx.ui.unit.IntOffset Origin;
}
- @androidx.compose.Immutable public final class IntPxBounds {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxBounds copy-Q13GOEE(int left, int top, int right, int bottom);
- method public int getBottom();
- method public int getLeft();
- method public int getRight();
- method public int getTop();
+ public final class IntOffsetKt {
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset IntOffset(int x, int y);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntOffset lerp(androidx.ui.unit.IntOffset start, androidx.ui.unit.IntOffset stop, float fraction);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntOffset);
}
- public final class IntPxKt {
- method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size Size-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline int coerceAtLeast-rRMsBxU(int, int minimumValue);
- method @androidx.compose.Stable public static inline int coerceAtMost-rRMsBxU(int, int maximumValue);
- method @androidx.compose.Stable public static inline int coerceIn-qx1LT1w(int, int minimumValue, int maximumValue);
- method public static inline int getHeight(androidx.ui.unit.IntPxBounds);
- method public static inline int getIpx(int);
- method public static inline int getWidth(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline boolean isFinite-gshw56o(int);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition lerp(androidx.ui.unit.IntPxPosition start, androidx.ui.unit.IntPxPosition stop, float fraction);
- method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
- method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
- method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
- method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
- method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size toSize(androidx.ui.unit.IntPxSize);
+ @androidx.compose.Immutable public final class IntSize {
+ ctor public IntSize(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize div(int other);
+ method public int getHeight();
+ method public int getWidth();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize times(int other);
+ property public final int height;
+ property public final int width;
+ field public static final androidx.ui.unit.IntSize.Companion! Companion;
}
- @androidx.compose.Immutable public final class IntPxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxPosition copy(long value);
- method public inline int getX();
- method public inline int getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition unaryMinus();
- property public final inline int x;
- property public final inline int y;
- field public static final androidx.ui.unit.IntPxPosition.Companion! Companion;
- }
-
- public static final class IntPxPosition.Companion {
- method public androidx.ui.unit.IntPxPosition getOrigin();
- property public final androidx.ui.unit.IntPxPosition Origin;
- }
-
- @androidx.compose.Immutable public final class IntPxSize {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxSize copy(long value);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize div(int other);
- method public inline int getHeight();
- method public inline int getWidth();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize times(int other);
- property public final inline int height;
- property public final inline int width;
- field public static final androidx.ui.unit.IntPxSize.Companion! Companion;
- }
-
- public static final class IntPxSize.Companion {
- method public androidx.ui.unit.IntPxSize getZero();
- property public final androidx.ui.unit.IntPxSize Zero;
- }
-
- @androidx.compose.Immutable public final inline class IntSize {
- ctor public IntSize();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static operator long div-impl(long $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static int getHeight-impl(long $this);
- method public static int getWidth-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long times-impl(long $this, int other);
- method @androidx.compose.Stable public static String toString-impl(long $this);
+ public static final class IntSize.Companion {
+ method public androidx.ui.unit.IntSize getZero();
+ property public final androidx.ui.unit.IntSize Zero;
}
public final class IntSizeKt {
- method @androidx.compose.Stable public static long IntSize(int width, int height);
- method @androidx.compose.Stable public static operator long times-twsQOwo(int, long size);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize IntSize(int width, int height);
+ method public static androidx.ui.unit.IntOffset getCenter(androidx.ui.unit.IntSize);
+ method @androidx.compose.Stable public static operator androidx.ui.unit.IntSize times(int, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.IntSize);
}
@androidx.compose.Immutable public final inline class Position {
@@ -474,10 +377,9 @@
method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.PxBounds);
}
diff --git a/ui/ui-unit/api/public_plus_experimental_current.txt b/ui/ui-unit/api/public_plus_experimental_current.txt
index f020b68..c91e1d5f 100644
--- a/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -2,69 +2,42 @@
package androidx.ui.core {
@androidx.compose.Immutable public final class Constraints {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ ctor public Constraints(internal long value);
+ method public androidx.ui.core.Constraints copy(int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method @androidx.compose.Immutable public androidx.ui.core.Constraints copy(long value);
+ method public boolean getHasBoundedHeight();
+ method public boolean getHasBoundedWidth();
method public int getMaxHeight();
method public int getMaxWidth();
method public int getMinHeight();
method public int getMinWidth();
+ property public final boolean hasBoundedHeight;
+ property public final boolean hasBoundedWidth;
+ property public final int maxHeight;
+ property public final int maxWidth;
+ property public final int minHeight;
+ property public final int minWidth;
field public static final androidx.ui.core.Constraints.Companion! Companion;
+ field public static final int Infinity = 2147483647; // 0x7fffffff
}
public static final class Constraints.Companion {
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
- }
-
- @androidx.compose.Immutable public final inline class Constraints2 {
- ctor public Constraints2();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
- method @androidx.compose.Immutable 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 @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Immutable public static inline String! toString-impl(long p);
- field public static final androidx.ui.core.Constraints2.Companion! Companion;
- field @androidx.compose.Stable public static final int Infinity = -1073741824; // 0xc0000000
- }
-
- public static final class Constraints2.Companion {
- method @androidx.compose.Stable public long fixed(int width, int height);
- method @androidx.compose.Stable public long fixedHeight(int height);
- method @androidx.compose.Stable public long fixedWidth(int width);
- }
-
- public final class Constraints2Kt {
- method @androidx.compose.Stable public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
- method @androidx.compose.Stable public static long constrain-M1ogGms(long, long size);
- method @androidx.compose.Stable 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 @androidx.compose.Stable public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
- method @androidx.compose.Stable public static boolean satisfiedBy-M1ogGms(long, long size);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixed(int width, int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight(int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth(int width);
}
public final class ConstraintsKt {
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints Constraints(int minWidth = 0, int maxWidth = 2147483647, int minHeight = 0, int maxHeight = 2147483647);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static int constrainHeight(androidx.ui.core.Constraints, int height);
+ method @androidx.compose.Stable public static int constrainWidth(androidx.ui.core.Constraints, int width);
method @androidx.compose.Stable 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 @androidx.compose.Stable public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
- method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints offset(androidx.ui.core.Constraints, int horizontal = 0, int vertical = 0);
+ method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
}
public enum LayoutDirection {
@@ -95,18 +68,16 @@
@androidx.compose.Immutable public interface Density {
method public float getDensity();
method public float getFontScale();
- method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp(int);
- method @androidx.compose.Stable public default float toDp-gshw56o(int);
+ method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp-vVlMl6k(long);
method @androidx.compose.Stable public default int toIntPx-ipo6vVg(float);
method @androidx.compose.Stable public default int toIntPx-vVlMl6k(long);
method @androidx.compose.Stable public default float toPx-ipo6vVg(float);
method @androidx.compose.Stable public default float toPx-vVlMl6k(long);
method @androidx.compose.Stable public default androidx.ui.geometry.Rect toRect(androidx.ui.unit.Bounds);
- method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp(int);
- method @androidx.compose.Stable public default long toSp-gshw56o(int);
+ method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp-ipo6vVg(float);
property public abstract float density;
property public abstract float fontScale;
@@ -286,126 +257,58 @@
field public static final long SecondsPerMinute = 60L; // 0x3cL
}
- @androidx.compose.Immutable public final inline class IntPx implements java.lang.Comparable<androidx.ui.unit.IntPx> {
- ctor public IntPx();
- method @androidx.compose.Stable public operator int compareTo-gshw56o(int p);
- method @androidx.compose.Stable public static operator int compareTo-gshw56o(int $this, int other);
- method public static int constructor-impl(int value);
- method @androidx.compose.Stable public static operator int div-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(int p, Object? p1);
- method public static boolean equals-impl0(int p1, int p2);
- method public int getValue();
- method @androidx.compose.Immutable public static inline int hashCode-impl(int p);
- method @androidx.compose.Stable public static operator int minus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static operator int plus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static inline operator int rem-impl(int $this, int other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, int other);
- method @androidx.compose.Stable public static String toString-impl(int $this);
- method @androidx.compose.Stable public static operator int unaryMinus-impl(int $this);
- field public static final androidx.ui.unit.IntPx.Companion! Companion;
+ @androidx.compose.Immutable public final class IntOffset {
+ ctor public IntOffset(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method public int getX();
+ method public int getY();
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset minus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset plus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset unaryMinus();
+ property public final int x;
+ property public final int y;
+ field public static final androidx.ui.unit.IntOffset.Companion! Companion;
}
- public static final class IntPx.Companion {
- method public int getInfinity();
- method public int getZero();
- property public final int Infinity;
- property public final int Zero;
+ public static final class IntOffset.Companion {
+ method public androidx.ui.unit.IntOffset getOrigin();
+ property public final androidx.ui.unit.IntOffset Origin;
}
- @androidx.compose.Immutable public final class IntPxBounds {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxBounds copy-Q13GOEE(int left, int top, int right, int bottom);
- method public int getBottom();
- method public int getLeft();
- method public int getRight();
- method public int getTop();
+ public final class IntOffsetKt {
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset IntOffset(int x, int y);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntOffset lerp(androidx.ui.unit.IntOffset start, androidx.ui.unit.IntOffset stop, float fraction);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntOffset);
}
- public final class IntPxKt {
- method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size Size-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline int coerceAtLeast-rRMsBxU(int, int minimumValue);
- method @androidx.compose.Stable public static inline int coerceAtMost-rRMsBxU(int, int maximumValue);
- method @androidx.compose.Stable public static inline int coerceIn-qx1LT1w(int, int minimumValue, int maximumValue);
- method public static inline int getHeight(androidx.ui.unit.IntPxBounds);
- method public static inline int getIpx(int);
- method public static inline int getWidth(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline boolean isFinite-gshw56o(int);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition lerp(androidx.ui.unit.IntPxPosition start, androidx.ui.unit.IntPxPosition stop, float fraction);
- method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
- method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
- method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
- method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
- method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size toSize(androidx.ui.unit.IntPxSize);
+ @androidx.compose.Immutable public final class IntSize {
+ ctor public IntSize(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize div(int other);
+ method public int getHeight();
+ method public int getWidth();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize times(int other);
+ property public final int height;
+ property public final int width;
+ field public static final androidx.ui.unit.IntSize.Companion! Companion;
}
- @androidx.compose.Immutable public final class IntPxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxPosition copy(long value);
- method public inline int getX();
- method public inline int getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition unaryMinus();
- property public final inline int x;
- property public final inline int y;
- field public static final androidx.ui.unit.IntPxPosition.Companion! Companion;
- }
-
- public static final class IntPxPosition.Companion {
- method public androidx.ui.unit.IntPxPosition getOrigin();
- property public final androidx.ui.unit.IntPxPosition Origin;
- }
-
- @androidx.compose.Immutable public final class IntPxSize {
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxSize copy(long value);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize div(int other);
- method public inline int getHeight();
- method public inline int getWidth();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize times(int other);
- property public final inline int height;
- property public final inline int width;
- field public static final androidx.ui.unit.IntPxSize.Companion! Companion;
- }
-
- public static final class IntPxSize.Companion {
- method public androidx.ui.unit.IntPxSize getZero();
- property public final androidx.ui.unit.IntPxSize Zero;
- }
-
- @androidx.compose.Immutable public final inline class IntSize {
- ctor public IntSize();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static operator long div-impl(long $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static int getHeight-impl(long $this);
- method public static int getWidth-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long times-impl(long $this, int other);
- method @androidx.compose.Stable public static String toString-impl(long $this);
+ public static final class IntSize.Companion {
+ method public androidx.ui.unit.IntSize getZero();
+ property public final androidx.ui.unit.IntSize Zero;
}
public final class IntSizeKt {
- method @androidx.compose.Stable public static long IntSize(int width, int height);
- method @androidx.compose.Stable public static operator long times-twsQOwo(int, long size);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize IntSize(int width, int height);
+ method public static androidx.ui.unit.IntOffset getCenter(androidx.ui.unit.IntSize);
+ method @androidx.compose.Stable public static operator androidx.ui.unit.IntSize times(int, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.IntSize);
}
@androidx.compose.Immutable public final inline class Position {
@@ -474,10 +377,9 @@
method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.PxBounds);
}
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev14.txt b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
index d3b9272..fafd9ab 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
@@ -2,69 +2,42 @@
package androidx.ui.core {
@androidx.compose.Immutable public final class Constraints {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ ctor public Constraints(internal long value);
+ method public androidx.ui.core.Constraints copy(int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method @androidx.compose.Immutable public androidx.ui.core.Constraints copy(long value);
+ method public boolean getHasBoundedHeight();
+ method public boolean getHasBoundedWidth();
method public int getMaxHeight();
method public int getMaxWidth();
method public int getMinHeight();
method public int getMinWidth();
+ property public final boolean hasBoundedHeight;
+ property public final boolean hasBoundedWidth;
+ property public final int maxHeight;
+ property public final int maxWidth;
+ property public final int minHeight;
+ property public final int minWidth;
field public static final androidx.ui.core.Constraints.Companion! Companion;
+ field public static final int Infinity = 2147483647; // 0x7fffffff
}
public static final class Constraints.Companion {
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
- }
-
- @androidx.compose.Immutable public final inline class Constraints2 {
- ctor public Constraints2();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
- method @androidx.compose.Immutable 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 @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Immutable public static inline String! toString-impl(long p);
- field public static final androidx.ui.core.Constraints2.Companion! Companion;
- field @androidx.compose.Stable public static final int Infinity = -1073741824; // 0xc0000000
- }
-
- public static final class Constraints2.Companion {
- method @androidx.compose.Stable public long fixed(int width, int height);
- method @androidx.compose.Stable public long fixedHeight(int height);
- method @androidx.compose.Stable public long fixedWidth(int width);
- }
-
- public final class Constraints2Kt {
- method @androidx.compose.Stable public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
- method @androidx.compose.Stable public static long constrain-M1ogGms(long, long size);
- method @androidx.compose.Stable 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 @androidx.compose.Stable public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
- method @androidx.compose.Stable public static boolean satisfiedBy-M1ogGms(long, long size);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixed(int width, int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight(int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth(int width);
}
public final class ConstraintsKt {
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints Constraints(int minWidth = 0, int maxWidth = 2147483647, int minHeight = 0, int maxHeight = 2147483647);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static int constrainHeight(androidx.ui.core.Constraints, int height);
+ method @androidx.compose.Stable public static int constrainWidth(androidx.ui.core.Constraints, int width);
method @androidx.compose.Stable 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 @androidx.compose.Stable public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
- method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints offset(androidx.ui.core.Constraints, int horizontal = 0, int vertical = 0);
+ method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
}
public enum LayoutDirection {
@@ -95,18 +68,16 @@
@androidx.compose.Immutable public interface Density {
method public float getDensity();
method public float getFontScale();
- method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp(int);
- method @androidx.compose.Stable public default float toDp-gshw56o(int);
+ method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp-vVlMl6k(long);
method @androidx.compose.Stable public default int toIntPx-ipo6vVg(float);
method @androidx.compose.Stable public default int toIntPx-vVlMl6k(long);
method @androidx.compose.Stable public default float toPx-ipo6vVg(float);
method @androidx.compose.Stable public default float toPx-vVlMl6k(long);
method @androidx.compose.Stable public default androidx.ui.geometry.Rect toRect(androidx.ui.unit.Bounds);
- method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp(int);
- method @androidx.compose.Stable public default long toSp-gshw56o(int);
+ method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp-ipo6vVg(float);
property public abstract float density;
property public abstract float fontScale;
@@ -286,130 +257,58 @@
field public static final long SecondsPerMinute = 60L; // 0x3cL
}
- @androidx.compose.Immutable public final inline class IntPx implements java.lang.Comparable<androidx.ui.unit.IntPx> {
- ctor public IntPx();
- method @androidx.compose.Stable public operator int compareTo-gshw56o(int p);
- method @androidx.compose.Stable public static operator int compareTo-gshw56o(int $this, int other);
- method public static int constructor-impl(int value);
- method @androidx.compose.Stable public static operator int div-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(int p, Object? p1);
- method public static boolean equals-impl0(int p1, int p2);
- method public int getValue();
- method @androidx.compose.Immutable public static inline int hashCode-impl(int p);
- method @androidx.compose.Stable public static operator int minus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static operator int plus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static inline operator int rem-impl(int $this, int other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, int other);
- method @androidx.compose.Stable public static String toString-impl(int $this);
- method @androidx.compose.Stable public static operator int unaryMinus-impl(int $this);
- field public static final androidx.ui.unit.IntPx.Companion! Companion;
+ @androidx.compose.Immutable public final class IntOffset {
+ ctor public IntOffset(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method public int getX();
+ method public int getY();
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset minus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset plus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset unaryMinus();
+ property public final int x;
+ property public final int y;
+ field public static final androidx.ui.unit.IntOffset.Companion! Companion;
}
- public static final class IntPx.Companion {
- method public int getInfinity();
- method public int getZero();
- property public final int Infinity;
- property public final int Zero;
+ public static final class IntOffset.Companion {
+ method public androidx.ui.unit.IntOffset getOrigin();
+ property public final androidx.ui.unit.IntOffset Origin;
}
- @androidx.compose.Immutable public final class IntPxBounds {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxBounds copy-Q13GOEE(int left, int top, int right, int bottom);
- method public int getBottom();
- method public int getLeft();
- method public int getRight();
- method public int getTop();
+ public final class IntOffsetKt {
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset IntOffset(int x, int y);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntOffset lerp(androidx.ui.unit.IntOffset start, androidx.ui.unit.IntOffset stop, float fraction);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntOffset);
}
- public final class IntPxKt {
- method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size Size-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline int coerceAtLeast-rRMsBxU(int, int minimumValue);
- method @androidx.compose.Stable public static inline int coerceAtMost-rRMsBxU(int, int maximumValue);
- method @androidx.compose.Stable public static inline int coerceIn-qx1LT1w(int, int minimumValue, int maximumValue);
- method public static inline int getHeight(androidx.ui.unit.IntPxBounds);
- method public static inline int getIpx(int);
- method public static inline int getWidth(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline boolean isFinite-gshw56o(int);
- method @androidx.compose.Stable @kotlin.PublishedApi internal static inline int keepInfinity-qx1LT1w(int, int other, int noInfinityValue);
- method @androidx.compose.Stable @kotlin.PublishedApi internal static inline int keepInfinity-rRMsBxU(int, int noInfinityValue);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition lerp(androidx.ui.unit.IntPxPosition start, androidx.ui.unit.IntPxPosition stop, float fraction);
- method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
- method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
- method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
- method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
- method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size toSize(androidx.ui.unit.IntPxSize);
+ @androidx.compose.Immutable public final class IntSize {
+ ctor public IntSize(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize div(int other);
+ method public int getHeight();
+ method public int getWidth();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize times(int other);
+ property public final int height;
+ property public final int width;
+ field public static final androidx.ui.unit.IntSize.Companion! Companion;
}
- @androidx.compose.Immutable public final class IntPxPosition {
- ctor @kotlin.PublishedApi internal IntPxPosition(internal long value);
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxPosition copy(long value);
- method public inline int getX();
- method public inline int getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition unaryMinus();
- property public final inline int x;
- property public final inline int y;
- field public static final androidx.ui.unit.IntPxPosition.Companion! Companion;
- }
-
- public static final class IntPxPosition.Companion {
- method public androidx.ui.unit.IntPxPosition getOrigin();
- property public final androidx.ui.unit.IntPxPosition Origin;
- }
-
- @androidx.compose.Immutable public final class IntPxSize {
- ctor @kotlin.PublishedApi internal IntPxSize(internal long value);
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxSize copy(long value);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize div(int other);
- method public inline int getHeight();
- method public inline int getWidth();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize times(int other);
- property public final inline int height;
- property public final inline int width;
- field public static final androidx.ui.unit.IntPxSize.Companion! Companion;
- }
-
- public static final class IntPxSize.Companion {
- method public androidx.ui.unit.IntPxSize getZero();
- property public final androidx.ui.unit.IntPxSize Zero;
- }
-
- @androidx.compose.Immutable public final inline class IntSize {
- ctor public IntSize();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static operator long div-impl(long $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static int getHeight-impl(long $this);
- method public static int getWidth-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long times-impl(long $this, int other);
- method @androidx.compose.Stable public static String toString-impl(long $this);
+ public static final class IntSize.Companion {
+ method public androidx.ui.unit.IntSize getZero();
+ property public final androidx.ui.unit.IntSize Zero;
}
public final class IntSizeKt {
- method @androidx.compose.Stable public static long IntSize(int width, int height);
- method @androidx.compose.Stable public static operator long times-twsQOwo(int, long size);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize IntSize(int width, int height);
+ method public static androidx.ui.unit.IntOffset getCenter(androidx.ui.unit.IntSize);
+ method @androidx.compose.Stable public static operator androidx.ui.unit.IntSize times(int, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.IntSize);
}
@androidx.compose.Immutable public final inline class Position {
@@ -478,10 +377,9 @@
method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.PxBounds);
}
diff --git a/ui/ui-unit/api/restricted_current.txt b/ui/ui-unit/api/restricted_current.txt
index d3b9272..fafd9ab 100644
--- a/ui/ui-unit/api/restricted_current.txt
+++ b/ui/ui-unit/api/restricted_current.txt
@@ -2,69 +2,42 @@
package androidx.ui.core {
@androidx.compose.Immutable public final class Constraints {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.core.Constraints copy-Q13GOEE(int minWidth, int maxWidth, int minHeight, int maxHeight);
+ ctor public Constraints(internal long value);
+ method public androidx.ui.core.Constraints copy(int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
+ method @androidx.compose.Immutable public androidx.ui.core.Constraints copy(long value);
+ method public boolean getHasBoundedHeight();
+ method public boolean getHasBoundedWidth();
method public int getMaxHeight();
method public int getMaxWidth();
method public int getMinHeight();
method public int getMinWidth();
+ property public final boolean hasBoundedHeight;
+ property public final boolean hasBoundedWidth;
+ property public final int maxHeight;
+ property public final int maxWidth;
+ property public final int minHeight;
+ property public final int minWidth;
field public static final androidx.ui.core.Constraints.Companion! Companion;
+ field public static final int Infinity = 2147483647; // 0x7fffffff
}
public static final class Constraints.Companion {
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixed-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight-gshw56o(int height);
- method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth-gshw56o(int width);
- }
-
- @androidx.compose.Immutable public final inline class Constraints2 {
- ctor public Constraints2();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static long copy-impl(long $this, int minWidth = this.minWidth, int maxWidth = this.maxWidth, int minHeight = this.minHeight, int maxHeight = this.maxHeight);
- method @androidx.compose.Immutable 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 @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Immutable public static inline String! toString-impl(long p);
- field public static final androidx.ui.core.Constraints2.Companion! Companion;
- field @androidx.compose.Stable public static final int Infinity = -1073741824; // 0xc0000000
- }
-
- public static final class Constraints2.Companion {
- method @androidx.compose.Stable public long fixed(int width, int height);
- method @androidx.compose.Stable public long fixedHeight(int height);
- method @androidx.compose.Stable public long fixedWidth(int width);
- }
-
- public final class Constraints2Kt {
- method @androidx.compose.Stable public static long Constraints2(@IntRange(from=0) int minWidth = 0, int maxWidth = -1073741824, @IntRange(from=0) int minHeight = 0, int maxHeight = -1073741824);
- method @androidx.compose.Stable public static long constrain-M1ogGms(long, long size);
- method @androidx.compose.Stable 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 @androidx.compose.Stable public static long offset-xOKVbDg(long, int horizontal = 0, int vertical = 0);
- method @androidx.compose.Stable public static boolean satisfiedBy-M1ogGms(long, long size);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixed(int width, int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedHeight(int height);
+ method @androidx.compose.Stable public androidx.ui.core.Constraints fixedWidth(int width);
}
public final class ConstraintsKt {
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints Constraints(int minWidth = 0, int maxWidth = 2147483647, int minHeight = 0, int maxHeight = 2147483647);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize constrain(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static int constrainHeight(androidx.ui.core.Constraints, int height);
+ method @androidx.compose.Stable public static int constrainWidth(androidx.ui.core.Constraints, int width);
method @androidx.compose.Stable 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 @androidx.compose.Stable public static androidx.ui.core.Constraints offset-3L2DHGc(androidx.ui.core.Constraints, int horizontal = 0.ipx, int vertical = 0.ipx);
- method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntPxSize size);
+ method @androidx.compose.Stable public static androidx.ui.core.Constraints offset(androidx.ui.core.Constraints, int horizontal = 0, int vertical = 0);
+ method @androidx.compose.Stable public static boolean satisfiedBy(androidx.ui.core.Constraints, androidx.ui.unit.IntSize size);
}
public enum LayoutDirection {
@@ -95,18 +68,16 @@
@androidx.compose.Immutable public interface Density {
method public float getDensity();
method public float getFontScale();
- method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp(int);
- method @androidx.compose.Stable public default float toDp-gshw56o(int);
+ method @androidx.compose.Stable public default float toDp(float);
method @androidx.compose.Stable public default float toDp-vVlMl6k(long);
method @androidx.compose.Stable public default int toIntPx-ipo6vVg(float);
method @androidx.compose.Stable public default int toIntPx-vVlMl6k(long);
method @androidx.compose.Stable public default float toPx-ipo6vVg(float);
method @androidx.compose.Stable public default float toPx-vVlMl6k(long);
method @androidx.compose.Stable public default androidx.ui.geometry.Rect toRect(androidx.ui.unit.Bounds);
- method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp(int);
- method @androidx.compose.Stable public default long toSp-gshw56o(int);
+ method @androidx.compose.Stable public default long toSp(float);
method @androidx.compose.Stable public default long toSp-ipo6vVg(float);
property public abstract float density;
property public abstract float fontScale;
@@ -286,130 +257,58 @@
field public static final long SecondsPerMinute = 60L; // 0x3cL
}
- @androidx.compose.Immutable public final inline class IntPx implements java.lang.Comparable<androidx.ui.unit.IntPx> {
- ctor public IntPx();
- method @androidx.compose.Stable public operator int compareTo-gshw56o(int p);
- method @androidx.compose.Stable public static operator int compareTo-gshw56o(int $this, int other);
- method public static int constructor-impl(int value);
- method @androidx.compose.Stable public static operator int div-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int div-impl(int $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(int p, Object? p1);
- method public static boolean equals-impl0(int p1, int p2);
- method public int getValue();
- method @androidx.compose.Immutable public static inline int hashCode-impl(int p);
- method @androidx.compose.Stable public static operator int minus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static operator int plus-gshw56o(int $this, int other);
- method @androidx.compose.Stable public static inline operator int rem-impl(int $this, int other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, float other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, double other);
- method @androidx.compose.Stable public static operator int times-impl(int $this, int other);
- method @androidx.compose.Stable public static String toString-impl(int $this);
- method @androidx.compose.Stable public static operator int unaryMinus-impl(int $this);
- field public static final androidx.ui.unit.IntPx.Companion! Companion;
+ @androidx.compose.Immutable public final class IntOffset {
+ ctor public IntOffset(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method public int getX();
+ method public int getY();
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset minus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset plus(androidx.ui.unit.IntOffset other);
+ method @androidx.compose.Stable public inline operator androidx.ui.unit.IntOffset unaryMinus();
+ property public final int x;
+ property public final int y;
+ field public static final androidx.ui.unit.IntOffset.Companion! Companion;
}
- public static final class IntPx.Companion {
- method public int getInfinity();
- method public int getZero();
- property public final int Infinity;
- property public final int Zero;
+ public static final class IntOffset.Companion {
+ method public androidx.ui.unit.IntOffset getOrigin();
+ property public final androidx.ui.unit.IntOffset Origin;
}
- @androidx.compose.Immutable public final class IntPxBounds {
- method public int component1();
- method public int component2();
- method public int component3();
- method public int component4();
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxBounds copy-Q13GOEE(int left, int top, int right, int bottom);
- method public int getBottom();
- method public int getLeft();
- method public int getRight();
- method public int getTop();
+ public final class IntOffsetKt {
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset IntOffset(int x, int y);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntOffset lerp(androidx.ui.unit.IntOffset start, androidx.ui.unit.IntOffset stop, float fraction);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntOffset offset);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset plus(androidx.ui.unit.IntOffset, androidx.ui.geometry.Offset offset);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntOffset);
}
- public final class IntPxKt {
- method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size Size-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline int coerceAtLeast-rRMsBxU(int, int minimumValue);
- method @androidx.compose.Stable public static inline int coerceAtMost-rRMsBxU(int, int maximumValue);
- method @androidx.compose.Stable public static inline int coerceIn-qx1LT1w(int, int minimumValue, int maximumValue);
- method public static inline int getHeight(androidx.ui.unit.IntPxBounds);
- method public static inline int getIpx(int);
- method public static inline int getWidth(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline boolean isFinite-gshw56o(int);
- method @androidx.compose.Stable @kotlin.PublishedApi internal static inline int keepInfinity-qx1LT1w(int, int other, int noInfinityValue);
- method @androidx.compose.Stable @kotlin.PublishedApi internal static inline int keepInfinity-rRMsBxU(int, int noInfinityValue);
- method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition lerp(androidx.ui.unit.IntPxPosition start, androidx.ui.unit.IntPxPosition stop, float fraction);
- method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
- method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
- method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
- method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
- method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.geometry.Size toSize(androidx.ui.unit.IntPxSize);
+ @androidx.compose.Immutable public final class IntSize {
+ ctor public IntSize(internal long value);
+ method @androidx.compose.Stable public inline operator int component1();
+ method @androidx.compose.Stable public inline operator int component2();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize div(int other);
+ method public int getHeight();
+ method public int getWidth();
+ method @androidx.compose.Stable public operator androidx.ui.unit.IntSize times(int other);
+ property public final int height;
+ property public final int width;
+ field public static final androidx.ui.unit.IntSize.Companion! Companion;
}
- @androidx.compose.Immutable public final class IntPxPosition {
- ctor @kotlin.PublishedApi internal IntPxPosition(internal long value);
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxPosition copy(long value);
- method public inline int getX();
- method public inline int getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxPosition unaryMinus();
- property public final inline int x;
- property public final inline int y;
- field public static final androidx.ui.unit.IntPxPosition.Companion! Companion;
- }
-
- public static final class IntPxPosition.Companion {
- method public androidx.ui.unit.IntPxPosition getOrigin();
- property public final androidx.ui.unit.IntPxPosition Origin;
- }
-
- @androidx.compose.Immutable public final class IntPxSize {
- ctor @kotlin.PublishedApi internal IntPxSize(internal long value);
- method @androidx.compose.Immutable public androidx.ui.unit.IntPxSize copy(long value);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize div(int other);
- method public inline int getHeight();
- method public inline int getWidth();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.IntPxSize times(int other);
- property public final inline int height;
- property public final inline int width;
- field public static final androidx.ui.unit.IntPxSize.Companion! Companion;
- }
-
- public static final class IntPxSize.Companion {
- method public androidx.ui.unit.IntPxSize getZero();
- property public final androidx.ui.unit.IntPxSize Zero;
- }
-
- @androidx.compose.Immutable public final inline class IntSize {
- ctor public IntSize();
- method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static operator long div-impl(long $this, int other);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static int getHeight-impl(long $this);
- method public static int getWidth-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long times-impl(long $this, int other);
- method @androidx.compose.Stable public static String toString-impl(long $this);
+ public static final class IntSize.Companion {
+ method public androidx.ui.unit.IntSize getZero();
+ property public final androidx.ui.unit.IntSize Zero;
}
public final class IntSizeKt {
- method @androidx.compose.Stable public static long IntSize(int width, int height);
- method @androidx.compose.Stable public static operator long times-twsQOwo(int, long size);
+ method @androidx.compose.Stable public static androidx.ui.unit.IntSize IntSize(int width, int height);
+ method public static androidx.ui.unit.IntOffset getCenter(androidx.ui.unit.IntSize);
+ method @androidx.compose.Stable public static operator androidx.ui.unit.IntSize times(int, androidx.ui.unit.IntSize size);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.IntSize);
}
@androidx.compose.Immutable public final inline class Position {
@@ -478,10 +377,9 @@
method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntOffset round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.geometry.Size);
method @androidx.compose.Stable public static androidx.ui.geometry.Size toSize(androidx.ui.unit.PxBounds);
}
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/core/Constraints.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/core/Constraints.kt
index d7439d3..960c67b 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/core/Constraints.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/core/Constraints.kt
@@ -14,19 +14,15 @@
* limitations under the License.
*/
@file:Suppress("NOTHING_TO_INLINE")
+
package androidx.ui.core
import androidx.compose.Immutable
import androidx.compose.Stable
-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
+import androidx.ui.unit.IntSize
/**
- * Immutable constraints used for measuring child [Layout]s or [LayoutModifier]s. A parent layout
+ * 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 [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]
@@ -52,82 +48,390 @@
* 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.
+ * [Constraints] 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
-data class Constraints(
- @Stable
- val minWidth: IntPx = IntPx.Zero,
- @Stable
- val maxWidth: IntPx = IntPx.Infinity,
- @Stable
- val minHeight: IntPx = IntPx.Zero,
- @Stable
- val maxHeight: IntPx = IntPx.Infinity
+// This can be made inline after b/155690960 is fixed.
+/*inline*/ data class Constraints(
+ @PublishedApi internal val value: Long
) {
- 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)"
+ /**
+ * 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
+ get() {
+ val mask = WidthMask[focusIndex]
+ return ((value shr 2).toInt() and mask)
}
- require(minHeight <= maxHeight) {
- "Constraints should be satisfiable, but minHeight($minHeight) > maxHeight($maxHeight)"
+
+ /**
+ * The maximum width that the measurement can take. This will either be
+ * a positive value greater than or equal to [minWidth] or [Constraints.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
}
- 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" }
+
+ /**
+ * The minimum height that the measurement can take.
+ */
+ val minHeight: Int
+ 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 [Constraints.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 [Constraints], 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
+ ): Constraints {
+ require(minHeight >= 0 && minWidth >= 0) {
+ "minHeight($minHeight) and minWidth($minWidth) must be >= 0"
+ }
+ require(maxWidth >= minWidth || maxWidth == Infinity) {
+ "maxWidth($maxWidth) must be >= minWidth($minWidth)"
+ }
+ require(maxHeight >= minHeight || maxHeight == Infinity) {
+ "maxHeight($maxHeight) must be >= minHeight($minHeight)"
+ }
+ return createConstraints(minWidth, maxWidth, minHeight, maxHeight)
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (other !is Constraints) {
+ return false
+ }
+ return value == other.value
+ }
+
+ override fun hashCode(): Int {
+ return value.hashCode()
+ }
+
+ override fun toString(): String {
+ val maxWidth = maxWidth
+ val maxWidthStr = if (maxWidth == Infinity) "Infinity" else maxWidth.toString()
+ val maxHeight = maxHeight
+ val maxHeightStr = if (maxHeight == Infinity) "Infinity" else maxHeight.toString()
+ return "Constraints(minWidth = $minWidth, maxWidth = $maxWidthStr, " +
+ "minHeight = $minHeight, maxHeight = $maxHeightStr)"
}
companion object {
/**
+ * 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 = Int.MAX_VALUE
+
+ /**
+ * 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.
*/
@Stable
- fun fixed(width: IntPx, height: IntPx) = Constraints(width, width, height, height)
+ fun fixed(
+ width: Int,
+ height: Int
+ ): Constraints {
+ 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.
*/
@Stable
- fun fixedWidth(width: IntPx) = Constraints(
- minWidth = width,
- maxWidth = width,
- minHeight = IntPx.Zero,
- maxHeight = IntPx.Infinity
- )
+ fun fixedWidth(
+ width: Int
+ ): Constraints {
+ 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.
*/
@Stable
- fun fixedHeight(height: IntPx) = Constraints(
- minWidth = IntPx.Zero,
- maxWidth = IntPx.Infinity,
- minHeight = height,
- maxHeight = height
- )
+ fun fixedHeight(
+ height: Int
+ ): Constraints {
+ require(height >= 0) {
+ "height($height) must be >= 0"
+ }
+ return createConstraints(
+ minWidth = 0,
+ maxWidth = Infinity,
+ minHeight = height,
+ maxHeight = height
+ )
+ }
+
+ /**
+ * Creates a [Constraints], only checking that the values fit in the packed Long.
+ */
+ internal fun createConstraints(
+ minWidth: Int,
+ maxWidth: Int,
+ minHeight: Int,
+ maxHeight: Int
+ ): Constraints {
+ val heightVal = if (maxHeight == Infinity) minHeight else maxHeight
+ val heightBits = bitsNeedForSize(heightVal)
+
+ val widthVal = if (maxWidth == Infinity) minWidth else maxWidth
+ 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 Constraints(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"
+ )
+ }
+ }
}
}
/**
- * Whether or not the upper bound on the maximum height.
- * @see hasBoundedWidth
+ * Create a [Constraints]. [minWidth] and [minHeight] must be positive and
+ * [maxWidth] and [maxHeight] must be greater than or equal to [minWidth] and [minHeight],
+ * respectively, or [Infinity][Constraints.Infinity].
*/
@Stable
-val Constraints.hasBoundedHeight get() = maxHeight.isFinite()
-
-/**
- * Whether or not the upper bound on the maximum width.
- * @see hasBoundedHeight
- */
-@Stable
-val Constraints.hasBoundedWidth get() = maxWidth.isFinite()
+fun Constraints(
+ minWidth: Int = 0,
+ maxWidth: Int = Constraints.Infinity,
+ minHeight: Int = 0,
+ maxHeight: Int = Constraints.Infinity
+): Constraints {
+ require(maxWidth >= minWidth) {
+ "maxWidth($maxWidth) must be >= than minWidth($minWidth)"
+ }
+ require(maxHeight >= minHeight) {
+ "maxHeight($maxHeight) must be >= than minHeight($minHeight)"
+ }
+ require(minWidth >= 0 && minHeight >= 0) {
+ "minWidth($minWidth) and minHeight($minHeight) must be >= 0"
+ }
+ return Constraints.createConstraints(minWidth, maxWidth, minHeight, maxHeight)
+}
/**
* Whether there is exactly one width value that satisfies the constraints.
@@ -146,7 +450,7 @@
* This is true when at least one of maxWidth and maxHeight are 0.
*/
@Stable
-val Constraints.isZero get() = maxWidth == IntPx.Zero || maxHeight == IntPx.Zero
+val Constraints.isZero get() = maxWidth == 0 || maxHeight == 0
/**
* Returns the result of coercing the current constraints in a different set of constraints.
@@ -163,26 +467,46 @@
* Takes a size and returns the closest size to it that satisfies the constraints.
*/
@Stable
-fun Constraints.constrain(size: IntPxSize) = IntPxSize(
- size.width.coerceIn(minWidth, maxWidth),
- size.height.coerceIn(minHeight, maxHeight)
+fun Constraints.constrain(size: IntSize) = IntSize(
+ width = size.width.coerceIn(minWidth, maxWidth),
+ height = size.height.coerceIn(minHeight, maxHeight)
)
/**
+ * Takes a width and returns the closest size to it that satisfies the constraints.
+ */
+@Stable
+fun Constraints.constrainWidth(width: Int) = width.coerceIn(minWidth, maxWidth)
+
+/**
+ * Takes a height and returns the closest size to it that satisfies the constraints.
+ */
+@Stable
+fun Constraints.constrainHeight(height: Int) = height.coerceIn(minHeight, maxHeight)
+
+/**
* Takes a size and returns whether it satisfies the current constraints.
*/
@Stable
-fun Constraints.satisfiedBy(size: IntPxSize) =
- minWidth <= size.width && size.width <= maxWidth &&
- minHeight <= size.height && size.height <= maxHeight
+fun Constraints.satisfiedBy(size: IntSize): Boolean {
+ return size.width in minWidth..maxWidth && size.height in minHeight..maxHeight
+}
/**
* Returns the Constraints obtained by offsetting the current instance with the given values.
*/
@Stable
-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)
+fun Constraints.offset(horizontal: Int = 0, vertical: Int = 0) = Constraints(
+ (minWidth + horizontal).coerceAtLeast(0),
+ addMaxWithMinimum(maxWidth, horizontal),
+ (minHeight + vertical).coerceAtLeast(0),
+ addMaxWithMinimum(maxHeight, vertical)
)
+
+private fun addMaxWithMinimum(max: Int, value: Int): Int {
+ return if (max == Constraints.Infinity) {
+ max
+ } else {
+ (max + value).coerceAtLeast(0)
+ }
+}
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/core/Constraints2.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/core/Constraints2.kt
deleted file mode 100644
index c979e1b..0000000
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/core/Constraints2.kt
+++ /dev/null
@@ -1,482 +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.
- */
-@file:Suppress("NOTHING_TO_INLINE")
-
-package androidx.ui.core
-
-import androidx.compose.Immutable
-import androidx.compose.Stable
-import androidx.ui.unit.IntSize
-import androidx.ui.util.annotation.IntRange
-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.
- */
-@Suppress("EXPERIMENTAL_FEATURE_WARNING")
-@Immutable
-inline class Constraints2(
- @PublishedApi internal val value: Long
-) {
- /**
- * Indicates how the bits are assigned. One of:
- * * MinFocusWidth
- * * MaxFocusWidth
- * * MinFocusHeight
- * * MaxFocusHeight
- */
- @Stable
- private val focusIndex
- get() = (value and FocusMask).toInt()
-
- /**
- * The minimum width that the measurement can take.
- */
- @Stable
- 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].
- */
- @Stable
- 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.
- */
- @Stable
- 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].
- */
- @Stable
- 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
- */
- @Stable
- 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
- */
- @Stable
- 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].
- */
- @Stable
- 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.
- */
- @Stable
- const val Infinity = Int.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.
- */
- @Stable
- 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.
- */
- @Stable
- 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.
- */
- @Stable
- 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].
- */
-@Stable
-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.
- */
-@Stable
-val Constraints2.hasFixedWidth get() = maxWidth == minWidth
-
-/**
- * Whether there is exactly one height value that satisfies the constraints.
- */
-@Stable
-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.
- */
-@Stable
-val Constraints2.isZero get() = maxWidth == 0 || maxHeight == 0
-
-/**
- * Returns the result of coercing the current constraints in a different set of constraints.
- */
-@Stable
-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.
- */
-@Stable
-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.
- */
-@Stable
-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.
- */
-@Stable
-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/commonMain/kotlin/androidx/ui/unit/Density.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Density.kt
index f8828fb..b920919 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Density.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Density.kt
@@ -18,6 +18,7 @@
import androidx.compose.Immutable
import androidx.compose.Stable
+import androidx.ui.core.Constraints
import androidx.ui.geometry.Rect
import kotlin.math.roundToInt
@@ -37,7 +38,7 @@
) : Density
/**
- * A density of the screen. Used for the conversions between [Dp], [Px], [IntPx] and [TextUnit].
+ * A density of the screen. Used for the conversions between [Dp], [Px], [Int] and [TextUnit].
*
* @sample androidx.ui.unit.samples.WithDensitySample
*/
@@ -63,10 +64,13 @@
fun Dp.toPx(): Float = value * density
/**
- * Convert [Dp] to [IntPx] by rounding
+ * Convert [Dp] to [Int] by rounding
*/
@Stable
- fun Dp.toIntPx(): IntPx = toPx().roundToInt().ipx
+ fun Dp.toIntPx(): Int {
+ val px = toPx()
+ return if (px.isInfinite()) Constraints.Infinity else px.roundToInt()
+ }
/**
* Convert [Dp] to Sp. Sp is used for font size, etc.
@@ -85,10 +89,10 @@
}
/**
- * Convert Sp to [IntPx] by rounding
+ * Convert Sp to [Int] by rounding
*/
@Stable
- fun TextUnit.toIntPx(): IntPx = toPx().roundToInt().ipx
+ fun TextUnit.toIntPx(): Int = toPx().roundToInt()
/**
* Convert Sp to [Dp].
@@ -101,16 +105,16 @@
}
/**
- * Convert [IntPx] to [Dp].
+ * Convert an [Int] pixel value to [Dp].
*/
@Stable
- fun IntPx.toDp(): Dp = (value / density).dp
+ fun Int.toDp(): Dp = (this / density).dp
/**
- * Convert [IntPx] to Sp.
+ * Convert an [Int] pixel value to Sp.
*/
@Stable
- fun IntPx.toSp(): TextUnit = (value / (fontScale * density)).sp
+ fun Int.toSp(): TextUnit = (this / (fontScale * density)).sp
/** Convert a [Float] pixel value to a Dp */
@Stable
@@ -120,14 +124,6 @@
@Stable
fun Float.toSp(): TextUnit = (this / (fontScale * density)).sp
- /** Convert a [Int] pixel value to a Dp */
- @Stable
- fun Int.toDp(): Dp = toFloat().toDp()
-
- /** Convert a [Int] pixel value to a Sp */
- @Stable
- fun Int.toSp(): TextUnit = toFloat().toSp()
-
/**
* Convert a [Bounds] to a [Rect].
*/
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntOffset.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntOffset.kt
new file mode 100644
index 0000000..b626d2e
--- /dev/null
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntOffset.kt
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ */
+
+@file:Suppress("NOTHING_TO_INLINE")
+
+package androidx.ui.unit
+
+import androidx.compose.Immutable
+import androidx.compose.Stable
+import androidx.ui.geometry.Offset
+import androidx.ui.util.lerp
+import androidx.ui.util.packInts
+import androidx.ui.util.unpackInt1
+import androidx.ui.util.unpackInt2
+
+/**
+ * A two-dimensional position using [Int] pixels for units
+ */
+@Immutable
+/*inline*/ class IntOffset(
+ @PublishedApi internal val value: Long
+) {
+ /**
+ * The horizontal aspect of the position in [Int] pixels.
+ */
+ @Stable
+ val x: Int
+ get() = unpackInt1(value)
+
+ /**
+ * The vertical aspect of the position in [Int] pixels.
+ */
+ @Stable
+ val y: Int
+ get() = unpackInt2(value)
+
+ @Stable
+ inline operator fun component1(): Int = x
+
+ @Stable
+ inline operator fun component2(): Int = y
+
+ /**
+ * Subtract a [IntOffset] from another one.
+ */
+ @Stable
+ inline operator fun minus(other: IntOffset) =
+ IntOffset(x - other.x, y - other.y)
+
+ /**
+ * Add a [IntOffset] to another one.
+ */
+ @Stable
+ inline operator fun plus(other: IntOffset) =
+ IntOffset(x + other.x, y + other.y)
+
+ /**
+ * Returns a new [IntOffset] representing the negation of this point.
+ */
+ @Stable
+ inline operator fun unaryMinus() = IntOffset(-x, -y)
+
+ @Stable
+ override fun toString(): String = "($x, $y)"
+
+ @Stable
+ override fun equals(other: Any?): Boolean {
+ if (other !is IntOffset) {
+ return false
+ }
+ return other.value == value
+ }
+
+ @Stable
+ override fun hashCode(): Int {
+ return value.hashCode()
+ }
+
+ companion object {
+ val Origin = IntOffset(0, 0)
+ }
+}
+
+/**
+ * Constructs a [IntOffset] from [x] and [y] position [Int] values.
+ */
+@Stable
+inline fun IntOffset(x: Int, y: Int): IntOffset =
+ IntOffset(packInts(x, y))
+
+/**
+ * Linearly interpolate between two [IntOffset]s.
+ *
+ * The [fraction] argument represents position on the timeline, with 0.0 meaning
+ * that the interpolation has not started, returning [start] (or something
+ * equivalent to [start]), 1.0 meaning that the interpolation has finished,
+ * returning [stop] (or something equivalent to [stop]), and values in between
+ * meaning that the interpolation is at the relevant point on the timeline
+ * between [start] and [stop]. The interpolation can be extrapolated beyond 0.0 and
+ * 1.0, so negative values and values greater than 1.0 are valid.
+ */
+@Stable
+fun lerp(start: IntOffset, stop: IntOffset, fraction: Float): IntOffset =
+ IntOffset(lerp(start.x, stop.x, fraction), lerp(start.y, stop.y, fraction))
+
+/**
+ * Converts the [IntOffset] to an [Offset].
+ */
+@Stable
+inline fun IntOffset.toOffset() = Offset(x.toFloat(), y.toFloat())
+
+@Stable
+operator fun Offset.plus(offset: IntOffset): Offset =
+ Offset(x + offset.x, y + offset.y)
+
+@Stable
+operator fun Offset.minus(offset: IntOffset): Offset =
+ Offset(x - offset.x, y - offset.y)
+
+@Stable
+operator fun IntOffset.plus(offset: Offset): Offset =
+ Offset(x + offset.x, y + offset.y)
+
+@Stable
+operator fun IntOffset.minus(offset: Offset): Offset =
+ Offset(x - offset.x, y - offset.y)
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
deleted file mode 100644
index 13ab3c9..0000000
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
+++ /dev/null
@@ -1,482 +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.
- */
-@file:Suppress("NOTHING_TO_INLINE")
-
-package androidx.ui.unit
-
-import androidx.compose.Immutable
-import androidx.compose.Stable
-import androidx.ui.geometry.Offset
-import androidx.ui.geometry.Size
-import androidx.ui.unit.IntPx.Companion.Infinity
-import androidx.ui.util.lerp
-import androidx.ui.util.packInts
-import androidx.ui.util.unpackInt1
-import androidx.ui.util.unpackInt2
-import kotlin.math.max
-import kotlin.math.min
-import kotlin.math.roundToInt
-
-/**
- * Dimension value represented in whole pixels (px). Layout and constraints operate on Int
- * pixels. Operations with an [Infinity] IntPx result in [Infinity].
- */
-@Suppress("EXPERIMENTAL_FEATURE_WARNING")
-@Immutable
-inline class IntPx(val value: Int) : Comparable<IntPx> {
- /**
- * Add two [IntPx]s together. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
- @Stable
- operator fun plus(other: IntPx) =
- keepInfinity(other, IntPx(value = this.value + other.value))
-
- /**
- * Subtract a IntPx from another one. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
- @Stable
- operator fun minus(other: IntPx) =
- keepInfinity(other, IntPx(value = this.value - other.value))
-
- /**
- * This is the same as multiplying the IntPx by -1. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
- @Stable
- operator fun unaryMinus() = keepInfinity(IntPx(-value))
-
- /**
- * Divide a IntPx by a scalar and return the rounded result as an IntPx. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
- @Stable
- operator fun div(other: Float): IntPx =
- keepInfinity(IntPx(value = (value.toFloat() / other).roundToInt()))
-
- /**
- * Divide a IntPx by a scalar and return the rounded result as an IntPx. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
- @Stable
- operator fun div(other: Double): IntPx =
- keepInfinity(IntPx(value = (value.toDouble() / other).roundToInt()))
-
- /**
- * Divide a IntPx by a scalar and return the rounded result as an IntPx. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
- @Stable
- operator fun div(other: Int): IntPx =
- keepInfinity(IntPx(value = (value.toFloat() / other).roundToInt()))
-
- /**
- * Multiply a IntPx by a scalar and round the result to an IntPx. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
- @Stable
- operator fun times(other: Float): IntPx =
- keepInfinity(IntPx(value = (value.toFloat() * other).roundToInt()))
-
- /**
- * Multiply a IntPx by a scalar and round the result to an IntPx
- */
- @Stable
- operator fun times(other: Double): IntPx =
- keepInfinity(IntPx(value = (value.toDouble() * other).roundToInt()))
-
- /**
- * Multiply a IntPx by a scalar and result in an IntPx
- */
- @Stable
- operator fun times(other: Int): IntPx =
- keepInfinity(IntPx(value = value * other))
-
- /**
- * Returns the remainder of the IntPx when dividing by an integer.
- */
- @Stable
- inline operator fun rem(other: Int): IntPx =
- IntPx(value = value % other)
-
- /**
- * Support comparing Dimensions with comparison operators.
- */
- @Stable
- override /* TODO: inline */ operator fun compareTo(other: IntPx) = value.compareTo(other.value)
-
- @Stable
- override fun toString() = "$value.ipx"
-
- companion object {
- /**
- * An IntPx that indicates that there is no bound in the dimension. This is
- * commonly used in `Constraints.maxHeight` and `Constraints.maxWidth` to indicate
- * that the particular dimension is not regulated and measurement should choose
- * the best option without any constraint.
- */
- @Stable
- val Infinity = IntPx(value = Int.MAX_VALUE)
-
- /**
- * Zero IntPx dimension. Same as `0.ipx`.
- */
- @Stable
- val Zero = IntPx(value = 0)
- }
-}
-
-/**
- * Return whether `true` when it is finite or `false` when it is [IntPx.Infinity]
- */
-@Stable
-inline fun IntPx.isFinite(): Boolean = value != Int.MAX_VALUE
-
-@PublishedApi
-@Stable
-internal inline fun IntPx.keepInfinity(other: IntPx, noInfinityValue: IntPx): IntPx {
- return if (!isFinite() || !other.isFinite()) Infinity else noInfinityValue
-}
-
-@PublishedApi
-@Stable
-internal inline fun IntPx.keepInfinity(noInfinityValue: IntPx): IntPx {
- return if (!isFinite()) this else noInfinityValue
-}
-
-/**
- * Create a [IntPx] using an [Int]:
- * val left = 10
- * val x = left.ipx
- * // -- or --
- * val y = 10.ipx
- */
-@Stable
-inline val Int.ipx: IntPx get() = IntPx(value = this)
-
-/**
- * Multiply an IntPx by a Float and round the result to an IntPx. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
-@Stable
-inline operator fun Float.times(other: IntPx): IntPx =
- other.keepInfinity(IntPx(value = (other.value.toFloat() * this).roundToInt()))
-
-/**
- * Multiply an IntPx by a Double and round the result to an IntPx. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
-@Stable
-inline operator fun Double.times(other: IntPx): IntPx =
- other.keepInfinity(IntPx(value = (other.value.toDouble() * this).roundToInt()))
-
-/**
- * Multiply an IntPx by a Double to result in an IntPx. Any operation on an
- * [IntPx.Infinity] results in [IntPx.Infinity]
- */
-@Stable
-inline operator fun Int.times(other: IntPx): IntPx =
- other.keepInfinity(IntPx(value = other.value * this))
-
-/**
- * Return the minimum of two [IntPx]s. Any value is considered less than [IntPx.Infinity].
- */
-@Stable
-inline fun min(a: IntPx, b: IntPx): IntPx =
- IntPx(value = min(a.value, b.value))
-
-/**
- * Return the maximum of two [IntPx]s. An [IntPx.Infinity] is considered the maximum value.
- */
-@Stable
-inline fun max(a: IntPx, b: IntPx): IntPx =
- IntPx(value = max(a.value, b.value))
-
-/**
- * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
- *
- * @return this value if it's in the range, or [minimumValue] if this value is less than
- * [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
- */
-@Stable
-inline fun IntPx.coerceIn(minimumValue: IntPx, maximumValue: IntPx): IntPx =
- IntPx(value = value.coerceIn(minimumValue.value, maximumValue.value))
-
-/**
- * Ensures that this value is not less than the specified [minimumValue].
- *
- * @return this value if it's greater than or equal to the [minimumValue] or the
- * [minimumValue] otherwise.
- */
-@Stable
-inline fun IntPx.coerceAtLeast(minimumValue: IntPx): IntPx =
- IntPx(value = value.coerceAtLeast(minimumValue.value))
-
-/**
- * Ensures that this value is not greater than the specified [maximumValue].
- *
- * @return this value if it's less than or equal to the [maximumValue] or the
- * [maximumValue] otherwise. Passing [IntPx.Infinity] as [maximumValue] will
- * always return this.
- */
-@Stable
-inline fun IntPx.coerceAtMost(maximumValue: IntPx): IntPx =
- IntPx(value = value.coerceAtMost(maximumValue.value))
-
-/**
- * Linearly interpolate between two [IntPx]s.
- *
- * The [fraction] argument represents position on the timeline, with 0.0 meaning
- * that the interpolation has not started, returning [start] (or something
- * equivalent to [start]), 1.0 meaning that the interpolation has finished,
- * returning [stop] (or something equivalent to [stop]), and values in between
- * meaning that the interpolation is at the relevant point on the timeline
- * between [start] and [stop]. The interpolation can be extrapolated beyond 0.0 and
- * 1.0, so negative values and values greater than 1.0 are valid.
- *
- * If [start] or [stop] is [IntPx.Infinity], then [IntPx.Infinity] is returned.
- */
-@Stable
-fun lerp(start: IntPx, stop: IntPx, fraction: Float): IntPx {
- return start.keepInfinity(stop, IntPx(lerp(start.value, stop.value, fraction)))
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-// Structures using IntPx
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-/**
- * A two dimensional size using [IntPx] for units
- */
-@OptIn(ExperimentalUnsignedTypes::class)
-@Immutable
-data class IntPxSize @PublishedApi internal constructor(@PublishedApi internal val value: Long) {
- /**
- * The horizontal aspect of the size in [IntPx].
- */
- @Stable
- inline val width: IntPx
- get() = unpackInt1(value).ipx
-
- /**
- * The vertical aspect of the size in [IntPx].
- */
- @Stable
- inline val height: IntPx
- get() = unpackInt2(value).ipx
-
- /**
- * Returns an IntPxSize scaled by multiplying [width] and [height] by [other]
- */
- @Stable
- inline operator fun times(other: Int): IntPxSize =
- IntPxSize(width = width * other, height = height * other)
-
- /**
- * Returns an IntPxSize scaled by dividing [width] and [height] by [other]
- */
- @Stable
- inline operator fun div(other: Int): IntPxSize =
- IntPxSize(width = width / other, height = height / other)
-
- @Stable
- override fun toString(): String = "$width x $height"
-
- companion object {
- /**
- * [IntPxSize] with zero values.
- */
- @Stable
- val Zero = IntPxSize(0.ipx, 0.ipx)
- }
-}
-
-/**
- * Constructs an [IntPxSize] from width and height [IntPx] values.
- */
-@OptIn(ExperimentalUnsignedTypes::class)
-@Stable
-inline fun IntPxSize(width: IntPx, height: IntPx): IntPxSize =
- IntPxSize(packInts(width.value, height.value))
-
-/**
- * Returns an [IntPxSize] with [size]'s [IntPxSize.width] and [IntPxSize.height]
- * multiplied by [this]
- */
-@Stable
-inline operator fun Int.times(size: IntPxSize) = size * this
-
-/**
- * Returns the [IntPxPosition] of the center of the rect from the point of [0, 0]
- * with this [IntPxSize].
- */
-@Stable
-fun IntPxSize.center(): IntPxPosition {
- return IntPxPosition(width / 2f, height / 2f)
-}
-
-/**
- * Subtract a [IntPxPosition] from this [Offset].
- */
-@Stable
-inline operator fun Offset.minus(other: IntPxPosition) =
- Offset(x - other.x.value, y - other.y.value)
-
-/**
- * Add a [IntPxPosition] to this [Offset].
- */
-@Stable
-inline operator fun Offset.plus(other: IntPxPosition) =
- Offset(x + other.x.value, y + other.y.value)
-
-/**
- * A two-dimensional position using [IntPx] for units
- */
-@OptIn(ExperimentalUnsignedTypes::class)
-@Immutable
-data class IntPxPosition @PublishedApi internal constructor(
- @PublishedApi internal val value: Long
-) {
- /**
- * The horizontal aspect of the position in [IntPx]
- */
- @Stable
- inline val x: IntPx
- get() = unpackInt1(value).ipx
-
- /**
- * The vertical aspect of the position in [IntPx]
- */
- @Stable
- inline val y: IntPx
- get() = unpackInt2(value).ipx
-
- /**
- * Subtract a [IntPxPosition] from another one.
- */
- @Stable
- inline operator fun minus(other: IntPxPosition) =
- IntPxPosition(x - other.x, y - other.y)
-
- /**
- * Add a [IntPxPosition] to another one.
- */
- @Stable
- inline operator fun plus(other: IntPxPosition) =
- IntPxPosition(x + other.x, y + other.y)
-
- /**
- * Returns a new PxPosition representing the negation of this point.
- */
- @Stable
- inline operator fun unaryMinus() = IntPxPosition(-x, -y)
-
- override fun toString(): String = "($x, $y)"
-
- companion object {
- @Stable
- val Origin = IntPxPosition(0.ipx, 0.ipx)
- }
-}
-
-/**
- * Constructs a [IntPxPosition] from [x] and [y] position [IntPx] values.
- */
-@OptIn(ExperimentalUnsignedTypes::class)
-inline fun IntPxPosition(x: IntPx, y: IntPx): IntPxPosition =
- IntPxPosition(packInts(x.value, y.value))
-
-/**
- * Linearly interpolate between two [IntPxPosition]s.
- *
- * The [fraction] argument represents position on the timeline, with 0.0 meaning
- * that the interpolation has not started, returning [start] (or something
- * equivalent to [start]), 1.0 meaning that the interpolation has finished,
- * returning [stop] (or something equivalent to [stop]), and values in between
- * meaning that the interpolation is at the relevant point on the timeline
- * between [start] and [stop]. The interpolation can be extrapolated beyond 0.0 and
- * 1.0, so negative values and values greater than 1.0 are valid.
- */
-@Stable
-fun lerp(start: IntPxPosition, stop: IntPxPosition, fraction: Float): IntPxPosition =
- IntPxPosition(lerp(start.x, stop.x, fraction), lerp(start.y, stop.y, fraction))
-
-/**
- * A four dimensional bounds using [IntPx] for units
- */
-@Immutable
-data class IntPxBounds(
- val left: IntPx,
- val top: IntPx,
- val right: IntPx,
- val bottom: IntPx
-)
-
-/**
- * A width of this IntPxBounds in [IntPx].
- */
-@Stable
-inline val IntPxBounds.width: IntPx get() = right - left
-
-/**
- * A height of this IntPxBounds in [IntPx].
- */
-@Stable
-inline val IntPxBounds.height: IntPx get() = bottom - top
-
-/**
- * Returns the [IntPxPosition] of the center of the [IntPxBounds].
- */
-@Stable
-inline fun IntPxBounds.center(): IntPxPosition {
- return IntPxPosition(left + width / 2f, top + height / 2f)
-}
-
-/**
- * Convert a [IntPxBounds] to a [IntPxSize].
- */
-@Stable
-inline fun IntPxBounds.toSize(): IntPxSize {
- return IntPxSize(width, height)
-}
-
-/**
- * Create a [Size] from [IntPx] values.
- */
-@Stable
-inline fun Size(width: IntPx, height: IntPx): Size =
- Size(width = width.value.toFloat(), height = height.value.toFloat())
-
-/**
- * Create a [Offset] from [IntPx] values.
- */
-@Stable
-inline fun Offset(x: IntPx, y: IntPx): Offset =
- Offset(x.value.toFloat(), y.value.toFloat())
-
-/**
- * Convert a [IntPxPosition] to a [Offset]
- */
-@Stable
-inline fun IntPxPosition.toOffset(): Offset =
- Offset(x.value.toFloat(), y.value.toFloat())
-
-/**
- * Convert a [IntPxSize] to a [Size]
- */
-@Stable
-inline fun IntPxSize.toSize(): Size = Size(this.width.value.toFloat(), this.height.value.toFloat())
\ No newline at end of file
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntSize.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntSize.kt
index e30c25e..2c3ecc6 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntSize.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntSize.kt
@@ -20,6 +20,7 @@
import androidx.compose.Immutable
import androidx.compose.Stable
+import androidx.ui.geometry.Size
import androidx.ui.util.packInts
import androidx.ui.util.unpackInt1
import androidx.ui.util.unpackInt2
@@ -27,9 +28,8 @@
/**
* A two-dimensional size class used for measuring in [Int] pixels.
*/
-@Suppress("EXPERIMENTAL_FEATURE_WARNING")
@Immutable
-inline class IntSize(@PublishedApi internal val value: Long) {
+/*inline*/ class IntSize(@PublishedApi internal val value: Long) {
/**
* The horizontal aspect of the size in [Int] pixels.
*/
@@ -44,6 +44,12 @@
val height: Int
get() = unpackInt2(value)
+ @Stable
+ inline operator fun component1(): Int = width
+
+ @Stable
+ inline operator fun component2(): Int = height
+
/**
* Returns an IntSize scaled by multiplying [width] and [height] by [other]
*/
@@ -60,6 +66,25 @@
@Stable
override fun toString(): String = "$width x $height"
+
+ override fun equals(other: Any?): Boolean {
+ if (other !is IntSize) {
+ return false
+ }
+ return other.value == value
+ }
+
+ @Stable
+ override fun hashCode(): Int {
+ return value.hashCode()
+ }
+
+ companion object {
+ /**
+ * IntSize with a zero (0) width and height.
+ */
+ val Zero = IntSize(0L)
+ }
}
/**
@@ -70,8 +95,20 @@
operator fun Int.times(size: IntSize) = size * this
/**
- * Constructs an [IntPxSize] from width and height [IntPx] values.
+ * Constructs an [IntSize] from width and height [Int] values.
*/
@Stable
fun IntSize(width: Int, height: Int): IntSize =
IntSize(packInts(width, height))
+
+/**
+ * Returns the [IntOffset] of the center of the rect from the point of [0, 0]
+ * with this [IntSize].
+ */
+@Stable
+val IntSize.center: IntOffset
+ get() = IntOffset(width / 2, height / 2)
+
+// temporary while PxSize is transitioned to Size
+@Stable
+fun IntSize.toSize() = Size(width.toFloat(), height.toFloat())
\ No newline at end of file
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
index e1dc4a7..9029a7c 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
@@ -220,7 +220,7 @@
* Round a [Offset] down to the nearest [Int] coordinates.
*/
@Stable
-inline fun Offset.round(): IntPxPosition = IntPxPosition(x.roundToInt().ipx, y.roundToInt().ipx)
+inline fun Offset.round(): IntOffset = IntOffset(x.roundToInt(), y.roundToInt())
/**
* A four dimensional bounds using pixels for units
@@ -290,12 +290,4 @@
right,
bottom
)
-}
-
-/**
- * Convert a [Size] to a [Rect].
- */
-@Stable
-fun Size.toRect(): Rect {
- return Rect(0f, 0f, width, height)
}
\ No newline at end of file
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntOffsetTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntOffsetTest.kt
new file mode 100644
index 0000000..c433723
--- /dev/null
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntOffsetTest.kt
@@ -0,0 +1,56 @@
+/*
+ * 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.unit
+
+import androidx.ui.geometry.Offset
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class IntOffsetTest {
+ @Test
+ fun lerpPosition() {
+ val a = IntOffset(3, 10)
+ val b = IntOffset(5, 8)
+ assertEquals(IntOffset(4, 9), lerp(a, b, 0.5f))
+ assertEquals(IntOffset(3, 10), lerp(a, b, 0f))
+ assertEquals(IntOffset(5, 8), lerp(a, b, 1f))
+ }
+
+ @Test
+ fun positionMinus() {
+ val a = IntOffset(3, 10)
+ val b = IntOffset(5, 8)
+ assertEquals(IntOffset(-2, 2), a - b)
+ assertEquals(IntOffset(2, -2), b - a)
+ }
+
+ @Test
+ fun positionPlus() {
+ val a = IntOffset(3, 10)
+ val b = IntOffset(5, 8)
+ assertEquals(IntOffset(8, 18), a + b)
+ assertEquals(IntOffset(8, 18), b + a)
+ }
+
+ @Test
+ fun toOffset() {
+ assertEquals(Offset(3f, 10f), IntOffset(3, 10).toOffset())
+ }
+}
\ No newline at end of file
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
deleted file mode 100644
index 9640c3d..0000000
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
+++ /dev/null
@@ -1,238 +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.unit
-
-import androidx.ui.geometry.Offset
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertFalse
-import org.junit.Assert.assertTrue
-import org.junit.Assert.fail
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.JUnit4
-
-@RunWith(JUnit4::class)
-class IntPxTest {
- @Test
- fun constructor() {
- val dim1 = IntPx(value = 5)
- assertEquals(5, dim1.value)
-
- val dim2 = IntPx(value = Int.MAX_VALUE)
- assertEquals(Int.MAX_VALUE, dim2.value)
- }
-
- @Test
- fun pxIntegerConstruction() {
- val dim = 10.ipx
- assertEquals(10, dim.value)
- }
-
- @Test
- fun subtractOperator() {
- assertEquals(-1, (3.ipx - 4.ipx).value)
- assertEquals(1, (10.ipx - 9.ipx).value)
- assertEquals(IntPx.Infinity, 10.ipx - IntPx.Infinity)
- assertEquals(IntPx.Infinity, IntPx.Infinity - 10.ipx)
- }
-
- @Test
- fun addOperator() {
- assertEquals(2, (1.ipx + 1.ipx).value)
- assertEquals(10, (6.ipx + 4.ipx).value)
- assertEquals(IntPx.Infinity, 10.ipx + IntPx.Infinity)
- assertEquals(IntPx.Infinity, IntPx.Infinity + 10.ipx)
- }
-
- @Test
- fun multiplyOperator() {
- assertEquals(0, (1.ipx * 0).value)
- assertEquals(0, (1.ipx * 0f).value)
- assertEquals(0, (1.ipx * 0.0).value)
- assertEquals(10, (1.ipx * 10).value)
- assertEquals(10, (1.ipx * 10f).value)
- assertEquals(10, (1.ipx * 9.5f).value)
- assertEquals(10, (1.ipx * 10.0).value)
- assertEquals(10, (1.ipx * 9.5).value)
- assertEquals(IntPx.Infinity, IntPx.Infinity * 10)
- assertEquals(IntPx.Infinity, IntPx.Infinity * 10f)
- assertEquals(IntPx.Infinity, IntPx.Infinity * 10.0)
- assertEquals(IntPx.Infinity, IntPx.Infinity * 0)
- assertEquals(IntPx.Infinity, IntPx.Infinity * 0f)
- assertEquals(IntPx.Infinity, IntPx.Infinity * 0.0)
- }
-
- @Test
- fun multiplyOperatorScalar() {
- assertEquals(10, (10f * 1.ipx).value)
- assertEquals(10, (10 * 1.ipx).value)
- assertEquals(10, (10.0 * 1.ipx).value)
-
- assertEquals(IntPx.Infinity, 10 * IntPx.Infinity)
- assertEquals(IntPx.Infinity, 10f * IntPx.Infinity)
- assertEquals(IntPx.Infinity, 10.0 * IntPx.Infinity)
- assertEquals(IntPx.Infinity, 0 * IntPx.Infinity)
- assertEquals(IntPx.Infinity, 0f * IntPx.Infinity)
- assertEquals(IntPx.Infinity, 0.0 * IntPx.Infinity)
- }
-
- @Test
- fun infinity() {
- assertEquals(Int.MAX_VALUE, IntPx.Infinity.value)
- assertFalse(IntPx.Infinity.isFinite())
- assertTrue(30.ipx.isFinite())
- }
-
- @Test
- fun compare() {
- assertTrue(1.ipx < 3.ipx)
- assertEquals(0, 1.ipx.compareTo(1.ipx))
- assertTrue(1.ipx > 0.ipx)
- assertTrue(10000.ipx < IntPx.Infinity)
- assertTrue(IntPx.Infinity > 10000.ipx)
- }
-
- @Test
- fun minTest() {
- assertEquals(10, min(10.ipx, 20.ipx).value)
- assertEquals(10, min(20.ipx, 10.ipx).value)
- assertEquals(10, min(10.ipx, 10.ipx).value)
- assertEquals(10.ipx, min(10.ipx, IntPx.Infinity))
- }
-
- @Test
- fun maxTest() {
- assertEquals(20, max(10.ipx, 20.ipx).value)
- assertEquals(20, max(20.ipx, 10.ipx).value)
- assertEquals(20, max(20.ipx, 20.ipx).value)
- assertEquals(IntPx.Infinity, max(IntPx.Infinity, 20.ipx))
- assertEquals(IntPx.Infinity, max(20.ipx, IntPx.Infinity))
- }
-
- @Test
- fun coerceIn() {
- assertEquals(10, 10.ipx.coerceIn(0.ipx, 20.ipx).value)
- assertEquals(10, 20.ipx.coerceIn(0.ipx, 10.ipx).value)
- assertEquals(10.ipx, 10.ipx.coerceIn(0.ipx, IntPx.Infinity))
- assertEquals(10.ipx, 0.ipx.coerceIn(10.ipx, IntPx.Infinity))
- assertEquals(10, 0.ipx.coerceIn(10.ipx, 20.ipx).value)
- try {
- 10.ipx.coerceIn(20.ipx, 10.ipx)
- fail("Expected an exception here")
- } catch (e: IllegalArgumentException) {
- // success!
- }
- }
-
- @Test
- fun coerceAtLeast() {
- assertEquals(10, 0.ipx.coerceAtLeast(10.ipx).value)
- assertEquals(10, 10.ipx.coerceAtLeast(5.ipx).value)
- assertEquals(10, 10.ipx.coerceAtLeast(10.ipx).value)
- assertEquals(IntPx.Infinity, 10.ipx.coerceAtLeast(IntPx.Infinity))
- }
-
- @Test
- fun coerceAtMost() {
- assertEquals(10, 100.ipx.coerceAtMost(10.ipx).value)
- assertEquals(10, 10.ipx.coerceAtMost(20.ipx).value)
- assertEquals(10, 10.ipx.coerceAtMost(10.ipx).value)
- assertEquals(10, 10.ipx.coerceAtMost(IntPx.Infinity).value)
- }
-
- @Test
- fun sizeCenter() {
- val size = IntPxSize(width = 10.ipx, height = 20.ipx)
- assertEquals(IntPxPosition(5.ipx, 10.ipx), size.center())
- val size2 = IntPxSize(width = IntPx.Infinity, height = IntPx.Infinity)
- assertEquals(IntPxPosition(IntPx.Infinity, IntPx.Infinity), size2.center())
- }
-
- @Test
- fun lerp() {
- assertEquals(10.ipx, lerp(10.ipx, 20.ipx, 0f))
- assertEquals(20.ipx, lerp(10.ipx, 20.ipx, 1f))
- assertEquals(15.ipx, lerp(10.ipx, 20.ipx, 0.5f))
- assertEquals(IntPx.Infinity, lerp(10.ipx, IntPx.Infinity, 0.5f))
- assertEquals(IntPx.Infinity, lerp(IntPx.Infinity, 10.ipx, 0.5f))
- }
-
- @Test
- fun lerpPosition() {
- val a = IntPxPosition(3.ipx, 10.ipx)
- val b = IntPxPosition(5.ipx, 8.ipx)
- assertEquals(IntPxPosition(4.ipx, 9.ipx), lerp(a, b, 0.5f))
- assertEquals(IntPxPosition(3.ipx, 10.ipx), lerp(a, b, 0f))
- assertEquals(IntPxPosition(5.ipx, 8.ipx), lerp(a, b, 1f))
- }
-
- @Test
- fun positionMinus() {
- val a = IntPxPosition(3.ipx, 10.ipx)
- val b = IntPxPosition(5.ipx, 8.ipx)
- assertEquals(IntPxPosition(-2.ipx, 2.ipx), a - b)
- assertEquals(IntPxPosition(2.ipx, -2.ipx), b - a)
- }
-
- @Test
- fun positionPlus() {
- val a = IntPxPosition(3.ipx, 10.ipx)
- val b = IntPxPosition(5.ipx, 8.ipx)
- assertEquals(IntPxPosition(8.ipx, 18.ipx), a + b)
- assertEquals(IntPxPosition(8.ipx, 18.ipx), b + a)
- }
-
- @Test
- fun boundsWidth() {
- val bounds = IntPxBounds(10.ipx, 5.ipx, 25.ipx, 15.ipx)
- assertEquals(15.ipx, bounds.width)
- }
-
- @Test
- fun boundsHeight() {
- val bounds = IntPxBounds(10.ipx, 5.ipx, 25.ipx, 15.ipx)
- assertEquals(10.ipx, bounds.height)
- }
-
- @Test
- fun toSize() {
- val size = IntPxSize(15.ipx, 10.ipx)
- val bounds = IntPxBounds(10.ipx, 5.ipx, 25.ipx, 15.ipx)
- assertEquals(size, bounds.toSize())
- }
-
- @Test
- fun createPosition() {
- assertEquals(Offset(10f, 20f), Offset(10.ipx, 20.ipx))
- }
-
- @Test
- fun remainder() {
- assertEquals(2.ipx, 10.ipx % 4)
- }
-
- @Test
- fun sizeTimesInt() {
- assertEquals(IntPxSize(10.ipx, 10.ipx), IntPxSize(2.ipx, 2.ipx) * 5)
- assertEquals(IntPxSize(10.ipx, 10.ipx), 5 * IntPxSize(2.ipx, 2.ipx))
- }
-
- @Test
- fun sizeDivInt() {
- assertEquals(IntPxSize(10.ipx, 10.ipx), IntPxSize(40.ipx, 40.ipx) / 4)
- }
-}
\ No newline at end of file
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntSizeTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntSizeTest.kt
index ec27428..aea86d2 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntSizeTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntSizeTest.kt
@@ -44,4 +44,18 @@
fun intSizeDivInt() {
assertEquals(IntSize(10, 10), IntSize(40, 40) / 4)
}
+
+ @Test
+ fun sizeCenter() {
+ val size = IntSize(width = 10, height = 20)
+ assertEquals(IntOffset(5, 10), size.center)
+ }
+
+ @Test
+ fun components() {
+ val size = IntSize(width = 10, height = 20)
+ val (w, h) = size
+ assertEquals(10, w)
+ assertEquals(20, h)
+ }
}
\ No newline at end of file
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
index ac548a2..bc9838e2 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
@@ -93,14 +93,14 @@
@Test
fun pxPositionMinusIntPxPosition() {
val a = Offset(3f, 10f)
- val b = IntPxPosition(5.ipx, 8.ipx)
+ val b = IntOffset(5, 8)
assertEquals(Offset(-2f, 2f), a - b)
}
@Test
fun pxPositionPlusIntPxPosition() {
val a = Offset(3f, 10f)
- val b = IntPxPosition(5.ipx, 8.ipx)
+ val b = IntOffset(5, 8)
assertEquals(Offset(8f, 18f), a + b)
}