WindowInfoTrackerCallbackAdapter

Added in 1.0.0
Deprecated in 1.6.0-alpha03

class WindowInfoTrackerCallbackAdapter : WindowInfoTracker


An adapter for WindowInfoTracker that allows listening for WindowLayoutInfo updates using callbacks instead of Flow.

This adapter is no longer necessary the callback-based listeners have been added to WindowLayoutInfo. Use WindowInfoTracker directly.

Summary

Public constructors

This function is deprecated. This constructor is no longer necessary.

Public functions

Unit
addWindowLayoutInfoListener(
    activity: Activity,
    executor: Executor,
    consumer: Consumer<WindowLayoutInfo>
)

This function is deprecated. Use WindowInfoTracker.registerWindowLayoutInfoListener(Activity, Executor, Consumer).

Unit
addWindowLayoutInfoListener(
    context: @UiContext Context,
    executor: Executor,
    consumer: Consumer<WindowLayoutInfo>
)

This function is deprecated. Use WindowInfoTracker.registerWindowLayoutInfoListener(Context, Executor, Consumer).

open Unit
registerWindowLayoutInfoListener(
    context: @UiContext Context,
    executor: Executor,
    listener: Consumer<WindowLayoutInfo>
)

This function is deprecated. Use WindowInfoTracker.registerWindowLayoutInfoListener(Context, Executor, Consumer).

Unit

This function is deprecated. Use WindowInfoTracker.unregisterWindowLayoutInfoListener(Consumer).

open Unit

This function is deprecated. Use WindowInfoTracker.unregisterWindowLayoutInfoListener(Consumer).

Inherited functions

From androidx.window.layout.WindowInfoTracker
open WindowLayoutInfo

This function is deprecated. This adapter is no longer necessary.

open Flow<WindowLayoutInfo>

This function is deprecated. This adapter is no longer necessary.

open Flow<WindowLayoutInfo>

This function is deprecated. This adapter is no longer necessary.

Inherited properties

From androidx.window.layout.WindowInfoTracker
open List<SupportedPosture>

This property is deprecated. This adapter is no longer necessary.

Public constructors

WindowInfoTrackerCallbackAdapter

Added in 1.0.0
Deprecated in 1.6.0-alpha03
WindowInfoTrackerCallbackAdapter(tracker: WindowInfoTracker)

Use WindowInfoTracker constructor instead.

Public functions

addWindowLayoutInfoListener

Added in 1.0.0
Deprecated in 1.6.0-alpha03
fun addWindowLayoutInfoListener(
    activity: Activity,
    executor: Executor,
    consumer: Consumer<WindowLayoutInfo>
): Unit

Registers a listener to consume WindowLayoutInfo values of the Activity window from a kotlinx.coroutines.flow.Flow. If the same consumer is registered twice then this method is a no-op.

Use WindowInfoTracker.registerWindowLayoutInfoListener instead.

Parameters
activity: Activity

an Activity that hosts a android.view.Window.

executor: Executor

that the consumer will invoke on.

consumer: Consumer<WindowLayoutInfo>

for WindowLayoutInfo values.

See also
windowLayoutInfo

addWindowLayoutInfoListener

Added in 1.1.0
Deprecated in 1.6.0-alpha03
fun addWindowLayoutInfoListener(
    context: @UiContext Context,
    executor: Executor,
    consumer: Consumer<WindowLayoutInfo>
): Unit

Registers a UiContext listener to consume WindowLayoutInfo values from a kotlinx.coroutines.flow.Flow. If the same consumer is registered twice then this method is a no-op.

Use WindowInfoTracker.registerWindowLayoutInfoListener instead.

Parameters
context: @UiContext Context

a UiContext such as an Activity, created with Context#createWindowContext or is a InputMethodService.

executor: Executor

that the consumer will invoke on.

consumer: Consumer<WindowLayoutInfo>

for WindowLayoutInfo values.

See also
windowLayoutInfo

registerWindowLayoutInfoListener

open fun registerWindowLayoutInfoListener(
    context: @UiContext Context,
    executor: Executor,
    listener: Consumer<WindowLayoutInfo>
): Unit

Registers a UiContext listener to consume WindowLayoutInfo values. If the same listener is registered twice then this method is a no-op. Overridden here for compatibility.

Use WindowInfoTracker.registerWindowLayoutInfoListener instead.

Parameters
context: @UiContext Context

a UiContext such as an Activity.

executor: Executor

that the listener will invoke on.

listener: Consumer<WindowLayoutInfo>

for WindowLayoutInfo values.

See also
windowLayoutInfo

removeWindowLayoutInfoListener

Added in 1.0.0
Deprecated in 1.6.0-alpha03
fun removeWindowLayoutInfoListener(consumer: Consumer<WindowLayoutInfo>): Unit

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

Use WindowInfoTracker.unregisterWindowLayoutInfoListener instead.

See also
windowLayoutInfo

unregisterWindowLayoutInfoListener

open fun unregisterWindowLayoutInfoListener(
    listener: Consumer<WindowLayoutInfo>
): Unit

Unregisters a listener to stop consuming WindowLayoutInfo values. Overridden here for compatibility.

Use WindowInfoTracker.unregisterWindowLayoutInfoListener instead.

Parameters
listener: Consumer<WindowLayoutInfo>

The listener to be removed.

See also
windowLayoutInfo