Android 12 Developer Preview is here! Try it out, and give us your feedback!

Compose UI

Fundamental components of compose UI needed to interact with the device, including layout, drawing, and input.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
February 24, 2021 - - 1.0.0-beta01 -


Compose is combination of 6 Maven Group Ids within androidx. Each Group contains a targeted subset of functionality, each with it's own set of release notes.

This table explains the groups and links to each set of release notes.

compose.animationBuild animations in their Jetpack Compose applications to enrich the user experience.
compose.compilerTransform @Composable functions and enable optimizations with a Kotlin compiler plugin.
compose.foundationWrite Jetpack Compose applications with ready to use building blocks and extend foundation to build your own design system pieces.
compose.materialBuild Jetpack Compose UIs with ready to use Material Design Components. This is the higher level entry point of Compose, designed to provide components that match those described at
compose.runtimeFundamental building blocks of Compose's programming model and state management, and core runtime for the Compose Compiler Plugin to target.
compose.uiFundamental components of compose UI needed to interact with the device, including layout, drawing, and input.

Declaring dependencies

To add a dependency on Compose, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    implementation "androidx.compose.ui:ui:1.0.0-beta01"

android {
    buildFeatures {
        compose true

    composeOptions {
        kotlinCompilerVersion "1.4.30"
        kotlinCompilerExtensionVersion "1.0.0-beta01"

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        jvmTarget = "1.8"

For more information about dependencies, see Add build dependencies.


Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.0.0

Version 1.0.0-beta01

February 24, 2021

androidx.compose.ui:ui-*:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits.

This is the first release of Compose 1.0.0 Beta.

API Changes

  • onStart callback has been added to detectDragGestures (I67269, b/179995594)
  • Modifiers for sizing to intrinsics are no longer experimental. (I15744)
  • MeasureBlocks was renamed to MeasurePolicy which became a fun interface. Layout APIs were updated / simplified to use MeasurePolicy. (Icab48, b/167662468, b/156751158)
  • InteractionState has been replaced with [Mutable]InteractionSource
    • Interfaces are responsible for emitting / collecting Interaction events.
    • Instead of passing interactionState = remember { InteractionState() } to components such as Button and Modifier.clickable(), use interactionSource = remember { MutableInteractionSource() }.
    • Instead of: Interaction.Pressed in interactionState you should instead use the extension functions on InteractionSource, such as InteractionSource.collectIsPressedAsState().
    • For complex use cases you can use InteractionSource.interactions to observe the stream of Interactions. See the InteractionSource documentation and samples for more information.
    • (I85965, b/152525426, b/171913923, b/171710801, b/174852378)
  • Add AccessibilityMananger interface and LocalAccessibilityMananger in CompositionLocals (I53520)
  • Removed deprecated LayoutCoordinates methods, use function instead of the property for positionInParent and boundsInParent (I580ed, b/169874631, b/175142755)
  • Typealiases replaced by underlying types:
    • ColorStop is now Pair<Float, Color>
    • SpanStyleRange is now `AnnotatedString.Range
    • ParagraphStyleRange is now AnnotatedString.Range<ParagraphStyle>
    • StringAnnotation is now AnnotatedString.Range<String>
    • (I8dd1a)
  • Created new TextInputSession for input sessions from low level text components such as CoreTextField. (I8817f, b/177662148)
  • Placeable now exposes measuredSize, representing the size which the child layout actually measured to. This size might not respect the measurement constraints. (Ib2729, b/172560206, b/172338608)
  • Add selectionGroup modifier that allows to mark collection of Tabs or RadioButtons for accessibility purposes (Ie5c29)
  • The defaultFactory for compositionLocalOf and staticCompositionLocalOf is now required instead of optional.

    This changes removes a potential type error for non-nullable types where no default factory was provided. Previously this would provide a null reference for a non-nullable type.

    For nullable types consider supplying { null } as the default factory.

    We do not recommend using locals with non-nullable types unless a sensible default can be provided. If no sensible default exists, the defaultFactory lambda should throw an exception. However throwing an exception means that consumers of the local will have an implicit dependency on it being provided that is not enforced by the type system. (Ifbd2a)

  • Deprecated methods from ui modules were removed (I646f6)

  • Size modifiers were renamed. Modifier.width/height/size were renamed to requiredWidth/requiredHeight/requiredSize. Modifier.preferredWidth/preferredHeight/preferredSize were renamed to width/height/size. (I5b414)

  • Modifier.tapGestureFilter has been removed. Use Modifier.pointerInput { detectTapGestures(...) } instead. (I266ed, b/175294473)

  • partial consumption was removed from pointer input system. The recommended way of coordinating partial consumtion is Modifier.nestedScroll. (Ie9c9b)

  • Orientation has been moved to foundation package. VelocirtTracker moved from ui.gesture to ui.input.pointer. (Iff4a8, b/175294473)

  • imageResource and vectorResource are now extension functions on ImageBitmap and ImageVector companions respectively. load{Image,Vector,Font}Resource functions have been deleted. (I89130)

  • AnimationClockObservable and subclasses have been removed. AnimatedFloat has been removed. (Icde52, b/177457083)

  • Providers has been renamed to CompositionLocalProvider

    • The Composition constructor no longer accepts a key parameter, and has been deprecated.
    • currentCompositeKeyHash has been turned into a composable top level property instead of a composable top level function.
    • CompositionData and CompositionGroup have been moved to the androidx.compose.runtime.tooling namespace
    • ComposableLambda has been made an interface instead of a concrete class, and no longer has type parameters.
    • ComposableLambdaN has been made an interface instead of a concrete class, and no longer has type parameters.
    • The snapshotFlow function has been moved to the androidx.compose.runtime namespace
    • the merge method of SnapshotMutationPolicy is no longer experimental
    • The @TestOnly top level clearRoots function has been removed. It is no longer necessary.
    • keySourceInfoOf and resetSourceInfo functions have been removed. They are no longer necessary.
    • Composer.collectKeySourceInformation has been removed. It is no longer necessary.
    • isJoinedKey, joinedKeyLeft, and joinedKeyRight methods have been removed. They are no longer necessary.
    • Various top level APIs have been moved and reorganized into different files. Due to Kotlin’s file class semantics, this will break binary compatibility but not source compatibility, so should not be an issue for most users.
    • (I99b7d, b/177245490)
  • ComponentActivity.setContent() was removed from compose:ui. Use the one from androidx.activity:activity-compose:1.3.0-alpha01. viewModel() and LocalViewModelStoreOwner were removed from compose:ui. Use the ones from androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha01 (I6f36b)

  • Modifier.scrollable has been reworked. Now it uses Scrollable interface instead of ScrollableController class (I4f5a5, b/174485541, b/175294473)

  • CustomEvens support from PointerInputModifier has been removed (I02707, b/175294473)

  • SnapshotStateObserver is not Experimental anymore (Id2e6a)

  • Deleted some previously deprecated APIs (Ice5da, b/178633932)

  • longPressGestureFilter and doubleClickGestureFilter have been removed. use Modifier.pointerInput with helper functions e.g detectTapGestures (I2fedf, b/175294473)

  • Removed String.format API refactored usages in various toString methods to not leverage String.format internally. (Id1290)

  • Removed dp assertions (I798d2)

  • Removed androidx.compose.runtime:runtime-dispatch (I55feb)

  • Text actions now check focus automatically (I13777, b/179648629)

  • Removed runBlockingWithManualClock (I15cdc, b/179664814)

  • Scroll position in Modifier.verticalScroll()/horizontalScroll() is represented with Ints now (I81298)

  • FlingConfig has been renamed to FlingBehavior now allows for customization of suspend animation rather than predefined Decays. (I02b86, b/175294473)

  • Added a helper function that is helpful to set the same action for all ImeAction callbacks (I63447, b/179226323)

  • Removed SoftwareKeyboardController callback from all text fields to be replaced by a new API shortly. (Iae869, b/168778053)

  • FontSpan and FontWeigthStyleSpan are no longer used and removed. (Ie5b56, b/177423444)

  • Made the following Material API changes:

    • Added contentPadding parameter to Top/BottomAppBar to allow customizing the default padding.
    • Reordered parameters in BackdropScaffold to follow API guidelines for required parameters being before optional parameters.
    • Moved icon parameter in BottomNavigationItem to be after selected and onClick.
    • Renamed alwaysShowLabels parameter in BottomNavigationItem to alwaysShowLabel.
    • Renamed bodyContent parameters in a few components to just content.
    • Reordered parameters in ButtonDefaults.buttonColors(). Please note that because the type of the parameters have not changed, this will not cause an error in your code - please ensure you are either using named parameters or update the ordering manually, otherwise your code will not work the same as previously.
    • Added secondaryVariant parameter to darkColors(). This color is typically the same as secondary in dark theme, but adding for consistency and further customization.
    • Removed ElevationDefaults and animateElevation() from the public API surface since they were not commonly used / useful.
    • Renamed onValueChangeEnd in Slider to onValueChangeFinished and made it nullable.
    • Renamed text parameter in Snackbar to content for consistency.
    • Added contentPadding parameter to DropdownMenuItem to allow customizing the default padding and made content be an extension on RowScope.
    • Renamed ModalDrawerLayout to ModalDrawer.
    • Renamed BottomDrawerLayout to BottomDrawer.
    • (I1cc66)

Bug Fixes

  • Added API to use AnimatedVectorDrawable resources in Compose. Use animatedVectorResource to load an <animated-vector> XML as an AnimatedImageVector and animate it with painterFor (I8ea91)
  • Added new LocalSoftwareKeyboardController composition local API to replace previous SoftwareKeyboardController interface on TextField. (I658b6, b/168778053)

Version 1.0.0-alpha12

February 10, 2021

androidx.compose.ui:ui-*:1.0.0-alpha12 is released. Version 1.0.0-alpha12 contains these commits.

API Changes

  • Support for ViewGroups was removed from UiApplier. The Deprecated emitView composables were removed. (Ifb214)
  • Modifier.pointerInput now requires remember keys to indicate when the pointer input detection coroutine should restart for new dependencies. (I849cd)
  • CompositionReference renamed to CompositionContext (I53fcb)
  • Bounds has been renamed to DpRect (I4b32a)
  • Testing update: hasText() will check for both input and label/hint/placeholder texts in the text field (Iab803)
  • viewModel() composable and LocalViewModelStoreOwner were moved to androidx.lifecycle.viewmodel.compose. You will now need to add a separate dependency androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha01 in order to use it. (I7a374)
  • Allow nullable action in AccessibilityAction, change action label in AccessibilityAction and CustomAccessibilityAction from CharSequence to String (I0dc82)
  • In order to better match naming conventions with ImageBitmap and ImageVector, ImagePainter has been renamed to BitmapPainter to parallel VectorPainter. (Iba381, b/174565889)
  • Better substring test APIs with substring now as an argument (Icbe78)
  • Added an Modifier.focusOrder() that accepts a FocusRequester without specifying a custom focus order a lambda. This is useful when we only need to specify a reference but not a custom focus order for a composable (I4f52a, b/179180978)
  • ComponentActivity.setContent has moved to androidx.activity.compose.setContent in the androidx.activity:activity-compose module. (Icf416)
  • Destructuring and copy() methods have been removed from several classes where they were rarely used. (I26702, b/178659281)
  • Moved Popup to be platform specific. AndroidPopupProperties has been renamed to PopupProperties, and isFocusable has been moved to a focusable parameter in PopupProperties (Ieeea5)
  • Moved Dialog to be platform specific. Renamed AndroidDialogProperties to DialogProperties. (I4ef69, b/179138130)
  • Made LayoutNode internal (I8a7b1, b/175103944)
  • Constraints.enforce was replaced with Constraints.constrain. (I8b8ea)
  • loadFontResource is deprecated. Use fontResource instead. imageResource, loadImageResource, vectorResource, and loadVectorResource are deprecated. Use painterResource instead. (I6b809)
  • For performance reasons, ScrollAxisRange semantics now takes lambdas returning Floats instead of direct Float values. (If4a35, b/178657186)
  • Added EditableText semantics to mark editable input text of the text field for accessibility and corresponding test methods to check the semantics (I8e07a)
  • Made OwnerLayer/OwnerScope/OwnerSnapshotObserver internal (I4ffaf, b/175103944)
  • toIntPx() was renamed to roundToPx(). (I9b7e4, b/173502290)
  • IntBounds was renamed to IntRect and the API was improved. (I1f6ff)
  • Snapshot API was updated to be more consistent with API guideline as well as hiding internal implementation classes from the public API. (Id9e32)
  • Added expand and collapse semantics actions. Added expand and halfExpand in ModalBottomSheetState (Ib5064)
  • Modifier.dragGestureFilter has been deprecated. Use Modifier.pointerInput { detectDragGestures (...)} instead. Alternatively, use Modifier.draggable for one axis drags (I0ba93, b/175294473)
  • Renamed Ambients to match the Ambient -> CompositionLocal rename. Ambients used to be named AmbientFoo, now CompositionLocals are named LocalFoo. (I2d55d)
  • The deprecated BaseTextField is now removed. Use BasicTextField instead. (I71368)
  • Selection was moved to foundation. (I7892b)
  • Similarly to how we previously removed state { 0 } composable and now promote usage like remember { mutableStateOf(0) } we are going to remove savedInstanceState { 0 } composable. You should use rememberSaveable { mutableStateOf(0) } instead and it will save and restore automatically if the type used inside the MutableState can be stored in the Bundle. If previously you were passing a custom saver object now you need to use a new overload of rememberSaveable which has stateSaver parameter. The usage will look like this: val holder = rememberSaveable(stateSaver = HolderSaver) { mutableStateOf(Holder(0)) } (Ib4c26, b/177338004)
  • Added password semantics for accessibility (I231ce)
  • Added ProgressBarRangeInfo.Indeterminate to mark indeterminate progress bars for accessibility (I6fe05)
  • emptyContent() and (@Composable () -> Unit).orEmpty() utilities have been deprecated as they no longer have any positive performance impact or value (I0484d)
  • snapshotFlow and withMutableSnapshot are no longer experimental (I6a45f)
  • Recomposers can now be closed. Closed recomposers will continue recomposition until composition child coroutines complete. Recomposer.shutDown renamed to cancel to contrast with close. (Ib6d76)
  • UiSavedStateRegistry was renamed to SaveableStateRegistry, AmbientUiSavedStateRegistry was renamed to AmbientSaveableStateRegistry and both moved to androidx.compose.runtime.saveable package. (I30224)
  • Artefact androidx:compose:runtime:runtime-saved-instance-state was renamed to androidx:compose:runtime:runtime-saveable (I6dcac)
  • Many longstanding deprecated APIs in the ui package are deleted. (I2f2dc)
  • The compose:runtime-dispatch artifact is now deprecated. MonotonicFrameClock can now be found in compose:runtime and AndroidUiDispatcher can be found in compose:ui. (Ib5c36)
  • Outline.* classes are not data classes anymore (I4879e, b/178001427)
  • Removed view.captureToImage() without any replacement. (I7fcd2)
  • Introduced ColorMatrix API used to modify rgb values of source content Refactored ColorFilter API to be an interface and match the implementation of PathEffect. (Ica1e8)
  • Add layoutDirection param to Shape's createOutline. This allows to create layout direction aware shapes. (I57c20, b/152756983)
  • onImeActionPerformed is deprecated. use KeyboardActions instead (If0bbd, b/179071523)
  • Introduced an InfiniteAnimationPolicy coroutine context element that will be applied in infinite animations. By default no policy is installed, except when running tests with ComposeTestRule. (I50ec4, b/151940543)
  • canDrag has been removed from the Modifier.scrollable. (Id66e7, b/175294473)
  • Renamed LayoutCoordinates.parentCoordinates to LayoutCoordinates.parentLayoutCoordinates to allow for a new parentCoordinates property. The parentCoordinates property now offers the parent modifier's LayoutCoordintes. This will make for more complete use cases for onSizeChanged() and onGloballyPositioned() (Idfbfd, b/177926591)
  • tapGestureFilter, doubleTapGestureFilter, longPressGestureFilter and pressIndicaitonGestureFilter have been deprecated. Use Modifier.clickable or Modifier.pointerInput with detectTapGestures function instead. (I6baf9, b/175294473)
  • SaveableStateRegistry's unregisterProvider was removed. Instead registerProvider() now returns SaveableStateRegistry.Entry object which you can use to unregister (Ic4274, b/178583739)
  • rememberSavedInstanceState() was renamed to rememberSaveable() and moved to androidx.compose.runtime.saveable package. (I1366e, b/177338004)
  • Removed CoreText and CoreTextField from public API
    • Removed deprecated SelectionContainer overload
    • (I99c19)
  • Tests in which Compose is used in hierarchies that are added/removed directly to the WindowManager are now more stable. (Ie81ed, b/175765614)
  • Removed Recomposer.current(). [Abstract]ComposeView now default to lazily created, window-scoped Recomposers driven by the ViewTreeLifecycleOwner for the window. Recomposition and withFrameNanos-based animation ticks are paused while the host Lifecycle is stopped. (I38e11)
  • Recomposer.runningRecomposers now offers a global StateFlow of read-only RecomposerInfo for observing ongoing composition state in the process. Prefer this API to Recomposer.current(), which is now deprecated. (If8ebe)
  • Saver, listSaver(), mapSaver(), autoSaver was moved from androidx.compose.runtime.savedinstancestate to androidx.compose.runtime.saveable (I77fe6)
  • EditCommands accept AnnotatedString. However this is an API only change and multi-style text editing is not implemented yet. (I4c3ea)
  • Uptime and Duration have been removed. (Ib9bf4, b/177420019)
  • CompositionData.asTree() and related APIs moved to separate ui-tooling-data module and marked as experimental (Ic95b8)
  • Parameters on RounderCornerShape, CutCornerShape and CornerBasedShape were renamed from left/right to start/end in order to support the shape's auto mirroring in the rtl direction. AbsoluteRounderCornerShape and AbsoluteCutCornerShape were introduced for the cases when auto-mirroring is not desired. (I61040, b/152756983)
  • The API the Compose compiler plugin targets has been refactored to use an interface instead of a concrete class. The interface also no longer uses a type parameter.

    This is an internal change that should not effect source code compatibility but is a binary breaking change. (I3b922, b/169406779)

  • Remove unintentionally public StringBuilder.deleteAt function (Id6ed9)

Bug Fixes

  • ComposeViews placed in view hierarchies that are children of another composition now host child compositions of their ancestors (I92883)
  • Updated compose's imageFromResource API to reuse the resource drawable cache when loading ImageBitmap objects. (If3627, b/178751994)

Version 1.0.0-alpha11

January 28, 2021

androidx.compose.ui:ui-*:1.0.0-alpha11 is released. Version 1.0.0-alpha11 contains these commits.

API Changes

  • WithConstraints was reworked as BoxWithConstraints and moved to foundation.layout. (I9420b, b/173387208)
  • Key.DPadUp is deprecated. Use Key.DirectionUp instead. (Iab335, b/177954892)
  • Owner interface from now on internal. (If8e35)
  • Added FocusManager.moveFocus() API to move focus programmatically. (I045cb, b/177681839)
  • Changes PopupPositionProvider to use window-relative coordinates, not global coordinates. Renames parentGlobalBounds to anchorBounds, and changes windowGlobalBounds to be windowSize: IntSize (I2994a)
  • Duration and Uptime will be replace with Long milliseconds, and this step removes the dependency of pointer input on those classes. (Ia33b2, b/175142755, b/177420019)
  • AmbientSavedStateRegistryOwner was added similarly to already existing AmbientLifecycleOwner and AmbientViewModelStoreOwner (I9a3e8, b/176756365)
  • Updated vector graphics API to support parsing of tinting applied to the root of vector graphics. (Id9d53, b/177210509)
  • Added toolType to PointerInputChange to differentiate devices (Iac787, b/175142755)
  • AmbientWindowManager is renamed to AmbientWindowInfo (I2686a, b/177084714, b/177084983)
  • Deprecated global coordinates methods and made new window-based coordinates methods. (Iee284)
  • Added Modifier.toolingGraphicsLayer which adds a graphics layer modifier when inspection is turned on. (I315df)
  • FocusRequester.createRefs is now marked as experimental as it might change. (I2d898, b/177000821)
  • SemanticsPropertyReceiver.hidden was renamed to invisibleToUser and marked @ExperimentalComposeUiApi. AccessibilityRangeInfo was renamed to ProgressBarRangeInfo. stateDescriptionRange was renamed to progressBarRangeInfo. AccessibilityScrollState was renamed to ScrollAxisRange. horizontalAccessibilityScrollState was renamed to horizontalScrollAxisRange. verticalAccessibilityScrollState was renamed to verticalScrollAxisRange. (Id3148)
  • Removed PointerInputData and modified PointerInputChange to give it all of PointerInputData's fields. Made PointerInputEvent and PointerInputEventData internal because they aren't used in any public API. (Ifff97, b/175142755)
  • Updated GraphicsLayerScope implement density to support conversions of dp into raw pixels. (Ied528, b/176819695)
  • Updated matrix API to follow row major ordering and provide index constants to assist with conversions between different matrix representations to match framework conversion logic between SkMatrix and Matrix4 internally. (I432e6)
  • Removed experimental monotonicFrameAnimationClockOf methods (Ib753f, b/170708374)
  • Move String.fintPrecedingBreak and String.fingFollowingBreak to InternalTextApi. (I657c4)
  • androidx.compose.ui.util.isSurrogatePair has been removed from public API. (Ia9494)
  • Renamed TransformedText.transformedText to TransformedText.text
    • TransformedText is no longer a data class (Ie672a)
  • Removed data class from the following classes:
    • InlineTextContent
    • LocaleList (I605c7)
  • The following classes are not data classes anymore:
    • AnnotatedString
    • ParagraphStyle
    • SpanStyle
    • TextStyle
    • FontWeight
    • TextDecoration
    • TextGeometricTransform
    • TextIndex
    • TextLayoutResult
    • TextLayoutInput (Iaff99)
  • Changed VisualTransformation to be a functional interface (I3bba4)
  • Added a function reference parameter type (I5e1bd)
  • Add transformed bounds to InspectorNode (Ice42f)

Bug Fixes

  • onCommit, onDispose, and onActive have been deprecated in favor of SideEffect and DisposableEffect APIs (If760e)
  • Changes to factory functions for Font/FontFamily/Typeface

    • Added factory functions that start with capital letter
    • Deprecated previous factory functions with lowercase first letters
    • New factory functions return the FontFamily instead of subclasses
    • Hid constructors of the subclasses, so that they can only be constructed via factory functions.
    • Renamed Font.asFontFamily to Font.toFontFamily (I42aa7)
  • Introduced ComposeContentTestRule, which extends ComposeTestRule and defines setContent, which has been removed from ComposeTestRule. Added a factory method createEmptyComposeRule() that returns a ComposeTestRule and does not launch an Activity for you. Use this when you want to launch your Activity during your test, e.g. using ActivityScenario.launch (I9d782, b/174472899)

  • animateAsState is now animateFooAsState, where Foo is the type of the variable being animated. e.g. Float, Dp, Offset, etc (Ie7e25)

  • Content description parameter has been added to the Image and Icon. It is used to provide description to the accessibility services (I2ac4c)

  • Remove displaySize as it should be avoided. Typically it is better to use size of onRoot() or window size at least. (I62db4)

  • OnSizeChanged was reporting the size of the layout's contents. It now reports the size at its position within the modifier chain. (I36b78, b/177562900)

  • The emit() API and all overloads have been deprecated and renamed to ComposeNode. The APIs are identical, just a different name in order to follow the naming conventions of Compose (I4137b)

  • TextFieldValue accepts AnnotatedString. However this is an API only change and multi-style text editing is not implemented yet.

    • Removed initial from EditingBuffer constructor parameters. (I326d5)
  • invalidate and compositionReference() are now deprecated in favor of currentRecomposeScope and rememberCompositionReference respectively. (I583a8)

  • AnnotatedString is changed to extend from kotlin.CharSequence. Therefore length and subSequence are now instance functions, and extension functions are removed. (Iaf429)

  • RememberObserver replaces CompositionLifecycleObserver and CompositionLifecycleObserver is now deprecated.

    RememberObserver is a replacement for CompositionLifecycleObserver with modified semantics and renamed methods. Changing to the new API can be done mechanically for objects that are only remembered once which is, and continues to be, the recommended practice. However, if a reference was remembered more than once in a composition onRemembered is called for each reference where onEnter is only called once. onEnter was called multiple time if the object was used in subcompositions, such as WithConstraints and Scaffold making the single onEnter call guarantee unreliable and it was removed for RememberObserver.

    RememberObserver adds onAbandoned which is called if the RememberObserver instance is returned from the callback passed to remember but was not remembered in the composition state and, therefore, will never have onRemembered called. This can occur if an exception terminates composition before completing or the composition is discarded because the state is was producing a composition for is no longer current or otherwise is no longer needed. If the instance of RememberObserver following the single reference recommendation above is tracking an external resource both onForgotten and onAbandoned each indicate that the resource is no longer needed. If the object is tracking work started or resources allocated in onRemembered, onAbandoned can be ignored as it will not be called if onRemembered is called. (I02c36)

  • Deprecated arithmetic operations between 2 or more TextUnits. Deprecated TextUnit.Sp and TextUnit.Em functions in preference to the extension functions such as Int.sp and Int.em. (I48369)

  • Resources in libraries with no explicitly declared public resources (ex. via public.xml) are now private by default. (Ia1dcc, b/170882230)

  • ScrollableColumn/Row were deprecated. Using ScrollableColumn is less efficient compared to LazyColumn when you have a large scrolling content because with LazyColumn we can only compose/measure/draw visible elements. To prevent users from going the inefficient way we decided to deprecate ScrollableColumn and ScrollableRow and promote usages of LazyColumn and LazyRow instead. Users can still decide they don't need the lazy behaviour and use the modifiers directly like this: Column(Modifier.verticalScroll(rememberScrollState())) (Ib976b, b/170468083)

  • New items(count: Int) factory method for scope of LazyColumn/LazyRow/LazyVerticalGrid. items(items: List) and itemsIndexed(items: List) are now extension functions so you have to manually import them when used. New extension overloads for Arrays: items(items: Array) and itemsIndexed(Array) (I803fc, b/175562574)

  • Please use ImeAction.None instead of ImeAction.NoAction

    • Please use ImeAction.Default instead of ImeAction.Unspecified (Ie1bcc)
  • Leverage TestCoroutineDispatcher in testing (I532b6)

  • Renamed TextInputService.onStateUpdated as updateState (Id4853)

  • TransitionDefinition-based Transition has been deprecated (I0ac57)

  • TextUnitType.Inherit is removed. Please use TextUnitType.Unspecified instead. (I9ff64)

Version 1.0.0-alpha10

January 13, 2021

androidx.compose.ui:ui-*:1.0.0-alpha10 is released. Version 1.0.0-alpha10 contains these commits.

Breaking Change

  • Restructuring of the internal compiler API allows batching changes to the nodes generated as a result of composition into the "apply changes" phase of composition, after all @Composable functions have completed.

    This is a behavioral breaking change that might affect application code as nodes are no longer available from internal and experimental APIs until after changes have been applied. This can usually be worked around by surrounding code with such dependencies in a SideEffect composable to defer execution of the code until after the nodes have been created and initialized. (I018da)

API Changes

  • Added Modifier.focusOrder() that can be used to specify a custom focus traversal order (I90cf5, b/175899543, b/170155556, b/170155429)
  • Removed deprecated focusObserver use onFocusChanged or onFocusEvent instead (I3ecb9, b/175156387)
  • EditOperations API Changes
    • Renamed EditOperation as EditCommand
    • Added Command suffix for EditOperation concrete implementations
    • EditCommand's are no longer data classes
    • Renamed EditOperation.process function to applyTo
    • Renamed InputEventListener to InputEventCallback
    • (I0a366)
  • Removed unused PxSquared, PxCubed, PxInverse. Changed to be a property. (I973f7)
  • ui-test module will now be able to configure the creation of Recomposers for UIs under test (Ibebd8)
  • Modified Velocity to have component parts and mathematical operations. (Ib0447)
  • Renamed @ExperimentalTesting to @ExperimentalTestApi to be consistent with similar experimental api annotations (Ia4502, b/171464963)
  • Renamed Color.useOrElse() to Color.takeOrElse() (Ifdcf5)
  • Removed unused DpInverse, DpSquared, and DpCubed classes. (I4d62b)
  • Constraints#satisfiedBy was renamed to isSatisfiedBy. (I9cf5c)
  • Add a callback to notify Owner when layoutnode bounds change. (I72fd1)
  • Added isSpecified, isUnspecified, and useOrElse for inline classes with an Unspecified constant. (I93f7b, b/174310811)
  • Expand [Abstract]ComposeView APIs to allow recycling Compose-based views, disposing their composition to recreate again later. Add APIs for installing and discovering window-scoped Recomposers and CompositionReferences for creating child compositions.

    Add ViewCompositionStrategy for configuring the composition disposal strategy of [Abstract]ComposeViews; default behavior is dispose on window detach. (I860ab)

  • Removed Any.identityHashCode() public api (I025d7)

  • Removed toStringAsFixed API in favor of using String.format instead directly. (Iaba6b)

  • Add Toggle to foundation Strings.kt (I4a5b7, b/172366489)

  • Moved nativeClass to ui module and made it internal. Updated usages of nativeClass in equals implementations to use 'is MyClass' instead. (I4f734)

  • Modifier.focus() and Modifier.focusRequester() are deprecated. Use Modifier.focusModifier() and Modifier.focusReference() instead. (I75a48, b/175160751, b/175160532, b/175077829)

  • Introduced SelectionRegistrar.notifySelectableChange to notify Selectable updates to SelectionManager. (I6ff30, b/173215242)

  • Introduced Outline.bounds property to obtain the bounding rect for various outline implementations. (I16e74, b/175093504)

  • Deprecated TestUiDispatcher. Use Dispatchers.Main instead (Ic171f, b/175385255)

  • ImeOptions and KeyboardOptions are no more a data class (I3c898, b/168684531)

  • VisualTransformation API Changes

    • Renamed OffsetMap to OffsetMapping
    • Renamed OffsetMapping.identityOffsetMap to OffsetMapping.Identity
    • PasswordTransformation is no longer data-class
    • Moved OffsetMapping to its own file
    • (I0bdf3)
  • Renamed Position to DpOffset and removed getDistance() (Ib2dfd)

  • Changed fun Dp.isFinite() to a val Dp.isFinite (I50e00)

Bug Fixes

  • Recomposer now exposes a Flow of its current state, allowing monitoring its activity and the activity of associated effects. (Ifb2b9)
  • The native keyEvent can now be accessed through keyEvent.nativeKeyEvent (I87c57, b/173086397)
  • animate() is now replaced with animateAsState(), which returns a State<T> instead of T. This allows better performance, as the invalidation scope can be narrowed down to where the State value is read. (Ib179e)
  • Add Semantics role API and add Role as a parameter to clickable, selectable and toggleable SemanticsModifier. Changed Modifier.progressSemantics so that Slider can also use it. (I216cd)
  • New coroutine-based API Animatable that ensures mutual exclusiveness among its animations.
    • New DecayAnimationSpec to support multi-dimensional decay animation
    • (I820f2, b/168014930)

Version 1.0.0-alpha09

December 16, 2020

androidx.compose.ui:ui-*:1.0.0-alpha09 is released. Version 1.0.0-alpha09 contains these commits.

API Changes

  • Deprecated KeyEvent.Alt is now removed. Use KeyEvent.isAltPressed instead. (Idd695)
  • Modifier.keyInputFilter and Modifier.previewKeyInputFilter are deprecated use Modifier.onKeyEvent and Modifier.onPreviewKeyEvent instead (Idbf1b, b/175156384)
  • Modifier.focusObserver is deprecated. Use Modifier.onFocusChanged or Modifier.onFocusEvent instead (I30f17, b/168511863, b/168511484)
  • For suspending pointer input APIs, renamed HandlePointerInputScope to AwaitPointerEventScope and handlePointerInput() to awaitPointerEventScope(). (Idf0a1, b/175142755)
  • Autofill API is now experimental API and requires opt-in (I0a1ec)
  • Adding destructuring declarations to create FocuSRequester instances (I35d84, b/174817008)
  • accessibilityLabel has been renamed to contentDescription. accessibilityValue has been renamed to stateDescription. (I250f2)
  • Custom events were removed from suspending pointer input API (Ia54d5, b/175142755)
  • Introduced several new functions in SelectionRegistrar and also renamed onPositionChange to notifyPositionChange. (Ifbaf7)
  • More members of LayoutNode we marked as internal (I443c6)
  • LayoutInfo was introduced to be used by tooling and testing (I9b190)
  • AndroidOwner made internal (Ibcad0, b/170296980)
  • Removed ExperimentalPointerInput annotation (Ia7a24)
  • Nested scroll system added. Refer to Modifier.nestedScroll for more details (I36e15, b/162408885)
  • subcomposeInto(LayoutNode) was made internal (Id724a)
  • The Applier interface has changed to simplify building trees bottom-up instead of top-down.

    The insert() method has been renamed to insertTopDown().

    A new method, insertBottomUp(), was added.

    An applier either inserts nodes into the tree it is editing using insertTopDown() or insertBottomUp() depending on which performs better.

    Some trees, such as LayoutNode and View, are much more efficient to build bottom-up than top-down. Prior to this change, a stack of inserts was required to implement bottom-up which needed to be copied to every applier which needed bottom-up construction for performance. With this change an Applier overrides insertBottomUp() to build a tree bottom-up and insertTopDown() to build the tree top-down. (Icbdc2)

  • Added dismissOnBackPress and dismissOnClickOutside properties to AndroidDialogProperties. These allow configuring when the dialog's onDismissRequest lambda will be invoked. (If5e17)

  • Added painterResource API to handle opaquely loading Painter objects from either rasterized asset formats (like PNGs) or VectorDrawables. Consumers no longer have to determine the type of asset in advance and can call this method to get a Painter object to use in Image composables or painter modifiers. (I2c703, b/173818471)

  • Added Modifier.clearAndSetSemantics to clear descendants' semantics and set new ones. (I277ca)

  • Moved ContentDrawScope to ui-graphics module to be with DrawScope. (Iee043, b/173832789)

  • Introduced PathEffect graphics API to provide different patterns to stroked shapes. Deprecated usage of NativePathEffect in favor of expect/actual implementation of PathEffect. (I5e976, b/171072166)

  • Added IdlingResource interfaces to Compose, as a Compose supported variant of Espresso's idling resources. They can be registered and unregistered through the ComposeTestRule (I433f3)

  • Removed global (un)registration of ComposeIdlingResource and global (un)registration of clocks into ComposeIdlingResource (I32660)

Bug Fixes

  • Lambdas in offset modifiers now return IntOffset rather than Float. (Ic9ee5, b/174137212, b/174146755)
  • Removed SlotTable, SlotReader and SlotWriter from the public API. These were marked as InternalComposeAPI previously. Now they are internal to the compose module.

    CompositionData and CompositionGroup were added as a replacement for the ui-tooling API to use to extract composition information. These are public but are not intended for use outside the ui-tooling API as they provide the raw information the ui-tooling API interprets (I31a9c)

  • Refactored ShaderBrush to lazily create a shader instance when sizing information of the drawing environment is available. This is useful to define gradients that occupy the full drawing bounds of a composable at composition time, without having to implement custom DrawModifier implementations.

    Deprecated gradient function constructor APIs in favor of factory methods on a Gradient object. (I511fc, b/173066799)

  • Deprecate LazyColumnFor, LazyRowFor, LazyColumnForIndexed and LazyRowForIndexed. Use LazyColumn and LazyRow instead (I5b48c)

  • Deprecated BuildCompat.isAtLeastR (Idb37e)

  • Added buildAnnotatedString factory function in order to build an AnnotatedString. Deprecated annotatedString builder function. (Idfe0b)

  • Removed extension methods on Float and Double to convert values to radians. Moved to be a private function within the implementation PathParser which was the only place where it was used (I25f52)

Version 1.0.0-alpha08

December 2, 2020

androidx.compose.ui:ui-*:1.0.0-alpha08 is released. Version 1.0.0-alpha08 contains these commits.

API Changes

  • Add semantics action Dismiss (I2b706)
  • Moved DrawModifier APIs from the androidx.compose.ui package to the androidx.compose.ui.draw package. Created DrawModifierDeprecated.kt file to include typealiases/helper methods to assist with the migration from the deprecated to the current APIs. (Id6044, b/173834241)
  • Renamed Modifier.drawLayer to Modifier.graphicsLayer Also updated related classes to GraphicsLayer as per API feedback. (I0bd29, b/173834241)
  • New methods placeable.placeWithLayer() and placeable.placeRelativeWithLayer() were added which allows custom layouts and layout modifiers to place a child with introducing a graphics layer for their drawing. Having that we can first optimize redrawings, so when we need to move a child we don't have to redraw its content, second we can apply draw transformations for a child (Ibd8f6, b/170296989, b/171493718, b/173030831)
  • <T> was removed from SubcomposeLayout declaration. You can use it without specifying a type now. (Ib60c8)
  • Added Modifier.scale/rotate APIs as conveniences for drawLayer.
    • Renamed Modifier.drawOpacity to Modifier.alpha
    • Renamed Modifier.drawShadow to Modifier.shadow (I264ca, b/173208140)
  • Made PointerInputData's uptime and position fields non-nullable. (Id468a)
  • MaterialTheme now sets the correct colors for selection handles and selection background. Non-Material apps can manually use AmbientTextSelectionColors to customize the colors used for selection. (I1e6f4, b/139320372, b/139320907)
  • Added WindowManager.isWindowFocused to check if the host window is in focus, and a WindowFocusObserver that provides an onWindowFocusChanged callback. (I53b2a, b/170932874)
  • Updated TransformOrigin API to have destructuring syntax to return pivotFractionX and pivotFractionY as component1 and component2 (If43c4, b/173586560)
  • Added lint check for composable lambda parameter naming and position, to check for consistency with Compose guidelines. Also migrated some APIs using children as the name for their trailing lambda to content, according to the lint check and guidance. (Iec48e)
  • Added API to check if Alt, Ctrl, Meta or Shift modifier keys were pressed when a keyevent was dispatched. (I50ed9)
  • Added a new Modifier.drawLayer() overload. It takes a lambda block on a new GraphicsLayerScope where you define the layer parameters in a way which allows to skip recomposition and relayout when the state change happens. DrawLayerModifier is now internal in preparation to migrating its logic into placeable.placeWithLayer() method of LayoutModifier (I15e9f, b/173030831)
  • Deprecated Ambients named with Ambient as their suffix, and replaced them with new properties prefixed with Ambient, following other Ambients and Compose API guidelines. (I33440)
  • Moved androidx.compose.ui.text.Typeface to androidx.compose.ui.text.font.Typeface (Ic2b81)
  • Semantics argument mergeAllDescendants was renamed to mergeDescendants. (Ib6250)
  • New drag gesture detector suspending pointer input API, including orientation locking. (Icef25)
  • Renamed VectorAsset to ImageVector Moved and renamed VectorAsset to Builder to be an inner class of ImageVector as per API guidelines. Added typealias of VectorAssetBuilder to link to ImageVector.Builder for compat. (Icfdc8)
  • Renamed ImageAsset and related methods to ImageBitmap. (Ia2d99)
  • Add zIndex param for the PlacementScope's place() so Modifier.zIndex() now works as a LayoutModifier and any custom layout can set zIndexes for their children right in the placement block (I711f7, b/171493718)
  • Moved foundation semantics properties to ui (I6f05c)
  • Deprecate place(Offset) and placeRelative(Offset). Use overloads with int offsets instead (I4c5e7)
  • Previously Deprecated APIs were removed: Modifier.onPositioned was removed, use Modifier.onGloballyPositioned. Modifier.onDraw was removed, use Modifier.onDrawBehind. was removed, use Modifier.then. Color.Unset was removed, use Color.Unspecified. PxBounds class was removed, use Rect instead. (Ie9d02, b/172562222)
  • The Alignment interface was updated and made functional. (I46a07, b/172311734)
  • Gesture detector for tap, double-tap, long press, and press indication were added using the new suspending pointer input. A few utilities were added as well, making it easier for developers to write their own gesture detectors. (I00807)
  • id was renamed to layoutId for LayoutIdParentData. was renamed to Measurable.layoutId. (Iadbcb, b/172449643)
  • New multitouch gesture detector, including helpers for detecting rotation, zoom, and panning. (Ic459d)
  • Introduced SweepGradientShader and SweepGradientBrush APIs. (Ia22c1)
  • Time control in tests (TestAnimationClock and its usages) is now experimental (I6ef86, b/171378521)
  • Add coroutine-based scrolling APIs:

    Adds LazyListState.snapToItem and LazyListState.smoothScrollBy, as well as lower-level APIs for scroll control. These APIs provide a suspend interface to control scrolling that waits until the scroll is finished before returning. (Ie5642)

  • Modifier.focusable has need added in foundation. Use this to add focusable behavior to a component, with correct semantics and accessibility. (I41eb9, b/152525426, b/162865824)

  • Provide default implementations of methods and properties in AnimationClockTestRule that can be delegated to its clock (I7ea3d, b/173399709)

  • AndroidComposeTestRule can now accept custom activity launchers (Ib8288, b/153623653, b/154135019)

  • TextLayoutResult.getLineVisibleEnd is deprecated. As a replacement TextLayoutResult.getLineEnd now has a new parameter visibleEnd. (I73282)

  • Updated TextFieldValue API

    • made TextFieldValue.composition readonly
    • removed exception thrown for invalid selection range (I4a675, b/172239032)
  • Support TtsAnnotation for text to speech engine. (I54cc6)

  • New APIs for running animations in coroutines (Ied662)

Bug Fixes

  • The alignment parameter of Box was renamed to contentAlignment. (I2c957)
  • offsetPx modifiers were renamed to offset. They are now taking lambda parameters instead of State. (Ic3021, b/173594846)
  • Added resetInput parameter to TextInputService#onStateUpdated (I3e8f5, b/172239032, b/171860947)
  • Added lint check for Modifier parameters in Composable functions. This lint check checks the naming, return type, default value, and order of the parameter for consistency with Compose guidelines. (If493b)
  • Temporarily added option to let the TestAnimationClock be driven by the MonotonicFrameClock (I1403b, b/173402197)
  • Added Android Typeface wrapper. You can load an Android Typeface via typeface function i.e. typeface(Typeface.DEFAULT). Also renamed typefaceFromFontFamily() to typeface() (I52ab7)
  • Added lint check to check that Modifier factory functions are defined as extensions on Modifier, so they can be fluently chained together. (I07981)
  • Remove old ui-test module and its stubs (I3a7cb)
  • Recomposer no longer accepts an EmbeddingContext; required scheduling dependencies are obtained from the effectCoroutineContext. FrameManager is deprecated; platform integrations should initialize their own global snapshot handling. (I02369)
  • Pass style information to accessibility node. (If5e8d)
  • TextUnit.Inherit is renamed to TextUnit.Unspecified for consistency with other units. (Ifce19)

Compose UI Version 1.0.0-alpha07

November 11, 2020

androidx.compose.ui:ui-*:1.0.0-alpha07 is released. Version 1.0.0-alpha07 contains these commits.

API Changes

  • Introduced ScaleFactor inline class to represent scale factors for the horizontal and vertical axes independent of one another in order to support non-uniform scaling use cases.
    • Added computeScaleFactor method to ContentScale
    • Added ContentScale.FillBounds to perform non-uniform scaling to stretch the src bounds to fully occupy the destination.
    • Added operator methods to compute ScaleFactor parameters with Size parameters.
    • (Ic96a6, b/172291582)
  • The BiasAlignment and BiasAbsoluteAlignment factories for creating Alignments were added. (Iac836, b/169406772)
  • Allow a developer to forcefully clear focus. (I90372)
  • A bug causing elevation not being drawn for Views inside Compose was fixed. (If7782)
  • Created onDrawBehind API within ContentDrawScope to match naming convention with Modifier.drawBehind. (I4fc3a, b/171955269)
  • Add support for camera distance to complement 3d transformations rotationX/rotationY on layer APIs. (I40213, b/171492100)
  • Added SelectionContainer without the callback (Ibfadb)
  • ExperimentalSubcomposeLayoutApi annotation was removed. SubcomposeLayout can now be used without adding @OptIn (I708ad)
  • FirstBaseline and LastBaseline were moved to androidx.compose.ui.layout package (Ied2e7)
  • Removed opacity from drawShadow() modifier as it was confusing. (I82c62, b/171624638)
  • MeasureResult was moved out of MeasureScope. (Ibf96d, b/171184002)
  • Several layout related symbols were moved from androidx.compose.ui to androidx.compose.layout.ui. (I0fa98, b/170475424)
  • Removed Deprecated FocusState2 (I686cb, b/168686446)
  • ZIndexModifier is now internal (I1808b, b/171493718)
  • Updated return type of lerp method on Size parameters to return a non-null Size to avoid unnecessary boxing. (Ib0044)
  • Added TestMonotonicFrameClock for testing code that relies on Compose's MonotonicFrameClock for awaiting composition frame events using kotlinx-coroutines-test's runBlockingTest (I4402f)
  • Removed GestureScope.localToGlobal (I15299, b/171462785)
  • Added onAllNodesWithSubstring finder (I81dd7, b/171462889)
  • androidx.ui.test module deprecated. Please migrate to androidx.compose.ui.test and androidx.compose.ui.test.junit4 (I452e8)

Bug Fixes

  • captureToBitmap moved to captureToImage. (I86385)
  • foundation.Text has been deprecated and replaced with material.Text. For a basic, unopinionated text API that does not consume values from a theme, see (If64cb)
  • Update TextFields to accept KeyboardOptions (Ida7f3)
  • Rename KeyboardOptions as ImeOptions (I82f36)
  • Moved KeyboardType and ImeAction into KeyboardOptions (I910ce)
  • provideDefault was added as an alternative for providing ambients, and it can be used to specify ambient values that will only be set when there is no ambient value already provided. (Id6635, b/171024925)
  • BaseTextField has been deprecated. Use BasicTextField instead. (I896eb)
  • Introduce ui-test-junit4 module (Ib91f8)
  • relativePaddingFrom was renamed to paddingFrom. The paddingFromBaseline modifier was added, as convenience for specifying distances from layout bounds to text baselines. (I0440a, b/170633813)
  • LaunchedTask was renamed to LaunchedEffect for consistency with the SideEffect and DisposableEffect APIs. LaunchedEffect with no subject params is not permitted in order to encourage best practices. (Ifd3d4)
  • Introduced resources composable that recomposes when the configuration updates. (I6387c, b/167352819)
  • Recomposer now requires a CoroutineContext at construction (Ic4610)
  • Sum zIndex values when multiple Modifier.zIndex() applied. Previously the first one was winning. (Ic514c, b/170623936)
  • Changes to the internal SlotTable implementation which should not affect the public API. (If9828)
  • Added Keyboard auto correct IME Option (I57b8d)
  • androidx.ui.test moved to androidx.compose.ui.test (I9ffdb)
  • Removed KeyboardOptions.toImeOptions from public API. (Ic2e45)

External Contribution

  • Disabled publication of internal artifact androidx.compose.ui:ui-text-android (Ib93fa)

Version 1.0.0-alpha06

October 28, 2020

androidx.compose.ui:ui-*:1.0.0-alpha06 is released. Version 1.0.0-alpha06 contains these commits.

API Changes

  • Recomposer is now a CompositionReference and a valid composition parent. Explicit Recomposer is now required in fewer places. (I4036f)
  • Deprecate VectorPainter in favor of rememberVectorPainter to better indicate that the composable API internally leverages 'remember' to persist data across compositions. (Ifda43)
  • Updated Modifier.drawWithCache API to expose ContentDrawScope as a receiver scope instead of DrawScope in order to provide implementations the ability to re-order drawing commands. This is useful for blending/ tinting use cases in which content pixels must be rendered first in order for the corresponding blend mode algorithm to be applied properly. (Ie7ec8)
  • Move SimpleContainer into PopupTestUtils.kt (I78c57)
  • ConsumedData is no longer a data class. See for details (I1737f)
  • Fix Rtl Handle Position. (I6e1e0)
  • Refactored DrawScope and ContentDrawScope to be interfaces instead of abstract classes
    • Created CanvasDrawScope implementation of DrawScope
    • Refactored implementations of DrawScope to use CanvasScope instead
    • Created DrawContext to wrap dependencies for DrawScope
    • Removed deprecated methods on DrawScope (I56f5e)
  • Breaking change: removed the return value from PointerInputFilter.onPointerEvent(...) given that the only value that should be able to be changed in pointer events is consumption data. Instead of returning data from PointerInputFilter.onPointerEvent(...), now you can just mutate the consumption data of the PointerEvents passed in. (I6acd0)
  • MeasureScope and IntrinsicMeasureScope were made interfaces. (I1a087, b/170461665)
  • The merge function for AlignmentLine was hidden. (I9da1a, b/170612900, b/170611568)
  • Add ability to specify inspector info in composed modifier (Idee08, b/163494569)
  • Added SelectAll option into selection menu (Ief02b)
  • Updated DrawTransform.rotate to take a default pivot parameter of center to match the documentation.
    • Updated DrawScope.rotateRad to consume an Offset for the pivot point to match other transformation methods.
    • Deprecated DrawScope.rotateRad overload that consumed floats for the x and y coordinate of the pivot.
    • (Iffcbb, b/170434992)

Bug Fixes

  • API lint check for MissingGetterMatchingBuilder is enabled for androidx (I4bbea, b/138602561)
  • Add test. (I6b8ae)
  • Enable transitions in ComposeTestRule; remove option to enable the blinking cursor from ComposeTestRule. (If0de3)
  • Added KeyboardCapitalization IME Option (I8ac38)
  • Added single line keyboard option to CoreTextField (I72e6d)
  • Move SimpleContainer into PopupTestUtils.kt (I65c3e)
  • Renamed Radius API to CornerRadius to better express how it is used throughout Compose. Updated documentation to indicate that negative corner radii are clamped to zero. (I130c7, b/168762961)
  • Improved Android interop by continuing to send MotionEvents to child Android Views that return false for onTouchEvent for all actions except ACTION_DOWN (I94c5a, b/170320973)
  • Box was made an inline function. (Ibce0c, b/155056091)

External Contribution

  • Support different locales for AnnotatedString.capitalize and AnnotatedString.decapitalize (I4aa7f)

Version 1.0.0-alpha05

October 14, 2020

androidx.compose.ui:ui-*:1.0.0-alpha05 is released. Version 1.0.0-alpha05 contains these commits.

API Changes

  • Add a DSL for specifying inspector information (Ic9a22)
  • Move LongPress into Text. (Iff2bc)
  • Experimental Modifier.pointerInput suspending input modifier (Ia77d2)
  • Added Copy/Paste/Cut accessibility actions (I6db4f)
  • Public constructor for AndroidOwner was removed (Iacaef)
  • Popups and dialogs now inherit FLAG_SECURE from parent Window. Also added option to configure this explicitly (I64966, b/143778148, b/143778149)
  • Consumption data is now mutable. Also calls to extension functions that do consumption now no longer return a new PointerInputChange, but instead mutate the provided PointerInputChange.

    This is the first step in a 2 step process to make PointerEvent data mutable such that other pointer data cannot be edited by user code. The second step will be to remove the List<PointerInputChange> return type from PointerInputFilter.onPointerEvent(...). (Id067e)

  • Disable Selection in Text, and a Demo. (Ie7e97)

  • Made onGloballyPositioned an inline function (I15830)

  • OnPositionedModifier is renamed to OnGloballyPositionedModifier and onPositioned() is renamed to onGloballyPositioned(). (I587e8, b/169083903)

  • The hasPendingMeasureOrLayout property was added to Owner, telling whether the Owner has any pending layout work. (I3d9f8, b/169038599)

  • Added API to programmatically clear focus (Ie1dc2, b/161487952)

  • Removed PointerInputFilter.onPointerInput(...). PointerInputFilter.onPointerEvent(...) should be used in its place. (I6f04a)

  • Changes to Size

    • Removed Size.getFlipped
    • Removed Size.rem
    • Removed Size.truncDiv (Ief44d, b/169790720)
  • As part of the standardization of sentinel values for inline classes, rename Color.Unset to Color.Unspecified for consistency with other inline classes (I97611, b/169797763)

  • TextOverflow.None is introduced. When overflow is None, Text won't handle overflow anymore, and it will report its actual size to LayoutNode. (I175c9, b/158830170)

  • The scope parameter within AnnotatedString.Builder.addStringAnnotation is renamed to tag for API consistency. (I7c8cb)

Bug Fixes

  • The scrolling performance of LazyColumn/Row is improved by doing less work in subcomposition on every scroll. The new hasInvalidations() method was added for Composition class. hasPendingChanges() method from Recomposer was renamed to hasInvalidations() (Ib2f32, b/168293643, b/167972292, b/165028371)
  • Updated Size.Unspecified parameters to be Float.NaN instead of Float.POSITIVE_INFINITY. Updated Painter implementations to check against Size.Unspecified as well as non-finite Sizes. (I95a7e)
  • The order of place() calls in custom Layouts now defines the drawing order for the children (Ibc9f6)
  • Support AnnotatedString to SpannableString conversion for accessibility. (Ief907)
  • Added stubs for android classes that are on older platforms to avoid use of reflection when possible. (Ia1790)
  • Fixed bug: If the software keyboard showing caused the app to translate, pointer input coordinates would become incorrect. (Ic4cec, b/163077821)

Version 1.0.0-alpha04

October 1, 2020

androidx.compose.ui:ui-*:1.0.0-alpha04 is released. Version 1.0.0-alpha04 contains these commits.

API Changes

  • Added OwnerScope to allow collection of layout and drawing observation scopes once they are no longer valid. (Ic4cf8)
  • Added OnRemeasuredModifier and onSizeChanged() to receive a callback when content layout has been remeasured and the size has changed, respectively. (I657cf, b/154108792)
  • Add long click semantics action (I6281b, b/156468846)
  • Made FocusManager private. (I7872f)
  • Updated implementation to create a dedicated DrawCacheModifier implementation instead of adding optional properties on DrawModifier.

    Updated documentation for various methods (Ibd166)

  • Make TextRange inline to avoid object creation. (Id034b)

  • PlacementScope#parentWidth and PlacementScope#parentLayoutDirection can no longer be read from the placement block of a custom layout. (Icc1ae, b/168295623)

  • add AccessibilityScrollState to semantics properties. (Ifeda9)

  • Introduced Modifier.drawWithCache to support creating a drawing object that conditionally recreates dependencies that depend on size/state information (I376dc)

  • ParagraphConstraints is removed. Width is directly passed to Paragraph now. (Ica712)

Bug Fixes

  • Updated many Graphics APIs
    • Updated scale and rotation transformation APIs to consume a single Offset parameter to represent the pivot coordinate instead of separate float parameters for the x/y coordinates in DrawScope and DrawTransform
    • Removed Rect.expandToInclude and Rect.join methods
    • Updated Radius documentation to say oval in addition to elliptical
    • Added documentation to indicate the public constructor for the inline Radius class is not to be called directly but instead Radius objects should be instantiated through their function constructors
    • Removed RoundRect APIs to query topRight, bottomRight, bottomCenter, etc.
    • Deprecated Rect.shift in favor of Rect.translate
    • Removed RoundRect.grow and Rect.shrink APIs
    • Renamed RoundRect.outerRect to Rect.boundingRect
    • Removed RoundRect.middleRect/tallMiddleRect/wideMiddleRect and Rect.isStadium methods
    • Renamed RoundRect.longestSide to RoundRect.maxDimension
    • Renamed RoundRect.shortestSide to RoundRect.minDimension
    • Changed to be a property instead of a function
    • Updated RoundRect constructor to consume Radius properties instead of individual parameters for x/y radius values
    • Removed Size APIs that assumed it was a Rectangle with origin at 0,0
    • Added a destructing API to Radius
    • Migrated various RoundRect extension functions to be properties instead
    • (I8f5c7, b/168762961)
  • foundation.Box was deprecated. Please use foundation.layout.Box instead. (Ie5950, b/167680279)
  • Stack was renamed to Box. The previously existing Box will be deprecated in favor of the new Box in The behavior of the new Box is to stack children one on top of another when it has multiple children - this is different from the previous Box, which was behaving similar to a Column. (I94893, b/167680279)
  • Box decoration parameters have been deprecated. If you want to have decorations/padding on your box, use Modifiers instead (Modifier.background, Modifier.border, Modifier.padding) (Ibae92, b/167680279)
  • Updated many Graphics APIs
    • Updated DrawScope APIs with scoped transformation methods to indicate that the transformation is only applied within the callback and removed after the callback is invoked
    • Updated clipPath documentation to refer to Path instead of rounded rectangle
    • Fixed spacing in documentation for right parameter in clipPath
    • Renamed DrawScope.drawCanvas to drawIntoCanvas and removed size parameter
    • Renamed dx/dy parameters in inset method to horizontal and vertical
    • Added inset overload that provides the same inset value to all 4 bounds
    • Removed documentation on inset method indicating that inset would be applied to all 4 sides
    • Updated documentation for Rect class
    • Updated comments on Rect parameters to match kdoc style
    • Removed Rect.join and Rect.expandToInclude
    • Created overload for Rect.translate(offset) and deprecated Rect.shift
    • (If086a, b/167737376)
  • Annotated rootAnimationClockFactory, transitionsEnabled, blinkingCursorEnabled and textInputServiceFactory with @VisibleForTesting, make them internal API and hide their kdoc (I554eb, b/168308412)
  • Remove SelectionContainer from the Top to disable default selection and avoid unexpected behavior. One can specifically use a SelectionContainer to wrap the content that needs to be selectable instead. (I8dfe0, b/158459594)

Version 1.0.0-alpha03

September 16, 2020

androidx.compose.ui:ui-*:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

API Changes

  • Remove scroll forward/backward semantics actions. Added steps in AccessibilityRangeInfo. (Ia47b0)
  • Removed onInvalidate() from Owner -- OwnedLayer handles invalidation. (Ica72b, b/162061312)
  • Removed operator methods on Size API that consume Offset parameters. The result of these operations is unclear and the type of result is unexpected for these. Ex. should size - offset return an offset or a size result with the difference?

    Also removed deprecated methods on Size class. (Iec902, b/166514214)

Bug Fixes

  • Fix for items of LazyColumn being incorrectly drawn sometimes, this was also causing crashes in some conditions. (Ibcf17, b/163066980, b/165921895)
  • DpConstraints and APIs using it were deprecated. (I90cdb, b/167389835)
  • Moved createAndroidComposeRule and AndroidInputDispatcher from to androidx.ui.test (Idef08, b/164060572)
  • Usages of gravity were consistently renamed to align or alignment in layout APIs. (I2421a, b/164077038)
  • Added onNode and other global methods on ComposeTestRule as the current global ones are going to be deprecated. (Ieae36)

Version 1.0.0-alpha02

September 2, 2020

androidx.compose.ui:ui-*:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

API Changes

  • remove callback to notify Owner when layoutnode bounds change. (If654e, b/166106882)
  • Added support for filltype parameters on vector graphics paths to support cutouts of shapes according to evenOdd or NonZero path fill rules. (I43dd2)
  • Uptime and Velocity are now inline classes (I48f4a)
  • Duration is now an inline class (I565eb)
  • Add a callback to notify Owner when layoutnode bounds change. (Ic40b3)
  • Fixed issue where Rect function constructor with Offset and radius would create the Rect in the order of left, right, top, bottom instead of left, top, right, bottom.

    Removed deprecated companion methods on Rect in favor of function constructors.

    Added tests to verify methods in Rect.kt (I08460, b/165822356)

Bug Fixes

  • Added MutableRect, a rectangle that can be modified. (I71bd2, b/160140398)
  • Matrix4 was replaced with Matrix. All other parts of vectormath package have been removed. (Ibd665, b/160140398)
  • The calling convention for composable functions has changed. This is a binary breaking change. All libraries must be recompiled to work with this version of the compose compiler plugin.

    This change does not create a source level breaking change as the only APIs that have changed are compiler APIs that have an explicit opt in. (I7afd2, b/158123185)

  • Fixed crash that could occur when dispatch to a PointerInputFilter could cause the PointerInputFilter to be synchronously removed. (I58f25)

Version 1.0.0-alpha01

August 26, 2020

androidx.compose.ui:ui-*:1.0.0-alpha01 is released. Version 1.0.0-alpha01 contains these commits.

Version 0.1.0-dev

Version 0.1.0-dev17

August 19, 2020

androidx.compose.ui:ui-*:0.1.0-dev17 is released. Version 0.1.0-dev17 contains these commits.

API Changes

  • emitView was deprecated. Use AndroidView instead if possible for emitting Views inside Compose. Note that composing Views and ViewGroups directly will not be supported in the future unless these are leaves in the composition tree, case when this can be achieved using AndroidView. (I29b1e, b/163871221)
  • FocusState2 is deprecated and replaced by FocusState (Ia8b79, b/160822876, b/160923332)
  • The deprecated AndroidView overloads were removed. (I946b9, b/163802393)
  • Custom emits can now declare that one or more of its setters can be skipped and recomposed independently of the emit. (Ibbd13)
  • Changed Vector classes to no longer be data classes as the same object instance is used for composition.

    Added mutableStateOf flag for VectorPainter to conditionally re-draw if contents of the vector change.

    Refactored VectorComponent instance to be part of VectorPainter as it is re-used across compositions.

    Updated GroupComponent and PathComponent to have their name fields be mutable (Ieae45, b/151378808)

  • Removed onChildPositioned and OnChildPositionedModifier. Developers should use onPositioned and OnPositionedModifier on the child layout instead. (I4522e, b/162109766)

  • Offset has become an inline class (Iaec70)

  • Added a modifier param to SelectionContainer (I4aada, b/161487952)

  • Removed deprecated FocusModifier (I0b4ba, b/160922116, b/160821157, b/162441435, b/160822875, b/160921940)

  • Added mergePolicy lambda to SemanticsPropertyKey. This can be used to define a custom policy for mergeAllDescendants semantics merging. The default policy is to use the parent value if already present, otherwise the child value. (Iaf6c4, b/161979921)

  • Constraints is now an inline class (I88736)

  • Added FocusManager that moves common focus logic out of AndroidComposeView (I528ef, b/161487952, b/162206799)

  • Updated PointerEventPass names for Alpha release. (Ifda6f)

  • IntOffset is now an inline class (Iac0bf)

  • IntSize is now an inline class (I2bf42)

  • PlacementScope.placeAbsolute() was renamed to, and the previous was renamed to PlacementScope.placeRelative(). As a result, the method will not automatically mirror the position in right-to-left contexts anymore. If this is desired, use PlacementScope.placeRelative() instead. (I873ac, b/162916675)

  • AlertDialog now uses FlowRow for buttons (I00ec1, b/161809319, b/143682374)

  • Made some test utilities non public because they are not where they belong. Will be made public in the future. (I32ab1)

  • Refactored organization of pointer input code. (Ie3f45)

  • Deprecated PxBounds in favor of Rect. Updated all usages of PxBounds with rect and added proper deprecate/replace with annotations to assist with the migration. (I37038, b/162627058)

  • Removed Deprecated KeyEvent2. Use KeyEvent instead. (Ied2d0, b/162097587)

  • KeyEvent has a unicode property that can be used to get the unicode character generated by the specified key and meta key state combination (If3afc)

  • Made the DelayUp custom event and related classes an opt in API as it is very likely going to be changed. (I56d6f)

  • Removed 2 PointerEventPasses that are no longer needed. (I3dd9d)

  • Add parameter color, shadow and TextDecoration to Paragraph.paint This function is useful to avoid unnecessary Paragraph recreation. (I81689)

Bug Fixes

  • Removed onFocusChanged callbacks from TextField. Use Modifier.focusObserver instead. (I51089, b/161297615)
  • Modifier.drawBorder has been deprecated. Use Modifier.border instead. Border data class has been replaced by BorderStroke (I4257d, b/158160576)
  • Removed deprecated FrameManager calls.

    Internal compose APIs have been changed to reduce the amount of overhead to track state objects such as mutableStateof() (I80ba6)

  • VerticalScroller and HorizontalScroller have been removed. Use ScrollableColumn/Row instead. Modifier.drawBackground has been removed. Use Modifier.background (I73b0d, b/163019183)

  • Crash when something which saves the state was used inside the for loop is fixed. Now having the same key in savedInstanceState() is allowed, api of UiSavedStateRegistry is now adjusted to this new requirement (I4ab76, b/160042650, b/156853976, b/159026663, b/154920561)

  • The state { ... } composable is now deprecated in favor of explicit calls to remember { mutableStateOf(...) } for clarity. This reduces the overall API surface and number of concepts for state management, and matches the by mutableStateOf() pattern for class property delegation. (Ia5727)

  • Renamed RRect to RoundRect to better fit compose naming patterns Created similar function constructors to RRect and deprecated RRect function constructors (I5d325)

Version 0.1.0-dev16

August 5, 2020

androidx.compose.ui:ui-*:0.1.0-dev16 is released. Version 0.1.0-dev16 contains these commits.

API Changes

  • OnChildPositioned has been deprecated. Use OnPositioned on the child instead. (I87f95, b/162109766)
  • setViewContent was deprecated. setContent should be used instead. (I7e497, b/160335130)
  • Added the AndroidViewBinding API for inflating and composing layout resources, based on ViewBinding. (I081c6)
  • KeyEvent2 is replaced by KeyEvent (I2d770, b/162097585)
  • Added support for Alt hardware key (I9036b)
  • FocusManager is Deprecated. Use Modifier.focus(), Modifier.focusObserver() and Modifier.focusRequester() instead. (I74ae4, b/162211322)
  • loadVectorResource supports trimPath attributes (I808fe)
  • Move dialog to ui (I47fa6)
  • Removed 2 PointerEventPasses that are no longer needed. (I33ca7)
  • Implemented PointerInteropModifier which provides the ability to receive MotionEvents and interact with Compose as if you are an implementation of an Android View. (Ieb08c)
  • Removed the deprecated tag modifier. Please use layoutId instead. (Idaa05, b/162023919)
  • The APIs for right-to-left support has been updated. LayoutDirectionAmbient has been added, which can be used to read and change the layout direction. Modifier.rtl and Modifier.ltr have been removed. (I080b3)
  • Support path trimming in vector graphics (Ie16c9, b/158188351)
  • Added Modifier.layout() that allows to create a custom layout modifier conveniently (I73b69, b/161355194)
  • Added a new AndroidView API and deprecated the existing ones. (I5bcfd)
  • has been deprecated, use Modifier.then instead. 'Then' has a stronger signal of ordering, while also prohibits to type Modifier.padding().background() + anotherModifier, which breaks the chain and harder to read (Iedd58, b/161529964)
  • Add [Abstract]ComposeView View subclasses for hosting Compose content in a View hierarchy. (I46357)
  • Row and Column are now inline function significantly reducing the overhead of using them. (I75c10)
  • SubcomposeLayout is added. It is a low level primitive which allows to compose the children during the measuring if we want to use some values available only later during the measure for the subtree composition. For example WithConstraints is not implemented using SubcomposeLayout. (I25cc8)
  • Added SemanticsNode.positionInRoot to get the position of a SemanticsNode relative to the root of the Compose hierarchy (Icdf26, b/161336532)
  • MotionEvents passed all the way through from Android, into Compose, and back into Android. (I14be8, b/158034713)
  • Removed dropdownPopup. (I00430)
  • Fixed popup position on cut-out displays. (Idd7dd)
  • Add accessibility action to get TextLayoutResult (I9d6e6)
  • RemeasurementModifier added. it allows to synchronously remeasure the layout. In general you never need it as remeasure/relayout is happening automatically, but we use it inside LazyColumnItems during the scroll. (I5f331, b/160791058)
  • Remove getLineEllipsisOffset/getLineEllipsisCount. Use getLineVisibleEnd/getLineEnd/isLineEllipsized instead. (I85aa2)
  • Add some Marks/Annotations for best practice reason. (I66b20)
  • expose more line APIs in TextLayoutResult. (I79bd2)
  • Built-in vector converters to convert built-in units are now accessible via Foo.VectorConverter. e.g. Dp.VectorConverter, Color.VectorConverter, Float.VectorConverter, etc (I3e273)

Bug Fixes

  • Address broad API fixes (I077bc)
    1. Remove unused OffsetBase interface
    2. Align Offset and IntOffset classes to have a consistent API surface
    3. Rename IntOffset.Origin to IntOffset.Zero to be consistent with Offset API
    4. Moved nativeCanvas method off of Canvas interface to support consumers to create their own Canvas instances
    5. Created stub EmptyCanvas class to refactor DrawScope to be a non-null parameter instead of lateinit and ensure non-nullability of the field
    6. Renamed ClipOp enums to be Pascal Case
    7. Renamed FilterQuality enums to be Pascal Case
    8. Renamed StrokeJoin enums to be Pascal Case
    9. Renamed PointMode enums to be Pascal Case
    10. Renamed PaintingStyle enums to be Pascal Case
    11. Renamed PathFillType enums to be Pascal Case
    12. Renamed StrokeCap enums to be Pascal Case
    13. Updated DrawCache implementation to no longer use lateinit params
    14. Updated DrawScope to no longer use lazy delegation for fillPaint and strokePaint internal parameters
    15. Updated Image composable to avoid Box usage for less overhead
    16. Updated Outline class to have @Immutable annotations
    17. Updated PathNode to have @Immutable annotations for each path instruction
    18. Updated Vector subcomposition to remove redundant conditional checks for equality as compose already handles them
    19. Deprecated Rect companion constructor methods in favor of function constructors
    20. Updated Brush classes and function constructors with @Immutable and @Stable APIs
    21. Updated VertexMode enum to be PascalCase
    22. Updated DrawScope selectPaint method to conditionally overwrite stroke parameters on the paint if they have changed
    23. Updated Size to add destructuring API, rename UnspecifiedSize to Unspecified and removed unused methods
  • Updated compose BlendMode API consumption to properly map between Android framework BlendModes and PorterDuff modes depending on API level. Introduced BlendMode#isSupported API to act as a capability query to determine if the BlendMode is supported on the device before it is used. (I0ef42)
  • LazyItemScope was added for itemContent param of Lazy lists. It provides modifiers to fill the parent max size which solves the use case when the item should fill the viewport and the regular Modifier.fillMaxSize() doesn't work as the item is measured with infinity constraints. (Ibd3b2, b/162248854)
  • Removed SemanticsNodeInteraction.performPartialGesture. Use SemanticsNodeInteraction.performGesture instead. (Id9b62)
  • LazyColumnItems was renamed to LazyColumnFor. LazyRowItems was renamed to LazyRowFor (I84f84)
  • foundation.shape.corner package was flattened to foundation.share (I46491, b/161887429)
  • Renamed AndroidComposeTestRule to createAndroidComposeRule. (I70aaf)
  • Added more APIs to TextLayoutResult. (Id7e04)
  • Material FilledTextField was renamed to TextField and foundational TextField was renamed to BaseTextField to make simplest desired API easy to discover and use (Ia6242, b/155482676)
  • Modifier.drawBackground has been renamed to Modifier.background (I13677)

Version 0.1.0-dev15

July 22, 2020

androidx.compose.ui:ui-*:0.1.0-dev15 is released. Version 0.1.0-dev15 contains these commits.

Dependencies Update

  • To use the 0.1.0-dev15 version of Compose, you will need to update your dependencies according to the new code snippets shown above in Declaring dependencies.

API Changes

  • FocusModifier is deprecated in favor of Modifier.focus, Modifier.focusRequester, Modifier.focusObserver. FocusState and FocusDetailedState are deprecated in favor of FocusState2 (I46919, b/160822875, b/160922136)
  • Added a modifier to observe focus state change. (I05866, b/160924455, b/160923326)
  • Added a modifier to request focus changes (I8dd73, b/161182057, b/160924778)
  • Ajdust the Toolbar Menu to show copy, cut, paste properly. (Id3955)
  • Single-value semantics properties now use a calling style. For example, 'semantics { hidden = true }' is now written as: semantics { hidden() }. (Ic1afd, b/145951226, b/145955412)
  • Added Modifier.focus which replaces FocusModifier. (Ib852a, b/160924778)
  • Add FloatingToolbar for TextField Selection. (Ie8b07)
  • Added an experimental api annotation for key input related API (I53c0a)
  • Added an experimental api annotation for all Focus-related API (I53b24, b/160903352)
  • Added FocusState2 which will replace FocusDetailedState (I0a3ba, b/160822595)
  • Added ExperimentalFocus which is an @OptIn annotation for Focus API. (I1544b, b/160820961)
  • An IntBounds unit class has been added, representing integer pixel bounds from layout. The API of PopupPositionProvider has been updated to use it. (I0d8d0, b/159596546)
  • Applier now requires a clear() method for disposing compositions (Ibe697)
  • KeyEvent is deprecated and replaced by KeyEvent2 (I68730)
  • A new optional flag useUnmergedTree was added to test finders. (I2ce48)
  • Made LayoutNode experimental API (I4f2e9)
  • Added copy methods to various inline class types including:

    • Offset
    • Size
    • Radius
    • Motion
    • TransformOrigin

    • Deprecated Size.copy companion object method favor of instance copy method (Ife290, b/159905651)

  • Popups, Dialogs and Menus are now inheriting the contextual MaterialTheme (Ia3665, b/156527485)

  • TextDirection is renamed as ResolvedTextDirection (I3ff38)

  • Removed layout direction parameter from the measure block of the Layout() function. Layout direction is however available inside the callback through the measure scope object (Ic7d9d)

  • Refactor SelectionHandles for reusing. (I420e0)

  • Clickable was removed. Use Modifier.clickable (I84bdf)

  • TestTag and Semantics have been deleted. Use Modifier.testTag and Modifier.semantics instead (I15ff0, b/158841414)

  • Prior to this change, the compose compiler plugin would non-trivially intercept calls to constructors inside of a @Composable function if there was an (I5205a, b/158123804)

  • Modifier.tag was renamed to Modifier.layoutId, to avoid confusion with Modifier.testTag. (I995f0)

  • Alignment line Int positions returned from Placeable#get(AlignmentLine) are now non-null. If the queried alignment line is missing, AlignmentLine.Unspecified will be returned. (I896c5, b/158134875)

  • The AndroidView composable was added a modifier parameter. (I48a88, b/158746303)

  • Semantics() is deprecated. Use Modifier.semantics() instead. (I72407, b/158841414)

  • Add viewModel() composable which allows to create or get already created ViewModel similarly to how it works in Activity or Fragment (I5fdd1)

  • Replaced usage of IntPx with Int. Replaced IntPxPosition with IntOffset. Replaced IntPxSize with IntSize. (Ib7b44)

  • In order to consolidate the number of classes used to represent sizing information, standardize on usage of the Size class instead of PxSize. This provides the benefits of an inline class to leverage a long to pack 2 float values to represent width and height represented as floats. (Ic0191)

  • In order to consolidate the number of classes used to represent positioning information, standardize on usage of the Offset class instead of PxPosition. This provides the benefits of an inline class to leverage a long to pack 2 float values to represent x and y offsets represented as floats. (I3ad98)

  • Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters. Deleted Px class in its entirety (I3ff33)

  • Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I086f4)

  • Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (Id3434)

  • Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I97a5a)

  • TestTag is now deprecated. Use Modifier.testTag instead. (If5110, b/157173105)

  • The default, no-op, implementation of ParentDataModifier#modifyParentData has been removed - it was equivalent to not implementing the interface in the first place. (I0deaa)

  • Previously deprecated ScaleFit as removed. Use ContentScale instead. (Ifbc5b)

  • Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I19d02)

  • Added the DropdownMenu component in ui-material, a Material Design menu implementation. (I9bb3d)

  • Removed deprecated LayoutTag(), please use Modifier.tag() instead. Removed deprecated Modifier.matchParent(), please use Modifier.matchParentSize() instead. (If8044)

  • Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I57bff)

  • Modifier.semantics has been undeprecated to allow usages for high level components. (I4cfdc)

  • Consolidated CanvasScope implementations so there is now just DrawScope and ContentDrawScope Renamed CanvasScope to DrawScope. Updated DrawScope to implement Density interface and provide LayoutDirection Deleted DrawScope subclass in ContentDrawScope Painter and PainterModifier have been updated to no longer maintain an RTL property themselves as DrawScope provides this already without manually providing it (I1798e)

  • DoubleTapGestureFilter now disambiguates SingleTapGestureFilter across the tree. (If92b1)

  • Updated Alignment API and added support for absolute alignment (which does not auto-mirror in Rtl context) (I38cd3)

  • DrawLayer modifiers api has been changed: outlineShape renamed to shape and has the RectangleShape default value and now non-nullable; clipToOutline renamed to clip; clipToBounds removed as it is the same as clip == true with RectangleShape (I7ef11, b/155075735)

  • Updated higher level compose APIs that expose a Canvas to expose CanvasScope instead. This removes the need for consumers to maintain their own Paint objects. For consumers that still require access to a Canvas they can use the drawCanvas extension method which provides a callback to issue drawing commands with the underlying Canvas. (I80afd)

  • WithConstraints trailing lambda API has been changed. Now instead of two params it has a receiver scope which in addition to constraints and layoutDirection provides minWidth, maxWidth, minHeight and maxHeight properties in Dp (I91b9a, b/149979702)

  • Renamed LayoutModifier2 to LayoutModifier. (Id29f3)

  • Removed deprecated LayoutModifier interface. (I2a9d6)

  • Intrinsic measurements functions in Layout and LayoutModifier2 have an IntrinsicMeasureScope receiver now which provides intrinsics query API with implicitly propagated layout direction. (Id9945)

  • Layout and LayoutModifier children can be measured with a different layout direction. (Ibd731)

  • New Modifier.zIndex() is added to control the drawing order of the children within the same parent layout. elevation property on DrawLayerModifier is renamed to shadowElevation and doesn't control the drawing order anymore. The params order fo DrawShadow is changed: elevation is now the first one and the shape is the second one with a RectangleShape default. (I20150, b/152417501)

  • Removed onSizeChange and onPositionChange in Owner. (I5c718)

  • Added Constraints2, a copy of Constraints that does only supports Int connstraints values rather than IntPx. IntPx will be removed and all integer constraints will be assumed to be pixels like Android.

    • Added IntSize as well, which will eventually replace IntPxSize. (I4b43a)
  • Made Alignment instantiable with arbitrary values. Added 1D Alignments. (Ia0c05)

  • alignToSiblings now accepts a Measured instead of Placeable. (I5788d)

  • (I45f09, b/152842521)

    • Renamed ScaleFit to ContentScale
    • Moved ContentScale from ui-graphics to ui-core module to live in the same module as the Alignment API.
    • Renamed FillMaxDimension to Crop
    • Renamed FillMinDimension to Fit
    • Renamed Fit to Inside to better match
    • ImageView.ScaleType equivalents
    • Added documentation indicating that the combination of Crop and Alignment.Center achieves the same result as ImageView.ScaleType.CENTER_CROP and Fit used with Alignment.Center achieves the same result as ImageView.ScaleType.FIT_CENTER Inside used with Alignment.Center achieves the same result as ImageView.ScaleType.CENTER_INSIDE
  • Rtl support for draw modifiers. (I0aaf9)

  • Released API for inflating Android Views from XML. See ViewInCompose demo for more details. (I42916)

  • Improve DrawModifier API:

    • Made the receiver scope for draw() ContentDrawScope
    • Removed all parameters on draw()
    • DrawScope has same interface as former CanvasScope
    • ContentDrawScope has drawContent() method (Ibaced, b/152919067)
  • Added positionInParent and boundsInParent for LayoutCoordinates. (Icacdd, b/152735784)

  • DrawLayerModifier and drawLayer() now default clipToBounds and clipToOutline to false. (I0eb8b, b/152810850)

  • Renamed LayoutResult to MeasureResult. (Id8c68)

  • Added LayoutModifier2, a new API for defining layout modifiers; deprecated LayoutModifier (If32ac)

  • Replaced Modifier plus operator with factory extension functions (I225e4)

  • Added translationX/Y properties to support offseting the display list of drawing commands for a given Layer. This is useful to move content in response to animations or touch events. (I8641c)

  • Added pivotX, pivotY parameters to Layer APIs to support rotation and scaling around a particular point on a layer (Icf7c3)

  • Add OnPositionedModifier and OnChildPositionedModifier to replace OnPositioned and OnChildPositioned composable functions. (I2ec8f)

  • Added LayerModifier, a modifier that allows adding a RenderNode for a Layout. It allows setting clipping, opacity, rotation, scaling, and shadows. This will replace RepaintBoundary. (I7100d, b/150774014)

  • Made the layout direction be propagated from parent layout node to children. Added layout direction modifier. (I3d955)

  • Stack component supports right-to-left directionality (Ic9e00)

  • Initial support for Rtl in Compose layout (Ia5519)

  • Density and DensityScope were merged into one interface. Instead of ambientDensity() you can now use DensityAmbient.current. Instead of withDensity(density) just with(density) (I11cb1)

  • Changed LayoutCoordinates to make providedAlignmentLines a Set instead of a Map and have LayoutCoordinates implement the get() operator instead for retrieving a value. This makes it easier for modifiers to modify one or more value of the set without creating a new collection for each modifier. (I0245a)

  • LayoutCoordinates no longer has a position property. The position property does not make sense when considering LayoutModifiers, rotation, or scaling. Instead, developers should use parentCoordinates and childToLocal() to calculate the transform from one LayoutCoordinate to another.

    LayoutCoordinates uses IntPxSize for the size property instead of PxSize. Layouts use integer pixel sizes for layouts, so all layout sizes should use integers and not floating point values. (I9367b)

  • Improvements to the API surface of Constraints (I0fd15)

  • Created CanvasScope API that wraps a Canvas object to expose a stateless, declarative drawing API surface. Transformations are contained within their own receiver scope and sizing information is also scoped to corresponding inset bounds. It does not require a consumer to maintain its own Paint state object for configuring drawing operations.

    • Added CanvasScopeSample as well as updated the demo app to include a declarative graphics demo (Ifd86d)
  • Removed unused MaskFilter API as it has limited usage and is not optimized for hardware acceleration in most use cases (I54f76)

  • RectangleShape moved from* to* (Ia74d5, b/154507984)

  • Replaced all nullable Color uses in API with non-nullable and use Color.Unset instead of null (Iabaa7)

  • Introduce additional optional rect parameter to ImagePainter to support drawing a subsection of underlying ImageAsset (I0ea9e)

  • Added Unset Color to represent an unset value without boxing Colors. (If901a)

  • Added Canvas.rotate and Canvas.scale extension methods to consume optional pivot coordinates for transformations. These default to the top left corner of the current canvas translation.

    Also moved Canvas.rotateRad to be an extension method for consistency (Ibaca6)

  • Created PixelMap API to support querying pixel information from an ImageAsset. (I69ad6)

  • Renamed toFrameworkRect/toFrameworkRectF to toAndroidRect/toAndroidRectF to match naming convention for object conversions between compose and the Android framework APIs they are built on top of. Also updated docs on these APIs (I86337)

  • Added VectorPainter API to replace existing subcomposition API for vector graphics. Result of subcomposition is a VectorPainter object instead of a DrawModifier. Deprecated previous DrawVector composables in favor of VectorPainter.

    Renamed Image(Painter) API to PaintBox(Painter) Created Vector composable that behaves like the Image composable except with a VectorAsset instead of an ImageAsset (I9af9a, b/149030271)

  • Renamed Image to ImageAsset to better differentiate the difference between the Image data and the upcoming Image composable used to participate in layout and draw content. _Body:Created extension method on, Bitmap.asImageAsset(), to create an instance of an ImageAsset useful for combining traditional Android application development with the compose framework (Id5bbd)

  • Added TextDirection.Content (I48f36)

  • Added operator (I0ad1a)

  • Force is removed from TextDirectionAlgorithm enum values (Icc944)

  • TextDirectionAlgorithm is renamed as TextDirection (I75ce8)

  • Implements LongPressAndDrag for TextField Selection. (I17919)

  • Added AnnotatedString.getStringAnnotations that returns all annotations within the range. (I1fa00)

  • Changed the package name for Locale and LocaleList from androidx.ui.text to androidx.ui.intl (I8132c)

  • TextField's cursor has a blinking animation (Id10a7)

  • API change: AnnotatedString(builder: Builder) is renamed to annotatedString(builder: Builder). (Ia6377)

  • API change: AnnotatedString.Item is renamed to AnnotatedString.Range. (I2d44d)

  • Rename AnnotatedString.Builder.addAnnotationString to addStringAnnotation. (I5059e)

  • Now it is possible to hide/show software keyboard by using SoftwareKeyboardController which is delivered by onTextInputStarted callback (I8dc44, b/151860051)

  • Added plus operator for (Text/Paragraph/Span)Style which delegates to merge() function. (Ia1add)

  • FontWeight.lerp does not snap anymore. It is still a data class. (I521c2)

  • FontWeight constructor is now public, it is not data class anymore. (Id6b1f)

  • Add getLineStart, getLineEnd, getEllipsisOffset and getEllipsisCount to TextLayoutResult (Ibc801)

  • ui-text module is renamed as ui-text-core (I57dec)

  • Removed unused Size class as there is a duplicate Size class in the ui-geometry module that is being consumed. (I1b602)

  • Added AdapterList, a scrolling list component that only composes and lays out the visible items. Currently known issues include that it is vertical-only and does not fully handle all cases of changes to its children. (Ib351b)

  • Add paddings, border, shape and background param to Box (I05027, b/148147281)

Bug Fixes

  • onFocusChange callback in text fields renamed to onFocusChanged (Ida4a1)
  • VerticalScroller and HoriziontalScroller have been deprecated. Use ScrollableColumn and ScrollableRow for build-in experience with Column/Row behaviour and parameters, or Modifier.verticalScroll and Modifier.horizontalScroll on your own element. Similarly, ScrollerPosition has been deprecated in favor of ScrollState' (I400ce, b/157225838, b/149460415, b/154105299)
  • runOnIdleCompose renamed to runOnIdle (I83607)
  • Several testing APIs were renamed to be more intuitive. All findXYZ APIs were renamed to onNodeXYZ. All doXYZ APIs were renamed to performXYZ. (I7f164)
  • Compose UI can now be composed inside ViewGroups without requiring a new composition. See ViewInteropDemo for an example. (I9ab0b, b/160455080)
  • Added sortWith and removeRange to MutableVector (Icccf7)
  • Implement Drag Selection Handles to change selection for TextField. (I27032)
  • Removed Shader inline class that wrapped the NativeShader expect class Renamed NativeShader to Shader. The wrapped Shader inline class did not add anything valuable to the API surface and was an inline class, so use the NativeShader class directly. (I25e4d)
  • Refactored PainterModifier to no longer provide scaling based on the given constraints and ContentScale parameter. Implementations of Painter are to scale their drawing content themselves based on the given size of the DrawScope they are drawing into.

    Fixed issue where VectorPainter's cache bitmap was sized to its default size instead of the given size to draw into.

    Updated ImagePainter to scale its content instead of relying on PainterModifier to do so on its behalf. (I6ba90)

  • add top-level withFrameNanos function for animation timing (Ie34c5)

  • @Untracked annotation has been deprecated. Replace with @ComposableContract(tracked=false) (Id211e)

  • and androidx.ui.input.EditorValue is deprecated. TextField, FilledTextField and CoreTextField composables that uses that type is also deprecated. Please use androidx.ui.input.TextFieldValue instead (I4066d, b/155211005)

  • Fixed issue where pointer input dispatch would cause a crash if PointerInputFilters were removed via subcomposition during disptach. This is now fixed. (I1f48b, b/157998762)

  • Fixed issue where pointer input dispatch would cause a crash if PointerInputFilters were removed via subcomposition during disptach. This is now fixed. (Iab398, b/157998762)

  • Refactored Radius class to be an inline class. Removed companion creation methods in favor of function constructor with default parameter to have the radius along the y-axis match that of the mandatory x-axis radius parameter.

    Updated DrawScope.drawRoundRect to consume a single Radius parameter instead of 2 separate float values for the radius along the x and y axis (I46d1b)

  • The Recompose composable is no longer a useful abstraction. Most recomposition should happen as a result of MutableState assignments. For anything beyond that, it is recommended that you use the invalidate function to trigger a recomposition of the current scope. (Ifc992)

  • Replaced usage of Px class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (Iede0b)

  • Changes the code generation strategy of Compose’s compiler. Prior to the change, the compose compiler would transform calls to composable functions. With this change, we now transform the body of a composable function and leave the callsite unaltered (mostly).

    This means that most of the logic communicating with the compose runtime happens at the start of the function body, instead of at the callsite.

    This should be a source-compatible change for all usage of compose. Most users of compose should not have to update any code as a result of this change.

    In order to support this work, the JVM signature of all composable functions has changed. A Composable function accepting a single parameter is transformed into a function accepting 3 parameters, the additional parameters are the Composer, a ‘key’ integer. a bitmask integer used to propagate metadata through calls.

    Compose now also transforms default arguments to a composable function. It does this without introducing an additional synthetic default overload of the function itself, so this change will result in fewer functions being defined.

    Known intentional behavioral changes resulting from this:

    1. Some calls will skip where they wouldn’t have previously
    2. Composable expressions in default argument expressions are now correctly subscribed to and handled

    This work included some optimizations: 1. The result of comparisons of parameters are propagated through the call graph to other composable functions. This will result in fewer comparisons at runtime, reduces the slot table size, as well as more skipping of composable functions that were previously not skipped 2. Paremeters which are determined to be “static” at compile time are no longer compared or stored in the runtime. This reduces the number of comparisons and reduces slot table size. 3. Control flow structure of the body of functions is used to minimize the number of groups that are generated. This reduces slot table size and results in less work for the runtime 4. Unused dispatch and receiver parameters to functions are not included in determining skippability of the function if they are not used inside of the body of the function.

    Most breaking changes were for APIs that the compiler targets directly, and typical use of compose will not be affected: 1. Composer::startExpr was removed 2. Composer::endExpr was removed 3. Composer::call was deprecated 4. The non-varargs overloads of key have been removed. Use the vararg version going forward. 5. The Pivotal annotation was deprecated. Use key as a replacement. 6. ScopeUpdateScope::updateScope was changed to expect a Function3 instead of Function1 7. restartableFunction and restartableFunctionN were updated to include additional compile time parameters (I60756, b/143464846)

  • Removed deprecated LayoutAlign modifiers. (I10877)

  • Removed RepaintBoundary in favor of DrawLayerModifier (I00aa4)

  • Button, FloatingActionButton and Clickable now have a separate enabled param. Some of the params on Button were renamed or reordered. (I54b5a)

  • Replaced ButtonStyle with distinct functions and removed text (string) overload. See updated samples for usage information. (If63ab, b/146478620, b/146482131)

  • Breaking changes to the ambients API. See log and Ambient<T> documentation for details (I4c7ee, b/143769776)

  • Changed the behavior of default TextDirection to be determined by LayoutDirection. i.e. If LayoutDirection is RTL, default TextDirection will be RTL. Previously it was TextDirection.ContentOrLtr/Rtl (I4e803)

  • Bug fix: When font weight and font style are nested on an AnnotatedString, text is not rendered correctly. (I77a9d)

  • Adds commonly used parameters to Text(). If you are currently creating a local text style to pass a small number of these parameters, such as Text(style = TextStyle(textAlign = TextAlign.Center)), you can now just provide the parameters directly: Text(textAlign = TextAlign.Center) (I82768)

  • ui-android-text module is renamed as ui-text-android (I68cbe)