WindowAreaControllerCallbackAdapter


@ExperimentalWindowApi
public final class WindowAreaControllerCallbackAdapter implements WindowAreaController


An adapter for WindowAreaController to provide callback APIs.

Summary

Public constructors

Public methods

final void

Registers a listener that is interested in the current list of WindowAreaInfo available to be interacted with.

final void

Removes a listener of available WindowAreaInfo records.

Inherited methods

From androidx.window.area.WindowAreaController
@NonNull Flow<@NonNull List<@NonNull WindowAreaInfo>>

Flow of the list of current WindowAreaInfos that are currently available to be interacted with.

void
presentContentOnWindowArea(
    @NonNull Binder token,
    @NonNull Activity activity,
    @NonNull Executor executor,
    @NonNull WindowAreaPresentationSessionCallback windowAreaPresentationSessionCallback
)

Starts a presentation session on the WindowAreaInfo identified by the token and sends updates through the WindowAreaPresentationSessionCallback.

void
transferActivityToWindowArea(
    @NonNull Binder token,
    @NonNull Activity activity,
    @NonNull Executor executor,
    @NonNull WindowAreaSessionCallback windowAreaSessionCallback
)

Starts a transfer session where the calling Activity is moved to the window area identified by the token.

Public constructors

WindowAreaControllerCallbackAdapter

Added in 1.2.0
public WindowAreaControllerCallbackAdapter(
    @NonNull WindowAreaController controller
)

Public methods

addWindowAreaInfoListListener

Added in 1.2.0
public final void addWindowAreaInfoListListener(
    @NonNull Executor executor,
    @NonNull Consumer<@NonNull List<@NonNull WindowAreaInfo>> listener
)

Registers a listener that is interested in the current list of WindowAreaInfo available to be interacted with.

The listener will receive an initial value on registration, as soon as it becomes available.

Parameters
@NonNull Executor executor

to handle sending listener updates.

@NonNull Consumer<@NonNull List<@NonNull WindowAreaInfo>> listener

to receive updates to the list of WindowAreaInfo.

removeWindowAreaInfoListListener

Added in 1.2.0
public final void removeWindowAreaInfoListListener(
    @NonNull Consumer<@NonNull List<@NonNull WindowAreaInfo>> listener
)

Removes a listener of available WindowAreaInfo records. If the listener is not present then this method is a no-op.

Parameters
@NonNull Consumer<@NonNull List<@NonNull WindowAreaInfo>> listener

to remove from receiving status updates.