SpatialWindow


public static class SpatialWindow


Methods used to manage the Activity's main spatial window when it is displayed in Home Space Mode.

See also
Session

Summary

Constants

static final float

Constant to indicate that there are no preferences for the aspect ratio.

Public fields

static @NonNull SpatialWindow

Public methods

final void
setPreferredAspectRatio(
    @NonNull Session session,
    @NonNull Activity activity,
    float preferredRatio
)

Sets a preferred main panel aspect ratio for Home Space Mode.

Constants

NO_PREFERRED_ASPECT_RATIO

Added in 1.0.0-alpha05
public static final float NO_PREFERRED_ASPECT_RATIO

Constant to indicate that there are no preferences for the aspect ratio.

Public fields

INSTANCE

Added in 1.0.0-alpha05
public static @NonNull SpatialWindow INSTANCE

Public methods

setPreferredAspectRatio

Added in 1.0.0-alpha05
public final void setPreferredAspectRatio(
    @NonNull Session session,
    @NonNull Activity activity,
    float preferredRatio
)

Sets a preferred main panel aspect ratio for Home Space Mode.

The ratio is only applied to the Activity. If the activity launches another activity in the same task, the ratio is not applied to the new activity. Also, while the activity is in Full Space Mode, the preference is ignored.

If the activity's current aspect ratio differs from the preferredRatio, the panel is automatically resized. This resizing preserves the panel's area. To avoid runtime resizing, consider specifying the desired aspect ratio in your application's manifest. This ensures your activity launches with the preferred aspect ratio from the start.

Parameters
@NonNull Session session

the session from which to set the preference.

@NonNull Activity activity

the activity for which to set the preference.

float preferredRatio

the aspect ratio determined by taking the panel's width over its height. Use NO_PREFERRED_ASPECT_RATIO to indicate that there are no preferences.