androidx.compose.ui.platform
Interfaces
AccessibilityManager |
Interface for managing accessibility. |
Cmn
|
Clipboard |
Cmn
|
|
ClipboardManager |
This interface is deprecated. Use Clipboard instead, which supports suspend functions. |
Cmn
|
InfiniteAnimationPolicy |
Provides a policy that will be applied to animations that get their frame time from |
Cmn
|
InspectableValue |
A compose value that is inspectable by tools. |
Cmn
|
PlatformTextInputInterceptor |
Single-function interface passed to |
Cmn
|
PlatformTextInputMethodRequest |
Represents a request to open a platform-specific text input session via |
Cmn
android
|
PlatformTextInputModifierNode |
A modifier node that can connect to the platform's text input IME system. |
Cmn
|
PlatformTextInputSession |
Receiver type for |
Cmn
android
|
PlatformTextInputSessionScope |
A |
Cmn
|
SoftwareKeyboardController |
Provide software keyboard control. |
Cmn
|
TextToolbar |
Interface for text-related toolbar. |
Cmn
|
UriHandler |
An interface of providing platform specific URL handling. |
Cmn
|
ViewCompositionStrategy |
A strategy for managing the underlying Composition of Compose UI |
android
|
ViewConfiguration |
Contains methods to standard constants used in the UI for timeouts, sizes, and distances. |
Cmn
|
ViewRootForInspector |
The marker interface to be implemented by |
android
|
ViewRootForTest |
The marker interface to be implemented by the |
android
|
WindowInfo |
Provides information about the Window that is hosting this compose hierarchy. |
Cmn
|
WindowRecomposerFactory |
A factory for creating an Android window-scoped |
android
|
Classes
AbstractComposeView |
Base class for custom |
android
|
AndroidUiDispatcher |
A |
android
|
AndroidUiFrameClock |
android
|
|
AndroidUriHandler |
android
|
|
AndroidViewConfiguration |
A |
android
|
AutoClearFocusBehavior |
A behavior for auto-clearing focus for |
android
|
ClipEntry |
Platform specific protocol that expresses an item in the native Clipboard. |
Cmn
android
|
ClipMetadata |
Platform specific protocol that describes an item in the native Clipboard. |
Cmn
android
|
ComposeView |
A |
android
|
ComposeViewContext |
|
android
|
InspectableModifier |
This class is deprecated. This API will create more invalidations of your modifier than necessary, so it's use is discouraged. |
Cmn
|
InspectableModifier.End |
This class is deprecated. This API will create more invalidations of your modifier than necessary, so it's use is discouraged. |
Cmn
|
InspectorInfo |
A builder for an |
Cmn
|
InspectorValueInfo |
Implementation of |
Cmn
|
NativeClipboard |
Native Clipboard specific to each platform. |
Cmn
android
|
ValueElement |
A |
Cmn
|
ValueElementSequence |
A builder for a sequence of |
Cmn
|
ViewCompositionStrategy.DisposeOnLifecycleDestroyed |
|
android
|
Objects
ComposeView.Companion |
Here to allow extension functions |
android
|
InfiniteAnimationPolicy.Key |
Cmn
|
|
ViewCompositionStrategy.DisposeOnDetachedFromWindow |
|
android
|
ViewCompositionStrategy.DisposeOnDetachedFromWindowOrReleasedFromPool |
The composition will be disposed automatically when the view is detached from a window, unless it is part of a |
android
|
ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed |
|
android
|
WindowRecomposerPolicy |
android
|
Enums
TextToolbarStatus |
Status of the |
Cmn
|
Composables
InterceptPlatformTextInput |
Intercept all calls to |
Cmn
|
rememberNestedScrollInteropConnection |
Create and |
android
|
Modifiers
inspectable |
Use this to group a common set of modifiers and provide |
Cmn
|
testTag |
Applies a tag to allow modified element to be found in tests. |
Cmn
|
Type aliases
NativeClipboard |
Native Clipboard specific to each platform. |
android
|
Top-level functions summary
inline InspectorInfo.() -> Unit |
debugInspectorInfo(crossinline definitions: InspectorInfo.() -> Unit)Use this to specify modifier information for compose tooling. |
Cmn
|
Extension functions summary
Recomposer |
View.createLifecycleAwareWindowRecomposer(Create a |
android
|
Unit |
Used to disable |
android
|
suspend Nothing |
PlatformTextInputModifierNode.establishTextInputSession(Starts a new text input session and suspends until the session is closed. |
Cmn
|
ComposeViewContext? |
Returns the |
android
|
CompositionContext? |
Returns the parent |
android
|
Uri? |
Returns the first non-null |
android
|
Unit |
Used to enable |
android
|
ClipEntry |
android
|
|
ClipMetadata |
android
|
Top-level properties summary
Boolean |
This property is deprecated. Use ContentCapture.isEnabled instead |
android
|
ProvidableCompositionLocal<AccessibilityManager?> |
The CompositionLocal to provide communication with platform accessibility service. |
Cmn
|
ProvidableCompositionLocal<Autofill?> |
This property is deprecated. Use the new semantics-based Autofill APIs androidx.compose.ui.autofill.ContentType and androidx.compose.ui.autofill.ContentDataType instead. |
Cmn
|
ProvidableCompositionLocal<AutofillManager?> |
The CompositionLocal that can be used to trigger autofill actions. |
Cmn
|
ProvidableCompositionLocal<AutofillTree> |
This property is deprecated. Use the new semantics-based Autofill APIs androidx.compose.ui.autofill.ContentType and androidx.compose.ui.autofill.ContentDataType instead. |
Cmn
|
ProvidableCompositionLocal<Clipboard> |
The CompositionLocal to provide communication with platform clipboard service. |
Cmn
|
ProvidableCompositionLocal<ClipboardManager> |
This property is deprecated. Use LocalClipboard instead which supports suspend functions |
Cmn
|
ProvidableCompositionLocal<Configuration> |
The Android |
android
|
ProvidableCompositionLocal<Context> |
Provides a |
android
|
ProvidableCompositionLocal<Boolean> |
Text cursor blinking |
Cmn
|
ProvidableCompositionLocal<Density> |
Provides the |
Cmn
|
ProvidableCompositionLocal<FocusManager> |
The CompositionLocal that can be used to control focus within Compose. |
Cmn
|
ProvidableCompositionLocal<FontFamily.Resolver> |
The CompositionLocal for compose font resolution from FontFamily. |
Cmn
|
ProvidableCompositionLocal<GraphicsContext> |
The CompositionLocal to provide access to a |
Cmn
|
ProvidableCompositionLocal<HapticFeedback> |
The CompositionLocal to provide haptic feedback to the user. |
Cmn
|
ProvidableCompositionLocal<InputModeManager> |
The CompositionLocal to provide an instance of InputModeManager which controls the current input mode. |
Cmn
|
ProvidableCompositionLocal<Boolean> |
Inspectable mode CompositionLocal. |
Cmn
|
ProvidableCompositionLocal<LayoutDirection> |
The CompositionLocal to provide the layout direction. |
Cmn
|
ProvidableCompositionLocal<LifecycleOwner> |
This property is deprecated. Moved to lifecycle-runtime-compose library in androidx.lifecycle.compose package. |
Cmn
android
|
CompositionLocal<Locale> |
The CompositionLocal to provide the locale. |
Cmn
|
CompositionLocal<LocaleList> |
The CompositionLocal to provide the locale list. |
Cmn
|
ProvidableCompositionLocal<Resources> |
The Android |
android
|
ProvidableCompositionLocal<SavedStateRegistryOwner> |
This property is deprecated. Moved to savedstate-compose library in androidx.savedstate.compose package. |
android
|
CompositionLocal<Boolean> |
True when the system is currently capturing the contents of a scrollable in this compose view or any parent compose view. |
Cmn
|
ProvidableCompositionLocal<SoftwareKeyboardController?> |
The |
Cmn
|
ProvidableCompositionLocal<TextInputService?> |
This property is deprecated. Use PlatformTextInputModifierNode instead. |
Cmn
|
ProvidableCompositionLocal<TextToolbar> |
The CompositionLocal to provide text-related toolbar. |
Cmn
|
ProvidableCompositionLocal<UriHandler> |
The CompositionLocal to provide functionality related to URL, e.g. open URI. |
Cmn
|
ProvidableCompositionLocal<View> |
The CompositionLocal containing the current Compose |
android
|
ProvidableCompositionLocal<ViewConfiguration> |
The CompositionLocal that provides the ViewConfiguration. |
Cmn
|
ProvidableCompositionLocal<WindowInfo> |
The CompositionLocal that provides information about the window that hosts the current |
Cmn
|
InspectorInfo.() -> Unit |
An empty |
Cmn
|
Boolean |
Turn on inspector debug information. |
Cmn
|
Extension properties summary
CompositionContext? |
The |
android
|
Top-level functions
debugInspectorInfo
inline fun debugInspectorInfo(crossinline definitions: InspectorInfo.() -> Unit): InspectorInfo.() -> Unit
Use this to specify modifier information for compose tooling.
This factory method allows the specified information to be stripped out by ProGuard in release builds.
import androidx.compose.foundation.background import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.debugInspectorInfo import androidx.compose.ui.platform.inspectable import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp /** Sample with a single parameter */ fun Modifier.simpleFrame(color: Color) = inspectable( inspectorInfo = debugInspectorInfo { name = "simpleFrame" value = color } ) { background(color, RoundedCornerShape(5.0.dp)) } /** Sample with multiple parameters */ fun Modifier.fancyFrame(size: Dp, color: Color) = inspectable( inspectorInfo = debugInspectorInfo { name = "fancyFrame" properties["size"] = size properties["color"] = color } ) { background(color, RoundedCornerShape(size)) }
Extension functions
View.createLifecycleAwareWindowRecomposer
fun View.createLifecycleAwareWindowRecomposer(
coroutineContext: CoroutineContext = EmptyCoroutineContext,
lifecycle: Lifecycle? = null
): Recomposer
Create a Lifecycle and window attachment-aware Recomposer for this View with the same behavior as WindowRecomposerFactory.LifecycleAware.
coroutineContext will override any CoroutineContext elements from the default configuration normally used for this content view. The default CoroutineContext contains AndroidUiDispatcher.CurrentThread; this function should only be called from the UI thread of this View or its intended UI thread if it is currently detached.
If lifecycle is null or not supplied the LifecycleOwner returned by findViewTreeLifecycleOwner will be used; if a non-null lifecycle is not provided and a ViewTreeLifecycleOwner is not present an IllegalStateException will be thrown.
The returned Recomposer will be cancelled when this View is detached from a window or if its determined Lifecycle is destroyed. Recomposition and associated frame-based effects may be throttled or paused while the Lifecycle is not at least Lifecycle.State.STARTED.
ComposeView.Companion.disableWindowInsetsRulers
fun ComposeView.Companion.disableWindowInsetsRulers(): Unit
Used to disable androidx.compose.ui.layout.WindowInsetsRulers. This can be used when UI never reads WindowInsets across all ComposeViews to reduce the overhead of requesting WindowInsets updates. Only call this when no ComposeViews will ever need to handle insets over the lifetime of the application. This should be called before the first ComposeView is created.
PlatformTextInputModifierNode.establishTextInputSession
suspend fun PlatformTextInputModifierNode.establishTextInputSession(
block: suspend PlatformTextInputSessionScope.() -> Nothing
): Nothing
Starts a new text input session and suspends until the session is closed.
The block function must call PlatformTextInputSession.startInputMethod to actually show and initiate the connection with the input method. If it does not, the session will end when this function returns without showing the input method.
If this function is called while another session is active, the sessions will not overlap. The new session will interrupt the old one, which will be cancelled and allowed to finish running any cancellation tasks (e.g. finally blocks) before running the new block function.
The session will be closed when:
-
The session function throws an exception.
-
The requesting coroutine is cancelled.
-
Another session is started via this method, either from the same modifier or a different one. The session may remain open when:
-
The system closes the connection. This behavior currently only exists on Android depending on OS version. Android platform may intermittently close the active connection to immediately start it back again. In these cases the session will not be prematurely closed, so that it can serve the follow-up requests.
This function should only be called from the modifier node's coroutineScope. If it is not, the session will not automatically be closed if the modifier is detached.
import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusEventModifierNode import androidx.compose.ui.focus.FocusState import androidx.compose.ui.platform.PlatformTextInputMethodRequest import androidx.compose.ui.platform.PlatformTextInputModifierNode import androidx.compose.ui.platform.PlatformTextInputSession import androidx.compose.ui.platform.establishTextInputSession class PlatformTextInputModifierNodeSample : Modifier.Node(), FocusEventModifierNode, PlatformTextInputModifierNode