Google is committed to advancing racial equity for Black communities. See how.

UI



androidx.ui

API Reference

Works with the Jetpack Compose library.

Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release September 16, 2020 - - - 1.0.0-alpha03

Structure

Compose is combination of 7 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.

Group Description compose Define your UI programmatically with composable functions that describe its shape and data dependencies. compose.animation Build animations in their Jetpack Compose applications to enrich the user experience. compose.foundation Write Jetpack Compose applications with ready to use building blocks and extend foundation to build your own design system pieces. compose.material Build 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 www.material.io. compose.runtime Fundamental building blocks of Compose's programming model and state management, and core runtime for the Compose Compiler Plugin to target. compose.ui Fundamental components of compose UI needed to interact with the device, including layout, drawing, and input. ui Works with the Jetpack Compose library.

Declaring dependencies

To add a dependency on Compose UI, 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.ui:ui-tooling:1.0.0-alpha03" implementation "androidx.ui:ui-test:1.0.0-alpha03" } android { buildFeatures { compose true } composeOptions { kotlinCompilerVersion "1.4.0" kotlinCompilerExtensionVersion "1.0.0-alpha03" } } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions { jvmTarget = "1.8" freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"] } }

For more information about dependencies, see Add build dependencies.

Feedback

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-alpha03

September 16, 2020

androidx.ui:ui-test:1.0.0-alpha03 and androidx.ui:ui-tooling:1.0.0-alpha03 are released. Version 1.0.0-alpha03 contains these commits.

API Changes

Global testing functions such as onNode or waitForIdle are now deprecated, please migrate to their new counterparts that are defined on ComposeTestRule (I7f45a)

Moved createAndroidComposeRule and AndroidInputDispatcher from androidx.ui.test.android to androidx.ui.test (Idef08, b/164060572)

and from to (Idef08, b/164060572) Added onNode and other global methods on ComposeTestRule as the current global ones are going to be deprecated. (Ieae36)

Fixed size and position calculations in GestureScope, which caused amongst others generation of invalid swipe gestures (Iaf358, b/166589947)

Bug Fixes

Usages of gravity were consistently renamed to align or alignment in layout APIs. (I2421a, b/164077038)

InnerPadding was renamed to PaddingValues. (I195f1, b/167389171)

Version 1.0.0-alpha02

September 2, 2020

androidx.ui:ui-test:1.0.0-alpha02 and androidx.ui:ui-tooling:1.0.0-alpha02 are released. Version 1.0.0-alpha02 contains these commits.

API Changes

TestUiDispatcher is marked experimental (Iae99d, b/161247083)

Duration is now an inline class (I565eb)

Added ManualFrameClock.hasAwaiters to see if anything is awaiting a frame from that clock; runWithManualClock as a replacement for runBlocking when running tests that need a ManualFrameClock; TestUiDispatcher.Main that gives easy access to the main UI dispatcher in your tests. For example: @Test fun myTest() = runWithManualClock { clock -> // set some compose content withContext(TestUiDispatcher.Main) { clock.advanceClock(1000L) } if (clock.hasAwaiters) { println("The clock has awaiters") } else { println("The clock has no more awaiters") } } (I0a85b, b/161247083)

Bug Fixes

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)

Version 1.0.0-alpha01

August 26, 2020

androidx.ui:ui-test:1.0.0-alpha01 and androidx.ui:ui-tooling:1.0.0-alpha01 are released. Version 1.0.0-alpha01 contains these commits.

Version 0.1.0-dev

Version 0.1.0-dev17

August 19, 2020

androidx.ui:ui-test:0.1.0-dev17 and androidx.ui:ui-tooling:0.1.0-dev17 are released. Version 0.1.0-dev17 contains these commits.

API Changes

Offset has become an inline class (Iaec70)

IntSize is now an inline class (I2bf42)

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

Added createAndroidComposeRule function that takes a Class<T : ComponentActivity> as a parameter to easily create an AndroidComposeRule given a certain activity class. (I40da4)

Bug Fixes

Updated PointerEventPass names for Alpha release. (Ifda6f)

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

was renamed to , and the previous was renamed to . As a result, the method will not automatically mirror the position in right-to-left contexts anymore. If this is desired, use instead. (I873ac, b/162916675) 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)

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)

composable is now deprecated in favor of explicit calls to for clarity. This reduces the overall API surface and number of concepts for state management, and matches the pattern for class property delegation. (Ia5727) The spacedBy Arrangement was added for Row and Column, to enable positioning layout children with a fixed spacing. The aligned Arrangement was also added, to enable positioning layout children one next to the other and aligned in the Row/Column according to an Alignment. The previous Arrangement.Vertical#arrange and Arrangement.Horizontal#arrange methods were deprecated, and writing custom Arrangements will not be supported in the future. (I6733d, b/161985975)

Modifier.drawBorder has been deprecated. Use Modifier.border instead. Border data class has been replaced by BorderStroke (I4257d, b/158160576)

Version 0.1.0-dev16

August 5, 2020

androidx.ui:ui-test:0.1.0-dev16 and androidx.ui:ui-tooling:0.1.0-dev16 are released. Version 0.1.0-dev16 contains these commits.

Most Jetpack Compose packages have been refactored, according to the table below.

Jetpack Compose Package Refactoring

Old Package Name New Package Name androidx.animation androidx.compose.animation.core androidx.ui.autofill androidx.compose.ui.autofill androidx.compose androidx.compose.runtime androidx.compose.dispatch androidx.compose.runtime.dispatch androidx.ui.animation androidx.compose.animation androidx.ui.core androidx.compose.ui

androidx.compose.ui.unit

androidx.compose.ui.graphics androidx.ui.foundation androidx.compose.foundation androidx.ui.geometry androidx.compose.ui.geometry androidx.ui.graphics androidx.compose.ui.graphics androidx.ui.input androidx.compose.ui.text.input androidx.ui.intl androidx.compose.ui.text.intl androidx.ui.layout androidx.compose.foundation.layout androidx.ui.livedata androidx.compose.runtime.livedata androidx.ui.material androidx.compose.material androidx.ui.material.icons androidx.compose.material.icons androidx.ui.rxjava2 androidx.compose.runtime.rxjava2 androidx.ui.savedinstancestate androidx.compose.runtime.savedinstancestate androidx.ui.node androidx.compose.ui.node

androidx.compose.ui.input.pointer androidx.ui.platform androidx.compose.ui.platform androidx.ui.res androidx.compose.ui.res androidx.ui.semantics androidx.compose.ui.semantics androidx.ui.testutils androidx.compose.ui.input.pointer androidx.ui.text androidx.compose.foundation.text

androidx.compose.ui.text androidx.ui.text.platform androidx.compose.ui.text.android

androidx.compose.ui.platform androidx.ui.unit androidx.compose.ui.unit androidx.ui.util androidx.compose.ui.util androidx.ui.viewinterop androidx.compose.ui.viewinterop androidx.ui.viewmodel androidx.compose.ui.viewinterop

