JxrPlatformAdapter.ResizableComponent


interface JxrPlatformAdapter.ResizableComponent : JxrPlatformAdapter.Component


Component to enable resize semantics.

Summary

Public functions

Unit
addResizeEventListener(
    executor: Executor,
    resizeEventListener: JxrPlatformAdapter.ResizeEventListener
)

Adds the listener to the set of listeners that are invoked through the resize operation, such as start, ongoing and end.

Unit

Removes the given listener from the set of listeners for the resize events.

Unit
setFixedAspectRatio(fixedAspectRatio: Float)

Sets the aspect ratio of the entity during resizing.

Unit

Sets the maximum size constraint for the entity.

Unit

Sets the minimum size constraint for the entity.

Unit

Sets the size of the entity.

Inherited functions

From androidx.xr.scenecore.JxrPlatformAdapter.Component
Boolean

Lifecycle event, called when component is attached to an Entity.

Unit

Lifecycle event, called when component is detached from an Entity.

Public functions

addResizeEventListener

Added in 1.0.0-alpha01
fun addResizeEventListener(
    executor: Executor,
    resizeEventListener: JxrPlatformAdapter.ResizeEventListener
): Unit

Adds the listener to the set of listeners that are invoked through the resize operation, such as start, ongoing and end.

The listener is invoked on the provided executor. If the app intends to modify the UI elements/views during the callback, the app should provide the thread executor that is appropriate for the UI operations. For example, if the app is using the main thread to render the UI, the app should provide the main thread (Looper.getMainLooper()) executor. If the app is using a separate thread to render the UI, the app should provide the executor for that thread.

Parameters
executor: Executor

The executor to use for the listener callback.

resizeEventListener: JxrPlatformAdapter.ResizeEventListener

The listener to be invoked when a resize event occurs.

removeResizeEventListener

Added in 1.0.0-alpha01
fun removeResizeEventListener(
    resizeEventListener: JxrPlatformAdapter.ResizeEventListener
): Unit

Removes the given listener from the set of listeners for the resize events.

Parameters
resizeEventListener: JxrPlatformAdapter.ResizeEventListener

The listener to be removed.

setFixedAspectRatio

Added in 1.0.0-alpha01
fun setFixedAspectRatio(fixedAspectRatio: Float): Unit

Sets the aspect ratio of the entity during resizing.

The aspect ratio is determined by taking the panel's width over its height. A value of 0.0f (or negative) means there are no preferences.

This method does not immediately resize the entity. The new aspect ratio will be applied the next time the user resizes the entity through the reform UI. During this resize operation, the entity's current area will be preserved.

If a different resizing behavior is desired, such as fixing the width and adjusting the height, the client can manually resize the entity to the preferred dimensions before calling this method. No automatic resizing will occur when using the reform UI then.

Parameters
fixedAspectRatio: Float

Aspect ratio during resizing.

setMaximumSize

Added in 1.0.0-alpha01
fun setMaximumSize(maxSize: JxrPlatformAdapter.Dimensions): Unit

Sets the maximum size constraint for the entity.

The maximum size constraint is used to set constraints on how large the user can resize the bounding box of the entity up to. The size of the content inside that bounding box is fully controlled by the application.

Parameters
maxSize: JxrPlatformAdapter.Dimensions

Maximum size constraint for the Entity in meters.

setMinimumSize

Added in 1.0.0-alpha01
fun setMinimumSize(minSize: JxrPlatformAdapter.Dimensions): Unit

Sets the minimum size constraint for the entity.

The minimum size constraint is used to set constraints on how small the user can resize the bounding box of the entity up to. The size of the content inside that bounding box is fully controlled by the application.

Parameters
minSize: JxrPlatformAdapter.Dimensions

Minimum size constraint for the Entity in meters.

setSize

Added in 1.0.0-alpha01
fun setSize(dimensions: JxrPlatformAdapter.Dimensions): Unit

Sets the size of the entity.

The size of the entity is the size of the bounding box that contains the content of the entity. The size of the content inside that bounding box is fully controlled by the application.

Parameters
dimensions: JxrPlatformAdapter.Dimensions

Dimensions for the Entity in meters.