ActivitySpace
public final class ActivitySpace extends SpaceEntity
| java.lang.Object | ||||
| ↳ | androidx.xr.scenecore.BaseScenePose | |||
| ↳ | androidx.xr.scenecore.Entity | |||
| ↳ | androidx.xr.scenecore.SpaceEntity | |||
| ↳ | androidx.xr.scenecore.ActivitySpace |
ActivitySpace is a SpaceEntity used to track the system-managed pose and boundary of the volume associated with a spatialized Activity. The Application cannot directly control this volume, but the system might update it in response to the User moving it or entering or exiting Full Space Mode.
Summary
Public methods |
|
|---|---|
final void |
addBoundsChangedListener(@NonNull Consumer<@NonNull FloatSize3d> listener)Adds the given |
final void |
addBoundsChangedListener(Adds the given |
final void |
addOriginChangedListener(@NonNull Runnable listener)Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event. |
final void |
addOriginChangedListener(Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event. |
final @NonNull FloatSize3d |
The current bounds of this ActivitySpace. |
final @NonNull BoundingBox |
A recommended box for content to be placed in when in Full Space. |
final void |
removeBoundsChangedListener(Releases the given |
final void |
removeOriginChangedListener(@NonNull Runnable listener)Removes the previously-added listener. |
Inherited methods |
||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
Public methods
addBoundsChangedListener
public final void addBoundsChangedListener(@NonNull Consumer<@NonNull FloatSize3d> listener)
Adds the given Consumer as a listener to be invoked when this ActivitySpace's current boundary changes.
Consumer.accept will be invoked on the main thread.
| Parameters | |
|---|---|
@NonNull Consumer<@NonNull FloatSize3d> listener |
The Consumer to be invoked when this ActivitySpace's current boundary changes. |
addBoundsChangedListener
public final void addBoundsChangedListener(
@NonNull Executor callbackExecutor,
@NonNull Consumer<@NonNull FloatSize3d> listener
)
Adds the given Consumer as a listener to be invoked when this ActivitySpace's current boundary changes.
Consumer.accept will be invoked on the given executor.
addOriginChangedListener
public final void addOriginChangedListener(@NonNull Runnable listener)
Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event.
When this event occurs, any ScenePose that is not a child of ActivitySpace, such as AnchorSpace, will have a different position relative to the ActivitySpace. Therefore, this listener can be used to indicate when to invalidate any cached information about the relative difference in Pose between ActivitySpace's children and children of non-ActivitySpace ScenePoses.
The callback will be made on the SceneCore executor.
addOriginChangedListener
public final void addOriginChangedListener(
@NonNull Executor executor,
@NonNull Runnable listener
)
Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event.
When this event occurs, any ScenePose that is not a child of ActivitySpace, such as AnchorSpace, will have a different position relative to the ActivitySpace. Therefore, this listener can be used to indicate when to invalidate any cached information about the relative difference in Pose between ActivitySpace's children and children of non-ActivitySpace ScenePoses.
getBounds
public final @NonNull FloatSize3d getBounds()
The current bounds of this ActivitySpace.
getRecommendedContentBoxInFullSpace
public final @NonNull BoundingBox getRecommendedContentBoxInFullSpace()
A recommended box for content to be placed in when in Full Space.
The recommended content box is a static 3D volume that uses the device's field of view (FOV) angles, the system's default launch distance from the user, and the default scale of the system to calculate a box size that is sized to encompass the user's primary field of view.
This size does not change throughout the lifecycle of the application. Furthermore, the recommended content box does not have an independent concept of pose; its position is defined by the origin of this ActivitySpace.
The box is relative to the ActivitySpace's coordinate system. It is not scaled by the ActivitySpace's transform. The dimensions are always in meters. This provides a device-specific default volume that developers can use to size their content appropriately.
removeBoundsChangedListener
public final void removeBoundsChangedListener(
@NonNull Consumer<@NonNull FloatSize3d> listener
)
Releases the given Consumer from receiving updates when the ActivitySpace's boundary changes.
All listeners are automatically removed when the ActivitySpace is disposed even if this method is not explicitly called.
| Parameters | |
|---|---|
@NonNull Consumer<@NonNull FloatSize3d> listener |
The Consumer to be removed from receiving updates. |
removeOriginChangedListener
public final void removeOriginChangedListener(@NonNull Runnable listener)
Removes the previously-added listener.
All listeners are automatically removed when the ActivitySpace is disposed even if this method is not explicitly called.