Not Yet Refactored (no changes) androidx.ui.test androidx.ui.tooling

If you are using Android Studio, you can replace your import statements with the code snippet below and use the Optimize Imports button in Android Studio. For any cases that Android Studio doesn't cover, please reference the package list above.

import androidx.compose.runtime.* import androidx.compose.animation.* import androidx.compose.animation.core.* import androidx.compose.foundation.* import androidx.compose.foundation.gestures.* import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.* import androidx.compose.foundation.shape.* import androidx.compose.material.* import androidx.compose.material.icons.* import androidx.compose.material.icons.filled.* import androidx.compose.ui.* import androidx.compose.ui.geometry.* import androidx.compose.ui.draw.* import androidx.compose.ui.graphics.* import androidx.compose.ui.graphics.drawscope.* import androidx.compose.ui.graphics.painter.* import androidx.compose.ui.graphics.vector.* import androidx.compose.ui.layout.* import androidx.compose.ui.platform.* import androidx.compose.ui.res.* import androidx.compose.ui.text.* import androidx.compose.ui.text.font.* import androidx.compose.ui.text.style.* import androidx.compose.ui.unit.* import androidx.compose.ui.util.* import androidx.compose.ui.viewinterop.* import androidx.ui.tooling.preview.*

API Changes

KeyEvent2 is replaced by KeyEvent (I2d770, b/162097585)

Removed SemanticsNodeInteraction.performPartialGesture . Use SemanticsNodeInteraction.performGesture instead. (Id9b62)

. Use instead. (Id9b62) Renamed SemanticsNodeInteraction.getBoundsInRoot() to SemanticsNodeInteraction.getUnclippedBoundsInRoot() (Icafdf, b/161336532)

to (Icafdf, b/161336532) Renamed AndroidComposeTestRule to createAndroidComposeRule. (I70aaf)

Add isFocused() and isNotFocused() SemanticsMatcher. (I0b760)

Removed BaseGestureScope.globalBounds , which shouldn't be used from tests. Use coordinates local to the node with which you're interacting instead. (Ie9b08)

, which shouldn't be used from tests. Use coordinates local to the node with which you're interacting instead. (Ie9b08) Improved the accuracy of the inspector API (I3cfbf)

Bug Fixes

Move dialog to ui (I47fa6)

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)

Require type T to be explicitly specified for transitionDefinition. (I1aded)

Modifier.plus 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)

, which breaks the chain and harder to read (Iedd58, b/161529964) Added SemanticsNode.positionInRoot to get the position of a SemanticsNode relative to the root of the Compose hierarchy (Icdf26, b/161336532)

to get the position of a SemanticsNode relative to the root of the Compose hierarchy (Icdf26, b/161336532) Add accessibility action to get TextLayoutResult (I9d6e6)

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)

Renamed ColorPalette to Colors, to better map to the Material color system and remove confusion over ColorPalette being a 'generic' theming object, as opposed to being a specific implementation of the Material color system. Additionally renames lightColorPalette and darkColorPalette to lightColors and darkColors respectively. (I9e976, b/161812111)

foundation.shape.corner package were flatten to foundation.share (I46491, b/161887429)

Row and Column are now inline function significantly reducing the overhead of using them. (I75c10)

Version 0.1.0-dev15

July 22, 2020

androidx.ui:ui-test:0.1.0-dev15 and androidx.ui:ui-tooling:0.1.0-dev15 are released. Version 0.1.0-dev15 contains these commits.

Most Jetpack Compose artifacts have been refactored, according to the table below.

Please note, in this release only the artifact names have been refactored. In future releases, the package names will be updated to follow its new artifact name.

Jetpack Compose Artifact Refactoring

Old Artifact New Artifact androidx.compose:compose-dispatch androidx.compose.runtime:runtime-dispatch androidx.compose:compose-runtime androidx.compose.runtime:runtime androidx.ui:ui-animation androidx.compose.animation:animation androidx.ui:ui-animation-core androidx.compose.animation:animation-core androidx.ui:ui-core androidx.compose.ui:ui androidx.ui:ui-foundation androidx.compose.foundation:foundation androidx.ui:ui-geometry androidx.compose.ui:ui-geometry androidx.ui:ui-graphics androidx.compose.ui:ui-graphics androidx.ui:ui-layout androidx.compose.foundation:foundation-layout androidx.ui:ui-livedata androidx.compose.runtime:runtime-livedata androidx.ui:ui-material androidx.compose.material:material androidx.ui:ui-material-icons-core androidx.compose.material:material-icons-core androidx.ui:ui-material-icons-extended androidx.compose.material:material-icons-extended androidx.ui:ui-rxjava2 androidx.compose.runtime:runtime-rxjava2 androidx.ui:ui-saved-instance-state androidx.compose.runtime:runtime-saved-instance-state androidx.ui:ui-text androidx.compose.foundation:foundation-text androidx.ui:ui-text-android androidx.compose.ui:ui-text-android androidx.ui:ui-text-core androidx.compose.ui:ui-text androidx.ui:ui-unit androidx.compose.ui:ui-unit androidx.ui:ui-util androidx.compose.ui:ui-util

Not Yet Refactored (no changes) androidx.compose:compose-compiler androidx.ui:ui-test androidx.ui:ui-tooling

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

runOnIdleCompose renamed to runOnIdle (I83607)

renamed to (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)

API to print app's semantics as a hierarchy instead of a flat list. Also remove SemanticsMatcher.any, please use findRoot().printToString() to print semantics instead. (I866b5)

KeyEvent is deprecated and replaced by KeyEvent2 (I68730)

A new optional flag useUnmergedTree was added to test finders. (I2ce48)

Removed obsolete size testing APIs. (Iba0a0)

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)

Added new device parameter to @Preview (I39049)

Bug Fixes

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)

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 an experimental api annotation for key input related API (I53c0a)

Transition API has been changed to return a TransitionState instead of passing the TransitionState to children. This makes the API more consistent with animate() APIs. (I24e38)

Applier now requires a clear() method for disposing compositions (Ibe697)

Made LayoutNode experimental API (I4f2e9)

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

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

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)

Use AnimationSpec instead of AnimationBuilder in the top level APIs to clarify the concept of static animation specification -Improve the transition DSL by removing the lambda requirement for creating AnimationSpecs such as tween, spring. They instead take constructor params directly. -Improve the overall ease of use of AnimationSpec opening up constructors instead of relying on builders -Change the duration and delay for KeyFrames and Tween to Int. This eliminates unnecessary type casts and method overloading (for supporting both Long and Int). (Ica0b4)

