BasePanelEntity


sealed class BasePanelEntity<RtPanelEntityType : PanelEntity> : 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 : PanelEntity> BasePanelEntity(
    rtPanelEntity: RtPanelEntityType,
    entityManager: EntityManager
)

Public functions

Float

Gets the corner radius of this PanelEntity in meters.

Vector3

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

Dimensions

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

PixelDimensions

Returns the dimensions in Pixels for this panel entity.

Unit

Sets the corner radius of the PanelEntity.

Unit
setSize(dimensions: Dimensions)

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

Unit
setSizeInPixels(pixelDimensions: PixelDimensions)

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

Inherited functions

From androidx.xr.scenecore.ActivityPose
abstract Pose

Returns the activity space pose for this ActivityPose.

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

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

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

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

abstract Pose
transformPoseTo(pose: Pose, destination: ActivityPose)

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

From androidx.xr.scenecore.BaseEntity
open Unit
addChild(child: Entity)

Sets an Entity to be represented in this coordinate space.

open Boolean
addComponent(component: Component)

Adds a Component to this Entity.

open Unit

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

open Float
getAlpha(relativeTo: Int)

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

open List<Component>

Retrieves all components attached to this Entity.

open List<T>

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

open Entity?

Returns the parent of this Entity.

open Pose
getPose(relativeTo: Int)

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

open Float
getScale(relativeTo: Int)

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

open Boolean
isHidden(includeParents: Boolean)

Returns the hidden status of this Entity.

open Unit

Remove all components from this Entity.

open Unit

Removes the given Component from this Entity.

open Unit
setAlpha(alpha: Float, relativeTo: Int)

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

open Unit

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

open Unit
setHidden(hidden: Boolean)

Sets the local hidden state of this Entity.

open Unit
setParent(parent: Entity?)

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

open Unit
setPose(pose: Pose, relativeTo: Int)

Sets the pose for this Entity.

open Unit
setScale(scale: Float, relativeTo: Int)

Sets the scale of this entity relative to given space.

From androidx.xr.scenecore.Entity
open Float

Returns the alpha transparency set for this Entity.

open Pose

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

open Float

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

open Unit
setAlpha(alpha: Float)

Sets the alpha transparency of the Entity and its children.

open Unit
setPose(pose: Pose)

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

open Unit
setScale(scale: Float)

Sets the scale of this entity relative to its parent.

Protected constructors

BasePanelEntity

protected <RtPanelEntityType : PanelEntity> BasePanelEntity(
    rtPanelEntity: RtPanelEntityType,
    entityManager: EntityManager
)

Public functions

getCornerRadius

Added in 1.0.0-alpha04
fun getCornerRadius(): Float

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
fun getPixelDensity(): Vector3

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

Returns
Vector3

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

getSize

Added in 1.0.0-alpha04
fun getSize(): Dimensions

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
fun getSizeInPixels(): PixelDimensions

Returns the dimensions in Pixels for this panel entity.

setCornerRadius

Added in 1.0.0-alpha04
fun setCornerRadius(radius: Float): Unit

Sets the corner radius of the PanelEntity.

Parameters
radius: Float

The radius of the corners, in meters.

Throws
kotlin.IllegalArgumentException

if radius is <= 0.0f.

setSize

Added in 1.0.0-alpha04
fun setSize(dimensions: Dimensions): Unit

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
dimensions: Dimensions

Dimensions in meters in local space.

setSizeInPixels

Added in 1.0.0-alpha04
fun setSizeInPixels(pixelDimensions: PixelDimensions): Unit

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
pixelDimensions: PixelDimensions

Dimensions in pixels.