SpatialWindow
object SpatialWindow
Methods used to manage the Activity's main spatial window when it is displayed in Home Space Mode.
| See also | |
|---|---|
Session |
Summary
Constants |
|
|---|---|
const Float |
Constant to indicate that there are no preferences for the aspect ratio. |
Public functions |
|
|---|---|
Unit |
setPreferredAspectRatio(Sets a preferred main panel aspect ratio for Home Space. |
Constants
NO_PREFERRED_ASPECT_RATIO
const val NO_PREFERRED_ASPECT_RATIO: Float
Constant to indicate that there are no preferences for the aspect ratio.
Public functions
setPreferredAspectRatio
fun setPreferredAspectRatio(
session: Session,
activity: Activity,
preferredRatio: Float
): Unit
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 | |
|---|---|
session: Session |
the session from which to set the preference. |
activity: Activity |
the activity for which to set the preference. |
preferredRatio: Float |
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. |