PictureInPictureParamsCompat
class PictureInPictureParamsCompat
Helper class to access the framework android.app.PictureInPictureParams.
Builder is offered for a fluent API.
Summary
Nested types |
|---|
|
Builder class for |
Public constructors |
|---|
PictureInPictureParamsCompat( |
Public properties |
|
|---|---|
List<RemoteAction> |
Sets the user actions. |
Rational? |
Sets the aspect ratio. |
RemoteAction? |
Sets a close action that should be invoked before the default close PiP action. |
Rational? |
Sets the aspect ratio for the expanded picture-in-picture mode. |
Boolean |
This field indicates the PiP-able state of the application, and it will be translated to |
Boolean |
Sets whether the system can seamlessly resize the window while the activity is in picture-in-picture mode. |
Rect? |
Sets the window-coordinate bounds of an activity transitioning to picture-in-picture. |
CharSequence? |
Sets a subtitle for the picture-in-picture window, which may be displayed by the system to give the user more detailed information about what this PIP is displaying. |
CharSequence? |
Sets a title for the picture-in-picture window, which may be displayed by the system to give the user information about what this PIP is generally being used for. |
Public constructors
PictureInPictureParamsCompat
PictureInPictureParamsCompat(
isEnabled: Boolean = true,
aspectRatio: Rational? = null,
actions: List<RemoteAction> = emptyList(),
sourceRectHint: Rect? = null,
isSeamlessResizeEnabled: Boolean = false,
closeAction: RemoteAction? = null,
expandedAspectRatio: Rational? = null,
title: CharSequence? = null,
subTitle: CharSequence? = null
)
Public properties
actions
val actions: List<RemoteAction>
Sets the user actions. If there are more than ComponentActivity.getMaxNumPictureInPictureActions actions, then the input list will be truncated to that number.
Compatibility notes: this field is used on API 26+
aspectRatio
val aspectRatio: Rational?
Sets the aspect ratio. This aspect ratio is defined as the desired width / height, and does not change upon device rotation.
Compatibility notes: this field is used on API 26+
closeAction
val closeAction: RemoteAction?
Sets a close action that should be invoked before the default close PiP action. The custom action must close the activity quickly using ComponentActivity.finish. Otherwise, the system will forcibly close the PiP as if no custom close action was provided.
If the action matches one set via actions it may be shown in place of that custom action in the menu.
Compatibility notes: this field is used on API 33+
expandedAspectRatio
val expandedAspectRatio: Rational?
Sets the aspect ratio for the expanded picture-in-picture mode. The aspect ratio is defined as the desired width / height. The aspect ratio cannot be changed from horizontal to vertical or vertical to horizontal while the PIP is shown. Any such changes will be ignored.
Setting the expanded ratio shows the activity's support for expanded mode.
Compatibility notes: this field is used on API 33+
isEnabled
val isEnabled: Boolean
This field indicates the PiP-able state of the application, and it will be translated to PictureInPictureParams.isAutoEnterEnabled on API 31+.
isSeamlessResizeEnabled
val isSeamlessResizeEnabled: Boolean
Sets whether the system can seamlessly resize the window while the activity is in picture-in-picture mode. This should normally be the case for video content and when it's set to false, system will perform transitions to overcome the artifacts due to resize.
Compatibility notes: this field is used on API 31+
sourceRectHint
val sourceRectHint: Rect?
Sets the window-coordinate bounds of an activity transitioning to picture-in-picture. The bounds is the area of an activity that will be visible in the transition to picture-in-picture mode. For the best effect, these bounds should also match the aspect ratio in the arguments.
In Android 12+ these bounds are also reused to improve the exit transition from picture-in-picture mode. See the Picture-in-Picture doc for more details.
Compatibility notes: this field is used on API 26+
subTitle
val subTitle: CharSequence?
Sets a subtitle for the picture-in-picture window, which may be displayed by the system to give the user more detailed information about what this PIP is displaying.
Compatibility notes: this field is used on API 33+
title
val title: CharSequence?
Sets a title for the picture-in-picture window, which may be displayed by the system to give the user information about what this PIP is generally being used for.
Compatibility notes: this field is used on API 33+