An IllegalStateException is now thrown if you attempt to trigger a synchronization on the main thread, e.g. when you do: runOnIdleCompose { findByTag(\"tag\").assertExists() } Remove the call to runOnIdleCompose in such occurrences: findByTag(\"tag\").assertExists() (Idced7, b/159224666)

Added TextDecoration.plus operator (I0ad1a)

Button's content slot now behaves as Row (useful when you need to have an icon with a text, see samples on Button how to write it) (I0ff10, b/158677863)

Version 0.1.0-dev14

June 24, 2020

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

API Changes

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

with . Replaced with . Replaced with . (Ib7b44) In order to consolidate the number of classes used to represent sizing information, we standardized 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)

class instead of . 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, we standardized 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)

class instead of . 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 (I086f4)

class in various compose classes as part of the large refactoring effort to only rely on Dp and primitive types for pixel parameters (I086f4) 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)

are now non-null. If the queried alignment line is missing, will be returned. (I896c5, b/158134875) The AndroidView composable was added a modifier parameter. (I48a88, b/158746303)

composable was added a modifier parameter. (I48a88, b/158746303) Semantics() is deprecated. Use Modifier.semantics() instead. (I72407, b/158841414)

is deprecated. Use 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)

composable which allows to create or get already created ViewModel similarly to how it works in Activity or Fragment (I5fdd1) Replaced usage of the 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)

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)

is now deprecated. Use 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)

has been removed - it was equivalent to not implementing the interface in the first place. (I0deaa) Previously deprecated ScaleFit has been removed. Use ContentScale instead. (Ifbc5b)

has been removed. Use instead. (Ifbc5b) AdapterList was renamed to LazyColumnItems (6decc02)

was renamed to (6decc02) Added LazyRowItems - Horizontally scrolling analogue of LazyColumnItems (Ibbcf7)

- Horizontally scrolling analogue of (Ibbcf7) androidx.ui.foundation.shape.RectangleShape was removed; use androidx.ui.graphics.RectangleShape instead (I94939, b/154507984)

was removed; use instead (I94939, b/154507984) Added Modifier.zoomable for pinch-to-zoom functionality (Id5d63)

for pinch-to-zoom functionality (Id5d63) Toggleable component has been deprecated. Use Modifier.toggleable instead (I35220, b/157642842)

component has been deprecated. Use instead (I35220, b/157642842) MutuallyExclusiveSetItem has been deprecated. Use Modifier.selectable instead. (I02b47, b/157642842)

has been deprecated. Use instead. (I02b47, b/157642842) Added the fontWeight parameter to Text, which was accidentally not added previously (I56937)

parameter to Text, which was accidentally not added previously (I56937) The percent parameter when creating ConstraintLayout guidelines has been renamed to fraction. (Ida2db)

Added support for margins of ConstraintLayout barriers. (I47ffe)

Fixed RTL support in ConstraintLayout. Added RTL unaware APIs. (I3b1c7)

A new DSL for ConstraintLayout has been added. Please see the samples for more details. (Icaa9a)

Added the @ExperimentalLayout annotation. ConstraintLayout, FlowRow and FlowColumn are now tagged with it to mark that their APIs are going to change. (I412a8)

annotation. ConstraintLayout, FlowRow and FlowColumn are now tagged with it to mark that their APIs are going to change. (I412a8) Added Material Outlined Textfield (I1a518)

TabRow.TabPosition not contains position in Dp, not in IntPx (I34a07, b/158577776)

not contains position in Dp, not in IntPx (I34a07, b/158577776) Deprecated Modifier.ripple . Clickable now uses ripple as the default indication (if you have a MaterialTheme {} set in your application) so in most cases you can just use clickable and get ripple indication for free. If you need to customize the color / size / bounded parameter for the ripple, you can manually create a RippleIndication and pass it to clickable as the indication parameter. (I101cd, b/155375067)

. Clickable now uses ripple as the default indication (if you have a MaterialTheme {} set in your application) so in most cases you can just use clickable and get ripple indication for free. If you need to customize the color / size / bounded parameter for the ripple, you can manually create a RippleIndication and pass it to clickable as the indication parameter. (I101cd, b/155375067) Scaffold API has been reworked: few parameters changed their name, added new parameters for better customization. Added getter to query sizes of Fab, TopBar and BottomBar (I0e7ce)

Adds strokeWidth parameter to CircularProgressIndicator to customize the stroke size. To change the stroke size (height) of a LinearProgressIndicator, you can use Modifier.preferredHeight() or another size modifier. (Icea16, b/154919081)

Added relativeOffset(x, y) to GestureScope and PartialGestureScope , which produces an Offset instance with values relative to the component's size. relativeOffset(.1f, .2f) means an Offset where x is 10% of the component's width and y is 20% of the component's height. (Ia4bf7, b/158291007)

to and , which produces an Offset instance with values relative to the component's size. means an Offset where x is 10% of the component's width and y is 20% of the component's height. (Ia4bf7, b/158291007) When injecting double clicks and long clicks, you can now specify the duration of those injected gestures. (I51c97, b/155464717)

Added properties to GestureScope and PartialGestureScope to access common coordinates of a component. They are Floats for 1-dimensional properties (like right ) and Offsets for 2-dimensional properties (like centerLeft ). The 1-dimensional properties are: left centerX right top centerY bottom The 2-dimensional properties are: * topLeft * topCenter * topRight * centerLeft * center (existed already, mentioned for completeness) * centerRight * bottomLeft * bottomCenter * bottomRight Example usage: findByTag("widget") .doGesture { sendSwipe(topLeft, bottomRight) }



(I49ef3, b/158291007) - Added multi-touch gesture injection APIs to be able to test components when performing multi-touch gestures.

When injecting a gesture, one now has the ability to specify multiple pointers by supplying a pointer id to a partial gesture method. If no pointer id is specified, the pointer 0 is assumed, called the default pointer. Note that all prefab gestures ( sendClick , sendSwipe and all methods built on these) use the default pointer. The following methods in PartialGestureScope now have an overload that accepts a pointer id: - sendDown - sendMoveTo - sendMoveBy - sendUp

Each event now contains a complete list of the current location of each active pointer (an active pointer being one that is down), and the methods listed above send an event immediately. In addition, three new methods have been introduced: - movePointerTo - movePointerBy - sendMove

The methods movePointerTo and movePointerBy change the current location of a pointer, but do not send an event to reflect that. Consequently, they also don't advance the current time of the gesture. This allows one to move several pointers simultaneously. The last method, sendMove , does not accept any parameters and simply sends a move event, allowing one to "flush" all pointer movement. If pointers have been updated with movePointerXx , and a down or up event is sent, a move event will be sent immediately preceding the down or up event.

The timing of all methods has slightly changed as well. As of now, sendDown and sendUp no longer advance the time of the gesture, so one can send multiple pointers down or up simultaneously. All the other methods do advance the time of the gesture. It is currently not (yet) possible to change the time delta. (I9acac, b/157142514) - Added AnnotatedString.getStringAnnotations that returns all annotations within the range. (I1fa00)

Bug Fixes

Introduced low level stateless animation APIs. These APIs (I63bf7)

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)

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. 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 (Id3434)

Crossfade can now work with null as initial value (Iad6a4, b/155947711)

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)

