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(
    session: Session,
    activity: Activity,
    preferredRatio: Float
)

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

Constants

NO_PREFERRED_ASPECT_RATIO

Added in 1.0.0-alpha05
const val NO_PREFERRED_ASPECT_RATIOFloat

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

Public functions

setPreferredAspectRatio

Added in 1.0.0-alpha05
fun setPreferredAspectRatio(
    session: Session,
    activity: Activity,
    preferredRatio: Float
): Unit

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
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 NO_PREFERRED_ASPECT_RATIO to indicate that there are no preferences.