Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 0e3ce5dc163ffef97444657594ffe79cd851875c
Author: Ralston Da Silva <ralu@google.com>
Date: Sun Nov 08 23:43:11 2020
Add an API to check if the window is in focus
The current Focus modifiers let you know if a composable is in focus. When there are multiple windows open on the screen, we need to provide some API that can be used to check if the current window is in focus. This CL adds WindowManager.isWindowFocused property and a WindowFocusObserver composable that provides an onWindowFocusChanged callback that can be used to check if the window is in focus.
Bug: 170932874
Test: ./gradlew compose:ui:ui:connectedCheck -P android.testInstrumentationRunnerArguments.class=androidx.compose.ui.platform.WindowManagerAmbientTest
Relnote: Added WindowManager.isWindowFocused to check if the host window is in focus, and a WindowFocusObserver that provides an onWindowFocusChanged callback.
Change-Id: I53b2a702b81215dc5a5536144a752e1c93ab056e
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/SuspendingGestureTestUtil.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/UiDemos.kt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInDialog.kt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInPopup.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WindowManagerAmbientTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Ambients.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/WindowManager.kt
M compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopOwner.kt
M compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt
https://android-review.googlesource.com/1492096
Branch: androidx-master-dev
commit 0e3ce5dc163ffef97444657594ffe79cd851875c
Author: Ralston Da Silva <ralu@google.com>
Date: Sun Nov 08 23:43:11 2020
Add an API to check if the window is in focus
The current Focus modifiers let you know if a composable is in focus. When there are multiple windows open on the screen, we need to provide some API that can be used to check if the current window is in focus. This CL adds WindowManager.isWindowFocused property and a WindowFocusObserver composable that provides an onWindowFocusChanged callback that can be used to check if the window is in focus.
Bug: 170932874
Test: ./gradlew compose:ui:ui:connectedCheck -P android.testInstrumentationRunnerArguments.class=androidx.compose.ui.platform.WindowManagerAmbientTest
Relnote: Added WindowManager.isWindowFocused to check if the host window is in focus, and a WindowFocusObserver that provides an onWindowFocusChanged callback.
Change-Id: I53b2a702b81215dc5a5536144a752e1c93ab056e
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/SuspendingGestureTestUtil.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/UiDemos.kt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInDialog.kt
A compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInPopup.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WindowManagerAmbientTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Ambients.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/WindowManager.kt
M compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopOwner.kt
M compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt
Description
The current Focus modifiers let you know if a composable is in focus. When there are multiple windows open on the screen, the user needs to know if the current window is in focus. Add an ambient to provide this information.