androidx.ui.foundation.TextFieldValue 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)

and is deprecated. , , and 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 dispatch. This is now fixed. (I1f48b, b/157998762)

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

were removed via subcomposition during dispatch. 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)

TextField's cursor has a blinking animation (Id10a7)

Partial gestures no longer require passing around of a GestureToken (Id7ae5)

Fixed a ConstraintLayout bug causing a crash on recompositions. (Ibee5a, b/158164341)

Fixed onClick not being invoked for DropdownMenuItem s. (I3998b, b/157673259)

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

Version 0.1.0-dev13

June 10, 2020

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

Known Issues

When the application depends on androidx.core:core-ktx:1.2.0 , and a FontFamily with multiple fonts / font weights is used, font selection will render in regular font weight. We will be working on this issue, and currently the workaround is to use androidx.core:core-ktx:1.2.0-alpha01 or androidx.core:core-ktx:1.1.0 .

Version 0.1.0-dev12

May 27, 2020

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

API Changes

Added animate() support for Dp , Px , Size , Position , Bounds , PxPosition , PxSize , PxBounds , IntPx , IntPxSize , IntPxPosition , IntPxBounds , and AnimationVector (Ib7518, b/156559139)

support for , , , , , , , , , , , , and (Ib7518, b/156559139) Added the DropdownMenu component in ui-material , a Material Design menu implementation. (I9bb3d, b/135742486)

component in , a Material Design menu implementation. (I9bb3d, b/135742486) Removed deprecated LayoutTag() , please use Modifier.tag() instead. (If8044, b/157020665, b/156577646)

, please use Modifier.tag() instead. (If8044, b/157020665, b/156577646) Removed deprecated Modifier.matchParent() , please use Modifier.matchParentSize() instead. (If8044, b/157020665, b/156577646)

, please use instead. (If8044, b/157020665, b/156577646) 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, b/156681014)

Modifier.semantics has been undeprecated to allow usages for high level components. (I4cfdc, b/153198273, b/154023028)

DoubleTapGestureFilter now disambiguates SingleTapGestureFilter across the tree. (If92b1, b/147609897, b/148553848, b/138605697, b/148464969)

now disambiguates across the tree. (If92b1, b/147609897, b/148553848, b/138605697, b/148464969) Updated Alignment API and added support for absolute alignment (which does not auto-mirror in Rtl context) (I38cd3, b/153633345)

VerticalScroller now provides Column out of the box. HorizontalScroller now provides Row out of the box. (Ieca5d, b/157020670)

now provides Column out of the box. now provides out of the box. (Ieca5d, b/157020670) Modifier.indication has been added to foundation package. Use it to show press/drag/other indication on your custom interactable elements (I8425f, b/155287131)

has been added to foundation package. Use it to show press/drag/other indication on your custom interactable elements (I8425f, b/155287131) VerticalScroller and HorizontalScroller now support reversed scrolling when isReversed is set on ScrollerPosition (I953bd, b/155852672)

and now support reversed scrolling when is set on (I953bd, b/155852672) Support adding composables into text layout. (I1373c, b/139320966)

Removed deprecated DrawBackground API in favor of drawBackground extension APIs on Modifier. Refactored color, brush and paint drawBackground implementations to reduce code paths as well as remove requirement for Modifier to be created as part of composition. (I0343a, b/155999867)

Modifier.padding(InnerPadding) has been added (I94985, b/157133803)

has been added (I94985, b/157133803) Removed deprecated RowAlign, ColumnAlign in Row and Column. (If60d4, b/154524540, b/155858731)

Added the offsetPx layout modifier, which can be used to define (dynamic) offsets in px. (I5af57, b/154841615)

layout modifier, which can be used to define (dynamic) offsets in px. (I5af57, b/154841615) Allow to show/hide software keyboard manually using SoftwareKeyboardController (Ifb9d6, b/155427736)

Renamed Emphasis.emphasize() to Emphasis.applyEmphasis() (Iceebe, b/152874916)

to (Iceebe, b/152874916) Added utility for simulating pinch gesture in tests. (If6c42, b/145593752)

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

class as there is a duplicate class in the module that is being consumed. (I1b602, b/156546424) AnnotatedString.Item is renamed to AnnotatedString.Range . (I2d44d, b/156126205)

is renamed to . (I2d44d, b/156126205) 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: Some calls will skip where they wouldn’t have previously Composable expressions in default argument expressions are now correctly subscribed to and handled This work included some optimizations: 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 Parameters 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. 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 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: Composer::startExpr was removed Composer::endExpr was removed Composer::call was deprecated The non-varargs overloads of key have been removed. Use the vararg version going forward. The Pivotal annotation was deprecated. Use key as a replacement. ScopeUpdateScope::updateScope was changed to expect a Function3 instead of Function1 restartableFunction and restartableFunctionN were updated to include additional compile time parameters (I60756, b/143464846)



@Model annotation is now deprecated

@Model annotation is now deprecated. Use state and mutableStateOf as alternatives. This deprecation decision was reached after much careful discussion. Justification Rationale includes but is not limited to: Reduces API surface area and concepts we need to teach More closely aligns with other comparable toolkits (Swift UI, React, Flutter) Reversible decision. We can always bring @Model back later. Removes corner-case usage and difficult to answer questions about configuring @Model as things we need to handle @Model data classes, equals, hashcode, etc. How do I have some properties “observed” and others not? How do I specify structural vs. referential equality to be used in observation? Reduces "magic" in the system. Would reduce the likelihood of someone assuming system was smarter than it is (ie, it knowing how to diff a list) Makes the granularity of observation more intuitive. Improves refactorability from variable -> property on class Potentially opens up possibilities to do hand-crafted State-specific optimizations More closely aligns with the rest of the ecosystem and reduces ambiguity towards immutable or us "embracing mutable state" Migration Notes Almost all existing usages of @Model are fairly trivially transformed in one of two ways. The example below has a @Model class with two properties just for the sake of example, and has it being used in a composable. @Model class Position( var x: Int, var y: Int ) @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) } Alternative 1: Use State<OriginalClass> and create copies. This approach is made easier with Kotlin’s data classes. Essentially, make all previously var properties into val properties of a data class, and then use state instead of remember , and assign the state value to cloned copies of the original using the data class copy(...) convenience method. It’s important to note that this approach only works when the only mutations to that class were done in the same scope that the State instance is created. If the class is internally mutating itself outside of the scope of usage, and you are relying on the observation of that, then the next approach is the one you will want to use. data class Position( val x: Int, val y: Int ) @Composable fun Example() { var p by state { Position(0, 0) } PositionChanger( position=p, onXChange={ p = p.copy(x=it) } onYChange={ p = p.copy(y=it) } ) } Alternative 2: Use mutableStateOf and property delegates This approach is made easier with Kotlin’s property delegates and the mutableStateOf API which allows you to create MutableState instances outside of composition. Essentially, replace all var properties of the original class with var properties with mutableStateOf as their property delegate. This has the advantage that the usage of the class will not change at all, only the internal implementation of it. The behavior is not completely identical to the original example though, as each property is now observed/subscribed to individually, so the recompositions you see after this refactor could be more narrow (a good thing). class Position(x: Int, y: Int) { var x by mutableStateOf(x) var y by mutableStateOf(y) } // source of Example is identical to original @Composable fun Example() { var p = remember { Position(0, 0) } PositionChanger( position=p, onXChange={ p.x = it } onYChange={ p.y = it } ) } (I409e8, b/152050010, b/146362815, b/146342522, b/143413369, b/135715219, b/143263925, b/139653744)



