JxrPlatformAdapter.ResizableComponent


public interface JxrPlatformAdapter.ResizableComponent extends JxrPlatformAdapter.Component


Component to enable resize semantics.

Summary

Public methods

abstract void

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

abstract void

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

abstract void
setFixedAspectRatio(float fixedAspectRatio)

Sets the aspect ratio of the entity during resizing.

abstract void

Sets the maximum size constraint for the entity.

abstract void

Sets the minimum size constraint for the entity.

abstract void

Sets the size of the entity.

Inherited methods

From androidx.xr.scenecore.JxrPlatformAdapter.Component
abstract boolean

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

abstract void

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

Public methods

addResizeEventListener

Added in 1.0.0-alpha01
abstract void addResizeEventListener(
    @NonNull Executor executor,
    @NonNull JxrPlatformAdapter.ResizeEventListener resizeEventListener
)

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
@NonNull Executor executor

The executor to use for the listener callback.

@NonNull JxrPlatformAdapter.ResizeEventListener resizeEventListener

The listener to be invoked when a resize event occurs.

removeResizeEventListener

Added in 1.0.0-alpha01
abstract void removeResizeEventListener(
    @NonNull JxrPlatformAdapter.ResizeEventListener resizeEventListener
)

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

Parameters
@NonNull JxrPlatformAdapter.ResizeEventListener resizeEventListener

The listener to be removed.

setFixedAspectRatio

Added in 1.0.0-alpha01
abstract void setFixedAspectRatio(float fixedAspectRatio)

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
float fixedAspectRatio

Aspect ratio during resizing.

setMaximumSize

Added in 1.0.0-alpha01
abstract void setMaximumSize(@NonNull JxrPlatformAdapter.Dimensions maxSize)

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
@NonNull JxrPlatformAdapter.Dimensions maxSize

Maximum size constraint for the Entity in meters.

setMinimumSize

Added in 1.0.0-alpha01
abstract void setMinimumSize(@NonNull JxrPlatformAdapter.Dimensions minSize)

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
@NonNull JxrPlatformAdapter.Dimensions minSize

Minimum size constraint for the Entity in meters.

setSize

Added in 1.0.0-alpha01
abstract void setSize(@NonNull JxrPlatformAdapter.Dimensions dimensions)

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
@NonNull JxrPlatformAdapter.Dimensions dimensions

Dimensions for the Entity in meters.