WindowInfoRepositoryCallbackAdapter

public final class WindowInfoRepositoryCallbackAdapter implements WindowInfoRepository


An adapted interface for WindowInfoRepository that allows listening for events via a callback shaped API.

Summary

Public constructors

Public methods

final void

Register a listener to consume WindowMetrics values.

final void

Register a listener to consume WindowLayoutInfo values.

final void

Remove a listener to stop consuming WindowMetrics values.

final void

Remove a listener to stop consuming WindowLayoutInfo values.

Public constructors

WindowInfoRepositoryCallbackAdapter

public final WindowInfoRepositoryCallbackAdapter(
    @NonNull WindowInfoRepository repository
)

Public methods

addCurrentWindowMetricsListener

@NonNull
public final void addCurrentWindowMetricsListener(
    @NonNull Executor executor,
    @NonNull Consumer<@NonNull WindowMetrics> consumer
)

Register a listener to consume WindowMetrics values. If the same consumer is registered twice then this method is a no-op.

addWindowLayoutInfoListener

@NonNull
public final void addWindowLayoutInfoListener(
    @NonNull Executor executor,
    @NonNull Consumer<@NonNull WindowLayoutInfo> consumer
)

Register a listener to consume WindowLayoutInfo values. If the same consumer is registered twice then this method is a no-op.

See also
windowLayoutInfo

removeCurrentWindowMetricsListener

@NonNull
public final void removeCurrentWindowMetricsListener(
    @NonNull Consumer<@NonNull WindowMetrics> consumer
)

Remove a listener to stop consuming WindowMetrics values. If the listener has already been removed then this is a no-op.

removeWindowLayoutInfoListener

@NonNull
public final void removeWindowLayoutInfoListener(
    @NonNull Consumer<@NonNull WindowLayoutInfo> consumer
)

Remove a listener to stop consuming WindowLayoutInfo values. If the listener has already been removed then this is a no-op.

See also
windowLayoutInfo