BasePanelEntity


public sealed class BasePanelEntity<RtPanelEntityType extends PanelEntity> extends BaseEntity

Known direct subclasses
PanelEntity

PanelEntity creates a spatial panel in Android XR.

Known indirect subclasses
ActivityPanelEntity

ActivityPanelEntity creates a spatial panel for embedding an Activity in Android XR.


Provides implementations for common Panel functionality.

Summary

Protected constructors

<RtPanelEntityType extends PanelEntity> BasePanelEntity(
    @NonNull RtPanelEntityType rtPanelEntity,
    @NonNull EntityManager entityManager
)

Public methods

final float

Gets the corner radius of this PanelEntity in meters.

final @NonNull Vector3

This method is deprecated. This api will be removed in a future release.

final @NonNull Dimensions

Returns the dimensions in local space, in unscaled meters for this panel entity.

final @NonNull PixelDimensions

Returns the dimensions in Pixels for this panel entity.

final void
setCornerRadius(float radius)

Sets the corner radius of the PanelEntity.

final void
setSize(@NonNull Dimensions dimensions)

Sets the size in meters for the surface on which the View is laid out.

final void

Sets the size in pixels for the surface on which the view is laid out.

Inherited methods

From androidx.xr.scenecore.ActivityPose
abstract @NonNull Pose

Returns the activity space pose for this ActivityPose.

abstract @NonNull ListenableFuture<@NonNull HitTestResult>
hitTestAsync(@NonNull Vector3 origin, @NonNull Vector3 direction)

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

abstract @NonNull ListenableFuture<@NonNull HitTestResult>
hitTestAsync(
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    @ActivityPose.HitTestFilterValue int hitTestFilter
)

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

abstract @NonNull Pose

Returns a pose relative to this ActivityPose transformed into a pose relative to the destination.

From androidx.xr.scenecore.BaseEntity
void

Sets an Entity to be represented in this coordinate space.

boolean

Adds a Component to this Entity.

void

Disposes of any system resources held by this Entity, and transitively calls dispose() on all its children.

float
getAlpha(int relativeTo)

Returns the alpha transparency set for this Entity, relative to given space.

@NonNull List<@NonNull Component>

Retrieves all components attached to this Entity.

@NonNull List<@NonNull T>

Retrieves all Components of the given type T and its sub-types attached to this Entity.

Entity

Returns the parent of this Entity.

@NonNull Pose
getPose(int relativeTo)

Returns the pose for this entity, relative to the provided space.

float
getScale(int relativeTo)

Returns the scale of this entity, relative to given space.

boolean
isHidden(boolean includeParents)

Returns the hidden status of this Entity.

void

Remove all components from this Entity.

void

Removes the given Component from this Entity.

void
setAlpha(float alpha, int relativeTo)

Sets the alpha transparency of the Entity relative to given space.

void

Sets alternate text for this entity to be consumed by Accessibility systems.

void
setHidden(boolean hidden)

Sets the local hidden state of this Entity.

void
setParent(Entity parent)

Sets this Entity to be represented in the parent's coordinate space.

void
setPose(@NonNull Pose pose, int relativeTo)

Sets the pose for this Entity.

void
setScale(float scale, int relativeTo)

Sets the scale of this entity relative to given space.

From androidx.xr.scenecore.Entity
float

Returns the alpha transparency set for this Entity.

@NonNull Pose

Returns the pose for this entity, relative to its parent.

float

Returns the local scale of this entity, not inclusive of the parent's scale.

void
setAlpha(float alpha)

Sets the alpha transparency of the Entity and its children.

void

Sets the pose for this Entity, relative to its parent.

void
setScale(float scale)

Sets the scale of this entity relative to its parent.

Protected constructors

BasePanelEntity

protected <RtPanelEntityType extends PanelEntity> BasePanelEntity(
    @NonNull RtPanelEntityType rtPanelEntity,
    @NonNull EntityManager entityManager
)

Public methods

getCornerRadius

Added in 1.0.0-alpha04
public final float getCornerRadius()

Gets the corner radius of this PanelEntity in meters. Has a default value of 0.

getPixelDensity

Added in 1.0.0-alpha04
Deprecated in 1.0.0-alpha04
public final @NonNull Vector3 getPixelDensity()

Gets the number of pixels per meter for this panel. This value reflects changes to scale, including parent scale.

Returns
@NonNull Vector3

Vector3 scale applied to pixels within the Panel. (Z will be 0)

getSize

Added in 1.0.0-alpha04
public final @NonNull Dimensions getSize()

Returns the dimensions in local space, in unscaled meters for this panel entity.

Users of this api can convert this entity's local space dimensions to real world meters by multiplying the local space dimensions with relative scale of this entity in unscaled world space i.e. real meters = local space dimensions getScale(Space.REAL_WORLD) and vice versa. For example a panel entity 1x1 dimensions in local space will look 2x2 meters in real world if the relative scale applied to this entity in the world space is 2.

getSizeInPixels

Added in 1.0.0-alpha04
public final @NonNull PixelDimensions getSizeInPixels()

Returns the dimensions in Pixels for this panel entity.

setCornerRadius

Added in 1.0.0-alpha04
public final void setCornerRadius(float radius)

Sets the corner radius of the PanelEntity.

Parameters
float radius

The radius of the corners, in meters.

Throws
kotlin.IllegalArgumentException

if radius is <= 0.0f.

setSize

Added in 1.0.0-alpha04
public final void setSize(@NonNull Dimensions dimensions)

Sets the size in meters for the surface on which the View is laid out. The dimensions provided are unscaled meters in the local space.

Users of this api can convert this entity's local space dimensions to real world meters by multiplying the local space dimensions with relative scale of this entity in unscaled world space i.e. real meters = local space dimensions * getScale(Space.REAL_WORLD) and vice versa. For example a panel entity 1x1 dimensions in local space will look 2x2 meters in real world if the relative scale applied to this entity in the world space is 2.

Parameters
@NonNull Dimensions dimensions

Dimensions in meters in local space.

setSizeInPixels

Added in 1.0.0-alpha04
public final void setSizeInPixels(@NonNull PixelDimensions pixelDimensions)

Sets the size in pixels for the surface on which the view is laid out. This essentially sets the resolution of underlying surface. The dimensions provided are in pixels.

This API doesn't do any scale compensation to pixel dimensions provided.

Parameters
@NonNull PixelDimensions pixelDimensions

Dimensions in pixels.