FakeActivitySpace


public final class FakeActivitySpace extends FakeSystemSpaceEntity


Test-only implementation of ActivitySpace

Summary

Public constructors

Public methods

void

Adds a listener to be called when the bounds of the primary Activity change.

@NonNull Dimensions

Returns the bounds of this ActivitySpace.

@NonNull ListenableFuture<@NonNull HitTestResult>
hitTestRelativeToActivityPose(
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    int hitTestFilter,
    @NonNull ActivityPose activityPose
)

Creates a hit test at the from the specified origin in the specified direction into the scene.

void

Removes a listener to be called when the bounds of the primary Activity change.

Public constructors

FakeActivitySpace

Added in 1.0.0-alpha04
public FakeActivitySpace()

Public methods

addOnBoundsChangedListener

Added in 1.0.0-alpha04
public void addOnBoundsChangedListener(
    @NonNull ActivitySpace.OnBoundsChangedListener listener
)

Adds a listener to be called when the bounds of the primary Activity change. If the same listener is added multiple times, it will only fire each event on time.

Parameters
@NonNull ActivitySpace.OnBoundsChangedListener listener

The listener to register.

getBounds

Added in 1.0.0-alpha04
public @NonNull Dimensions getBounds()

Returns the bounds of this ActivitySpace.

hitTestRelativeToActivityPose

Added in 1.0.0-alpha04
public @NonNull ListenableFuture<@NonNull HitTestResulthitTestRelativeToActivityPose(
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    int hitTestFilter,
    @NonNull ActivityPose activityPose
)

Creates a hit test at the from the specified origin in the specified direction into the scene.

Parameters
@NonNull Vector3 origin

The translation of the origin of the hit test relative to this ActivityPose.

@NonNull Vector3 direction

The direction for the hit test ray from the ActivityPose.

int hitTestFilter

The scenes that will be in range for the hit test.

@NonNull ActivityPose activityPose

The ActivityPose to hit test against.

Returns
@NonNull ListenableFuture<@NonNull HitTestResult>

a {@code ListenableFuture}. The HitResult describes if it hit something and where relative to the given ActivityPose. Listeners will be called on the main thread if Runnable::run is supplied.

removeOnBoundsChangedListener

Added in 1.0.0-alpha04
public void removeOnBoundsChangedListener(
    @NonNull ActivitySpace.OnBoundsChangedListener listener
)

Removes a listener to be called when the bounds of the primary Activity change. If the given listener was not added, this call does nothing.

Parameters
@NonNull ActivitySpace.OnBoundsChangedListener listener

The listener to unregister.