ActivityPanelEntity


class ActivityPanelEntity : PanelEntity


ActivityPanelEntity creates a spatial panel for embedding an Activity in Android XR. Users can either use an Intent to launch an Activity in the given panel or provide an instance of Activity to move into this panel. Calling Entity.dispose on this Entity will destroy the underlying Activity.

Summary

Public companion functions

ActivityPanelEntity
create(
    session: Session,
    pixelDimensions: IntSize2d,
    name: String,
    pose: Pose
)

Public factory function for a spatial ActivityPanelEntity.

Public functions

Unit
launchActivity(intent: Intent, bundle: Bundle?)

Launches an Activity in the given panel.

Unit

Moves the given Activity into this panel.

Inherited functions

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

Sets an Entity to be a child of this Entity in the scene graph.

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 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
isEnabled(includeParents: Boolean)

Returns the enabled 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
setEnabled(enabled: Boolean)

Sets the local enabled state of this Entity.

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 @FloatRange(from = 0.0, to = 1.0) Float

Returns the alpha transparency set for this Entity.

open Pose

Returns the Pose for this Entity, relative to its parent.

open @FloatRange(from = 0.0) Float

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

open Unit
setAlpha(alpha: @FloatRange(from = 0.0, to = 1.0) 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: @FloatRange(from = 0.0) Float)

Sets the scale of this Entity relative to its parent.

From androidx.xr.scenecore.PanelEntity
PerceivedResolutionResult

Gets the perceived resolution of this Entity in the CameraView.

From androidx.xr.scenecore.ScenePose
abstract suspend HitTestResult
hitTest(origin: Vector3, direction: Vector3)

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

abstract suspend HitTestResult
hitTest(origin: Vector3, direction: Vector3, hitTestFilter: Int)

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

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

Returns a Pose relative to this ScenePose, transformed into a Pose relative to the destination.

Inherited properties

From androidx.xr.scenecore.BaseEntity
open CharSequence

Alternate text for this Entity to be consumed by Accessibility systems.

open Entity?

The parent of this Entity, from which this Entity will inherit most of its properties.

From androidx.xr.scenecore.PanelEntity
Float

The corner radius of the PanelEntity, in meters.

Boolean

True if this panel is the MainPanelEntity, false otherwise.

FloatSize2d

The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent.

IntSize2d

The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface.

From androidx.xr.scenecore.ScenePose
abstract Pose

The current Pose relative to the activity space root.

Public companion functions

create

Added in 1.0.0-alpha06
fun create(
    session: Session,
    pixelDimensions: IntSize2d,
    name: String,
    pose: Pose = Pose.Identity
): ActivityPanelEntity

Public factory function for a spatial ActivityPanelEntity.

Parameters
session: Session

XR Session to create the ActivityPanelEntity.

pixelDimensions: IntSize2d

Bounds for the panel surface in pixels.

name: String

Name of the panel.

pose: Pose = Pose.Identity

Pose of this entity relative to its parent, the default value is Pose.Identity.

Returns
ActivityPanelEntity

an ActivityPanelEntity instance.

Public functions

launchActivity

Added in 1.0.0-alpha06
fun launchActivity(intent: Intent, bundle: Bundle? = null): Unit

Launches an Activity in the given panel. Subsequent calls to this method will replace the already existing Activity in the panel with the new one. The panel will not be visible until an Activity is successfully launched. This method will not provide any information about when the Activity successfully launches.

Parameters
intent: Intent

Intent to launch the activity.

bundle: Bundle? = null

Bundle to pass to the activity, can be null.

moveActivity

Added in 1.0.0-alpha06
fun moveActivity(activity: Activity): Unit

Moves the given Activity into this panel.

Parameters
activity: Activity

Activity to move into this panel.