Bug Fixes

Fixed a bug: When font weight and font style are nested on an AnnotatedString, text is not rendered correctly. (I77a9d, b/155081453)

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, b/155918846)

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, b/156681014)

Version 0.1.0-dev11

May 14, 2020

androidx.ui:ui-*:0.1.0-dev11 are released. Version 0.1.0-dev11 contains these commits.

API Changes

Crossfade now accepts optional AnimationBuilder param to allow configuring the animation (I6d6e0)

param to allow configuring the animation (I6d6e0) 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)

, , , and properties in Dp (I91b9a, b/149979702) Renamed LayoutModifier2 to LayoutModifier . (Id29f3)

to . (Id29f3) Removed deprecated LayoutModifier interface. (I2a9d6)

interface. (I2a9d6) HorizontalScroller and VerticalScroller now restore their scroll position using saved instance state. (Ia0fae, b/155075048)

and now restore their scroll position using saved instance state. (Ia0fae, b/155075048) FocusManagerAmbient is removed. Use FocusModifier.requestFocus to obtain focus. (Ic4826)

is removed. Use to obtain focus. (Ic4826) Table layout was removed temporarily until we will make it available again with a refreshed API. (Id88a7)

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 stateobject for configuring drawing operations. Added CanvasScopeSample as well as updated the demo app to include a declarative graphics Demo (Ifd86d)

ColoredRect has been removed. Use Box with drawBackground modifier instead (I983c7, b/152753731)

has been removed. Use with modifier instead (I983c7, b/152753731) Add cursor color customization to the TextField (I6e33f)

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

which is delivered by callback (I8dc44, b/151860051) TextFieldValue used with TextField can now be survive activity recreation when used like this: var text by savedInstanceState(saver = TextFieldValue.Saver) { TextFieldValue() } (I5c3ce, b/155075724)

used with can now be survive activity recreation when used like this: var text by (I5c3ce, b/155075724) 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)

. If you are currently creating a local text style to pass a small number of these parameters, such as , you can now just provide the parameters directly: (I82768) Replaced CoreTextField/TextField focusIdentifier parameter with FocusNode in order to integrate with focus subsystem. (I7ea48)

parameter with in order to integrate with focus subsystem. (I7ea48) TextField update - in horizontal dimension it will occupy all available space granted to it (Ib08df, b/154638552)

AlignmentLineOffset composable is deprecated, please use relativePaddingFrom() modifier instead. CenterAlignmentLine composable is removed. (I60107)

Added defaultMinSizeConstraints layout modifier, which sets size constraints to the wrapped layout only when the incoming corresponding constraints are unspecified (0 for min constraints and infinity for max constraints). (I311ea, b/150460257)

layout modifier, which sets size constraints to the wrapped layout only when the incoming corresponding constraints are unspecified (0 for min constraints and infinity for max constraints). (I311ea, b/150460257) Container has been removed. Use Box instead (Ibbc2b, b/151407926)

has been removed. Use instead (Ibbc2b, b/151407926) Removed deprecated LayoutWidth / Height / Size modifiers. (Ib0bc1)

/ / modifiers. (Ib0bc1) Added default parameter values for the offset modifier. (I37f06)

Added symmetric padding modifier. (I39840, b/152941819)

Removed deprecated LayoutAspectRatio modifier. (I65a74)

modifier. (I65a74) Fixed a bug in the width and height modifiers that was causing the wrapped layout to be measured with no opposite axis constraints. (I210b8, b/154797971)

Disabled buttons now visually follows the Material Design specification (I47dcb, b/155076924)

FilledTextField gets ime action, visual transformation and keyboard type support (I1f9cf, b/155075201)

gets ime action, visual transformation and keyboard type support (I1f9cf, b/155075201) Adds strokeWidth parameter to CircularProgressIndicator to customize the stroke size. To change the stroke size (height) of a LinearProgressIndicator , you can use Modifier.preferredHeight() or another size modifier. (Icea16, b/154919081)

parameter to to customize the stroke size. To change the stroke size (height) of a , you can use or another size modifier. (Icea16, b/154919081) Added slot API for trailing and leading icons in the FilledTextField and handling of the error state (Ic12e0)

and handling of the error state (Ic12e0) Adds doPartialGesture action with PartialGestureScope receiver that has the methods sendDown , sendMoveTo , sendMoveBy , sendUp and sendCancel . (I6b058, b/152477560)

action with PartialGestureScope receiver that has the methods , , , and . (I6b058, b/152477560) Adds sendDown , sendMove , sendUp and sendCancel methods to InputDispatcher , and GestureToken to combine these individual touch events to one gesture. (Ibd278, b/152477560)

, , and methods to , and to combine these individual touch events to one gesture. (Ibd278, b/152477560) Added plus operator for (Text/Paragraph/Span)Style which delegates to merge() function. (Ia1add)

The ui-framework and ui-platform projects have been merged into ui-core , so all dependencies on those modules only need to depend on ui-core. (/I70067)

Bug Fixes

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)

Removed deprecated LayoutAlign modifiers. (I10877)

modifiers. (I10877) Add Toolbar for text related operations. (I49d53)

Version 0.1.0-dev10

April 29, 2020

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

API Changes

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

uses in API with non-nullable and use instead of (Iabaa7) Intrinsic measurements functions in Layout and LayoutModifier2 have an IntrinsicMeasureScope receiver now which provides intrinsics query API with implicitly propagated layout direction. (Id9945)

and have an 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)

and 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 of DrawShadow have been changed: the first parameter is now the elevation and second parameter is now the shape , with a RectangleShape default. (I20150, b/152417501)

is added to control the drawing order of the children within the same parent layout. elevation property on is renamed to and doesn't control the drawing order anymore. The params order of have been changed: the first parameter is now the and second parameter is now the , with a default. (I20150, b/152417501) Removed onSizeChange and onPositionChange in Owner . (I5c718)

and in . (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)

, a copy of that does only supports connstraints values rather than . will be removed and all integer constraints will be assumed to be pixels like Android. Added InteractionState and Interaction , making it easier to build components that react to UI state changes such as press, and drag (Icfe25, b/152525426)

and , making it easier to build components that react to UI state changes such as press, and drag (Icfe25, b/152525426) RectangleShape has been moved from androidx.ui.foundation.shape.* to androidx.ui.graphics.* (Ia74d5, b/154507984)

