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(Sets a preferred main panel aspect ratio for Home Space. |
Constants
NO_PREFERRED_ASPECT_RATIO
public static final float NO_PREFERRED_ASPECT_RATIO
Constant to indicate that there are no preferences for the aspect ratio.
Public fields
Public methods
setPreferredAspectRatio
public final void setPreferredAspectRatio(
@NonNull Session session,
@NonNull Activity activity,
float preferredRatio
)
Sets a preferred main panel aspect ratio for Home Space.
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, 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 file. This ensures your activity launches with the preferred aspect ratio from the start.
The default preference is set to NO_PREFERRED_ASPECT_RATIO allowing the user to resize the spatial window to any aspect ratio. The actual initial aspect ratio is determined by system-defined behavior.
| 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 |
| Throws | |
|---|---|
IllegalArgumentException |
if preferredRatio is smaller than 1:12 or greater than 12:1. A value <= 0.0f indicates no preference and will not throw exception. |