androidx.window.embedding
Classes
ActivityEmbeddingController |
The controller that allows checking the current |
ActivityFilter |
Filter for |
ActivityRule |
Layout configuration rules for individual activities with split layouts. |
ActivityRule.Builder |
Builder for |
ActivityStack |
A container that holds a stack of activities, overlapping and bound to the same rectangle on the screen. |
DividerAttributes |
The attributes of the divider layout and behavior. |
DividerAttributes.DragRange |
Describes the range that the user is allowed to drag the draggable divider. |
DividerAttributes.DragRange.SplitRatioDragRange |
A drag range represented as an interval of the primary container's split ratios. |
DividerAttributes.DraggableDividerAttributes |
The attributes of a draggable divider. |
DividerAttributes.DraggableDividerAttributes.Builder |
The |
DividerAttributes.FixedDividerAttributes |
The attributes of a fixed divider. |
DividerAttributes.FixedDividerAttributes.Builder |
The |
EmbeddedActivityWindowInfo |
Describes the embedded window related info of an activity. |
EmbeddingAnimationBackground |
Background to be used for window transition animations for embedding activities if the animation requires a background. |
EmbeddingAnimationBackground.ColorBackground |
An {@link EmbeddingAnimationBackground} to specify of using a developer-defined color as the animation background. |
EmbeddingAnimationParams |
Parameters to be used for window transition animations for embedding activities. |
EmbeddingAnimationParams.AnimationSpec |
The animation to use when an activity transitions (e.g. open, close, or change). |
EmbeddingAnimationParams.Builder |
Builder for creating an instance of |
EmbeddingAspectRatio |
The aspect ratio of the parent window bound to allow embedding with the rule. |
EmbeddingConfiguration |
Configurations of Activity Embedding environment that defines how the embedded Activities behave. |
EmbeddingConfiguration.Builder |
Builder for creating an instance of |
EmbeddingConfiguration.DimAreaBehavior |
The area of dimming to apply. |
EmbeddingRule |
Base abstract class for activity embedding presentation rules, such as |
RuleController |
The controller to manage |
SplitAttributes |
Attributes that describe how the parent window (typically the activity task window) is split between the primary and secondary activity containers, including: |
SplitAttributes.Builder |
Builder for creating an instance of |
SplitAttributes.LayoutDirection |
The layout direction of the primary and secondary activity containers. |
SplitAttributes.SplitType |
The type of parent window split, which defines the proportion of the parent window occupied by the primary and secondary activity containers. |
SplitAttributesCalculatorParams |
The parameter container used to report the current device and window state in |
SplitController |
The controller class that gets information about the currently active activity splits and provides interaction points to customize the splits and form new splits. |
SplitController.SplitSupportStatus |
A class to determine if activity splits with Activity Embedding are currently available. |
SplitInfo |
Describes a split pair of two containers with activities. |
SplitPairFilter |
Filter for |
SplitPairRule |
Split configuration rules for activity pairs. |
SplitPairRule.Builder |
Builder for |
SplitPinRule |
Split configuration rules for pinning an |
SplitPinRule.Builder |
Builder for |
SplitPlaceholderRule |
Configuration rules for split placeholders. |
SplitPlaceholderRule.Builder |
Builder for |
SplitRule |
Split configuration rules for activities that are launched to side in a split. |
SplitRule.FinishBehavior |
Determines what happens with the associated container when all activities are finished in one of the containers in a split. |
Extension functions summary
Bundle |
@RequiresWindowSdkExtension(version = 5)Sets the target launching |
Extension functions
setLaunchingActivityStack
@RequiresWindowSdkExtension(version = 5)
fun Bundle.setLaunchingActivityStack(
context: Context,
activityStack: ActivityStack
): Bundle
Sets the target launching ActivityStack to the given Bundle.
The Bundle then could be used to launch an Activity to the top of the ActivityStack through Activity.startActivity. If there's a bundle used for customizing how the Activity should be started by ActivityOptions.toBundle or androidx.core.app.ActivityOptionsCompat.toBundle, it's suggested to use the bundle to call this method.
It is suggested to use a visible ActivityStack reported by SplitController.splitInfoList or OverlayController.overlayInfo, or the launching activity will be launched on the default target if the activityStack no longer exists in the host task. The default target could be the top of the visible split's secondary ActivityStack, or the top of the host task.
Below samples are use cases to specify the launching ActivityStack.
import androidx.core.app.ActivityOptionsCompat import androidx.window.embedding.ActivityStack import androidx.window.embedding.SplitController import androidx.window.embedding.setLaunchingActivityStack var primaryActivityStack: ActivityStack? = null SplitController.getInstance(primaryActivity).splitInfoList(primaryActivity).collect { splitInfoList -> primaryActivityStack = splitInfoList.last().primaryActivityStack } primaryActivity.startActivity( INTENT, ActivityOptionsCompat.makeBasic() .toBundle()!! .setLaunchingActivityStack(primaryActivity, primaryActivityStack!!), )
import androidx.core.app.ActivityOptionsCompat import androidx.window.embedding.ActivityStack import androidx.window.embedding.OverlayController import androidx.window.embedding.setLaunchingActivityStack var overlayActivityStack: ActivityStack? = null OverlayController.getInstance(context).overlayInfo(TAG_OVERLAY).collect { overlayInfo -> overlayActivityStack = overlayInfo.activityStack } // The use case is to launch an Activity to an existing overlay ActivityStack from the overlain // Activity. If activityStack is not specified, the activity is launched to the top of the // host task behind the overlay ActivityStack. overlainActivity.startActivity( INTENT, ActivityOptionsCompat.makeBasic() .toBundle()!! .setLaunchingActivityStack(overlainActivity, overlayActivityStack!!), )
| Parameters | |
|---|---|
context: Context |
The |
activityStack: ActivityStack |
The target |
| Throws | |
|---|---|
kotlin.UnsupportedOperationException |
if |