has been moved from to (Ia74d5, b/154507984) TextField API update - the onFocus and onBlur callbacks have been merged into a single onFocusChange(Boolean) callback with a boolean parameter (I66cd3)

API update - the and callbacks have been merged into a single callback with a boolean parameter (I66cd3) FontLoader has been removed. Use fontResource instead. (Id0308)

has been removed. Use instead. (Id0308) Removed unused MaskFilter API as it has limited usage and is not optimized for hardware acceleration in most use cases (I54f76)

API as it has limited usage and is not optimized for hardware acceleration in most use cases (I54f76) Added Unset Color to represent an unset value without boxing `Colors. (If901a)

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)

and extension methods to consume optional pivot coordinates for transformations. These default to the top left corner of the current canvas translation. FAB's and Extended FAB's default color has been changed to MaterialTheme.colors.secondary . (I3b9b9, b/154118816)

. (I3b9b9, b/154118816) No longer need to explicitly call onIdle() after ComposeTestRule.setContent {} . (Iafb2e, b/154079800)

after . (Iafb2e, b/154079800) You can now pass a custom ActivityTestRule to AndroidComposeTestRule (I38206, b/153623653)

to (I38206, b/153623653) Added getLineStart , getLineEnd , getEllipsisOffset , and getEllipsisCount to TextLayoutResult (Ibc801)

, , , and to (Ibc801) FontWeight.lerp does not snap anymore. It is still a data class. (I521c2)

does not snap anymore. It is still a data class. (I521c2) FontWeight constructor is now public, it is not data class anymore. (Id6b1f)

Bug Fixes

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

to support drawing a subsection of underlying (I0ea9e) Fixed a crash in AdapterList when removing items (Ic64b0, b/153195921)

when removing items (Ic64b0, b/153195921) It is now required to use ComposeTestRule in order for any Finders (like findByTag) to work (I75bb9, b/153565271)

Version 0.1.0-dev09

April 15, 2020

androidx.ui:ui-*:0.1.0-dev09 are released. Version 0.1.0-dev09 contains these commits.

API Changes

Made Alignment instantiable with arbitrary values. Added 1D Alignments. (Ia0c05)

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

Measured 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

Add Rtl support for draw modifiers. (I0aaf9)

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

Added positionInParent and boundsInParent for LayoutCoordinates . (Icacdd, b/152735784)

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

and now default and to . (I0eb8b, b/152810850) Renamed LayoutResult to MeasureResult . (Id8c68)

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

, a new API for defining layout modifiers; deprecated (If32ac) Removes ProvideContentColor , instead just use ContentColorAmbient directly with Providers (Iee942)

, instead just use directly with (Iee942) Adds color parameter to text, allowing overriding the color of the text style without needing to manually merge with the style provided in a theme. (I41a66)

Shape theming system is updated according to the Material design specification. Now you can provide small, medium and large shapes to be used by most of the components (Ifb4d1)

LayoutDirectionAmbient is deprecated. To read the layout direction defined by the locale, use localeLayoutDirection on ConfigurationAmbient (I851b1)

is deprecated. To read the layout direction defined by the locale, use on (I851b1) New LifecycleOwnerAmbient is now available. Now an Activity you are using with Compose UI should extend androidx.activity.ComponentActivity (or AppCompatActivity ). setContent on android.app.Activity is now deprecated (Idb25a, b/153141084)

is now available. Now an Activity you are using with Compose UI should extend (or ). on is now deprecated (Idb25a, b/153141084) Popup support RTL (Ib6657)

Add ClipboardManager . (I1dd2b)

. (I1dd2b) Added support for customizing dimensions of children of ConstraintLayout (Idb1a5)

OnChildPositioned has been removed. Developers should use Modifier.onChildPositioned modifier instead. (I5ade7, b/151141173, b/151641453, b/151818355)

has been removed. Developers should use modifier instead. (I5ade7, b/151141173, b/151641453, b/151818355) 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)

/ to / 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) Renamed EdgeInsets to InnerPadding . Renamed innerPadding parameter of Material Buttons to paddding. (I66165)

to . Renamed innerPadding parameter of Material Buttons to paddding. (I66165) Added modifiers for sizing to intrinsic measurements and deprecated the components serving this purpose. (I8295d)

Removed deprecated Wrap and Center composables. (I29e23)

and composables. (I29e23) Slider is now stateless. Users will need to pass and update state by themselves, just like in any other control. (Ia00aa)

StaticDrawer was removed. If you need it, use Box with material-spec'ed width instead (I244a7)

was removed. If you need it, use with material-spec'ed width instead (I244a7) Added modifier param to ListItem and reordered params to promote trailing lambda body (I66e21)

Added defaultFontFamily constructor parameter to Typography , allowing specifying the default font family that will be used for any provided TextStyles that do not have a family set. (I89d07)

constructor parameter to , allowing specifying the default font family that will be used for any provided TextStyles that do not have a family set. (I89d07) Temporarily removed Material Data Tables from the API surface. (Iaea61)

Renamed parameters in Divider composable (Ic4373)

composable (Ic4373) "children" trailing parameter was renamed for a lot of Material components, please use the new name if you used it via named params (or just use the trailing lambda syntax) (Ia6d19)

Removes MaterialTheme.emphasisLevels , instead use EmphasisAmbient.current to retrieve the emphasis levels (Ib5e40)

, instead use to retrieve the emphasis levels (Ib5e40) savedInstanceState() can now be used with nullable types (I6847f, b/153532190)

can now be used with nullable types (I6847f, b/153532190) Added ui-rxjava2 - new artifact with adapters for RxJava2. (Ifab4b, b/153369097) Example of the usage: val value by observable.subscribeAsState()

Added ui-livedata - new artifact with an adapter for LiveData. (Ie9e8c, b/150465596) Example of the usage: val value by liveData.observeAsState()



Bug Fixes

Added verticalGravity and horizontalGravity parameters to Row and Column , respectively. (I7dc5a)

and parameters to and , respectively. (I7dc5a) ui-text module was renamed as ui-text-core` (I57dec)

