Merge "Rename `introducesFrameOfReference` to `introducesMotionFrameOfReference`" into snap-temp-L09800030004121689
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
index 47ce294..059bf77 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
@@ -434,7 +434,7 @@
// Tagging as direct manipulation, such that consumers of this offset can decide whether
// to exclude this offset on their coordinates calculation. Such as whether an
// `approachLayout` will animate it or directly apply the offset without animation.
- withCurrentFrameOfReferencePlacement {
+ withMotionFrameOfReferencePlacement {
placeable.placeRelativeWithLayer(xOffset, yOffset)
}
}
diff --git a/compose/ui/ui/api/1.7.0-beta02.txt b/compose/ui/ui/api/1.7.0-beta02.txt
index a455f80..1b75413 100644
--- a/compose/ui/ui/api/1.7.0-beta02.txt
+++ b/compose/ui/ui/api/1.7.0-beta02.txt
@@ -2176,7 +2176,7 @@
@kotlin.jvm.JvmDefaultWithCompatibility public interface LayoutCoordinates {
method public operator int get(androidx.compose.ui.layout.AlignmentLine alignmentLine);
- method public default boolean getIntroducesFrameOfReference();
+ method public default boolean getIntroducesMotionFrameOfReference();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentCoordinates();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentLayoutCoordinates();
method public java.util.Set<androidx.compose.ui.layout.AlignmentLine> getProvidedAlignmentLines();
@@ -2184,15 +2184,15 @@
method public boolean isAttached();
method public androidx.compose.ui.geometry.Rect localBoundingBoxOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional boolean clipBounds);
method public long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
+ method public default long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public long localToRoot(long relativeToLocal);
method public default long localToScreen(long relativeToLocal);
method public long localToWindow(long relativeToLocal);
- method public default long positionInLocalFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
method public default long screenToLocal(long relativeToScreen);
method public default void transformFrom(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, float[] matrix);
method public default void transformToScreen(float[] matrix);
method public long windowToLocal(long relativeToWindow);
- property public default boolean introducesFrameOfReference;
+ property public default boolean introducesMotionFrameOfReference;
property public abstract boolean isAttached;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentCoordinates;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentLayoutCoordinates;
@@ -2268,8 +2268,7 @@
public interface LookaheadScope {
method public androidx.compose.ui.layout.LayoutCoordinates getLookaheadScopeCoordinates(androidx.compose.ui.layout.Placeable.PlacementScope);
- method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
- method public default long positionInLocalLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
+ method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public androidx.compose.ui.layout.LayoutCoordinates toLookaheadCoordinates(androidx.compose.ui.layout.LayoutCoordinates);
}
@@ -2419,7 +2418,7 @@
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, int x, int y, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, androidx.compose.ui.graphics.layer.GraphicsLayer layer, optional float zIndex);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
- method public final void withCurrentFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
+ method public final void withMotionFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
property public androidx.compose.ui.layout.LayoutCoordinates? coordinates;
property protected abstract androidx.compose.ui.unit.LayoutDirection parentLayoutDirection;
property protected abstract int parentWidth;
diff --git a/compose/ui/ui/api/current.ignore b/compose/ui/ui/api/current.ignore
index cbe2066..ad83765 100644
--- a/compose/ui/ui/api/current.ignore
+++ b/compose/ui/ui/api/current.ignore
@@ -1,29 +1,13 @@
// Baseline format: 1.0
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#Enter:
- Removed property FocusDirection.Companion.Enter from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#Exit:
- Removed property FocusDirection.Companion.Exit from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#getEnter():
- Removed method androidx.compose.ui.focus.FocusDirection.Companion.getEnter() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#getExit():
- Removed method androidx.compose.ui.focus.FocusDirection.Companion.getExit() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#enter:
- Removed property FocusProperties.enter from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#exit:
- Removed property FocusProperties.exit from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#getEnter():
- Removed method androidx.compose.ui.focus.FocusProperties.getEnter() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#getExit():
- Removed method androidx.compose.ui.focus.FocusProperties.getExit() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>):
- Removed method androidx.compose.ui.focus.FocusProperties.setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) parameter #0:
- Removed parameter arg1 in androidx.compose.ui.focus.FocusProperties.setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester> arg1) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>):
- Removed method androidx.compose.ui.focus.FocusProperties.setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) parameter #0:
- Removed parameter arg1 in androidx.compose.ui.focus.FocusProperties.setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester> arg1) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusRequester.Companion#Cancel:
- Removed property FocusRequester.Companion.Cancel from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusRequester.Companion#getCancel():
- Removed method androidx.compose.ui.focus.FocusRequester.Companion.getCancel() from compatibility checked API surface
+AddedMethod: androidx.compose.ui.layout.LayoutCoordinates#localPositionOf(androidx.compose.ui.layout.LayoutCoordinates, long, boolean):
+ Added method androidx.compose.ui.layout.LayoutCoordinates.localPositionOf(androidx.compose.ui.layout.LayoutCoordinates,long,boolean)
+AddedMethod: androidx.compose.ui.layout.LookaheadScope#localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates, long, boolean):
+ Added method androidx.compose.ui.layout.LookaheadScope.localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates,androidx.compose.ui.layout.LayoutCoordinates,long,boolean)
+
+
+RemovedMethod: androidx.compose.ui.layout.LayoutCoordinates#positionInMotionFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, long):
+ Removed method androidx.compose.ui.layout.LayoutCoordinates.positionInMotionFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates,long)
+RemovedMethod: androidx.compose.ui.layout.LookaheadScope#localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates, long):
+ Removed method androidx.compose.ui.layout.LookaheadScope.localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates,androidx.compose.ui.layout.LayoutCoordinates,long)
+RemovedMethod: androidx.compose.ui.layout.LookaheadScope#positionInMotionLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates, long):
+ Removed method androidx.compose.ui.layout.LookaheadScope.positionInMotionLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates,androidx.compose.ui.layout.LayoutCoordinates,long)
diff --git a/compose/ui/ui/api/current.txt b/compose/ui/ui/api/current.txt
index a455f80..1b75413 100644
--- a/compose/ui/ui/api/current.txt
+++ b/compose/ui/ui/api/current.txt
@@ -2176,7 +2176,7 @@
@kotlin.jvm.JvmDefaultWithCompatibility public interface LayoutCoordinates {
method public operator int get(androidx.compose.ui.layout.AlignmentLine alignmentLine);
- method public default boolean getIntroducesFrameOfReference();
+ method public default boolean getIntroducesMotionFrameOfReference();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentCoordinates();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentLayoutCoordinates();
method public java.util.Set<androidx.compose.ui.layout.AlignmentLine> getProvidedAlignmentLines();
@@ -2184,15 +2184,15 @@
method public boolean isAttached();
method public androidx.compose.ui.geometry.Rect localBoundingBoxOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional boolean clipBounds);
method public long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
+ method public default long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public long localToRoot(long relativeToLocal);
method public default long localToScreen(long relativeToLocal);
method public long localToWindow(long relativeToLocal);
- method public default long positionInLocalFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
method public default long screenToLocal(long relativeToScreen);
method public default void transformFrom(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, float[] matrix);
method public default void transformToScreen(float[] matrix);
method public long windowToLocal(long relativeToWindow);
- property public default boolean introducesFrameOfReference;
+ property public default boolean introducesMotionFrameOfReference;
property public abstract boolean isAttached;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentCoordinates;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentLayoutCoordinates;
@@ -2268,8 +2268,7 @@
public interface LookaheadScope {
method public androidx.compose.ui.layout.LayoutCoordinates getLookaheadScopeCoordinates(androidx.compose.ui.layout.Placeable.PlacementScope);
- method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
- method public default long positionInLocalLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
+ method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public androidx.compose.ui.layout.LayoutCoordinates toLookaheadCoordinates(androidx.compose.ui.layout.LayoutCoordinates);
}
@@ -2419,7 +2418,7 @@
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, int x, int y, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, androidx.compose.ui.graphics.layer.GraphicsLayer layer, optional float zIndex);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
- method public final void withCurrentFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
+ method public final void withMotionFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
property public androidx.compose.ui.layout.LayoutCoordinates? coordinates;
property protected abstract androidx.compose.ui.unit.LayoutDirection parentLayoutDirection;
property protected abstract int parentWidth;
diff --git a/compose/ui/ui/api/restricted_1.7.0-beta02.txt b/compose/ui/ui/api/restricted_1.7.0-beta02.txt
index a0024b9..9ab5ea2 100644
--- a/compose/ui/ui/api/restricted_1.7.0-beta02.txt
+++ b/compose/ui/ui/api/restricted_1.7.0-beta02.txt
@@ -2176,7 +2176,7 @@
@kotlin.jvm.JvmDefaultWithCompatibility public interface LayoutCoordinates {
method public operator int get(androidx.compose.ui.layout.AlignmentLine alignmentLine);
- method public default boolean getIntroducesFrameOfReference();
+ method public default boolean getIntroducesMotionFrameOfReference();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentCoordinates();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentLayoutCoordinates();
method public java.util.Set<androidx.compose.ui.layout.AlignmentLine> getProvidedAlignmentLines();
@@ -2184,15 +2184,15 @@
method public boolean isAttached();
method public androidx.compose.ui.geometry.Rect localBoundingBoxOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional boolean clipBounds);
method public long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
+ method public default long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public long localToRoot(long relativeToLocal);
method public default long localToScreen(long relativeToLocal);
method public long localToWindow(long relativeToLocal);
- method public default long positionInLocalFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
method public default long screenToLocal(long relativeToScreen);
method public default void transformFrom(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, float[] matrix);
method public default void transformToScreen(float[] matrix);
method public long windowToLocal(long relativeToWindow);
- property public default boolean introducesFrameOfReference;
+ property public default boolean introducesMotionFrameOfReference;
property public abstract boolean isAttached;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentCoordinates;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentLayoutCoordinates;
@@ -2271,8 +2271,7 @@
public interface LookaheadScope {
method public androidx.compose.ui.layout.LayoutCoordinates getLookaheadScopeCoordinates(androidx.compose.ui.layout.Placeable.PlacementScope);
- method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
- method public default long positionInLocalLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
+ method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public androidx.compose.ui.layout.LayoutCoordinates toLookaheadCoordinates(androidx.compose.ui.layout.LayoutCoordinates);
}
@@ -2426,7 +2425,7 @@
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, int x, int y, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, androidx.compose.ui.graphics.layer.GraphicsLayer layer, optional float zIndex);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
- method public final void withCurrentFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
+ method public final void withMotionFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
property public androidx.compose.ui.layout.LayoutCoordinates? coordinates;
property protected abstract androidx.compose.ui.unit.LayoutDirection parentLayoutDirection;
property protected abstract int parentWidth;
diff --git a/compose/ui/ui/api/restricted_current.ignore b/compose/ui/ui/api/restricted_current.ignore
index cbe2066..ad83765 100644
--- a/compose/ui/ui/api/restricted_current.ignore
+++ b/compose/ui/ui/api/restricted_current.ignore
@@ -1,29 +1,13 @@
// Baseline format: 1.0
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#Enter:
- Removed property FocusDirection.Companion.Enter from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#Exit:
- Removed property FocusDirection.Companion.Exit from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#getEnter():
- Removed method androidx.compose.ui.focus.FocusDirection.Companion.getEnter() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusDirection.Companion#getExit():
- Removed method androidx.compose.ui.focus.FocusDirection.Companion.getExit() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#enter:
- Removed property FocusProperties.enter from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#exit:
- Removed property FocusProperties.exit from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#getEnter():
- Removed method androidx.compose.ui.focus.FocusProperties.getEnter() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#getExit():
- Removed method androidx.compose.ui.focus.FocusProperties.getExit() from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>):
- Removed method androidx.compose.ui.focus.FocusProperties.setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) parameter #0:
- Removed parameter arg1 in androidx.compose.ui.focus.FocusProperties.setEnter(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester> arg1) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>):
- Removed method androidx.compose.ui.focus.FocusProperties.setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusProperties#setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester>) parameter #0:
- Removed parameter arg1 in androidx.compose.ui.focus.FocusProperties.setExit(kotlin.jvm.functions.Function1<? super androidx.compose.ui.focus.FocusDirection,androidx.compose.ui.focus.FocusRequester> arg1) from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusRequester.Companion#Cancel:
- Removed property FocusRequester.Companion.Cancel from compatibility checked API surface
-BecameUnchecked: androidx.compose.ui.focus.FocusRequester.Companion#getCancel():
- Removed method androidx.compose.ui.focus.FocusRequester.Companion.getCancel() from compatibility checked API surface
+AddedMethod: androidx.compose.ui.layout.LayoutCoordinates#localPositionOf(androidx.compose.ui.layout.LayoutCoordinates, long, boolean):
+ Added method androidx.compose.ui.layout.LayoutCoordinates.localPositionOf(androidx.compose.ui.layout.LayoutCoordinates,long,boolean)
+AddedMethod: androidx.compose.ui.layout.LookaheadScope#localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates, long, boolean):
+ Added method androidx.compose.ui.layout.LookaheadScope.localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates,androidx.compose.ui.layout.LayoutCoordinates,long,boolean)
+
+
+RemovedMethod: androidx.compose.ui.layout.LayoutCoordinates#positionInMotionFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, long):
+ Removed method androidx.compose.ui.layout.LayoutCoordinates.positionInMotionFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates,long)
+RemovedMethod: androidx.compose.ui.layout.LookaheadScope#localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates, long):
+ Removed method androidx.compose.ui.layout.LookaheadScope.localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates,androidx.compose.ui.layout.LayoutCoordinates,long)
+RemovedMethod: androidx.compose.ui.layout.LookaheadScope#positionInMotionLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates, long):
+ Removed method androidx.compose.ui.layout.LookaheadScope.positionInMotionLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates,androidx.compose.ui.layout.LayoutCoordinates,long)
diff --git a/compose/ui/ui/api/restricted_current.txt b/compose/ui/ui/api/restricted_current.txt
index a0024b9..9ab5ea2 100644
--- a/compose/ui/ui/api/restricted_current.txt
+++ b/compose/ui/ui/api/restricted_current.txt
@@ -2176,7 +2176,7 @@
@kotlin.jvm.JvmDefaultWithCompatibility public interface LayoutCoordinates {
method public operator int get(androidx.compose.ui.layout.AlignmentLine alignmentLine);
- method public default boolean getIntroducesFrameOfReference();
+ method public default boolean getIntroducesMotionFrameOfReference();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentCoordinates();
method public androidx.compose.ui.layout.LayoutCoordinates? getParentLayoutCoordinates();
method public java.util.Set<androidx.compose.ui.layout.AlignmentLine> getProvidedAlignmentLines();
@@ -2184,15 +2184,15 @@
method public boolean isAttached();
method public androidx.compose.ui.geometry.Rect localBoundingBoxOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional boolean clipBounds);
method public long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
+ method public default long localPositionOf(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public long localToRoot(long relativeToLocal);
method public default long localToScreen(long relativeToLocal);
method public long localToWindow(long relativeToLocal);
- method public default long positionInLocalFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, long relativeToSource);
method public default long screenToLocal(long relativeToScreen);
method public default void transformFrom(androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, float[] matrix);
method public default void transformToScreen(float[] matrix);
method public long windowToLocal(long relativeToWindow);
- property public default boolean introducesFrameOfReference;
+ property public default boolean introducesMotionFrameOfReference;
property public abstract boolean isAttached;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentCoordinates;
property public abstract androidx.compose.ui.layout.LayoutCoordinates? parentLayoutCoordinates;
@@ -2271,8 +2271,7 @@
public interface LookaheadScope {
method public androidx.compose.ui.layout.LayoutCoordinates getLookaheadScopeCoordinates(androidx.compose.ui.layout.Placeable.PlacementScope);
- method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
- method public default long positionInLocalLookaheadFrameOfReference(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource);
+ method public default long localLookaheadPositionOf(androidx.compose.ui.layout.LayoutCoordinates, androidx.compose.ui.layout.LayoutCoordinates sourceCoordinates, optional long relativeToSource, optional boolean includeMotionFrameOfReference);
method public androidx.compose.ui.layout.LayoutCoordinates toLookaheadCoordinates(androidx.compose.ui.layout.LayoutCoordinates);
}
@@ -2426,7 +2425,7 @@
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, int x, int y, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, androidx.compose.ui.graphics.layer.GraphicsLayer layer, optional float zIndex);
method public final void placeWithLayer(androidx.compose.ui.layout.Placeable, long position, optional float zIndex, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.graphics.GraphicsLayerScope,kotlin.Unit> layerBlock);
- method public final void withCurrentFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
+ method public final void withMotionFrameOfReferencePlacement(kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Placeable.PlacementScope,kotlin.Unit> block);
property public androidx.compose.ui.layout.LayoutCoordinates? coordinates;
property protected abstract androidx.compose.ui.unit.LayoutDirection parentLayoutDirection;
property protected abstract int parentWidth;
diff --git a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/ApproachLayoutTest.kt b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/ApproachLayoutTest.kt
index 0e60e34..c726f15 100644
--- a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/ApproachLayoutTest.kt
+++ b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/ApproachLayoutTest.kt
@@ -874,7 +874,7 @@
.run {
layout(width, height) {
if (toggleDmp) {
- withCurrentFrameOfReferencePlacement {
+ withMotionFrameOfReferencePlacement {
place(0, 200)
}
} else {
@@ -895,9 +895,10 @@
positionExcludingDmp = it
.parentLayoutCoordinates!!
.toLookaheadCoordinates()
- .positionInLocalLookaheadFrameOfReference(
+ .localLookaheadPositionOf(
sourceCoordinates = it
.toLookaheadCoordinates(),
+ includeMotionFrameOfReference = false
)
}
placeable.place(0, 0)
diff --git a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt
index cc84701..1cf158d8 100644
--- a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt
+++ b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt
@@ -117,7 +117,7 @@
import org.junit.Test
import org.junit.runner.RunWith
-const val Debug = false
+private const val Debug = false
@MediumTest
@RunWith(AndroidJUnit4::class)
@@ -2750,8 +2750,9 @@
sourceCoordinates = coordinates!!,
)
val excludedPosition = parent
- .positionInLocalLookaheadFrameOfReference(
+ .localLookaheadPositionOf(
sourceCoordinates = coordinates!!,
+ includeMotionFrameOfReference = false,
)
positionToExcludedArray[i] =
position to excludedPosition
@@ -2828,8 +2829,9 @@
)
val excludedPosition = parent
- .positionInLocalLookaheadFrameOfReference(
+ .localLookaheadPositionOf(
sourceCoordinates = coordinates!!,
+ includeMotionFrameOfReference = false,
)
positionToExcludedArray[i] =
position to excludedPosition
@@ -2882,7 +2884,7 @@
val placeable = measurable.measure(constraints)
return layout(placeable.width, placeable.height) {
if (withDirectManipulation) {
- withCurrentFrameOfReferencePlacement {
+ withMotionFrameOfReferencePlacement {
placeable.place(0, offset.fastRoundToInt())
}
} else {
@@ -2922,8 +2924,9 @@
excludedManipulationPosition =
parentLookaheadCoords
- .positionInLocalLookaheadFrameOfReference(
+ .localLookaheadPositionOf(
sourceCoordinates = it,
+ includeMotionFrameOfReference = false,
)
}
)
@@ -2973,7 +2976,7 @@
layout(300, 300) {
placeableData.fastForEach { (placeable, offsetData) ->
if (offsetData.withDirectManipulation) {
- withCurrentFrameOfReferencePlacement {
+ withMotionFrameOfReferencePlacement {
placeable.place(0, offsetData.offset.fastRoundToInt())
}
} else {
@@ -3008,8 +3011,9 @@
excludedManipulationPositions[0] =
parentLookaheadCoords
- .positionInLocalLookaheadFrameOfReference(
+ .localLookaheadPositionOf(
sourceCoordinates = it,
+ includeMotionFrameOfReference = false,
)
}
)
@@ -3030,8 +3034,9 @@
excludedManipulationPositions[1] =
parentLookaheadCoords
- .positionInLocalLookaheadFrameOfReference(
- sourceCoordinates = it
+ .localLookaheadPositionOf(
+ sourceCoordinates = it,
+ includeMotionFrameOfReference = false,
)
}
)
@@ -3082,7 +3087,7 @@
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
if (placeWithDirectManipulation) {
- withCurrentFrameOfReferencePlacement {
+ withMotionFrameOfReferencePlacement {
placeable.place(0, 200)
}
} else {
@@ -3104,8 +3109,9 @@
sourceCoordinates = lookaheadCoordinates,
)
lookingAheadPositionExcludingDmp = lookaheadScopeCoordinates
- .positionInLocalLookaheadFrameOfReference(
- sourceCoordinates = lookaheadCoordinates
+ .localLookaheadPositionOf(
+ sourceCoordinates = lookaheadCoordinates,
+ includeMotionFrameOfReference = false,
)
}
placeable.place(0, 0)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutCoordinates.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutCoordinates.kt
index ba1f7d5..309a44a 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutCoordinates.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutCoordinates.kt
@@ -58,29 +58,27 @@
val isAttached: Boolean
/**
- * By default, most [LayoutCoordinates] introduce a new frame of reference. In this context, a
- * frame of reference defines a point of hierarchical change, where other [LayoutCoordinates]
- * are positioned against.
- *
- * However, there are some layouts that may visually change the frame of reference, but not
- * hierarchically, such as Scroll. These Layouts should place their children using
- * [Placeable.PlacementScope.withCurrentFrameOfReferencePlacement].
+ * Indicates whether the corresponding Layout is expected to change its [Offset] in small
+ * increments (such as when its parent is a `Scroll`).
*
* In those situations, the corresponding placed [LayoutCoordinates] will have their
- * [introducesFrameOfReference] return false.
+ * [introducesMotionFrameOfReference] return `true`.
*
- * You may then use [positionInLocalFrameOfReference] to query a layout's position such that it
- * excludes all Offset that do not introduce a frame of reference.
+ * Custom Layouts that are expected to have similar behaviors should place their children using
+ * [Placeable.PlacementScope.withMotionFrameOfReferencePlacement].
+ *
+ * You may then use [localPositionOf] with `includeMotionFrameOfReference = false` to query a
+ * Layout's position such that it excludes all [Offset] introduced by those Layouts.
*
* This is typically helpful when deciding when to animate an [approachLayout] using
- * [LookaheadScope] coordinates. As you probably don't want to consider positional changes that
- * don't affect the layout hierarchy.
+ * [LookaheadScope] coordinates. As you probably don't want to trigger animations on small
+ * positional increments.
*
- * @see Placeable.PlacementScope.withCurrentFrameOfReferencePlacement
- * @see positionInLocalFrameOfReference
+ * @see Placeable.PlacementScope.withMotionFrameOfReferencePlacement
+ * @see localPositionOf
*/
@Suppress("GetterSetterNames") // Preferred name
- val introducesFrameOfReference: Boolean get() = true
+ val introducesMotionFrameOfReference: Boolean get() = false
/**
* Converts [relativeToScreen] relative to the device's screen's origin into an [Offset]
@@ -115,22 +113,35 @@
* Converts an [relativeToSource] in [sourceCoordinates] space into local coordinates.
* [sourceCoordinates] may be any [LayoutCoordinates] that belong to the same
* compose layout hierarchy.
+ *
+ * By default, includes the [Offset] when [introducesMotionFrameOfReference] is `true`. But you
+ * may exclude it from the calculation by using the overload that takes
+ * `includeMotionFrameOfReference` and passing it as `false`.
*/
- fun localPositionOf(sourceCoordinates: LayoutCoordinates, relativeToSource: Offset): Offset
+ fun localPositionOf(
+ sourceCoordinates: LayoutCoordinates,
+ relativeToSource: Offset
+ ): Offset
/**
- * Converts an [relativeToSource] in [sourceCoordinates] space into local coordinates, such that
- * the offset introduced on [LayoutCoordinates] where [introducesFrameOfReference] is false is
- * excluded.
+ * Converts an [relativeToSource] in [sourceCoordinates] space into local coordinates.
+ * [sourceCoordinates] may be any [LayoutCoordinates] that belong to the same
+ * compose layout hierarchy.
*
- * @see Placeable.PlacementScope.withCurrentFrameOfReferencePlacement
+ * Use [includeMotionFrameOfReference] to decide whether to include the [Offset] of any
+ * `LayoutCoordinate` that returns `true` in the [includeMotionFrameOfReference] flag.
+ *
+ * In other words, passing [includeMotionFrameOfReference] as `false`, returns a calculation
+ * that excludes the [Offset] set from Layouts that place their children using
+ * [Placeable.PlacementScope.withMotionFrameOfReferencePlacement].
*/
- fun positionInLocalFrameOfReference(
+ fun localPositionOf(
sourceCoordinates: LayoutCoordinates,
- relativeToSource: Offset,
+ relativeToSource: Offset = Offset.Zero,
+ includeMotionFrameOfReference: Boolean = true
): Offset {
throw UnsupportedOperationException(
- "positionInLocalFrameOfReference is not implemented on this LayoutCoordinates"
+ "localPositionOf is not implemented on this LayoutCoordinates"
)
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadLayoutCoordinates.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadLayoutCoordinates.kt
index 639920d..86e1054 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadLayoutCoordinates.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadLayoutCoordinates.kt
@@ -55,8 +55,8 @@
override val isAttached: Boolean
get() = coordinator.isAttached
- override val introducesFrameOfReference: Boolean
- get() = !lookaheadDelegate.isPlacedUsingCurrentFrameOfReference
+ override val introducesMotionFrameOfReference: Boolean
+ get() = lookaheadDelegate.isPlacedUnderMotionFrameOfReference
private val lookaheadOffset: Offset
get() = lookaheadDelegate.rootLookaheadDelegate.let {
@@ -82,33 +82,16 @@
override fun localPositionOf(
sourceCoordinates: LayoutCoordinates,
relativeToSource: Offset
- ): Offset =
- localPositionOf(
- sourceCoordinates = sourceCoordinates,
- relativeToSource = relativeToSource,
- excludeDirectManipulationOffset = false
- )
-
- override fun positionInLocalFrameOfReference(
- sourceCoordinates: LayoutCoordinates,
- relativeToSource: Offset
): Offset = localPositionOf(
sourceCoordinates = sourceCoordinates,
relativeToSource = relativeToSource,
- excludeDirectManipulationOffset = true
+ includeMotionFrameOfReference = true
)
- /**
- * Handles local position calculation.
- *
- * Pass [excludeDirectManipulationOffset] as true, to exclude offsets placed under
- * [Placeable.PlacementScope.withCurrentFrameOfReferencePlacement]. It's expected to be true for
- * calls coming from [positionInLocalFrameOfReference].
- */
- internal fun localPositionOf(
+ override fun localPositionOf(
sourceCoordinates: LayoutCoordinates,
relativeToSource: Offset,
- excludeDirectManipulationOffset: Boolean
+ includeMotionFrameOfReference: Boolean
): Offset {
if (sourceCoordinates is LookaheadLayoutCoordinates) {
val source = sourceCoordinates.lookaheadDelegate
@@ -119,12 +102,12 @@
// Common ancestor is in lookahead
val sourceInCommonAncestor = source.positionIn(
ancestor = ancestor,
- excludingAgnosticOffset = excludeDirectManipulationOffset
+ excludingAgnosticOffset = !includeMotionFrameOfReference
) + relativeToSource.round()
val lookaheadPosInAncestor = lookaheadDelegate.positionIn(
ancestor = ancestor,
- excludingAgnosticOffset = excludeDirectManipulationOffset
+ excludingAgnosticOffset = !includeMotionFrameOfReference
)
(sourceInCommonAncestor - lookaheadPosInAncestor).toOffset()
@@ -134,13 +117,13 @@
val sourcePosition = source.positionIn(
ancestor = sourceRoot,
- excludingAgnosticOffset = excludeDirectManipulationOffset
+ excludingAgnosticOffset = !includeMotionFrameOfReference
) + sourceRoot.position + relativeToSource.round()
val rootDelegate = lookaheadDelegate.rootLookaheadDelegate
val lookaheadPosition = lookaheadDelegate.positionIn(
ancestor = rootDelegate,
- excludingAgnosticOffset = excludeDirectManipulationOffset
+ excludingAgnosticOffset = !includeMotionFrameOfReference
) + rootDelegate.position
val relativePosition = (sourcePosition - lookaheadPosition).toOffset()
@@ -148,7 +131,7 @@
rootDelegate.coordinator.wrappedBy!!.localPositionOf(
sourceCoordinates = sourceRoot.coordinator.wrappedBy!!,
relativeToSource = relativePosition,
- excludeDirectManipulationOffset = excludeDirectManipulationOffset
+ includeMotionFrameOfReference = includeMotionFrameOfReference
)
}
} else {
@@ -160,20 +143,14 @@
val localLookaheadPos = localPositionOf(
sourceCoordinates = rootDelegate.lookaheadLayoutCoordinates,
relativeToSource = relativeToSource,
- excludeDirectManipulationOffset = excludeDirectManipulationOffset
+ includeMotionFrameOfReference = includeMotionFrameOfReference
)
- val localPos = if (excludeDirectManipulationOffset) {
- rootDelegate.coordinator.coordinates.positionInLocalFrameOfReference(
- sourceCoordinates = sourceCoordinates,
- relativeToSource = Offset.Zero,
- )
- } else {
- rootDelegate.coordinator.coordinates.localPositionOf(
- sourceCoordinates = sourceCoordinates,
- relativeToSource = Offset.Zero
- )
- }
+ val localPos = rootDelegate.coordinator.coordinates.localPositionOf(
+ sourceCoordinates = sourceCoordinates,
+ relativeToSource = Offset.Zero,
+ includeMotionFrameOfReference = includeMotionFrameOfReference
+ )
return localLookaheadPos + localPos
}
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt
index 66efabf..fe25ec8 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt
@@ -215,54 +215,31 @@
* [toLookaheadCoordinates], and 2) invoking [LayoutCoordinates.localPositionOf] with the
* converted coordinates.
*
- * For layouts where [LayoutCoordinates.introducesFrameOfReference] returns false (placed under
- * [Placeable.PlacementScope.withCurrentFrameOfReferencePlacement]) you may use
- * [positionInLocalLookaheadFrameOfReference] to get their position while excluding the
+ * For layouts where [LayoutCoordinates.introducesMotionFrameOfReference] returns `true` (placed
+ * under [Placeable.PlacementScope.withMotionFrameOfReferencePlacement]) you may pass
+ * [includeMotionFrameOfReference] as `false` to get their position while excluding the
* additional Offset.
*/
fun LayoutCoordinates.localLookaheadPositionOf(
sourceCoordinates: LayoutCoordinates,
relativeToSource: Offset = Offset.Zero,
+ includeMotionFrameOfReference: Boolean = true,
): Offset = localLookaheadPositionOf(
coordinates = this,
sourceCoordinates = sourceCoordinates,
relativeToSource = relativeToSource,
- excludeDirectManipulationOffset = false
- )
-
- /**
- * Similar to [localLookaheadPositionOf], converts [relativeToSource] in [sourceCoordinates]'s
- * lookahead coordinate space into local lookahead coordinates.
- *
- * However, the Offset introduced on [LayoutCoordinates] when their
- * [LayoutCoordinates.introducesFrameOfReference] property is false, will be excluded from the
- * calculation.
- *
- * Those [LayoutCoordinates] correspond to when they are placed by their parent under
- * [Placeable.PlacementScope.withCurrentFrameOfReferencePlacement], which is typically done by
- * Layouts that change their children positioning without affecting the overall hierarchy, or
- * they do so in small increments (such as Scroll).
- */
- fun LayoutCoordinates.positionInLocalLookaheadFrameOfReference(
- sourceCoordinates: LayoutCoordinates,
- relativeToSource: Offset = Offset.Zero,
- ): Offset = localLookaheadPositionOf(
- coordinates = this,
- sourceCoordinates = sourceCoordinates,
- relativeToSource = relativeToSource,
- excludeDirectManipulationOffset = true
+ includeMotionFrameOfReference = includeMotionFrameOfReference
)
}
/**
- * Internal implementation to handle [LookaheadScope.localLookaheadPositionOf] and
- * [LookaheadScope.positionInLocalLookaheadFrameOfReference].
+ * Internal implementation to handle [LookaheadScope.localLookaheadPositionOf].
*/
internal fun LookaheadScope.localLookaheadPositionOf(
coordinates: LayoutCoordinates,
sourceCoordinates: LayoutCoordinates,
relativeToSource: Offset,
- excludeDirectManipulationOffset: Boolean
+ includeMotionFrameOfReference: Boolean
): Offset {
val lookaheadCoords = coordinates.toLookaheadCoordinates()
val source = sourceCoordinates.toLookaheadCoordinates()
@@ -271,27 +248,21 @@
lookaheadCoords.localPositionOf(
sourceCoordinates = source,
relativeToSource = relativeToSource,
- excludeDirectManipulationOffset = excludeDirectManipulationOffset
+ includeMotionFrameOfReference = includeMotionFrameOfReference
)
} else if (source is LookaheadLayoutCoordinates) {
// Relative from source, so we take its negative position
-source.localPositionOf(
sourceCoordinates = lookaheadCoords,
relativeToSource = relativeToSource,
- excludeDirectManipulationOffset = excludeDirectManipulationOffset
+ includeMotionFrameOfReference = includeMotionFrameOfReference
)
} else {
- if (excludeDirectManipulationOffset) {
- lookaheadCoords.positionInLocalFrameOfReference(
- sourceCoordinates = source,
- relativeToSource = relativeToSource
- )
- } else {
- lookaheadCoords.localPositionOf(
- sourceCoordinates = lookaheadCoords,
- relativeToSource = relativeToSource
- )
- }
+ lookaheadCoords.localPositionOf(
+ sourceCoordinates = lookaheadCoords,
+ relativeToSource = relativeToSource,
+ includeMotionFrameOfReference = includeMotionFrameOfReference
+ )
}
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt
index 1e5f977..4638212 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt
@@ -18,8 +18,8 @@
import androidx.compose.ui.graphics.GraphicsLayerScope
import androidx.compose.ui.graphics.layer.GraphicsLayer
-import androidx.compose.ui.node.FrameOfReferencePlacementDelegate
import androidx.compose.ui.node.LookaheadCapablePlaceable
+import androidx.compose.ui.node.MotionReferencePlacementDelegate
import androidx.compose.ui.node.Owner
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.IntOffset
@@ -483,7 +483,7 @@
zIndex: Float,
noinline layerBlock: (GraphicsLayerScope.() -> Unit)?,
) {
- handleDirectManipulationPlacement()
+ handleMotionFrameOfReferencePlacement()
placeAt(position + apparentToRealOffset, zIndex, layerBlock)
}
@@ -493,7 +493,7 @@
zIndex: Float,
layer: GraphicsLayer
) {
- handleDirectManipulationPlacement()
+ handleMotionFrameOfReferencePlacement()
placeAt(position + apparentToRealOffset, zIndex, layer)
}
@@ -501,37 +501,37 @@
* Internal indicator to know when to tag [Placeable] as placed on the same frame of
* reference.
*/
- private var currentFrameOfReferencePlacement: Boolean = false
+ private var motionFrameOfReferencePlacement: Boolean = false
/**
* Placement done under [block], will have their [Placeable] placed on the same frame of
* reference as the current layout.
*
* In [LayoutCoordinates], this means that the offset introduced under [block] may be
- * excluded when calculating positions. See
- * [LayoutCoordinates.positionInLocalFrameOfReference].
+ * excluded when calculating positions by passing `includeMotionFrameOfReference = false` in
+ * [LayoutCoordinates.localPositionOf].
*
* Excluding the position set by certain layouts can be helpful to trigger lookahead based
* animation when intended. The typical case are layouts that change frequently due to a
* provided value, like [scroll][androidx.compose.foundation.verticalScroll].
*/
- fun withCurrentFrameOfReferencePlacement(block: PlacementScope.() -> Unit) {
- currentFrameOfReferencePlacement = true
+ fun withMotionFrameOfReferencePlacement(block: PlacementScope.() -> Unit) {
+ motionFrameOfReferencePlacement = true
block()
- currentFrameOfReferencePlacement = false
+ motionFrameOfReferencePlacement = false
}
/**
- * Updates the [FrameOfReferencePlacementDelegate.isPlacedUsingCurrentFrameOfReference] flag when called
- * a [Placeable] is placed under [withCurrentFrameOfReferencePlacement].
+ * Updates the [MotionReferencePlacementDelegate.isPlacedUnderMotionFrameOfReference] flag
+ * when called a [Placeable] is placed under [withMotionFrameOfReferencePlacement].
*
* Note that the Main/Lookahead pass delegate are expected to propagate the flag to the
* proper [LookaheadCapablePlaceable].
*/
- private fun Placeable.handleDirectManipulationPlacement() {
- if (this is FrameOfReferencePlacementDelegate) {
- this.isPlacedUsingCurrentFrameOfReference =
- [email protected]
+ private fun Placeable.handleMotionFrameOfReferencePlacement() {
+ if (this is MotionReferencePlacementDelegate) {
+ this.isPlacedUnderMotionFrameOfReference =
+ [email protected]
}
}
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeLayoutDelegate.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeLayoutDelegate.kt
index 9378bdc..356324c 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeLayoutDelegate.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeLayoutDelegate.kt
@@ -339,7 +339,7 @@
* actual measure/layout pass.
*/
inner class MeasurePassDelegate : Measurable, Placeable(), AlignmentLinesOwner,
- FrameOfReferencePlacementDelegate {
+ MotionReferencePlacementDelegate {
/**
* Is true during [replace] invocation. Helps to differentiate between the cases when our
* parent is measuring us during the measure block, and when we are remeasured individually
@@ -773,16 +773,16 @@
* Flag to indicate when we need to propagate coordinates updates that are not related to a
* position change.
*
- * @see isPlacedUsingCurrentFrameOfReference
+ * @see isPlacedUnderMotionFrameOfReference
*/
private var needsCoordinatesUpdate = false
- override var isPlacedUsingCurrentFrameOfReference: Boolean = false
+ override var isPlacedUnderMotionFrameOfReference: Boolean = false
set(new) {
// Delegated to outerCoordinator
- val old = outerCoordinator.isPlacedUsingCurrentFrameOfReference
+ val old = outerCoordinator.isPlacedUnderMotionFrameOfReference
if (new != old) {
- outerCoordinator.isPlacedUsingCurrentFrameOfReference = old
+ outerCoordinator.isPlacedUnderMotionFrameOfReference = old
// Affects coordinates measurements
this.needsCoordinatesUpdate = true
}
@@ -1124,7 +1124,7 @@
* the lookahead pass.
*/
inner class LookaheadPassDelegate : Placeable(), Measurable, AlignmentLinesOwner,
- FrameOfReferencePlacementDelegate {
+ MotionReferencePlacementDelegate {
/**
* Is true during [replace] invocation. Helps to differentiate between the cases when our
@@ -1458,12 +1458,12 @@
placeSelf(position, zIndex, null, layer)
}
- override var isPlacedUsingCurrentFrameOfReference: Boolean = false
+ override var isPlacedUnderMotionFrameOfReference: Boolean = false
set(new) {
// Delegated to outerCoordinator
- val old = outerCoordinator.lookaheadDelegate?.isPlacedUsingCurrentFrameOfReference
+ val old = outerCoordinator.lookaheadDelegate?.isPlacedUnderMotionFrameOfReference
if (new != old) {
- outerCoordinator.lookaheadDelegate?.isPlacedUsingCurrentFrameOfReference = new
+ outerCoordinator.lookaheadDelegate?.isPlacedUnderMotionFrameOfReference = new
}
field = new
}
@@ -1935,23 +1935,23 @@
/**
* Interface for layout delegates, so that they can set the
- * [LookaheadCapablePlaceable.isPlacedUsingCurrentFrameOfReference] to the proper placeable.
+ * [LookaheadCapablePlaceable.isPlacedUnderMotionFrameOfReference] to the proper placeable.
*/
-internal interface FrameOfReferencePlacementDelegate {
+internal interface MotionReferencePlacementDelegate {
/**
* Called when a layout is about to be placed.
*
* The corresponding [LookaheadCapablePlaceable] should have their
- * [LookaheadCapablePlaceable.isPlacedUsingCurrentFrameOfReference] flag updated to the given
+ * [LookaheadCapablePlaceable.isPlacedUnderMotionFrameOfReference] flag updated to the given
* value.
*
* The placeable should be tagged such that its corresponding coordinates reflect the
- * flag in [androidx.compose.ui.layout.LayoutCoordinates.introducesFrameOfReference]. Note that
+ * flag in [androidx.compose.ui.layout.LayoutCoordinates.introducesMotionFrameOfReference]. Note that
* when it's placed on the current frame of reference, it means it doesn't introduce a new frame
* of reference.
*
* This also means that coordinates consumers (onPlaced readers) are expected to be updated.
*/
- var isPlacedUsingCurrentFrameOfReference: Boolean
+ var isPlacedUnderMotionFrameOfReference: Boolean
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LookaheadDelegate.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LookaheadDelegate.kt
index e6d5e54..71f265d 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LookaheadDelegate.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LookaheadDelegate.kt
@@ -43,7 +43,7 @@
* functionalities between the two are extracted here.
*/
internal abstract class LookaheadCapablePlaceable : Placeable(), MeasureScopeWithLayoutNode,
- FrameOfReferencePlacementDelegate {
+ MotionReferencePlacementDelegate {
abstract val position: IntOffset
abstract val child: LookaheadCapablePlaceable?
abstract val parent: LookaheadCapablePlaceable?
@@ -53,12 +53,12 @@
private var _rulerScope: RulerScope? = null
/**
- * Indicates whether the [Placeable] was placed on the same frame of reference.
+ * Indicates whether the [Placeable] was placed under a motion frame of reference.
*
- * This means, that its offset may be ignored with
- * [LookaheadLayoutCoordinates.positionInLocalFrameOfReference].
+ * This means, that its offset may be excluded from calculation with
+ * `includeMotionFrameOfReference = false` in [LookaheadLayoutCoordinates.localPositionOf].
*/
- override var isPlacedUsingCurrentFrameOfReference: Boolean = false
+ override var isPlacedUnderMotionFrameOfReference: Boolean = false
val rulerScope: RulerScope
get() {
@@ -479,7 +479,7 @@
var aggregatedOffset = IntOffset.Zero
var lookaheadDelegate = this
while (lookaheadDelegate != ancestor) {
- if (!lookaheadDelegate.isPlacedUsingCurrentFrameOfReference ||
+ if (!lookaheadDelegate.isPlacedUnderMotionFrameOfReference ||
!excludingAgnosticOffset) {
aggregatedOffset += lookaheadDelegate.position
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt
index 9c8e0c8..dd3720d 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt
@@ -85,8 +85,8 @@
override val coordinates: LayoutCoordinates
get() = this
- override val introducesFrameOfReference: Boolean
- get() = !isPlacedUsingCurrentFrameOfReference
+ override val introducesMotionFrameOfReference: Boolean
+ get() = isPlacedUnderMotionFrameOfReference
private var released = false
@@ -847,27 +847,23 @@
override fun localPositionOf(
sourceCoordinates: LayoutCoordinates,
relativeToSource: Offset
- ): Offset = localPositionOf(sourceCoordinates, relativeToSource, false)
+ ): Offset = localPositionOf(
+ sourceCoordinates = sourceCoordinates,
+ relativeToSource = relativeToSource,
+ includeMotionFrameOfReference = true
+ )
- override fun positionInLocalFrameOfReference(
- sourceCoordinates: LayoutCoordinates,
- relativeToSource: Offset
- ): Offset = localPositionOf(sourceCoordinates, relativeToSource, true)
-
- /**
- * Common call
- */
- internal fun localPositionOf(
+ override fun localPositionOf(
sourceCoordinates: LayoutCoordinates,
relativeToSource: Offset,
- excludeDirectManipulationOffset: Boolean
+ includeMotionFrameOfReference: Boolean
): Offset {
if (sourceCoordinates is LookaheadLayoutCoordinates) {
sourceCoordinates.coordinator.onCoordinatesUsed()
return -sourceCoordinates.localPositionOf(
sourceCoordinates = this,
relativeToSource = -relativeToSource,
- excludeDirectManipulationOffset = excludeDirectManipulationOffset
+ includeMotionFrameOfReference = includeMotionFrameOfReference
)
}
@@ -878,11 +874,11 @@
var position = relativeToSource
var coordinator = nodeCoordinator
while (coordinator !== commonAncestor) {
- position = coordinator.toParentPosition(position, excludeDirectManipulationOffset)
+ position = coordinator.toParentPosition(position, includeMotionFrameOfReference)
coordinator = coordinator.wrappedBy!!
}
- return ancestorToLocal(commonAncestor, position, excludeDirectManipulationOffset)
+ return ancestorToLocal(commonAncestor, position, includeMotionFrameOfReference)
}
override fun transformFrom(sourceCoordinates: LayoutCoordinates, matrix: Matrix) {
@@ -965,18 +961,18 @@
private fun ancestorToLocal(
ancestor: NodeCoordinator,
offset: Offset,
- excludeDirectManipulationOffset: Boolean,
+ includeMotionFrameOfReference: Boolean,
): Offset {
if (ancestor === this) {
return offset
}
val wrappedBy = wrappedBy
if (wrappedBy == null || ancestor == wrappedBy) {
- return fromParentPosition(offset, excludeDirectManipulationOffset)
+ return fromParentPosition(offset, includeMotionFrameOfReference)
}
return fromParentPosition(
- position = wrappedBy.ancestorToLocal(ancestor, offset, excludeDirectManipulationOffset),
- excludeDirectManipulationOffset = excludeDirectManipulationOffset
+ position = wrappedBy.ancestorToLocal(ancestor, offset, includeMotionFrameOfReference),
+ includeMotionFrameOfReference = includeMotionFrameOfReference
)
}
@@ -1018,11 +1014,11 @@
*/
open fun toParentPosition(
position: Offset,
- excludeDirectManipulationOffset: Boolean = false
+ includeMotionFrameOfReference: Boolean = true
): Offset {
val layer = layer
val targetPosition = layer?.mapOffset(position, inverse = false) ?: position
- return if (excludeDirectManipulationOffset && isPlacedUsingCurrentFrameOfReference) {
+ return if (!includeMotionFrameOfReference && isPlacedUnderMotionFrameOfReference) {
targetPosition
} else {
targetPosition + this.position
@@ -1035,10 +1031,10 @@
*/
open fun fromParentPosition(
position: Offset,
- excludeDirectManipulationOffset: Boolean = false
+ includeMotionFrameOfReference: Boolean = true
): Offset {
val relativeToPosition =
- if (excludeDirectManipulationOffset && isPlacedUsingCurrentFrameOfReference) {
+ if (!includeMotionFrameOfReference && this.isPlacedUnderMotionFrameOfReference) {
position
} else {
position - this.position
diff --git a/wear/compose/compose-material/build.gradle b/wear/compose/compose-material/build.gradle
index 605c830..c5be843 100644
--- a/wear/compose/compose-material/build.gradle
+++ b/wear/compose/compose-material/build.gradle
@@ -46,6 +46,9 @@
implementation("androidx.profileinstaller:profileinstaller:1.3.1")
implementation("androidx.lifecycle:lifecycle-common:2.7.0")
+ // This :foundation dependency can be removed once the material libraries are updated to use
+ // 1.7.0 stable.
+ androidTestImplementation(project(":compose:foundation:foundation"))
androidTestImplementation(project(":compose:ui:ui-test"))
androidTestImplementation(project(":compose:ui:ui-test-junit4"))
androidTestImplementation(project(":compose:test-utils"))