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 dispose() on this entity will destroy the underlying activity.

Summary

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.ActivityPose
abstract Pose

Returns the activity space pose for this ActivityPose.

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

Returns the global alpha of this entity computed by multiplying the parent's global alpha to this entity's local alpha.

open Float

Returns the alpha transparency set for this Entity.

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

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 Float

Returns the accumulated scale of this Entity.

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)

Sets the alpha transparency of the Entity and its children.

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)

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.

open Unit
setSize(dimensions: Dimensions)

Sets the dimensions in pixels for the Entity.

From androidx.xr.scenecore.BasePanelEntity
Float

Gets the corner radius of this PanelEntity in meters.

Vector3

Gets the number of pixels per meter for this panel.

PixelDimensions

Returns the dimensions of the view underlying this PanelEntity.

open Dimensions

Returns the spatial size of this Panel in meters.

Unit

Sets the corner radius of the PanelEntity.

Unit

Sets the pixel (not Dp) dimensions of the view underlying this PanelEntity.

Public functions

launchActivity

Added in 1.0.0-alpha01
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. If the intent fails to launch the activity, the panel will not be visible. Note this will not update the dimensions of the surface underlying the panel. The Activity will be letterboxed as required to fit the size of the panel. The underlying surface can be resized by calling setPixelDimensions().

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-alpha01
fun moveActivity(activity: Activity): Unit

Moves the given activity into this panel. Note this will not update the dimensions of the surface underlying the panel. The Activity will be letterboxed as required to fit the size of the panel. The underlying surface can be resized by calling setPixelDimensions().

Parameters
activity: Activity

Activity to move into this panel.