WindowBackend
public
interface
WindowBackend
androidx.window.WindowBackend |
Backing interface for WindowManager
instances that server as the default information
supplier. By default ExtensionWindowBackend
implementation is used in
WindowManager.WindowManager(Context, WindowBackend)
, but it can be replaced with
a stub for testing.
Summary
Public methods | |
---|---|
abstract
DeviceState
|
getDeviceState()
Get the current device state. |
abstract
WindowLayoutInfo
|
getWindowLayoutInfo(Context context)
Get current window layout information for the provided |
abstract
void
|
registerDeviceStateChangeCallback(Executor executor, Consumer<DeviceState> callback)
Register a callback for device state changes. |
abstract
void
|
registerLayoutChangeCallback(Context context, Executor executor, Consumer<WindowLayoutInfo> callback)
Register a callback for layout changes of the window of the current visual |
abstract
void
|
unregisterDeviceStateChangeCallback(Consumer<DeviceState> callback)
Unregister a callback for device state changes. |
abstract
void
|
unregisterLayoutChangeCallback(Consumer<WindowLayoutInfo> callback)
Unregister a callback for window layout changes of the |
Public methods
getDeviceState
public abstract DeviceState getDeviceState ()
Get the current device state.
Returns | |
---|---|
DeviceState |
getWindowLayoutInfo
public abstract WindowLayoutInfo getWindowLayoutInfo (Context context)
Get current window layout information for the provided Context
. Must be called
only after the it is attached to the window and the layout pass has happened.
Parameters | |
---|---|
context |
Context |
Returns | |
---|---|
WindowLayoutInfo |
registerDeviceStateChangeCallback
public abstract void registerDeviceStateChangeCallback (Executor executor, Consumer<DeviceState> callback)
Register a callback for device state changes.
Parameters | |
---|---|
executor |
Executor |
callback |
Consumer |
registerLayoutChangeCallback
public abstract void registerLayoutChangeCallback (Context context, Executor executor, Consumer<WindowLayoutInfo> callback)
Register a callback for layout changes of the window of the current visual Context
.
Must be called only after the it is attached to the window.
Parameters | |
---|---|
context |
Context |
executor |
Executor |
callback |
Consumer |
unregisterDeviceStateChangeCallback
public abstract void unregisterDeviceStateChangeCallback (Consumer<DeviceState> callback)
Unregister a callback for device state changes.
Parameters | |
---|---|
callback |
Consumer |
unregisterLayoutChangeCallback
public abstract void unregisterLayoutChangeCallback (Consumer<WindowLayoutInfo> callback)
Unregister a callback for window layout changes of the Context
window.
Parameters | |
---|---|
callback |
Consumer |