ui-text-core` (I57dec) Improved DrawModifier API ((Ibaced, b/152919067)): Made the receiver scope for draw() ContentDrawScope Removed all parameters on draw() DrawScope has same interface as former CanvasScope ContentDrawScope has drawContent() method

API ((Ibaced, b/152919067)): runOnIdleCompose and runOnUiThread are now global functions instead of methods on ComposeTestRule . (Icbe8f)

and are now global functions instead of methods on . (Icbe8f) [Mutable]State property delegate operators moved to extensions to support Kotlin 1.4 property delegate optimizations. Callers must add imports to continue using by state { ... } or by mutableStateOf(...) . (I5312c)

or . (I5312c) ColoredRect has been deprecated. Use Box(Modifier.preferredSize(width, height).drawBackground(color)) instead. (I499fa, b/152753731)

has been deprecated. Use instead. (I499fa, b/152753731) We changed how we measure the first layout you put inside activity.setContent { } block. Previously it was forced to fill the whole activity screen, and now it behaves as if you put your layout inside a Stack: it can be smaller than a screen and will be positioned in the top left screen. If you want the old behaviour you can apply Modifier.fillMaxSize() for your layout. (Ie88a7, b/153453714)

block. Previously it was forced to fill the whole activity screen, and now it behaves as if you put your layout inside a Stack: it can be smaller than a screen and will be positioned in the top left screen. If you want the old behaviour you can apply Modifier.fillMaxSize() for your layout. (Ie88a7, b/153453714) ui-text-compose module was renamed to ui-text . ui-text now contains CoreText and CoreTextField composables (Ib7d47)

module was renamed to . now contains and composables (Ib7d47) Moved ui-framework/CoreText , CoreTextField composables under ui-text-compose . You might want to include ui-text-compose in your project. (I32042)

, composables under . You might want to include in your project. (I32042) Updated wrapContentWidth and wrapContentHeight to expect vertical or horizontal Alignment rather than any Alignment . The gravity modifier was updated to accept vertical or horizontal Alignment . Row , Column , and Stack were updated to support custom continuous Alignment s. (Ib0728)

and to expect vertical or horizontal rather than any . The gravity modifier was updated to accept vertical or horizontal . , , and were updated to support custom continuous s. (Ib0728) Created PixelMap API to support querying pixel information from an ImageAsset . (I69ad6)

API to support querying pixel information from an . (I69ad6) Added Material Design implementation of Filled Text Field (Ic75cd)

The ui-android-text package name ( androidx.text ) was replaced with androidx.ui.text.platform in order to align with androidx policy. (I42711)

Version 0.1.0-dev08

April 1, 2020

androidx.ui:ui-*:0.1.0-dev08 are released. Version 0.1.0-dev08 contains these commits.

API Changes

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)

, parameters to Layer APIs to support rotation and scaling around a particular point on a layer (Icf7c3) Draggable has been moved to modifier (Id9b16, b/151959544)

Moved Text to the androidx.ui.foundation package, from androidx.ui.core . (I87ce5)

to the package, from . (I87ce5) Added enabled param to Checkbox, Switch and Toggleable (I41c16)

param to Checkbox, Switch and Toggleable (I41c16) Ripple is now a Modifier. While Clickable is not yet converted the recommended usage is Clickable(onClick = { ... }, modifier = ripple()) (Ie5200, b/151331852, b/150060763)

(Ie5200, b/151331852, b/150060763) Added VectorPainter API to replace existing subcomposition API for vector graphics. The result of subcomposition is a VectorPainter object instead of a DrawModifier. Deprecated the 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)

ParentData composable is deprecated. You should either create a modifier which implements the ParentDataModifier interface, or use the LayoutTag modifier if you simply need to tag layout children to recognize them inside the measure block. (I51368, b/150953183)

composable is deprecated. You should either create a modifier which implements the interface, or use the modifier if you simply need to tag layout children to recognize them inside the measure block. (I51368, b/150953183) OnPositioned was removed in favor of the onPositioned modifier (I2ea3c)

was removed in favor of the modifier (I2ea3c) RowScope and ColumnScope members are now accessible outside Row and Column . (I3a641)

and members are now accessible outside and . (I3a641) Container has been deprecated. Use Box instead. (I675ce, b/151407926)

has been deprecated. Use instead. (I675ce, b/151407926) Refactored FloatingActionButton APIs to accept composable lambdas instead of primitives. See updated samples for usage information. (I00622)

APIs to accept composable lambdas instead of primitives. See updated samples for usage information. (I00622) New functions: savedInstanceState() and rememberSavedInstanceState() . They are similar to state() and remember() but have a saved instance state support build in (If1987, b/152025209)

Bug Fixes

Replaced Modifier plus operator with factory extension functions (I225e4)

Deprecated Center composable. It should be replaced either with the LayoutSize.Fill + LayoutAlign.Center modifier, or with one of the Box or Stack composables with suitable modifiers applied (Idf5e0)

+ modifier, or with one of the or composables with suitable modifiers applied (Idf5e0) Changed MaterialTheme APIs such as MaterialTheme.colors() , MaterialTheme.typography() to be properties instead of functions. Removed the parentheses from existing calls and no behavioral change is expected. (I3565a)

Version 0.1.0-dev07

March 18, 2020

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

API Changes

API additions to ManualAnimationClock: hasObservers: Boolean and constructor parameter dispatchOnSubscribe: Boolean (Iaa134)

and constructor parameter (Iaa134) 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)

Created Image composable to handle sizing/layout in addition to drawing a given ImageAsset to the screen. This composable also supports drawing any arbitrary Painter instance respecting its intrinsic size as well as supporting a given fixed size or minimum size (Ibcc8f)

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. (Id5bbd)

Created extension method on android.graphics.Bitmap , Bitmap.asImageAsset() , to create an instance of an ImageAsset useful for combining traditional Android application development with the compose framework. (Id5bbd)

, , to create an instance of an ImageAsset useful for combining traditional Android application development with the compose framework. (Id5bbd) androidx.compose.ViewComposer has been moved to androidx.ui.node.UiComposer and androidx.compose.Compose.subcomposeInto has moved to androidx.ui.core.subcomposeInto (Idef00)

has been moved to and has moved to (Idef00) Removed the Layout Composable function that accepts a varargs of children. (I8f7f6)

WithConstraints got LayoutDirection parameter (I6d6f7)

got parameter (I6d6f7) Added the LayoutOffset modifier for offsetting layout position (I0b8a3)

Surface and Card were moved from androidx.ui.material.surface to androidx.ui.material (I88a6d) (b/150863888)

Bug Fixes

Renamed LayoutFlexible to LayoutWeight. Renamed tight parameter to fill. (If4738)

The Opacity composable function has been replaced with the drawOpacity modifier. (I5fb62)

Tests using AndroidComposeTestRule now provide an animation clock at the root of the composition that allows it to be paused, resumed and advanced manually. (Id54c5)

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)

param. Some of the params on Button were renamed or reordered. (I54b5a) DrawVector has been changed from a regular composable function to returning a Modifier drawVector() that will draw the vector as a background to a layout. (I7b8e0)

Replace composable function Clip with modifier drawClip(). DrawClipToBounds is a convenient modifier to use when you only need to clip to the layer bounds with a rectangle shape. (If28eb)

Replaced DrawShadow composable function with drawShadow() modifier. Shadows are now drawn as part of LayerModifier. (I0317a)

Deprecated Wrap composable. It can be replaced either with the LayoutAlign modifier or with the Stack composable (Ib237f)

Renamed Painter.toModifier to Painter.asModifier as the newly created Modifier has a reference to the original Painter that can be shared across multiple Modifier instances (I7195b)

Negative padding in LayoutPadding is now disallowed. LayoutOffset should be used instead for negative position offsets. (Ifb5b1)

Version 0.1.0-dev06

March 4, 2020

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

API Changes

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

Initial support for Rtl in Compose layout (Ia5519)

Added Icon, IconButton and IconToggleButton, removing AppBarIcon. You can directly replace existing usages of AppBarIcon with IconButton, and they will now have the correct touch target. See the samples for usage information, and see Icons for the provided Material Icons you can use directly with these components. (I96849)

Removed Snackbar API with String parameters in favour of using the overload that accepts composable lambdas. See updated samples for usage information (I55f80)

Refactored Tab APIs to accept text and icon lambdas, (Ia057e)

and lambdas, (Ia057e) Added BottomNavigation component, see the docs and samples for usage information (I731a0)

Adds support for calling custom semantics actions. (I8c818)

Bug Fixes

Support right-to-left direction in LayoutPadding modifier (I9e8da)

Version 0.1.0-dev05

February 19, 2020

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

API Changes

Added Painter API. Created API to abstract drawing of content into a specified region. This behaves similar to the Drawable APIs however provides a more simplified API surface. Additionally there are generic implementations for applying various effects such as alpha and applying ColorFilters for arbitrary drawing implementations with the ability for the implementations themselves to provide a more optimized support for these facilities. (aosp/1214802)

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

documentation for details (I4c7ee, b/143769776) 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)

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.

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)

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) 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 initial support for embedding Android Views inside Compose. Please see the ViewInCompose.kt demo for more details. (I6d1ce)

Updated LayoutAlign to not fill the available space anymore (I2b14f)

Added androidx.ui:ui-material-icons-core and androidx.ui:ui-material-icons-extended modules. You can depend on androidx.ui:ui-material-icons-extended to be able to directly use all Material icons (material.io/icons) from inside Compose. A small (currently three, will be expanded in the future) subset including the most commonly used icons will be directly included as part of the main ui-material library, so you won’t need to add this large dependency to use icons such as Menu. See androidx.ui.material.icons.Icons documentation for more information, and the linked samples.

and modules. You can depend on to be able to directly use all Material icons (material.io/icons) from inside Compose. A small (currently three, will be expanded in the future) subset including the most commonly used icons will be directly included as part of the main ui-material library, so you won’t need to add this large dependency to use icons such as Menu. See documentation for more information, and the linked samples. Removed AspectRatio composable in favor of modifier. Deleted obsolete FlexColumn, FlexRow composables and Spacing modifier (Iec8a7)

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

Bug Fixes

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)

Known Issues

Changes to a component's semantic properties incorrectly cause all state in children to be lost, causing breakages in animations and anything else that relies on state being persisted across recompositions. Because lambdas cannot currently be compared, this includes any components that define a semantic action using a non- remember ed lambda, such as Scroller. This will be fixed in the next release. (b/148606417)

Version 0.1.0-dev04

January 29, 2020

androidx.ui:ui-*:0.1.0-dev04 is released. The commits included in this version can be found (here).

API Changes

Make pointer ids universally unique. (I42cde)

Semantics node merging (aosp/1138236)

Improvements to the API surface of Constraints (I0fd15)

Refactored the PathParser and PathNode / PathCommand (I715ae)

and / (I715ae) Update API surface of DpConstraints (I712a0)

Added support for modifiers that implement multiple interfaces. (I22c16)

Implemented cancel for the remainder of the gesture detectors. (I349f4)

Added Color.compositeOver() to Color (I5379d)

to Color (I5379d) Remove a few unneeded classes for androidx.ui:ui-core : ImageByteFormat , ImageRepeat , Matrix2 . (I45e6b)

: , , . (I45e6b) Enabled incremental Kotlin compilation in Compose projects (b/144304390)

Concatenate Modifiers with + (Ic33d3)

(Ic33d3) Added LayoutTag modifier (I69fe4)

Add ParagraphStyle attributes to TextStyle (If0d40)

Added DrawModifier, a modifier type that is allowed to draw on the surface of the modified layout. (I5fa56)

Change storage for the modifier position to be relative. (I5977f)

Added testing API to perform swipes on elements (I9125a)

Added Box component for combining layout and drawing common functionality. (I6e2a7)

Scrollers now exhibit native Android fling motion behavior. (b/147493715)

Replaced DrawBorder in favor of Border Modifier (Id335a)

Improved Scroller gesture detection. (I87d36)

Adds contentColor metadata to foundation (Icd074)

Scaffold material component has been added. Scaffold implements the basic material design visual layout structure. (I7731b)

Use new Surface's param contentColor in Buttons (b/146210556)

Removed textStyle.withOpacity() (I8cc9a)

(I8cc9a) Adds Emphasis subsystem (Ife95c)

FloatingActionButtonKt FAB properties are now private (I9c121)

FAB properties are now private (I9c121) Implemented the first iterations of a Snackbar (If1c08)

Added initial support for dark theme (I6323a)

Added size, center, and localToGlobal to GestureScope (I1ea37)

(I1ea37) Add API for injection of double click gesture (I44902)

Added sendLongClick methods to GestureScope (Ic7db9)

to (Ic7db9) Convert (x, y) to PxPosition in gesture injection (Ifefa4)

in gesture injection (Ifefa4) Added desired velocity to injected gesture (I3b9df)

Added bitmap capturing into Compose test API ( androidx.ui:ui-test ). (I4e36c)

). (I4e36c) Moved doClick to GestureScope (I56211)

to (I56211) Added findBySubstring and corresponding filters to FindersKt . (Ief0b9)

and corresponding filters to . (Ief0b9) Refactored Text Selection Bounding To 1 Char. (Iff757)

Removed TextSpan (Iebece)

Remove Composition classes in favor of Composer base class (Ieadbf)

Changed Vector defaultWidth/defaultHeight to use Dp (Iad267)

Correctly generate groups around inline composable calls (Ibf739)

Enabled flag prototyping in Gesture Detectors. (I4b7b0)

Change maxLines and ellipsis argument from nullable to non-null (I46dac)

AnnotatedString now uses SpanStyle (Ib6d3e)

Added modifiers support for WithConstraints (b/145399789)

Pass paragraph style to TextDelegate (Id2d4a)

Added SpanStyle class (Ifdb4f)

class (Ifdb4f) Use default value instead of nullable Float in TextGeometricTransform . (I1bf00)

. (I1bf00) Added PreviewActivity to androidx.ui:ui-tooling (Ic8988)

to (Ic8988) ModelObserver is now single-threaded. (b/146144712)

is now single-threaded. (b/146144712) Added benchmark for ModelObserver (Ia176b)

Call cancel callbacks when the PointerInputNode is removed from the tree. (I7112a)

Removed the LayoutInflexible modifier for Row and Column (I0d820)

Inherit layout modifiers from ParentDataModifier (I49b6a)

(I49b6a) Added Wrapped modifier (I6f8df)

Added Aligned modifiers (Ifc581)

Added Constraint Layout to Compose (I175ad)

Refactors