Compose Foundation
androidx.compose.foundation
androidx.compose.foundation.layout
androidx.compose.foundation.gestures
androidx.compose.foundation.selection
androidx.compose.foundation.lazy
androidx.compose.foundation.interaction
androidx.compose.foundation.text
(See the API reference docs for all compose packages)
Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
August 21, 2024 | 1.6.8 | 1.7.0-rc01 | - | - |
Structure
Compose is combination of 7 Maven Group Ids within androidx
. Each Group
contains a targeted subset of functionality, each with its own set of release
notes.
This table explains the groups and links to each set of release notes.
Group | Description |
---|---|
compose.animation | Build animations in their Jetpack Compose applications to enrich the user experience. |
compose.compiler | Transform @Composable functions and enable optimizations with a Kotlin compiler plugin. |
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.material3 | Build Jetpack Compose UIs with Material Design 3 Components, the next evolution of Material Design. Material 3 includes updated theming and components and Material You personalization features like dynamic color, and is designed to be cohesive with the new Android 12 visual style and system UI. |
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. |
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:
Groovy
dependencies { implementation "androidx.compose.foundation:foundation:1.6.8" } android { buildFeatures { compose true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
Kotlin
dependencies { implementation("androidx.compose.foundation:foundation:1.6.8") } android { buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.15" } kotlinOptions { jvmTarget = "1.8" } }
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.
See the Issue Tracker documentation for more information.
Version 1.7
Version 1.7.0-rc01
August 21, 2024
androidx.compose.foundation:foundation-*:1.7.0-rc01
is released. Version 1.7.0-rc01 contains these commits.
Bug Fixes
- Fixed a regression where the crash occurred when any element is focused inside a parent that is focusable (or clickable) and disabled. (b/317561689)
Version 1.7.0-beta07
August 7, 2024
androidx.compose.foundation:foundation-*:1.7.0-beta07
is released. Version 1.7.0-beta07 contains these commits.
Bug Fixes
- Text input related
SemanticsNodeInteraction
functionsperformTextReplacement
,performTextInput
, andperformTextClearance
is now going to throw assertion errors when they are called on read onlyTextFields
. (I4ae8f) - Fixed a visual glitch in hyperlinks. (I23311)
- Fixed
contentReceiver
modifier not working with some IMEs. - Velocity generation: Prevent propagation of NaN values in Compose UI and Foundation.
Version 1.7.0-beta06
July 24, 2024
androidx.compose.foundation:foundation-*:1.7.0-beta06
is released. Version 1.7.0-beta06 contains these commits.
Version 1.7.0-beta05
July 10, 2024
androidx.compose.foundation:foundation-*:1.7.0-beta05
is released. Version 1.7.0-beta05 contains these commits.
Bug Fixes
- Fix for treatment of Nan values in
SnapFlingBehavior
and Pager.
Version 1.7.0-beta04
June 26, 2024
androidx.compose.foundation:foundation-*:1.7.0-beta04
is released. Version 1.7.0-beta04 contains these commits.
Bug Fixes
- Avoid crashes when measuring very large text lines (e.g. 10k characters) (8157ab)
- Fixes measurement of very large text causing crash in the new
BasicTextField
(6b7575) - Reverts a behavior change in Row/Column measurement that breaks Text usage in certain scenarios (69e8ba)
Version 1.7.0-beta03
June 12, 2024
androidx.compose.foundation:foundation-*:1.7.0-beta03
is released. Version 1.7.0-beta03 contains these commits.
Version 1.7.0-beta02
May 29, 2024
androidx.compose.foundation:foundation-*:1.7.0-beta02
is released. Version 1.7.0-beta02 contains these commits.
API Changes
- Adds an experimental API for configuring prefetch behavior of
LazyGrids
similar to the existing experimental API forLazyLists
. This includes support for prefetching items in nestedLazyGrids
. Similiar toLazyListPrefetchStrategy
, the implementation default is to prefetch the first 2 nested items of each grid, but this can be configured by the newLazyGridPrefetchStrategy(nestedPrefetchItemCount)
andLazyListPrefetchStrategy#onNestedPrefetch
APIs. (I591c4) - Renamed
SemanticsProperties.Editable
toIsEditable
and changesSemanticsPropertyReceiver.editable
to a valisEditable
. The property is now a boolean and always specified by text fields. (I8acd8) - Moved
basicMarquee
default values intoMarqueeDefaults
object. (I12ff6) - Renamed
basicMarquee
delayMillis
parameter torepeatDelayMillis
. (I12ff6) - Update API for styling the links: moved the
TextLinkStyles
to theTextStyle
and removed theTextDefaults
from material (I5477b)
Bug Fixes
- Renamed
LayoutCoordinates.introducesFrameOfReference
toLayoutCoordinates.introducesMotionFrameOfReference
to better reflect its purpose. Renamed related function to calculate coordinates based on that flag. (I3a330) - Removed 'Default' from the
MarqueeDefaults
properties. (I1d8a0) - Removed 'Marquee' from
MarqueeDefaults
properties. (Iad4f4) - Removed
TextLinkStyles
from theTextStyle
class. Instead,TextLinkStyles
is part of theLinkAnntation
constructor and theAnnotatedString.fromHtml
method (I90b2b) - Fixed a bug where Pager would snap when flinging towards a bound while already settled at the bound. (I9f373, b/339171222)
- BTF2 now has correct mouse selection gestures. (Ibe8c6)
External Contribution
- Resubmit 'Make compose/measure time calculation content-type based in prefetch to improve accuracy' (Iea622)
- Make compose/measure time calculation content-type based in prefetch to improve accuracy (Ibccb1)
- Make
WindowInsetsPadding
modifiers available from common source set (I070b2)
Version 1.7.0-beta01
May 14, 2024
androidx.compose.foundation:foundation-*:1.7.0-beta01
is released. Version 1.7.0-beta01 contains these commits.
API Changes
- Added
KeyboardOptions.shouldShowKeyboardOnFocus
property back as deprecated hidden for binary compatibility. (I15cfe) Modifier.anchoredDraggable
now reverses drag deltas by default for components with a Horizontal orientation when used in an RTL layout. (I3c6d9)AnnotatedString.hasEqualsAnnotations
is nowhasEqualAnnotations
. (I685c0)- Updated the API for getting Material themed links in text. Specifically, removed the methods from the
TextDefaults
for constructing themedLinkAnnotations
and parse HTML with themed links. Instead, added aTextLinkStyles
class that allows to style the links as a parameter to the Text composable. (I31b93) - Replaced
onDragStarted
andonDragStopped
with non-suspend callbacks. (I59de8)
Bug Fixes
- Fixed a bug where Pager would crash when the
contentPadding
was bigger than the incoming constraints. Pager now coerces negative values returned fromPageSize
to 0. (Iba5d8, b/314008560)
Version 1.7.0-alpha08
May 1, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha08
is released. Version 1.7.0-alpha08 contains these commits.
New Features
- Added right-click context menu to
BasicTextField
andSelectionContainer
with items for cut, copy, paste, and select-all actions. (If8c93, Ia2b49, I6f268)
API Changes
LazyLayout
prefetch requests can be marked as urgent now, meaning that we expect this item to be needed in the next frame and want to ignore frame budget to make sure to do more work in advance (Id513f)- Renamed
isPositionedByParentWithDirectManipulation
tointroducesFrameOfReference
. Note that it now has the reverse effect, meaning that by default, mostLayoutCoordinates
introduce a frame of reference, and, only when placed under direct manipulation the property will be false. To query position with only those that introduce a frame of reference, usepositionInLocalFrameOfReference(...)
. OrpositionInLocalLookaheadFrameOfReference
from aLookaheadScope
. (Ifc5f7) - Renamed
onClicked
toonClick
insideLinkInteractionListener
(Iaa35c) - Change action lambda for
getScrollViewportLength
as per API council feedback. (Ibc74a) - Renamed stylus handwriting delegation APIs. (Ica45f, b/327271923)
- Rename
TextInclusionStrategy.isInside
toisIncluded
. MakeParagraph/MultiParagraph#getRangeForRect()
return type non nullable. (I51f26)
Bug Fixes
- Added "Select all" to all text contextual menus in
SelectionContainer
. (Ib750e, b/240143283) - Fixed long screenshot capture for scrolling containers with
reverseScrolling=true
. (I7c59c) - Fixed an issue where
AnchoredDraggableState
'scurrentValue
would change when approaching the state's bounds. (Iea30b, b/333846848)
External Contribution
- Renamed
PrefetchExecutor
->PrefetchScheduler
to better reflect its responsibilities. (Ib9154) - Added support for prefetching items in nested
LazyLists
(e.g. aLazyColumn
that renders nestedLazyRows
). This change is expected to reduce frame drops during scrolling for theseLazyLists
. The implementation default is to prefetch the first 2 nested items, however this behavior can be controlled by the newLazyLayoutPrefetchStrategy(nestedPrefetchItemCount)
andLazyListPrefetchStrategy#onNestedPrefetch
APIs. (I51952)
Version 1.7.0-alpha07
April 17, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha07
is released. Version 1.7.0-alpha07 contains these commits.
New Features
- Added a
TextDefaults
object that contains methods to construct aLinkAnnotation
and parse HTML-tagged string which applyMaterialTheme
to the links. (I98532, b/139312671) - Item appearance and disappearance animation support was added into
LazyVerticalGrid
andLazyHorizontalGrid
. Previously it was possible to addModifier.animateItemPlacement()
modifier in order to support placement (reordering) animations. We deprecated this modifier and introduced a new non-experimental modifier calledModifier.animateItem()
which allows you to support all three animation types: appearance (fade in), disappearance (fade out) and reordering. (Ib7d12, b/330510929) - Item appearance and disappearance animation support was added into
LazyVerticalStaggeredGrid
andLazyHorizontalStaggeredGrid
. Previously it was possible to addModifier.animateItemPlacement()
modifier in order to support placement (reordering) animations. We deprecated this modifier and introduced a new non-experimental modifier calledModifier.animateItem()
which allows you to support all three animation types: appearance (fade in), disappearance (fade out) and reordering. (I69bc9, b/330511290)
API Changes
- Adds
ContextMenuColors
and the associatedLocalContextMenuTheme
ProvidableCompositionLocal
. The colors of the context menu on text fields and selectable text can be modified by providing the composition local. (Ifa154) - Text links got pressed state styling option in addition to normal styling, hovered and focused. (I5f864, b/139312671)
- Introduce
ViewConfiguration.HandwritingGestureLineMargin
for handwriting gestures. Support handwriting gesture forBasicTextField
. (Ie6e13, b/325660505) - Removed
DelegatableNode.scrollIntoView
for the 1.7 release since we didn't have time to finish stabilizing the rest of the related API surface. This function will be re-introduced in 1.8 (I6cf61, b/333421581, b/332900232) - When querying Layout coordinates, you may now use the
excludeDirectManipulationOffset
argument to exclude the offset set by parent Layouts that placed their children usingPlaceable.PlacementScope.withDirectManipulationPlacement
. Likewise, a Layout that changes the position of its children frequently may now place them usingwithDirectManipulationPlacement
(such as Scroll, implemented by default). This helpsapproachLayout
based animations to be more intuitive, having now the opportunity to differentiate what offset to animate, and what to apply directly when deciding to animate their approach. (I60ec7) - Introduce
requestScrollToItem
forLazyStaggeredGrid
. For each measure-pass, the client may now opt-out of maintaining index based on the key by callingrequestScrollToItem
. This does not change existing behavior in any way unlessrequestScrollToItem
is called. (I63983) - Introduce
requestScrollToPage
in Pager. For each measure-pass, the client may now opt-out of maintaining index based on the key by callingrequestScrollToPage
. This does not change existing behavior in any way unlessrequestScrollToPage
is called. (Ic4213) - Introduced
requestScrollToItem
forLazyGrids
. For each measure-pass, the client may now opt-out of maintaining index based on the key by callingrequestScrollToItem
. This does not change existing behavior in any way unlessrequestScrollToItem
is called. (I0a7a0) ClickableText
is marked as deprecated. To add links to the text, create anAnnotatedString
with aLinkAnnotation
corresponding to your link and pass thisAnnotatedString
to theText
composable (I34d4b, b/323346994)UrlAnnotation
is deprecated, useLinkAnnotation.Url
instead. If you're using Material theming, then useTextDefaults
object to create the annotation with Material theming applied to it (I8d180, b/323346545)String.parseAsHtml
renamed toAnnotatedString.Companion.fromHtml
(I43dcd)- Added styling arguments (
linkStyle
,focusedLinkStyle
,hoveredLinkStyle
) and a link interaction listener to theparseAsHtml
method. When parsing the HTML-tagged string with<a>
tags, the method will construct aLinkAnnotation.Url
for each such tag and pass the styling objects and link interaction listener to each annotation. (I7c977) LinkAnnotation
now takes the state-based styling arguments and aLinkInteractionListener
. Add this annotation to theAnnotatedString
to get a hyperlink. By passingfocusedState
and/orhoveredState
you can define the visual configuration for links when they are focused and/or hovered. (I81ce4, b/139312671)- The feature flag for long screenshots has been removed. (I28648, b/329128246)
LazyColumn
will now render sticky headers correctly in long screenshots. (I8d239, b/329296635)- Stabilized majority of the remaining experimental APIs that were introduced with the new
BasicTextField
. (I714e2) - Added
textObfuscationCharacter
parameter toBasicSecureTextField
that controls which character to use while obfuscating the contents. (I0588b) NestedScroll
sources Drag and Fling are being replaced byUserInput
andSideEffect
to accommodate for the extended definition of these sources that now include animations (Side Effect) and Mouse Wheel and Keyboard (UserInput
). (I40579)- Introduce
LocalBringIntoViewSpec
, a platform dependent focus scrolling behavior that is applied at the Scrollable modifier layer. (I27aa5, b/317453911) - Removed
TextFieldCharSequence
.TextFieldBuffer.originalValues
is replaced withTextFieldBuffer.originalText
andTextFieldBuffer.originalSelection
. (I2c7d6) ImeOptions.hintLocales
is no longer nullable. If you want to pass an empty Locale list, please useLocaleList.Empty
. (Ic5bc4)- Renamed
getOffsetFractionForPage
togetOffsetDistanceInPages
. (Ia05e2)
Bug Fixes
- When
InputTransformations
are joined withnext
, theirKeyboardOptions
are now properly merged by individual options using the newKeyboardOptions.merge
method. (Ie5304, b/295951492) AnchoredDraggableState
'stargetValue
now does not consider positional thresholds anymore. It now has an implicit threshold of 50%, meaning that thetargetValue
changes at the midpoint between two anchors. (I82c2c)
External Contribution
- Renamed 2 scroll APIs (I56a75)
Version 1.7.0-alpha06
April 3, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha06
is released. Version 1.7.0-alpha06 contains these commits.
New Features
- Item appearance and disappearance animation support was added into
LazyColumn
andLazyRow
. Previously it was possible to addModifier.animateItemPlacement()
modifier in order to support placement (reordering) animations. We deprecated this modifier and introduced a new non-experimental modifier calledModifier.animateItem()
which allows you to support all three animation types: appearance (fade in), disappearance (fade out) and reordering. (I2d7f7, b/150812265) - Clients of
LazyColumn/LazyRow
may now opt-out of maintaining an index based on the key for the upcoming measure-pass by calling a non-suspendLazyListState.requestToScroll
. (I98036, b/209652366) - Added
parseAsHtml
method for styled strings: it allows to convert a string marked with HTML tags intoAnnotatedString
. Note that not all tags are supported, for example you won't be able to display bullet lists yet. (I84d3d) - Implemented experimental support for long screenshots in Compose scroll containers using the official Android API (
ScrollCaptureCallback
). This feature is experimental and may not currently handle all cases correctly. For that reason it is currently disabled by default. To opt-in, set theComposeFeatureFlag_LongScreenshotsEnabled
flag to true. This flag will be removed before 1.7 beta. (I2b055, b/329296471) - Introduce new
GraphicsLayer
API to provide more flexibility in placement and rendering ofGraphicsLayer
instances and support intrinsic rendering features without needing to coordinate with Composable implementations to specifyGraphicsLayer
modifier instances.
API Changes
- All
KeyboardOptions
parameters now have an unspecified value by default. AddedKeyboardOptions.merge
method. - Renamed
KeyboardOptions.autoCorrect
toautoCorrectEnabled
and made it nullable, where null indicates no value was specified. (Ia8ba0, b/295951492) - Renamed
outOfBoundsPageCount
tobeyondViewportPageCount
. (I129c6) fun ClipEntry.getMetadata()
is changed toval ClipEntry.clipMetadata
. (I50155)- Removed
TextFieldState.valueAsFlow()
. Prefer usingsnapshotFlow { state.text }
, orsnapshotFlow { TextFieldCharSequence(state.text, state.selection) }
(I7d629) - Reorganized
InputTransformation.transformInput
parameters. RemovedoriginalValue: TextFieldCharSequence
. InsteadTextFieldBuffer
now carries this value with the same name. Also removed thevalueWithChanges: TextFieldBuffer
parameter.TextFieldBuffer
now is the receiver scope on the function. (I919cc) BasicTextField(state)
variant andBasicSecureTextField
now useKeyboardActionHandler
instead ofKeyboardActions
to process actions taken by the software keyboard. (I58dda)- Stylus handwriting delegation APIs to support stylus handwriting on "fake" text input fields. (I9c09c, b/327271923)
- Renamed
KeyboardOptions.shouldShowKeyboardOnFocus
toshowKeyboardOnFocus
. (Ib4b7a, b/295951492) - Removed
hintMediaTypes
parameter fromModifier.contentReceiver
. Developers were already encouraged to check the receivedTransferableContent
's media type since it could be incompatible with the configuredhintMediaTypes
. (I82f99) - Reordered the parameters of
BasicSecureTextField
. RemovedkeyboardType
andimeAction
parameters in favor of fullKeyboardOptions
class while keeping the same defaults appropriate forBasicSecureTextField
. Also removed thescrollState
parameter. (Ibbfa9) TextFieldState.text
's type is changed fromTextFieldCharSequence
to justCharSequence
. Therefore, addedTextFieldState.selection: TextRange
andTextFieldState.composition: TextRange?
to read the current selection and composition values directly from the state object.- Removed
TextFieldState.forEachTextValue
. (Idb2a2) - Removed
ClipboardManager.getClipMetadata
andClipboardManager.hasClip
functions. Please useclipEntry.getMetadata()
to read the current clip entry's metadata. Also checkClipboardManager.getClip
's result if it's null or not to understand whether Clipboard has a current clip. (I50498) ClipboardManager.setClip
now accepts null to be able to clear the Clipboard. (I7d2e9)ReceiveContentListener
is converted to a function interface. AlsoModifier.receiveContent
overload that takes in a lambda is removed sinceReceiveContentListener
is a function interface now.Modifier.receiveContent
is renamed toModifier.contentReceiver
. (I1e6af)- Renamed
TransferableContent.consumeEach
toTransferableContent.consume
. (I1e462) rememberTextFieldState
has graduated to a Stable API. (I37999)
Bug Fixes
- Fixed a bug where
BasicTextField(state)
variant did not work with CJK(composition based) keyboards. (I54425) - Fixed a bug where
Modifier.dragAndDropTarget()
could reference stale data in certain scenarios withModifier.Node
re-use. (I05bb1) - Reverted a recent contract change where
AnchoredDraggableState#anchoredDrag
calls would snap at the end of ananchoredDrag
operation. (I95715)
Version 1.7.0-alpha05
March 20, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha05
is released. Version 1.7.0-alpha05 contains these commits.
API Changes
- Removed experimental
LocalTextLinkStyle
composition local for styling hyperlinks. (Iebfa7) - Removed experimental override of
BasicText
withonLinkClicked
argument. A replacement API for hyperlinks support will follow in the future. (I107d5) - Removed Codepoints related methods and properties under
TextFieldState
andTextFieldBuffer
. Also removed theinChars
suffixes from the remaining selection and composition related APIs. (Ief7ce) AnchoredDraggable
'scurrentValue
will now update when passing through an anchor point. UsesettledValue
to receive the previouscurrentValue
semantics, only updating when settling at an anchor. The progress is now exposed as a function (requiring a starting and end point) instead of a property. (Ibe6e8, b/318707189, b/298271489, b/294991954)BasicTextField(state)
,TextFieldState
,InputTransformation
,OutputTransformation
,TextFieldLineLimits
,TextFieldDecorator
are graduated to stable. (I9582b)- Introduced
InterceptPlatformTextInput
for helping write low-level IME-related tests and other low-level IME use cases.PlatformTextInputTestOverride
has been deprecated. (I862ed, b/322680547) - Split
restrictedConstraints()
to two methods:fitPrioritizingWidth()
andfitPrioritizingHeight()
(I6d7fd)
External Contribution
- Added 2 new API
isLastScrollForward
/isLastScrollBackward
to check scroll direction for latest scroll action, return false if no scroll action yet. (I63a0e)
Version 1.7.0-alpha04
March 6, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha04
is released. Version 1.7.0-alpha04 contains these commits.
API Changes
- Support stylus handwriting feature on devices after Android U. (I002e4)
- Added
hintLocales
toKeyboardOptions
to provideTextFields
with the ability to hint IMEs with specific locales to preset a preferred language. (Id18c2) - Removed the Experimental
BasicTextField2
andBasicSecureTextField
overloads that tookvalue: String
andonValueChange: () -> String
parameters. (I568b4) - Add an optional
applySemantics
function toInputTransformation
to influence the semantics of theBasicTextField2
that it's applied to. (I74a2f, b/170648072) - In this CL we are adding the
GetScrollViewportLength
semantic action so we can pipe up information about the components being scrolled in compose to the a11y system. This CL also applies the usage of said property in Foundation Scrollable Lists. (Ic5fa2) BasicTextField2
is renamed toBasicTextField
. (Ie5713)FocusRequester.createRefs
is now stable (I4d92c, b/261436820)- Introduced
DelegatableNode.scrollIntoView()
to allow modifier nodes to makescrollIntoView
requests directly. (I2b3b7, b/299939840) - Introduced
DelegatableNode.requireView()
to allow modifier nodes to get the current AndroidView
without reading a composition local. (I40768) - Introducing contextual layout information within Contextual Flow Row Scope and Contextual Flow Column Scope, featuring line index, position, and constraints on maximum width and height to stay in specified position. Items exceeding maximum width/height may flow to the next line or be omitted based on overflow settings. (Id13f8, b/292114798)
Bug Fixes
- Fixed a bug where in certain conditions toggling
enabled
orreadOnly
attributes ofTextField
would cause a crash. (Iae17b)
Version 1.7.0-alpha03
February 21, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha03
is released. Version 1.7.0-alpha03 contains these commits.
API Changes
- Introduced
DelegatableNode.requireLayoutCoordinates()
as a way to get aModifier.Node
's currentLayoutCoordinates
without needing to overrideonPlaced
and store the coordinates in a property yourself. (Ia8657) - Introduced
DelegatableNode.currentLayoutCoordinates
as a way to get aModifier.Node
's currentLayoutCoordinates
without needing to overrideonPlaced
and store the coordinates in a property yourself. (Iaebaa) - Performance optimizations in
DraggableAnchors
used byAnchoredDraggable
. (I89cff) BasicTextField2
and related APIs underandroidx.compose.foundation.text2
package are moved toandroidx.compose.foundation.text
. (I9f635)BasicTextField2
no longer accepts aCodepointTransformation
parameter. UseBasicSecureTextField
orOutputTransformation
. (Id34ff)- Added method to compare only the annotations of two
AnnotatedStrings
. (I32659) - Introducing
ContextualFlowRow
and EnhancedFlowRow
/Column
withMaxLines
andOverflow
. We are excited to announce enhancements to the experimentalFlowRow
andFlowColumn
, now featuringmaxLines
and overflow support, alongside the debut ofContextualFlowRow
andContextualFlowColumn
. This update is designed to provide performance optimal components, whereContextualFlow*
is perfect for a large number of items making use of a smallmaxLines
config and dynamic +N see more buttons, andFlowRow
andFlowColumn
is perfect for a small number of items, less than 100 items. Important: To maintain existing behavior inFlowRow
orFlowColumn
where all items are composed regardless of if they fit the cross axis max, setoverflow
toFlowRowOverflow.Visible
orFlowColumnOverflow.Visible
during initialization. ExploreContextualFlowRowSample
andFlowRowSample
for examples of these new features in action. (Ib9135, b/293577082)
Bug Fixes
- Cursor animation no longer requests frames between on and off states. (Ia2253)
KeyboardOptions
' deprecated copy constructors will now correctly copy all properties. (If12de)
Version 1.7.0-alpha02
February 7, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha02
is released. Version 1.7.0-alpha02 contains these commits.
API Changes
HorizontalPager
,VerticalPager
andPagerState
are promoted to stable. (I67660, b/316966909)- Added
LocalTextLinkStyle
composition local that allows to change the style of the links in Text across the app. If you're using your own theme in the app, you should be setting this composition local according to your theming. When using Material theme the color of the link by default will be set to Material's primary color. (I7eb10) - Introduced
receiveContent
modifier that provides developers with a way to receive rich content in Jetpack Compose. receiveContent
integrates withBasicTextField2
to accept rich content provided by the software keyboard, or via Clipboard paste action. (I81b72)- In this change we're replacing
SnapFlingBehavior
withTargetedFlingBehavior
in pager to unlock other use cases and provide greater flexibility. (I762ea) - In this change we're making Snapping APIs Stable. We're also cleaning up some of the testing code and adding more samples to Snapping. (Id8da9)
- Introduce
TargetedFlingBehavior
, aFlingBehavior
that allows propagating information about the state of the ongoing animation and it's target scroll offset. (I6a207)
Bug Fixes
BasicTextField2
now keeps the cursor in view while typing when it has been scrolled out of view or would move out of view due to input. (Ieb856, b/237190748)
External Contribution
- Adds an experimental API for configuring prefetch behavior of LazyLists. (I022a4)
Version 1.7.0-alpha01
January 24, 2024
androidx.compose.foundation:foundation-*:1.7.0-alpha01
is released. Version 1.7.0-alpha01 contains these commits.
New Features
- Added a new
Indication API
,IndicationNodeFactory
. This leads to more performantIndication
implementations compared to the previous (now deprecated)rememberUpdatedInstance
API. For migration information, see developer.android.com. clickable / combinedClickable / selectable / toggleable
now accepts a nullableMutableInteractionSource
parameter. If null, and the providedIndication
is anIndicationNodeFactory
, theIndication
can be lazily created only when needed, which improves performance. If you are not hoisting and using theMutableInteractionSource
, it is recommended to pass null.
API Changes
- Introduce
DecayAnimation
inAnchoredDraggable
, this change adds adecayAnimationSpec
parameter toAnchoredDraggable
allowing to use decay animation when settling to one of the anchors. The change also includes renaming the existinganimationSpec
tosnapAnimationSpec
to help understanding the use case of each spec. BasicTextField2
is available for experimental use. It should be roughly at feature parity withBasicTextField
, and behavior should be production-ready. However, the API remains experimental for now. Before stabilizing, it will be renamed toBasicTextField
and moved into the same package.- Introduced the first draft of the
OutputTransformation
API forBasicTextField2
. This API replaces most of the use cases ofVisualTransformation
in the oldBasicTextField
. However it is not complete yet, and some things won't work correctly, but we'd appreciate any feedback on the API usability for your use cases. (aosp/2708848) - Introduced
LinkAnnotation
that allows to add links and clickables into text. Links feature is not complete yet and more API changes are coming. - Introduced
receiveContent
modifier that provides developers with a way to receive rich content in Jetpack Compose. receiveContent
integrates withBasicTextField2
to accept rich content provided by the software keyboard, or via paste from Clipboard.KeyboardOptions.shouldShowKeyboardOnFocus
allows you to disable the default behavior ofBasicTextField
of requesting a software keyboard on focus.TextInputService
andLocalTextInputService
are now deprecated. UsePlatformTextInputModifierNode
to integrate directly with platform IME APIs instead. (aosp/2862698)Indication#rememberUpdatedInstance
has been deprecated. It has a high unavoidable performance penalty, and prevents other optimizations. Instead, you should use the newIndicationNodeFactory
API.
Bug Fixes
BasicTextField
will now pre-validate a small selection of offset mappings whenVisualTransformation
is passed. This helps catch common coding errors that lead to unrecoverable exceptions in later measure or draw passes. By throwing during composition, it is more likely developers will see these errors during development helping avoid production crashes. (I0fd42)VisualTransformation
will not throw if you return an invalid index for an invalid index (b/316401857 )
Version 1.6
Version 1.6.8
June 12, 2024
androidx.compose.foundation:foundation-*:1.6.8
is released. Version 1.6.8 contains these commits.
Version 1.6.7
May 1, 2024
androidx.compose.foundation:foundation-*:1.6.7
is released. Version 1.6.7 contains these commits.
Version 1.6.6
April 17, 2024
androidx.compose.foundation:foundation-*:1.6.6
is released. Version 1.6.6 contains these commits.
Bug Fixes
- Fixed a bug where in certain conditions toggling
enabled
orreadOnly
attributes ofTextField
would cause a crash. (Iae17b)
Version 1.6.5
April 3, 2024
androidx.compose.foundation:foundation-*:1.6.5
is released. Version 1.6.5 contains these commits.
Bug Fixes
- Adds debugging logs to hard-to-reproduce bugs in Row/Column: (b/300280216 and b/297974033)
Version 1.6.4
March 20, 2024
androidx.compose.foundation:foundation-*:1.6.4
is released. Version 1.6.4 contains these commits.
Bug Fixes
- A long-press-then-drag selection gesture which moves out of the text’s layout bounds in the first frame of the drag no longer crashes. (Icdf90, b/325307463)
Version 1.6.3
March 6, 2024
androidx.compose.foundation:foundation-*:1.6.3
is released. Version 1.6.3 contains these commits.
Version 1.6.2
February 21, 2024
androidx.compose.foundation:foundation-*:1.6.2
is released. Version 1.6.2 contains these commits.
Bug Fixes
- Fix
AnimateContentSize
not resetting properly. (I07051) - Fix issue where
intrinsicHeight
of text would be over-cached in some circumstances. (3cd398, b/217910352)
Version 1.6.1
February 7, 2024
androidx.compose.foundation:foundation-*:1.6.1
is released. Version 1.6.1 contains these commits.
Bug Fixes
- Fix staggered grid measure when scrolled over limit. (bffc39)
- Add check for layout with large dimensions. (e74af5)
- Fix placement of 0-sized items at the start of the staggered grid. (785f94)
- Call onRelease callback in the same order as onForgotten. (31ce3b)
Version 1.6.0
January 24, 2024
androidx.compose.foundation:foundation-*:1.6.0
is released. Version 1.6.0 contains these commits.
Important changes since 1.5.0
- New Modifier
Modifier.anchoredDraggable
that unlocks the ability to drag and animate between predefined set of anchors. This modifier is intended to be a replacement forModifier.swipeable
. Learn how to use it and migrate fromModifier.swipeable
in the migration guide. - Drag and drop functionality between apps and components has been added. Refer to
DragAndDropTarget
,Modifier.dragAndDropSource
and other APIs to get started Modifier.draggable2D
is the new modifier that allows for easy 2d dragging support. See Sample.AndroidExternalSurface
andAndroidEmbeddedExternalSurface
have been added to make it easier to add surface-driven components in compose- Various API changes and improvements in
Pager
andsnapFlingBehaviour
- Various focus, text and insets APIs have been promoted to stable APIs
Version 1.6.0-rc01
January 10, 2024
androidx.compose.foundation:foundation-*:1.6.0-rc01
is released. Version 1.6.0-rc01 contains these commits.
API Changes
- The
DragAndDropTarget()
extension constructor has been removed. Create a new instance usingobject: DragAndDropTarget {}
. (I32318)
Version 1.6.0-beta03
December 13, 2023
androidx.compose.foundation:foundation-*:1.6.0-beta03
is released. Version 1.6.0-beta03 contains these commits.
Bug Fixes
- Fix crash that impacted very large text measured with infinite constraints. (I1a7df, b/312294386)
PlatformImeOptions
is now a concrete class instead of an interface. (If40a4)
Version 1.6.0-beta02
November 29, 2023
androidx.compose.foundation:foundation-*:1.6.0-beta02
is released. Version 1.6.0-beta02 contains these commits.
Bug Fixes
- Fix for
canScroll
not being updated after relayout-only scroll. (I60a86) - Fix for
Modifier.animateItemPlacement()
andLookaheadScope
after small scrolls. (I3a2b7)
Version 1.6.0-beta01
November 15, 2023
androidx.compose.foundation:foundation-*:1.6.0-beta01
is released. Version 1.6.0-beta01 contains these commits.
API Changes
- The
DragAndDropTarget
modifier now takes in the receivingDragAndDropTarget
explicitly and has a lambda to opt into a drag and drop session. There are now two factory functions for aDragAndDropModifierNode
. One for receiving transfers and one for transferring data (I69481) - Updated
maximumFlingVelocity
to be represented as Float. Updated documentation to be more clear about themaximumFlingVelocity
unity. (I8adc7) onDragAndDropStart
in theDragAndDropModifierNode
factory has been renamed toacceptDragAndDropTransfer
.acceptsDragAndDropTransfer
has been added to thedragAndDropTarget
Modifier
to accept from a drag and drop session. This lambda returns a viableDragAndDropTarget
if interested in a drag and drop session. Other lambdas for processing drag events have been replaced by this.a
DragAndDropTarget
factory function has been added to receive from drag and drop sessions (Iebf3a)Exposing
startDragImmediately
inAnchoredDraggable
gives control for detecting dragging gestures when using it. It is useful to set it when the widget is animating to a target anchor. See Sample. (Ie6d13, b/285139987)Foundation Tooltip APIs are now
@ExperimentalFoundationApi
(I30b0b)Removed
DragAndDropInfo
as a typeDragAndDropModifierNode.drag
now takes parameters for thetransferData
, decoration size and drag decorationDrawScope
lambdaDragAndDropTarget
has methods for particular drag and drop events instead of being a single abstract methodonDragAndDropEvent
in the factory function for aDragAndDropModifierNode
has been renamed toonDragAndDropStart
to better communicate that theDragAndDropTarget
provided is valid for a given drag and drop session onlyThe
DragAndDropEventType
has been removed (I645b1)Renamed
PlatformTextInputModifierNode.runTextInputSession
toestablishTextInputSession
. (I03cd0)Replace
OriginalText
byTextSubstitution
. (Ifa5a8)Renamed
PlatformTextInputModifierNode.textInputSession
torunTextInputSession
. (Ie9c6b)The children of
SubcomposeLayout
(and layouts likeLazyColumn
based on it) which are retained to be reused in future are considered deactivated. NewassertIsDeactivated()
test API was introduced to test such nodes. The rest of the test apis will filter out deactivated nodes by default. (I2ef84, b/187188981)clippingEnabled
parameter ofModifier.magnifier
is renamed toclip
.magnifierCenter
parameter ofModifier.magnifier
is made nullable preserving the same default behavior. (I6aa66)Material
SwipeToReveal
APIs (for Cards and Chips) now rely on a slot based API (as recommended by Compose) instead of data class based instances to create those slots. This is a breaking change, please see the demo and sample code for examples on how to use the new API. (Ia8943)
Bug Fixes
- Implement equals and hashcode for
PageSize.Fixed
. (Ie3ede, b/300134276) - Fixed a bug that would cause
BasicText
layout to not shrink whenminWidth
changed andminWidth
less than initial measure constraintsmaxWidth
(Idb19c) - Add renderer support for Sweep Gradient in
ArcLine
. (I4d5bb) - Fix binary compatibility issue with Window Inset change (Iee695)
- Remove material core layer for Material3 Chip/Button as the microbenchmarks show better performance without it. (I55555)
Version 1.6.0-alpha08
October 18, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha08
is released. Version 1.6.0-alpha08 contains these commits.
New Features
Modifier.draggable2D
is the new modifier that allows for easy 2d dragging support. See Sample (Id95f5, b/214412658)
API Changes
Modifier.dragAndDrawSource
has had theonDrawDragShadow
lambda renamed todrawDragDecoration
andDragAndDropInfo
has had the size parameter renamed todragDecorationSize
. (Id0e30, b/303904810)BasicTextField2
'sdecorationBox
parameter is renamed todecorator
. Its type is also changed to an equivalent fun interfaceTextFieldDecorator
. (I23c1c)
Bug Fixes
- Improved documentation on
BasicTextField
regardingonValueChange
requirements. (I90fc9, b/160257648)
Version 1.6.0-alpha07
October 4, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha07
is released. Version 1.6.0-alpha07 contains these commits.
API Changes
- Introduced
PlatformTextInputMethodTestOverride
for writing tests for custom text editors. (Id159b) - Renamed
GraphicsSurface
toAndroidExternalSurface
(I11680) - Added
DisableNonLinearFontScalingInCompose
temporary flag to disable non-linear font scaling. SetDisableNonLinearFontScalingInCompose = true
in your tests if you need time to clean them up. This flag will be removed in Compose 1.6.0-beta01. (Ic9486) - Added
ColorList
andColorSet
collections that avoid allocations. (I744bd) - This change removes
shortSnapVelocityThreshold
which has been turned into an implementation detail of the implementations ofSnapLayoutInfoProvider
. (I65f6d) - Adds
dragAndDropSource
Modifier for starting drag and drop sessions, anddragAndDropTarget
Modifier for receiving from drag and drop sessions (Ib7828, b/286038936) - Update
SnapPositionInLayout
documentation and position method. Introduce content paddings to the position method inSnapPositionInLayout
. (Id7938, b/300116110) - Added
UndoState
toTextFieldState
that provides the ability to undo/redo the changes made by the user. (Icc024)
Bug Fixes
- Fixed
basicMarquee
not animating after velocity change. (Id2e77, b/297974036)
Version 1.6.0-alpha06
September 20, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha06
is released. Version 1.6.0-alpha06 contains these commits.
New Features
- New Composable wrappers for
SurfaceView
andTextureView: GraphicsSurface()
andEmbeddedGraphicsSurface()
. It is an experimental API and is subject to changes and modifications. (I9ddb2) Modifier.magnifier()
is now a stable API. This includes the removal ofMagnifierStyle
in favor of inline parameters in the modifier itself. (I83bec, b/298381260, b/262367109, b/261438887)
API Changes
- Introduced
updateCurrentPage
andupdateTargetPage
inScrollScope
, these are the last pieces necessary to allowing customization of animated scroll throughPagerState.scroll
. (I9cad5, b/267744105, b/243786897) - Remove density from
SnapFlingBehavior
. All implementations ofSnapLayoutInfoProvider
already have a way of accessing the density, the receiver scope could be removed which will lead to a less complex implementation of bothSnapFlingBehavior
andSnapLayoutInfoProviders
. (I153c3) - More modifiers marked as stable. (I56af1, b/298046462)
- Removed
SnapStepSize
fromSnapLayoutInfoProvider
. The calculation should be done using the Layout information and provided through the approach or snapping offsets. (If320c)
Behavior Changes
- Compose now uses non-linear font scaling for better readability and accessibility. When font scale > 100% in system settings, small text will increase in size normally, but already-large text will only increase a little bit. Also, line heights defined in SP will automatically adjust to stay proportional to the 100% scale intended height. See the Font Scaling Best Practices for more info. (I11518)
Bug Fixes
- Remove the use of
rememberSaveable
for tooltips. (Icc131, b/299500338)
Version 1.6.0-alpha05
September 6, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha05
is released. Version 1.6.0-alpha05 contains these commits.
API Changes
- Add overloads for
BasicSecureTextField
that accept an immutable value and a callback to change that value, just like the currentBasicTextField
API. (Ia4882) - Add
Modifier.preferKeepClear()
to mark as composable as preferring to keep clear of floating windows on API 33 and above. (Ib51d5, b/297260115) - Fling velocities in View components like
ScrollView
andRecyclerView
are capped atViewConfiguration.ScaledMaximumFlingVelocity
. Compose now contains its own version ofmaximumFlingVelocity
which now applies toDraggable
. (Ibf974) - Removed deprecated
Pager
andPagerState
overloads. (Iea07e) - Added
BasicTooltipBox
tocompose.foundation
and updatedPlainTooltipBox
andRichTooltipBox
to useTooltipBox
with newPlainTooltip
andRichTooltip
composables. (I79e1d)
Version 1.6.0-alpha04
August 23, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha04
is released. Version 1.6.0-alpha04 contains these commits.
API Changes
- Add
ReusableComposition
interface for managing lifecycle and reuse of subcompositions. (I812d1, b/252846775) Modifier.focusGroup
has been promoted to stable APIs. (I7ffa3)- Add overloads for
BasicTextField2
that accept an immutable value and a callback to change that value, just like the currentBasicTextField
API. (I3f2b8) GridItemSpan::currentLineSpan
is now a stable API. (Icc29c)- Canvas that accepts
contentDescription
is now a stable API. (Ib3d29) - Introduced
viewportSize
inScrollState
, a way of knowing theviewPort
size of the component that usesScrollState
after measuring happens. (I8b85a, b/283102682) - Fixed an issue where the prefetching in Pager did not match the behavior in Views. (I93352, b/289088847)
Modifier.consumeWindowInsets(PaddingValues)
is now stable.Deprecated Modifier.consumedWindowInsets
API is now removed. UseModifier.consumeWindowInsets
instead. (Id72bb)
Version 1.6.0-alpha03
August 9, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha03
is released. Version 1.6.0-alpha03 contains these commits.
API Changes
- Overload of
LazyLayout
added, it accepts a lambda ofLazyLayoutItemProvider
, not a plain object as it was before. The previous overload is deprecated. (I42a5a) - Added support for configuring
privateImeOptions
(Idb772)
Bug Fixes
- Fixed text fields showing keyboard and being editable when
readOnly
is true. Also fixed the keyboard not showing whenreadOnly
is changed from true to false while focused. (I34a19, b/246909589)
Version 1.6.0-alpha02
July 26, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha02
is released. Version 1.6.0-alpha02 contains these commits.
API Changes
- Introduced
PagerLayoutInfo
with information collected after a measure pass inPager
. Also introducedPageInfo
, the information about a single measured Page inPager
. (Iad003, b/283098900) - Additional annotations to specify allowed inputs to composables (I51109)
- Added
SemanticsNodeInteraction.requestFocus
as a more convenient and discoverable way to request focus in tests. (Ie8722) - Completely redesigned
PlatformTextInput*
API. (I6c93a, b/274661182, b/267235947, b/277380808) SoftwareKeyboardController
andLocalSoftwareKeyboardController
are no longer experimental.LocalSoftwareKeyboardController
is also now a properCompositionLocal
. (I4c364)Modifier.transformable
now provides pan delta incanPan
parameter to help determine the direction of the pan to allow or disallow it. (I692aa, b/266829800)- Updates the modifier
consumeWindowInsets
to extend the superclassAbstractComposeView
(Iacd74, b/269479941)
Version 1.6.0-alpha01
June 21, 2023
androidx.compose.foundation:foundation-*:1.6.0-alpha01
is released. Version 1.6.0-alpha01 contains these commits.
New Features
- Introduced a new
AnchoredDraggable
API in Foundation. It can be used to build components that can be dragged between discrete states, like modal bottom sheets. This API replaces Material'sSwipeable
API. (I4a2ed)
API Changes
- Support
InputConnection#requestCursorUpdates
(I0c69b) - Introduced
scrollAnimationSpec
to allow custom animation specs. UpdatedBringIntoViewCalculator
toBringIntoViewScroller
. (Idb741) - Add
ResourceResolutionException
type to wrap throwables thrown when attempting to load bitmap assets with a description of the asset path that failed to load. (I19f44, b/230166331, b/278424788) - Added semantics properties and actions to support text translation. (I4a6bc)
- Introduced a
BringIntoViewCalculator
API that can be used to customize how components likeScrollable
respond tobringIntoView
requests. Changed the overload of scrollable to optionally accept an instance ofBringIntoViewCalculator
. (Iaf5af)
Bug Fixes
- Added a lint check to warn if you are creating a
MutableInteractionSource
in composition without remembering it, similar to the lint checks for creating mutable state /Animatable
. (I5daae) - Added support for selection by mouse. Touch based selection will expand by word, and shrink by character. (Ic0c6c, b/180639271)
- Added
FocusTargetModifierNode
interface that can be used to create a customFocusTarget
. (I9790e)
Version 1.5
Version 1.5.4
October 18, 2023
androidx.compose.foundation:foundation-*:1.5.4
is released. Version 1.5.4 contains these commits.
Version 1.5.3
October 4, 2023
androidx.compose.foundation:foundation-*:1.5.3
is released. This version has no changes.
Version 1.5.2
September 27, 2023
androidx.compose.foundation:foundation-*:1.5.2
is released. Version 1.5.2 contains these commits.
Bug Fixes
- Fixed a bug in text that led to crashes in certain circumstances when semantics were invalidated.
Version 1.5.1
September 6, 2023
androidx.compose.foundation:foundation-*:1.5.1
is released. Version 1.5.1 contains these commits.
Bug Fixes
- Fixed text fields showing keyboard and being editable when
readOnly
is true. Also fixed the keyboard not showing whenreadOnly
is changed from true to false while focused. (I34a19, b/246909589)
Version 1.5.0
August 9, 2023
androidx.compose.foundation:foundation-*:1.5.0
is released. Version 1.5.0 contains these commits.
Important changes since 1.4.0
- Many foundational modifiers, including
Modifier.clickable
,Modifier.draggable
,Modifier.scrollable
, layout modifier and more have been migrated toModifier.Node
API, reducing the overhead on the initial composition. - Improvements in Pagers stability. Many bugs have been addressed.
pageCount
parameters now lives inPagerState
instead of the Pager itself
Version 1.5.0-rc01
July 26, 2023
androidx.compose.foundation:foundation-*:1.5.0-rc01
is released. Version 1.5.0-rc01 contains these commits.
Bug Fixes
An optional inspection to recommend migrating
mutableStateOf()
calls to their corresponding specialized types for primitives is available. Its lint ID isAutoboxingStateCreation
. Previously, this inspection was enabled by default for all projects. To see this warning in Android Studio's editor and your project's lint outputs, change its severity from informational to warning (or higher) by declaringwarning "AutoboxingStateCreation"
inside your module'sbuild.gradle
orbuild.gradle.kts
configuration as shown (I34f7e):android { lint { warning "AutoboxingStateCreation" } ... }
Version 1.5.0-beta03
June 28, 2023
androidx.compose.foundation:foundation-*:1.5.0-beta03
is released. Version 1.5.0-beta03 contains these commits.
Version 1.5.0-beta02
June 7, 2023
androidx.compose.foundation:foundation-*:1.5.0-beta02
is released. Version 1.5.0-beta02 contains these commits.
Version 1.5.0-beta01
May 24, 2023
androidx.compose.foundation:foundation-*:1.5.0-beta01
is released. Version 1.5.0-beta01 contains these commits.
API Changes
- Implement
PlatformDataProvider
to provide heart rate and daily steps.SensorGateway
interface is removed from the public API. (I55b84)
Bug Fixes
- Reduce allocations during lazy list/grids/etc. measurements (Iaf9e2)
- Reduced allocations when applying snapshots (I65c09)
- Removed allocations from spring animations (Ie9431)
- Removed allocation from
TextLayout
(I0fd11) - Removed multiple allocations in pointer velocity tracking (I26bae)
Version 1.5.0-alpha04
May 10, 2023
androidx.compose.foundation:foundation:1.5.0-alpha04
and androidx.compose.foundation:foundation-layout:1.5.0-alpha04
are released. Version 1.5.0-alpha04 contains these commits.
API Changes
- Added optimized
TextStyle.merge(...)
with full parameter list. (Iad234, b/246961787) - Introduce a
SnapLayoutInfoProvider
that can be used withLazyGridState
. (I92134, b/269237141, b/260914964) - Experimental
Modifier.animateItemPlacement()
was added for the lazy staggered grids item scope. You can apply it on the items in order to achieve the automation position change/reordering animations. (I4b62d, b/257034719) - Promote
GridCells.FixedSize
to stable.FixedSize
defines aLazyGrid
where each cell takes exact size on cross axis, with the remaining space distributed by cross axis arrangement. (I8542f) - Introduced receiver scope
PagerScope
for Pager and an utility function for calculation a given page offset. (If2577) - Introduce the
snapPositionalThreshold
when creating a snap fling behavior. Use this parameter to specify a positional threshold to short snapping in Pager. (If8f7f) - Replaced
SnapLayoutInfoProvider.calculateSnappingOffsetBounds
withcalculateSnappingOffset
. In this new method we simply request the next offset to snap to. The calculation of the bounds should be performed at the implementation level as this may differ depending on how one needs snapping to happen. (I923a4) LazyStaggeredGrid
APIs have been promoted to stable. (I633a5)- Remove
pageCount
fromHorizontal/VerticalPager
. This should be provided at the state creation. UpdatedPagerState
andrememberPagerState
to accept thepageCount
. (Ieb52d, b/266965072) - Remove
pageCount
fromHorizontal/VerticalPager
. This should be provided at the state creation. UpdatedPagerState
andrememberPagerState
to accept thepageCount
. (Ifa3cb, b/266965072) - Introduce
shortSnapVelocityThreshold
in Pager'sSnapFlingBehavior
. (I7379e, b/275579012) - Adds a
FlowRowScope
andFlowColumnScope
. (I54fe2)
Bug Fixes
- Calls to get semantics on Text when constraints have
minWidth
andminHeight
no longer crash. (Ibd072) - Fixed regression where keyboard wasn't showing for text fields inside dialogs not created by the
Dialog
composable. (I82551, b/262140644)
Version 1.5.0-alpha03
April 19, 2023
androidx.compose.foundation:foundation:1.5.0-alpha03
and androidx.compose.foundation:foundation-layout:1.5.0-alpha03
are released. Version 1.5.0-alpha03 contains these commits.
This release enables the new text rendering stack for Compose. The new stack is performance optimized, and you should see no visible changes.
If you do see changes in rendered text, you can debug by setting NewTextRendering1_5 = false
to confirm the behavior difference. Setting this will force recomposition. Please file any behavior differences as bugs.
The debug flag will be removed before the 1.5 beta01 release.(Iada23, b/246960758)
API Changes
- Make
FlowColumn/FlowRow
inline. (Idab37)
Version 1.5.0-alpha02
April 5, 2023
androidx.compose.foundation:foundation:1.5.0-alpha02
and androidx.compose.foundation:foundation-layout:1.5.0-alpha02
are released. Version 1.5.0-alpha02 contains these commits.
API Changes
- Added support for fixed size cells in
LazyGrid
and arranging them with cross axis arrangement. (I83ed9, b/235121277, b/267942510) - Added support for fixed size lanes in
LazyStaggeredGrid
and arranging them with cross axis arrangement. (I7d519) UrlAnnotation
s inAnnotatedString
s can now be opened via accessibility services likeTalkBack
. (If4d82, b/253292081)- Added the
InsertTextAtCursor
semantics action for text fields. (I11ed5) - Text-related test actions (e.g.
performTextInput
) will now request focus directly, using the semantics action, instead of clicking on the field. (I6ed05) - Adds support for cross axis spacing/arrangement using the
verticalArrangement
inFlowRow
andhorizontalArrangement
inFlowColumn
. We also remove the top-levelverticalAlignment
andhorizontalAlignment
inFlowRow/FlowColumn
. Developers can useModifier.align
instead. This reduces confusion between the naming conventions ofverticalAlignment
andverticalArrangement
. (I87b60, b/268365538)
Version 1.5.0-alpha01
March 22, 2023
androidx.compose.foundation:foundation:1.5.0-alpha01
and androidx.compose.foundation:foundation-layout:1.5.0-alpha01
are released. Version 1.5.0-alpha01 contains these commits.
API Changes
- Text and
BasicText
is refactored to use the new modifier system. This leads to substantial performance improvements in many cases. No changes should be visible. (If1d17, b/246961435) - Added the
PerformImeAction
semantics action to invoke the IME action on text editor nodes. (Ic606f, b/269633506)
Bug Fixes
- Updated internals of
Modifier.hoverable
. Thehoverable
modifier will only be shown in the inspector if it is enabled. (I82103)
Version 1.4
Version 1.4.3
May 3, 2023
androidx.compose.foundation:foundation:1.4.3
and androidx.compose.foundation:foundation-layout:1.4.3
are released with no changes (only a version bump).
Version 1.4.2
April 19, 2023
androidx.compose.foundation:foundation:1.4.2
and androidx.compose.foundation:foundation-layout:1.4.2
are released. Version 1.4.2 contains these commits.
Version 1.4.1
April 5, 2023
androidx.compose.foundation:foundation:1.4.1
and androidx.compose.foundation:foundation-layout:1.4.1
are released. Version 1.4.1 contains these commits.
Version 1.4.0
March 22, 2023
androidx.compose.foundation:foundation:1.4.0
and androidx.compose.foundation:foundation-layout:1.4.0
are released. Version 1.4.0 contains these commits.
Important changes since 1.3.0
- Added Emoji compat integration to
Text
andTextField
, as well as the lower level Paragraph. It is enabled by default when emojicompat is configured. EmojiCompat
can be configured on a specific Text usingPlatformParagraphStyle
.- Added full line span support to
LazyStaggeredGrid
(I28252) - Adding experimental
onHover
toClickableText
(I6938f) - Introduced new experimental overloads for the
runComposeUiTest
function andcreate*ComposeRule
functions that acceptCoroutineContext
parameters. The context will be used for the test composition and anyLaunchedEffect
andrememberCoroutineScope()
calls in the composition. (I10614, b/265177763) FlowRow
andFlowColumn
are now available as@ExperimentalFoundationApi
that allow for a more flexible row and column based layout of components that will break to a new line if there is not enough space on the main axis. (I3a7b2)Modifier.basicMarquee()
is available as experimental for displaying content with a scrolling marquee effect. (I2df44, b/139321650)
Version 1.4.0-rc01
March 8, 2023
androidx.compose.foundation:foundation:1.4.0-rc01
and androidx.compose.foundation:foundation-layout:1.4.0-rc01
are released. Version 1.4.0-rc01 contains these commits.
API Changes
- Introduced new low-level
PlatformTextInputAdapter
API for building custom text input implementations that talk directly to platform APIs. (I58df4) - Add support for reverse layout to
LazyStaggeredGrid
. (I3ef4a)
Bug Fixes
BasicTextField
'sSetText
semantics action will now update the text buffer using the same code path as IME updates and the testing functions (e.g.performTextReplacement
).- Text testing functions
performTextClearance
,performTextReplacement
, andperformTextSelection
now useSemanticsActions
. (I0807d, b/269633168, b/269624358)
Version 1.4.0-beta02
February 22, 2023
androidx.compose.foundation:foundation:1.4.0-beta02
and androidx.compose.foundation:foundation-layout:1.4.0-beta02
are released. Version 1.4.0-beta02 contains these commits.
API Changes
- Added a new
Modifier.Node.onReset()
callback allowing you to reset some local state to properly handle the case when theLayout
will be reused (for example as an item ofLazyColumn
). FixedFocusTargetModifierNode
to properly reset the focused state. (I65495, b/265201972) - Added
BlendMode
parameter toDrawScope.drawText
,Paragraph.paint
, andMultiParagraph.paint
methods to support different blending algorithms when drawing text on Canvas. (I57508) - Removed the
modifierElementOf()
API. Please extend fromModifierNodeElement
directly instead. (Ie6d21)
Bug Fixes
- Adjusting selection handles can no longer select a partial character. (Idedd1)
- Fix crash when ctrl+backspace on empty
TextField
(I0427f, b/244185537)
Version 1.4.0-beta01
February 8, 2023
androidx.compose.foundation:foundation:1.4.0-beta01
and androidx.compose.foundation:foundation-layout:1.4.0-beta01
are released. Version 1.4.0-beta01 contains these commits.
New Features
- Since 1.3, added Emoji compat integration to
Text
andTextField
, as well as the lower level Paragraph. It is enabled by default when emojicompat is configured. EmojiCompat
can be configured on a specific Text usingPlatformParagraphStyle
.
API Changes
- Added common implementation of
PinnableContainer
API used in allLazyLayouts
to retain items that exit composition, but still need to be active. (If45a4) PinnableContainer.PinnedHandle.unpin()
was renamed torelease()
(I4667a)
External Contribution
- Added
mainAxisItemSpacing
property toLazyListLayoutInfo
,LazyGridLayoutInfo
andLazyStaggeredGridItemInfo
(I52fad)
Version 1.4.0-alpha05
January 25, 2023
androidx.compose.foundation:foundation:1.4.0-alpha05
and androidx.compose.foundation:foundation-layout:1.4.0-alpha05
are released. Version 1.4.0-alpha05 contains these commits.
New Features
- Added full line span support to
LazyStaggeredGrid
(I28252) - Adding experimental
onHover
toClickableText
(I6938f) - Introduced new experimental overloads for the
runComposeUiTest
function andcreate*ComposeRule
functions that acceptCoroutineContext
parameters. The context will be used for the test composition and anyLaunchedEffect
andrememberCoroutineScope()
calls in the composition. (I10614, b/265177763)
API Changes
- Merges the pre/post APIs of
OverscrollEffect
into combined 'decorator'applyToScroll
andapplyToFling
functions. See the updated samples in the documentation for examples of how to implement an overscroll effect with the new API shape. (I8a9c4, b/255554340) - More type/nullability of inline/deprecated-hidden functions (I24f91)
LineBreak
andHyphens
APIs inTextStyle
are graduated to stable. (Ic1e1d)
Bug Fixes
- The cursor in text fields will now continue to blink even when animations are disabled. (I95e70, b/265177763)
Modifier.basicMarquee
now animates even when animations are disabled in the system settings. (I23389, b/262298306, b/265177763)
External Contribution
notifyFocusedRect
methods inTextInputSession
andTextInputService
are not deprecated again. (I23a04, b/262648050)
Version 1.4.0-alpha04
January 11, 2023
androidx.compose.foundation:foundation:1.4.0-alpha04
and androidx.compose.foundation:foundation-layout:1.4.0-alpha04
are released. Version 1.4.0-alpha04 contains these commits.
New Features
FlowRow
andFlowColumn
are now available as@ExperimentalFoundationApi
that allow for a more flexible row and column based layout of components that will break to a new line if there is not enough space on the main axis. (I3a7b2)Modifier.basicMarquee()
is available as experimental for displaying content with a scrolling marquee effect. (I2df44, b/139321650)
API Changes
FocusRequesterModifier
is deprecated in favor ofFocusRequesterNode
(I7f4d7, b/247708726, b/255352203, b/253043481, b/247716483, b/254529934, b/251840112, b/251859987, b/257141589)AndroidFont
constructor withvariationSettings
is now a stable API, and can be used to create new types of font descriptors. (I5adcc, b/261565807)- Introduced
PinnableContainer
api propagated by lazy lists via a composition local which allows to pin current item. This means such item will not be disposed when it is scrolled away from the view. For example,Modifier.focusable()
will pin the current focused item via this mechanism. (Ib8881, b/259274257, b/195049010) - Rewrote the way scrollables respond to
bringIntoViewRequesters
and focusables to better model the complexity of those operations and handle more edge cases. (I2e5fe, b/241591211, b/192043120, b/237190748, b/230756508, b/239451114) - More return type nullability of deprecated-hidden functions (Ibf7b0)
- Added experimental
TextMotion
toTextStyle
to define Text either to beStatic(default)
or Animated. UseTextMotion.Animated
if Text is going to be scaled, translated, or rotated via animation. (I24dd7) - Add
TextFieldFocusModifier
to fix focus navigation behaviour for android platform (I00303) - Replaced
maxSize: IntSize
argument indrawText
withsize: Size
to be inline with otherDrawScope
functions.size
is set toSize.Unspecified
by default which should not change the previous default behavior. (Icd27d)
Bug Fixes
- Adjustments in the snapping physics in
SnapFlingBehaviour
for a more natural feel.
Known Issue
- When updating from
androidx.compose.foundation:1.4.0-alpha03
toandroidx.compose.foundation:1.4.0-alpha04
, you might experience ajava.lang.NoSuchFieldError
error. Here is where the issue was orginially reported. A fix has been submitted, and will be available on the next Compose update. As a work around, update yourandroidx.compose.material
andandroidx.compose.material3
libraries to the latest version(1.1.0-alpha04) or downgrade yourandroidx.compose.foundation
to 1.4.0-alpha03.
Version 1.4.0-alpha03
December 7, 2022
androidx.compose.foundation:foundation:1.4.0-alpha03
and androidx.compose.foundation:foundation-layout:1.4.0-alpha03
are released. Version 1.4.0-alpha03 contains these commits.
API Changes
- In UI tests using a Compose rule, continuations resumed during
withFrameNanos
callbacks will not be dispatched until after all frame callbacks have finished running. This matches the behavior of compose when running normally. However, tests that rely on the old behavior may fail. This should only affect code that callswithFrameNanos
orwithFrameMillis
directly, and has logic outside of callback passed to those functions that may need to be moved inside the callbacks. See the animation test changes in this CL for examples. - Added optional
onPerformTraversals: (Long) -> Unit
parameter toTestMonotonicFrameClock
constructor and factory function to run code afterwithFrameNanos
callbacks but before resuming callers' coroutines. (Idb413, b/254115946, b/222093277, b/255802670) - Introduce Page accessibility actions:
PageUp
,PageDown
,PageLeft
,PageRight
. Note that these are only available from API 29. (Ida4ab) - Introduce
HorizontalPager
andVerticalPager
, a way of showing composables in a Pager manner. IntroducedPagerState
to control the Pagers as well as query information about the Pager's current state. IntroducedPageSize
, a way of controlling the size of a Pager's page, this can be used to create a carousel like Pagers. IntroducedPagerSnapDistance
, a way to control how snapping will work in Pager's fling behavior. (I01120) - Introduced an overload in
SnapFlingBehavior.performFling
to help to understand where the fling will settle. (I569f6) - Removed
OverscrollEffect#isEnabled
. Instead of needing to remember and set this flag, just don't dispatch events to the overscroll effect in cases where you do not want overscroll to show (for example ifScrollableState#canScrollForward/backward
both return false). (I1a4b0, b/255554340, b/255557085) - Added
ScrollableState#canScrollForward
andScrollableState#canScrollBackward
to query whether aScrollableState
has room to scroll in either direction (whether it is at the minimum / maximum of its range). This defaults to true for backwards compatibility with existing implementations ofScrollableState
. Consumers can use this to show indication to the user that there is still room to scroll, and this could also be used to avoid dispatching delta toScrollableStates
that have no room to scroll in a given direction, to reduce unnecessary work. (Idf1a0, b/255557085) - Added an Modifier API to query ancestors scroll info. (I2ba9d, b/203141462)
- Used in
Clickable
to correctly delay press interactions, when gestures could become scroll events. - Fixed
Clickables
not correctly delaying ripples, when used inside anScrollable ViewGroup
. - Updated Drawers and Sheets to correctly delay presses in case gestures can become scroll events.
- Update
snapStepSize
naming to be consistent with other methods inSnapLayoutInfoProvider
. (Ife67c) - Added
EmojiCompat
toCompose
(Ibf6f9, b/139326806) - Renamed
consumedWindowInsets()
toconsumeWindowInsets()
andwithConsumedWindowInsets()
toonConsumedWindowInsetsChanged()
and made the Modifiers public. (Ie44e1)
Bug Fixes
- The crash with
Modifier.animateItemPlacement()
and Lazy grids was fixed. It was happening in some conditions when the new items count is smaller then the previous one. (I0bcac, b/253195989)
Version 1.4.0-alpha02
November 9, 2022
androidx.compose.foundation:foundation:1.4.0-alpha02
and androidx.compose.foundation:foundation-layout:1.4.0-alpha02
are released. Version 1.4.0-alpha02 contains these commits.
API Changes
awaitFirstDown
andwaitForUpOrCancellation
now accept aPointerEventPass
for greater flexibility. (I7579a, b/212091796)- Revert
beyondBoundCount
API from Lazy* APIs (I12197) - Introduced parameter in Lazy APIs to compose and place out of viewport items (I69e89, b/172029355)
- Added
minLines
parameter to theBasicText
andBasicTextField
. It allows to set the minimum height of these composables in terms of number of lines (I24294, b/122476634)
Version 1.4.0-alpha01
October 24, 2022
androidx.compose.foundation:foundation:1.4.0-alpha01
and androidx.compose.foundation:foundation-layout:1.4.0-alpha01
are released. Version 1.4.0-alpha01 contains these commits.
API Changes
- A new method,
awaitEachGesture()
, for gesture detectors was added. It operates similar toforEachGesture()
, but the loop over gestures operates entirely within theAwaitPointerEventScope
so events can't be lost between iterations. forEachGesture()
has been deprecated in favor ofawaitEachGesture()
because it allows events to be lost between gestures. (Iffc3f, b/251260206)- Added
WindowInsets.imeAnimationSourc
e andWindowInsets.imeAnimationTarget
to determine the animation progress and know where the IME will be after animation completes. (I356f1, b/217770337)
Version 1.3
Version 1.3.1
November 9, 2022
androidx.compose.foundation:foundation:1.3.1
and androidx.compose.foundation:foundation-layout:1.3.1
are released. Version 1.3.1 contains these commits.
Bug Fixes
- Fix performance issue in
BeyondBoundsLayout
(aosp/2255266) ContentInViewModifier
will not read layout coordinates unless attached (aosp/2241316)
Version 1.3.0
October 24, 2022
androidx.compose.foundation:foundation:1.3.0
and androidx.compose.foundation:foundation-layout:1.3.0
are released. Version 1.3.0 contains these commits.
Important changes since 1.2.0
- Experimental versions of
LazyVerticalStaggeredGrid
andLazyHorizontalStaggeredGrid
were introduced. SnapFlingBehavior
,rememberSnapFlingBehavior
and other corresponding APIs were added as experimental.Modifier.clickable
,Modifier.toggleable
, andModifier.selectable
now show ripples if clicked with the keyboard or d-pad on a remote control.
Version 1.3.0-rc01
October 5, 2022
androidx.compose.foundation:foundation:1.3.0-rc01
and androidx.compose.foundation:foundation-layout:1.3.0-rc01
are released. Version 1.3.0-rc01 contains these commits.
API Changes
- Introduced
lowVelocityAnimationSpec
used by the approach step when there's not enough fling velocity to decay. (Iaeb27) - Added new experimental API Hyphens to support automatic hyphenation in Text (Iaa869)
Version 1.3.0-beta03
September 21, 2022
androidx.compose.foundation:foundation:1.3.0-beta03
and androidx.compose.foundation:foundation-layout:1.3.0-beta03
are released. Version 1.3.0-beta03 contains these commits.
API Changes
- Add options to customize line breaking in Text. (I86907)
BringIntoViewResponder
s are now able to get the most up-to-date bounds of a request while processing it. (If86a5, b/241591211)- Introduce support for spacings between items to experimental
Staggered Grid
(I10b82) - Introduce content padding to experimental
Staggered Grid
(I342ea) - Changed
size:IntSize
argument withconstraints: Constraints
inTextMeasurer.measure
method to support minimum width constraints. (I37530, b/242707525) - Added
Modifier.withConsumedWindowInsets()
to get consumedWindowInsets
for use outsidewindowInsetsPadding
. - Added
MutableWindowInsets
to allow easily changingWindowInsets
without recomposition. (I7fd28, b/237019262, b/243119659)
Version 1.3.0-beta02
September 7, 2022
androidx.compose.foundation:foundation:1.3.0-beta02
and androidx.compose.foundation:foundation-layout:1.3.0-beta02
are released. Version 1.3.0-beta02 contains these commits.
API Changes
- Initial version of experimental
StaggeredGrid
(Ia48be) - Renamed
FocusDirection.In
andFocusDirection.Out
toFocusDirection.Enter
andFocusDirection.Exit
(Ia4262, b/183746982) - Introduced a
rememberSnapFlingBehavior
overload that provides a quick way of enabling snapping inLazyLists
. (Ifb48a) - Replaced the
snapFlingBehavior
factory with a concreteSnapFlingBehavior
class. ScopedSnapLayoutInfoProvider
methods to Density to make Dp<->Px conversions easier for the API users. (I54a11) - Update
LazyLayoutMeasureScope.measure
to return list of placeables, highlighting desired immutability of the returned value. (I48b7c) - Introduced
SnapLayoutInfoProvider
which takes aLazyListState
to create an instance ofSnapLayoutInfoProvider
that can be used to enable a snapFlingBehavior
forLazyLists
. (I2dd10)
Bug Fixes
- Refactors
AwaitPointerEventScope#awaitLongPressOrCancellation
to match other await functions (I646e6)
Version 1.3.0-beta01
August 24, 2022
androidx.compose.foundation:foundation:1.3.0-beta01
and androidx.compose.foundation:foundation-layout:1.3.0-beta01
are released. Version 1.3.0-beta01 contains these commits.
API Changes
- Removed
pointerPosition
fromOverscrollEffect
- effects that care about pointer position can useModifier.pointerInput { }
in theeffectModifier
to get the current pointer position instead. (I9f606, b/241239306) - Exposed
AwaitPointerEventScope#awaitLongPressOrCancellation
as additional building block for more complex gesture detection (I04374, b/181577176) - Introduced
lazyListSnapLayoutInfoProvider
to enable snapping in Lazy Lists. (I3ecdf) - Introduced
SnapFlingBehavior
, a fling behavior that enables list snapping. Provide an instance ofSnapLayoutInfoProvider
with information about your snapping layout. (Ie754c)
Version 1.3.0-alpha03
August 10, 2022
androidx.compose.foundation:foundation:1.3.0-alpha03
and androidx.compose.foundation:foundation-layout:1.3.0-alpha03
are released. Version 1.3.0-alpha03 contains these commits.
API Changes
- Resource Fonts now support setting font variation settings (API 26+). (I900dd, b/143703328)
- Variable font support in
DeviceFontFamilyNameFont
(Ic1279, b/143703328) - Removed experimental annotation from
PlatformTextStyle
andLineHeightStyle
. (I64bef) - Text fields will now throw more detailed exceptions when the
OffsetMapping
provided by aVisualTransformation
returns invalid indices. (Ie73f9, b/229378536) - Introduce experimental APIs to share item provider logic between Lazy layouts. (Ic891c)
ScrollableDefaults.reverseDirection()
is not experimental anymore. (Iba646)- Deprecated
SemanticsModifier.id
and moved the semantics id toLayoutInfo.semanticsId
instead. (Iac808, b/203559524) checkScrollableContainerConstraints()
is not experimental anymore. (I2c290)Modifier.clipScrollableContainer()
is not experimental anymore. (Ia2b44)- Deprecate
TextInputService.show|hideSoftwareKeyboard
. Please useSoftwareKeyboardController
instead in app code andTextInputSession
in IME-management code. (I14e4c, b/183448615)
Version 1.3.0-alpha02
July 27, 2022
androidx.compose.foundation:foundation:1.3.0-alpha02
and androidx.compose.foundation:foundation-layout:1.3.0-alpha02
are released. Version 1.3.0-alpha02 contains these commits.
API Changes
- Added
drawText
extension function onDrawScope
to provide a way to draw multi-styled text on composables and modifiers that operate on aDrawScope
likeCanvas
anddrawBehind
. (I16a62, b/190787898)
Bug Fixes
- Soft keyboard will now be hidden when a text field is disabled while focused. (I6e3e4, b/237308379)
- When adding
InputEventChange
events to Velocity Tracker we will consider now deltas instead of positions, this will guarantee the velocity is correctly calculated for all cases even if the target element moves (Icea9d, b/216582726, b/223440806, b/227709803) - When a scrollable has a focused child, it will now correctly scroll to keep the focused child in view when its size is decreased, even when the size is animated. (I80867, b/230756508, b/220119990)
- Fixed a crash where
TextField
is cleared and refilled while selection is active. (I1235b, b/208655565, b/214253689)
Version 1.3.0-alpha01
June 29, 2022
androidx.compose.foundation:foundation:1.3.0-alpha01
and androidx.compose.foundation:foundation-layout:1.3.0-alpha01
are released. Version 1.3.0-alpha01 contains these commits.
API Changes
- Introduced the
UrlAnnotation
annotation type and associated methods to supportTalkBack
link support inAnnotatedString
s. (I1c754, b/231495122)
Bug Fixes
BasicTextField
cursorBrush
may now be animated without restarting the cursor timer. (I812e6, b/236383522)
Version 1.2
Version 1.2.1
August 10, 2022
androidx.compose.foundation:foundation:1.2.1
and androidx.compose.foundation:foundation-layout:1.2.1
are released. Version 1.2.1 contains these commits.
Version 1.2.0
July 27, 2022
androidx.compose.foundation:foundation:1.2.0
and androidx.compose.foundation:foundation-layout:1.2.0
are released. Version 1.2.0 contains these commits.
Important changes since 1.1.0
LazyVerticalGrid
andLazyHorizontalGrid
are stable now.- You can now specify a content type for items in Lazy lists and grids. This will allow the components to reuse elements more efficiently.
- Lazy lists and grids now have
userScrollEnabled
param which allows to disable scrolling via the user gestures. - A new experimental API called
LazyLayout
was added. It It is the API we use internally to power Lazy lists and grids. OverscrollEffect
API has been introduced as experimental. You can define custom overscroll effects as well as adding a standard platform one to custom scrollable containers.- Nested scrolling interoperability APIs have been introduced to allow for interoperability between views and compose scrolling actors.
- Mouse and trackpad scrolling has been added to all scrolling containers.
Version 1.2.0-rc03
June 29, 2022
androidx.compose.foundation:foundation:1.2.0-rc03
and androidx.compose.foundation:foundation-layout:1.2.0-rc03
are released. Version 1.2.0-rc03 contains these commits.
- No changes since 1.2.0-rc02.
Version 1.2.0-rc02
June 22, 2022
androidx.compose.foundation:foundation:1.2.0-rc02
and androidx.compose.foundation:foundation-layout:1.2.0-rc02
are released. Version 1.2.0-rc02 contains these commits.
Version 1.2.0-rc01
June 15, 2022
androidx.compose.foundation:foundation:1.2.0-rc01
and androidx.compose.foundation:foundation-layout:1.2.0-rc01
are released. Version 1.2.0-rc01 contains these commits.
API Changes
- An experimental
OverscrollEffect
has been introduced to allow for custom overscroll effects, alongside theModifier.scrollable
overloads that accept it. - Experimental
LocalOverScrollConfiguration
has been moved fromfoundation.gesture
to foundation package and renamed toLocalOverscrollConfiguration
(If19fb, b/204650733) - Interfaces in compose libraries are now built using jdk8 default interface methods (I5bcf1)
- Introduced an experimental api
checkScrollableContainerConstraints()
which allows to check that we do not nest scrollable containers. You can use it when create your own scrollable lazy layouts viaLazyLayout
. (Id6fab, b/233352497) - Removed deprecated
LazyVerticalGrid
fromandroidx.compose.foundation.lazy
package. The new stable api is located inandroidx.compose.foundation.lazy.grid
(I73c76, b/225192009)
Version 1.2.0-beta03
June 1, 2022
androidx.compose.foundation:foundation:1.2.0-beta03
and androidx.compose.foundation:foundation-layout:1.2.0-beta03
are released. Version 1.2.0-beta03 contains these commits.
API Changes
- Added new experimental
IntervalList
andMutableIntervalList
. It allows to represent some list of values via multiple intervals. It will be useful when you want to define your own dsl similar to the one used byLazyColumn
where list items can be defined via multiple item/items calls. (I2d05e, b/228580728)
Bug Fixes
- Clarified the documentation for
WindowInsets.ime
to state thatime
insets are reported as far back as API 23, but only animated on 30+. (Ia7fc0, b/230756508) - Pressing the forward delete key when the cursor is at the end of a text field will no longer crash.
DeleteSurroundingTextCommand
andDeleteSurroundingTextInCodePointsCommand
now require their constructor arguments to be non-negative. (Ica8e6, b/199919707)
Version 1.2.0-beta02
May 18, 2022
androidx.compose.foundation:foundation:1.2.0-beta02
and androidx.compose.foundation:foundation-layout:1.2.0-beta02
are released. Version 1.2.0-beta02 contains these commits.
- Downloadable font resolution that does not change the layout size of Text or
TextField
previously would not redraw, leading to stale font display. This bugfix ensures that text layout always triggers redraw (b/229727404). (I1d49e, b/229727404)
Version 1.2.0-beta01
May 11, 2022
androidx.compose.foundation:foundation:1.2.0-beta01
and androidx.compose.foundation:foundation-layout:1.2.0-beta01
are released. Version 1.2.0-beta01 contains these commits.
New Features
- This is the first beta release of 1.2!
API Changes
- Added experimental
BeyondBoundsInterval
that can be used by custom implementations ofLazyList
when they layout items beyond visible bounds (Ifabfb, b/184670295) LineHeightBehavior
is renamed asLineHeightStyle
LineVerticalAlignment
is renamed asLineHeightStyle.Alignment
- Renames
LineHeightTrim
is renamed asLineHeightStyle.Trim
- Default constructor values from
LineHeightStyle
is removed (I582bf, b/181155707) - Added default values for the optional members of
LazyLayoutItemProvider
interface. (Iba8a0) - In the
LazyLayoutItemProvider
api instead of a factory returning the composable lambda by index we now have a simpler composable function Item accepting the index. (Id2196) - LazyLayoutItemsProvider is renamed to LazyLayoutItemProvider (I0638c)
LazyLayoutItemsProvider.itemsCount
is renamed toitemCount
(Id409c)- Added Brush to
TextStyle
andSpanStyle
to provide a way to draw text with gradient coloring. (I53869, b/187839528) trimFirstLineTop
,trimLastLineBottom
attributes ofLineHeightBehavior
changed into a single enum:LineHeightTrim
.LineHeightTrim
have values of 4 states defined by two booleans:FirstLineTop
,LastLineBottom
, Both and None (Ifc6a5, b/181155707)Added
LineHeightBehavior
to theTextStyle
andParagraphStyle. LineHeightBehavior
controls whether line height is applied to the top of the first line and to the bottom of the last line. It also defines the alignment of line in the space provided byTextStyle
(lineHeight
).For example it is possible to get a behavior similar to what CSS defines via
LineHeightBehavior(alignment = LineVerticalAlignment.Center, trimFirstLineTop=false, trimLastLineBottom = false)
.trimFirstLineTop
,trimLastLineBottom
configurations works correctly only whenincludeFontPadding
is false. (I97332, b/181155707)Added experimental
imeNestedScroll()
modifier so that developers can control the IME through scrolling. (I60759)
Bug Fixes
- Fixed regression where text fields would not hide the keyboard when removed from the composition while focused. (I7a410, b/230536793, b/225541817)
- Support ellipsis when height is limited and doesn't fit all text lines (Ie528c, b/168720622)
BringIntoViewRequester.bringIntoView
will now always suspend until the request is either completed or was interrupted by a newer, non-overlapping request. Overlapping requests will be queued. (I43e7f, b/216790855)- Concurrent
BringIntoViewRequester.bringIntoView
calls for rectangles that are completely overlapping will now only honor the larger rectangle's request. (I34be7, b/216790855, b/184760918) - Turned on default
includeFontPadding
. It is possible to turn off theincludeFontPadding
usingTextStyle.platformTextStyle
attribute. In the near future we will change the default behavior however until that time this allows us to better integrate line height improvements (aosp/2058653) and solveTextField
clipping issues. (I01423, b/171394808) Modifier.bringIntoViewRequester
no longer usesonGloballyPositioned
. (I630f5)
External Contribution
MouseInjectionScope.scroll(delta = someDelta)
is now inverted on Android if we scroll vertically (if someDelta is positive, it will scroll downward) (Ifb697, b/224992993)
Version 1.2.0-alpha08
April 20, 2022
androidx.compose.foundation:foundation:1.2.0-alpha08
and androidx.compose.foundation:foundation-layout:1.2.0-alpha08
are released. Version 1.2.0-alpha08 contains these commits.
API Changes
- Display all available weights for systems fonts on Android when using
FontFamily.SansSerif
. This will use fallback font names like sans-serif-medium internally on API 21-28. This is a behavior change as previously only weights 400 and 700 were supported on API 21-28. (I380fe, b/156048036, b/226441992) - Paragraph and MultiParagraph are now accepting Constraints parameter. Passing
Constraints.maxHeight
is a no-op at the moment but will allow to do some calculation in the future, like ellipsizing based on the height. (I6afee, b/168720622) SubcomposeSlotReusePolicy.getSlotsToRetain()
now accepts a custom MutableSet-like class which doesn't allow adding new items in it. (Icd314)- Partial consumption (down OR position) has been deprecated in
PointerInputChange
. You can useconsume()
to consume the change completely. You can useisConsumed
to determine whether or not someone else has previously consumed the change. PointerInputChange::copy()
now always makes a shallow copy. It means that copies ofPointerInputChange
will be consumed once one of the copies is consumed. If you want to create an unboundPointerInputChange
, use constructor instead. (Ie6be4, b/225669674)- New experimental
LazyLayout
API is introduced. This allows you to build your own components likeLazyColumn
ofLazyVerticalGrid
. Note that the API is in its early stages and can be changed in the future releases. (Iba2bc, b/166591700) AndroidFont
now takestypefaceLoader
as a constructor parameter. (I2c971)WindowInsets
companion now exposes the visibility (whether they are on the screen, regardless of whether they intersect with the window) and the size they could be if they are available on the device, but not currently active. (I65182, b/217770337)
Version 1.2.0-alpha07
April 6, 2022
androidx.compose.foundation:foundation:1.2.0-alpha07
and androidx.compose.foundation:foundation-layout:1.2.0-alpha07
are released. Version 1.2.0-alpha07 contains these commits.
API Changes
- Added a
PinnableParent
API that allows children of lazy layouts to prevent the currently composed items from being disposed (Ibbdd0, b/184670295) LazyListLayoutInfo
andLazyGridLayoutInfo
now havebeforeContentPadding
andafterContentPadding
fields (I3b628, b/200920410)- Added
KeyboardType.Decimal
as an alternative toKeyboard.Number
for specifically including decimal separator in IME. (Iec4c8, b/209835363) - Add new font descriptor Font(DeviceFontFamilyName) to optionally lookup system-installed fonts during font fallback chains. (I30468, b/219754572)
PointerEventType.Scroll
andPointerEvent.scrollDelta
are stable APIs now (I574c5, b/225669674)- Added temporary compatibility configuration for
includeFontPadding
inTextStyle/ParagraphStyle. includeFontPadding
can be changed viaTextStyle(platformStyle = PlatformTextStyle(includeFontPadding = true/false))
. This is a temporary configuration option to enable migration and will be removed. (If47be, b/171394808) - Updated
FontFamily.Resolver
to integrate System-wide bold text accessibility setting (I6c1e7) - The
consumeWindowInsets
extension property ofComposeView
allows developers to disable consumption of Android WindowInsets. This allows separateComposeViews
in the hierarchy to each applyWindowInsets
without interfering with each other. (I0ef08, b/220943142)
Version 1.2.0-alpha06
March 23, 2022
androidx.compose.foundation:foundation:1.2.0-alpha06
and androidx.compose.foundation:foundation-layout:1.2.0-alpha06
are released. Version 1.2.0-alpha06 contains these commits.
API Changes
- Added
RequestFocus
semantics action to request focus on the focusable target. (I17b71) FocusOrder
has now been merged intoFocusProperties
andfocusProperties()
now has all the capabilities offocusOrder()
.FocusOrder
andfocusOrder()
have been deprecated.focusOrder()
that accepts afocusRequester
should be replaced with afocusRequester()
modifier in combination withfocusProperties()
. This allows the modifiers to have a stronger separation of concerns. (I601b7)WindowInsets.asPaddingValues(Density)
was added to allow developers to do the conversion without needing to be in composition. (I94c35)- Updated parsing of vector drawables to support auto mirroring to flip the content of a
VectorPainter
if the current layout direction is RTL. (I79cd9, b/185760237)
Bug Fixes
- Scroll modifiers (
Modifier.verticalScroll()
,Modifier.horizontalScroll()
, andModifier.scrollable()
) will now scroll to keep the focused composable visible if the scroll area is resized and the focused composable was previously visible. - TextFields will now be kept above the keyboard when they are focused and the keyboard is shown, when inside a non-lazy scrollable and the soft input mode is
ADJUST_RESIZE
. (I4a485, b/190539358, b/192043120, b/216842427)
Version 1.2.0-alpha05
March 9, 2022
androidx.compose.foundation:foundation:1.2.0-alpha05
and androidx.compose.foundation:foundation-layout:1.2.0-alpha05
are released. Version 1.2.0-alpha05 contains these commits.
API Changes
LazyVerticalGrid
andLazyHorizontalGrid
are now stable. (I307c0)LazyGridItemInfo.Unknown
was replaced with separateLazyGridItemInfo.UnknownRow
andLazyGridItemInfo.UnknownColumn
(I56d51)LazyVerticalGrid
/LazyHorizontalGrid
and all related apis were moved into.grid
subpackage. Please update your imports fromandroidx.compose.foundation.lazy
toandroidx.compose.foundation.lazy.grid
. (I2d446, b/219942574)- Text:
includeFontPadding
is now turned off by default. The clipping issues as a result ofincludeFontPadding=false
is handled and no clipping should occur for tall scripts. (I31c84, b/171394808) - Measured interface now exposes parentData property (I3313f)
- Introduced experimental
Modifier.onFocusedBoundsChanged
to allow observing the bounds of child focusables. (I14283, b/220030968, b/190539358, b/192043120, b/216842427) - LazyHorizontalGrid was added. (I61ae7, b/191238807)
- Added a new
LazyVerticalGrid
API to define cross axis sizes (I17723) - Added FocusGroup modifier (I64bc0, b/213508274, b/184670295)
Bug Fixes
WindowInsets.toString()
will now show the correct values. (I1585d)
External Contribution
- Updated to use Kotlinx coroutines 1.6.0 (I3366d)
Version 1.2.0-alpha04
February 23, 2022
androidx.compose.foundation:foundation:1.2.0-alpha04
and androidx.compose.foundation:foundation-layout:1.2.0-alpha04
are released. Version 1.2.0-alpha04 contains these commits.
API Changes
BringIntoViewResponders
are no longer required to manually pass requests up to parent responders, and are instead required to immediately return the rectangle they want their parent to bring into view. (I8e66a)- Support async font loading in Text (I77057, b/214587005)
LazyVerticalGrid
now supportsline breaking
before items with span not fitting inside the current line. (I05c40, b/207462103)- Renamed
excludeFromSystemGestures
tosystemGesturesExclusion
(I19526) LazyVerticalGrid
now supports reverseLayout. (I6d7d7, b/215572963, b/211753558)- Add
WindowInsets.only()
method to allow developers to include only dimensions from the WindowInsets. (I14c94, b/217768486) Added
ComposableTarget
,ComposableTargetMarker
andComposableOpenTarget
that allows compile time reporting of when a composable function is called targeting an applier it was not designed to use.In most cases the annotations can be inferred by the compose compiler plugin so using these annotation directly should be rare . The cases that cannot be inferred include creating and using a custom applier, abstract composable functions (such as interface methods), fields or global variables that are composable lambdas (local variables and parameters are inferred), or when using
ComposeNode
or a related composable functions.For custom appliers the composable functions that calls
ComposeNode
orReusableComposeNode
need to add aCompoableTarget
annotation for the function and any composable lambda parameter types. It is recommended, however, to create an annotation that is annotated withComposableTargetMarker
and then the marked annotation be used instead ofComposableTarget
directly. A composable annotation marked withComposableTargetMarker
is equivalent to aComposbleTarget
with the fully qualified name of the attribute class as the applier parameter. For an example of usingComposableTargetMarker
seeanroidx.compose.ui.UiComposable
. (I38f11)
Bug Fixes
- Now it is allowed to pass negative scroll offsets into
LazyGridState.scrollToItem()
andLazyGridState.animateScrollToItem()
. (I025c6, b/211753558) - Support async font loading for TextField. (Icc4bf, b/214587005)
Version 1.2.0-alpha03
February 9, 2022
androidx.compose.foundation:foundation:1.2.0-alpha03
and androidx.compose.foundation:foundation-layout:1.2.0-alpha03
are released. Version 1.2.0-alpha03 contains these commits.
API Changes
notifyFocusedRect
methods inTextInputSession
andTextInputService
are now deprecated and won't be called. UseBringIntoViewRequester
instead. (Ia4302, b/192043120, b/216842427, b/178211874)- Animations were enabled for items of lazy grids with Modifier.animateItemPlacement(). (Ib6621, b/211753218)
BringIntoViewRequester
now propagates requests to the hosting Android View. (Ia7a51)FontFamilyResolver
is now available viaLocalFontFamilyResolver.current
- Added
createFontFamilyResolver(context)
andcreateFontFamilyResolver(context, coroutineScope)
to create new FontFamily resolvers outside of compose usage. - Paragraph and MultiParagraph now take
FontFamily.Resolver
TextLayoutResult.layoutInput.fontFamilyResolver
now contains the resolver used for this layout, deprecatedTextLayoutResult.layoutInput.resourceLoader
as it is no longer used. (Id5a45, b/174162090)
- Added
- Added
AndroidFont
, a new low-level API for providing new types of font resource descriptors on Android. For example, loading fonts from an app-specific backend, optionally locating pre-installed fonts on-device, or loading a font from a resource not provided by the current Font factories.- Expanded
Font.ResourceLoaded
API to support optional and async font loading. It is not recommended that application developers use this API directly. To add new types of fonts see AndroidFont. Font.AndroidResourceLoader
extension function allows construction of aFont.ResourceLoader
when outside of composition.- Added
loadingStrategy
parameter to resource-based fonts, to allow async loading when resource font references downloadable fonts XML. (Ie5aea, b/174162090)
- Expanded
Typeface(FontFamily)
constructor is deprecated. This was previously used to preload fonts, which may take up to 10 seconds for downloadable fonts. With downloadable fonts, this call may block for 10 seconds. Instead useFontFamilyResolver.preload
fontResource(FontFamily): Typeface
is deprecated. This was previously used to preload fonts, which may take up to 10 seconds for downloadable fonts. Instead useFontFamilyResolver.preload
(If8e7c, b/174162090)
- You can now specify the content type for the items of
LazyVerticalGrid
- item/items functions onLazyGridScope
now accept such parameter. Providing such information helps item composition reusing logic to make it more efficiently and only reuse the content between the items of similar type. (I7b355, b/215372836) LazyListLayoutInfo
andLazyGridLayoutInfo
now have new properties:viewportSize
,orientation
,reverseLayout
(Ifc8ed, b/200920410)- You can now specify the content type for the items of LazyColumn/LazyRow - item/items functions on LazyListScope now accept such parameter. Providing such information helps item composition reusing logic to make it more efficiently and only reuse the content between the items of similar type. (I26506)
SubcomposeLayoutState
constructor acceptingmaxSlotsToRetainForReuse
is now deprecated. Instead there is a new constructor acceptingSubcomposeSlotReusePolicy
- a new interface allowing more granular control on what slots should be retained for the future reuse. (I52c4d)- Adds Modifiers for WindowInsets, both for padding and sizing. This allows some content to extend into the inset area, and still have primary content stay out of the inset area. For example, windowInsetsPadding can be used to pad the content area to avoid areas that may be fully or partially covered. (Id0395, b/213942085)
Bug Fixes
- TextFields will now be kept above the keyboard when they are
focused and the keyboard is shown, when the soft input mode is
ADJUST_PAN
. (I8eaeb, b/190539358, b/192043120) - Desktop uses composition local for
FontFamily.Resolver
- Desktop
FontLoader
is deprecated - New
createFontFamilyResolver
factory on Desktop (I6bbbb, b/174162090)
- Desktop
- The soft keyboard input type no longer flickers when changing focus between text fields. (I1bf50, b/187746439)
- Text fields no longer require an extra back press when the cursor handle is showing. (Ideb4b, b/205726883)
- Text selection magnifier behavior has been polished to match the platform magnifier. (Idd918, b/206833278)
Version 1.2.0-alpha02
January 26, 2022
androidx.compose.foundation:foundation:1.2.0-alpha02
and androidx.compose.foundation:foundation-layout:1.2.0-alpha02
are released. Version 1.2.0-alpha02 contains these commits.
API Changes
- Added
NonRestartableComposable
to methods that are overloads of existing methods without complex logic. This reduces compiler generated memoization checks (equals) for all parameters which are repeated in the inner function that is called. (I90490) - Added
excludeFromSystemGesture
Modifiers for easy access to Android'ssetSystemGestureExclusionRects
(I46f07)
Bug Fixes
- Text selection magnifier behavior has been polished to match the platform magnifier. (Idd918, b/206833278)
LazyColumn
,LazyRow
,Modifier.verticalScroll
and other containers that useModifier.scrollable
now support mouse wheel scrolling. (I2b5e1, b/198214718)
Version 1.2.0-alpha01
January 12, 2022
androidx.compose.foundation:foundation:1.2.0-alpha01
and androidx.compose.foundation:foundation-layout:1.2.0-alpha01
are released. Version 1.2.0-alpha01 contains these commits.
API Changes
- New parameter
userScrollEnabled
was added toLazyColumn
,LazyRow
, andLazyVerticalGrid
in order to allow users to temporarily or permanently disable the user initiated scroll via touch gestures or accessibility actions. Scrolling programmatically via the methods on the state will still be allowed. (I7eae9, b/201150093) - Add
onSizeChanged
callback to magnifier modifier. (I6879f) - The magnifier widget now shows when dragging selection
handles in a
SelectionContainer
. (I30b38, b/139320979)
Bug Fixes
- Fixes
TextField
cursor handle not hiding when scrolled out of view. (I14552, b/208883748)
Dependency Updates
- Now depends on Kotlin
1.6.10
.
Version 1.1
Version 1.1.1
February 23, 2022
androidx.compose.foundation:foundation:1.1.1
and androidx.compose.foundation:foundation-layout:1.1.1
are released. Version 1.1.1 contains these commits.
Bug Fixes
- Fix
NullPointerException
atandroidx.compose.ui.platform.RenderNodeLayer.updateDisplayList
(aosp/1947059, b/206677462) - Fix crash caused by clipboard content while reading from clipboard on Android. (I06020, b/197769306)
- Fixed RTL in
LazyVerticalGrid
(aosp/1931080, b/207510535)
Version 1.1.0
February 9, 2022
androidx.compose.foundation:foundation:1.1.0
and androidx.compose.foundation:foundation-layout:1.1.0
are released. Version 1.1.0 contains these commits.
Important changes since 1.0.0
- Stable support for the Android 12 Overscroll effect
- Improvements to touch target sizing
- Note that, with respect to Compose 1.0, Material components will expand their layout space to meet Material accessibility guidelines for touch target size. For instance, Button touch target will expand to a minimum size of 48x48dp, even if you set the Button's size to be smaller. This aligns Compose Material to the same behavior of Material Design Components, providing consistent behavior if you mix Views and Compose. This change also ensures that when you create your UI using Compose Material components, minimum requirements for touch target accessibility will be met.
- Stable support for Navigation Rail
- Graduates a number of previously experimental APIs to stable
- Support for newer versions of Kotlin
Version 1.1.0-rc03
January 26, 2022
androidx.compose.foundation:foundation:1.1.0-rc03
and androidx.compose.foundation:foundation-layout:1.1.0-rc03
are released. Version 1.1.0-rc03 contains these commits.
Bug Fixes
- Updated to support Compose Material 1.1.0-rc03
Version 1.1.0-rc01
December 15, 2021
androidx.compose.foundation:foundation:1.1.0-rc01
and androidx.compose.foundation:foundation-layout:1.1.0-rc01
are released. Version 1.1.0-rc01 contains these commits.
Bug Fixes
- Now it is allowed to pass negative scroll offsets into
LazyListState.scrollToItem()
andLazyListState.animateScrollToItem()
. (Iceb90, b/184252837) - Fixed a bug that caused missing accessibility scroll actions (I7cbfb)
Version 1.1.0-beta04
December 1, 2021
androidx.compose.foundation:foundation:1.1.0-beta04
and androidx.compose.foundation:foundation-layout:1.1.0-beta04
are released. Version 1.1.0-beta04 contains these commits.
New Features
- Updated to be compatible with Kotlin
1.6.0
API Changes
- Cleaned up nullability in
androidx.core.view
(I7078a, b/204917439) - Experimental APIs were added that allow to consume PointerInputchange as a whole or check whether it was consumed or not. (I2e59d)
- Show a magnifier widget when dragging the cursor or selection handles inside text fields. (I5391e, b/203781358)
Bug Fixes
- Fix text handles not moving when IME visibility changes. (I25f2e)
Version 1.1.0-beta03
November 17, 2021
androidx.compose.foundation:foundation:1.1.0-beta03
and androidx.compose.foundation:foundation-layout:1.1.0-beta03
are released. Version 1.1.0-beta03 contains these commits.
API Changes
- Support for horizontal spans was added to LazyVerticalGrid. (I7e2fa, b/176758183)
Experimental ability to animate Lazy lists item positions was added. There is a new modifier available within LazyItemScope called
Modifier.animateItemPlacement()
. Usage example:var list by remember { mutableStateOf(listOf("A", "B", "C")) } LazyColumn { item { Button(onClick = { list = list.shuffled() }) { Text("Shuffle") } } items(list, key = { it }) { Text("Item $it", Modifier.animateItemPlacement()) } }
- When you provide a key via
LazyListScope.item
orLazyListScope.items
this modifier will enable item reordering animations. Aside from item reordering all other position changes caused by events like arrangement or alignment changes will also be animated. (I59e7b, b/150812265)
- When you provide a key via
Version 1.1.0-beta02
November 3, 2021
androidx.compose.foundation:foundation:1.1.0-beta02
and androidx.compose.foundation:foundation-layout:1.1.0-beta02
are released. Version 1.1.0-beta02 contains these commits.
Bug Fixes
- Ripples and other indications will now only be delayed if they are inside a
Modifier.scrollable()
container, instead of always being delayed for a down event. (Ibefe0, b/203141462) - Added experimental BringIntoView API that lets you send a request to parents so that they scroll to bring an item into view (Ib918d, b/195353459)
External Contribution
- Added
Modifier.pointerHoverIcon
(I95f01)
Version 1.1.0-beta01
October 27, 2021
androidx.compose.foundation:foundation:1.1.0-beta01
and androidx.compose.foundation:foundation-layout:1.1.0-beta01
are released. Version 1.1.0-beta01 contains these commits.
Bug Fixes
- Added experimental BringIntoView API that lets you send a request to parents so that they scroll to bring an item into view (Ib918d, b/195353459)
Version 1.1.0-alpha06
October 13, 2021
androidx.compose.foundation:foundation:1.1.0-alpha06
and androidx.compose.foundation:foundation-layout:1.1.0-alpha06
are released. Version 1.1.0-alpha06 contains these commits.
API Changes
- A child-less overload for Layout was added, with improved efficiency (Ib0d9a)
SemanticsNodeInteraction.performSemanticsAction
now returns theSemanticsNodeInteraction
on which the function was called. (I9e5db)- Added
performScrollToNode(matcher: SemanticsMatcher)
that scrolls a scrollable container to the content that is matched by the given matcher. (Ic1cb8)
Version 1.1.0-alpha05
September 29, 2021
androidx.compose.foundation:foundation:1.1.0-alpha05
and androidx.compose.foundation:foundation-layout:1.1.0-alpha05
are released. Version 1.1.0-alpha05 contains these commits.
API Changes
- Added experimental historical pointers to PointerEventChange. (Ic1fd8, b/197553056, b/199921305)
Bug Fixes
- Fixed accessibility support for scrollables (both lazy and non-lazy) with respect to scrolling (I6cdb0)
Version 1.1.0-alpha04
September 15, 2021
androidx.compose.foundation:foundation:1.1.0-alpha04
and androidx.compose.foundation:foundation-layout:1.1.0-alpha04
are released. Version 1.1.0-alpha04 contains these commits.
API Changes
- Deprecated
performGesture
andGestureScope
, which have been replaced byperformTouchInput
andTouchInjectionScope
. (Ia5f3f, b/190493367) - Added
touchBoundsInRoot
toSemanticsNode
that includes the minimum touch target size so that developers can ensure that touch targets meet accessibility minimums. (I2e14b, b/197751214)
Bug Fixes
- Support for stretch overscroll has been added on Android 12 devices. (Iccf3c, b/171682480)
Version 1.1.0-alpha03
September 1, 2021
androidx.compose.foundation:foundation:1.1.0-alpha03
and androidx.compose.foundation:foundation-layout:1.1.0-alpha03
are released. Version 1.1.0-alpha03 contains these commits.
New Features
- Updated Compose
1.1.0-alpha03
to depend on Kotlin1.5.30
. (I74545)
API Changes
- Glow effect for scroll has been added. New experimental OverScrollConfiguration API has been added to allow for configuration of the overscroll visual effect. Provide null to turn off the overscroll effect. (I0c304, b/171682480)
- AwaitPointerEventScope now has withTimeout() and withTimeoutOrNull() (I507f0, b/179239764, b/182397793)
- Added test method to get the clipped bounds. (I6b28e)
- Added minimum touch target size to ViewConfiguration for use in semantics and pointer input to ensure accessibility. (Ie861c)
Version 1.1.0-alpha02
August 18, 2021
androidx.compose.foundation:foundation:1.1.0-alpha02
and androidx.compose.foundation:foundation-layout:1.1.0-alpha02
are released. Version 1.1.0-alpha02 contains these commits.
API Changes
- Added DpSize versions for
Modifier.size
andrequiredSize
(I3fc7e, b/194219828)
Version 1.1.0-alpha01
August 4, 2021
androidx.compose.foundation:foundation:1.1.0-alpha01
and androidx.compose.foundation:foundation-layout:1.1.0-alpha01
are released. Version 1.1.0-alpha01 contains these commits.
API Changes
- Updated
DrawScope#drawImage
method that consumes source and destination rects to consume an optional FilterQuality parameter. This is useful for pixel art that is intended to be pixelated when scaled up for pixel based art. Updated BitmapPainter + Image composable to also consume an optional FilterQuality parameter (Ie4fb0, b/180311607) - TextField now clears selection when back button is pressed, which matches Android EditText behavior. (I3ca16, b/174173645)
- Add Cursor Handle. (I07a82, b/173016579)
Bug Fixes
- Scrolling via semantics actions for lazy lists and regular scrolling components is now animated (Id9066, b/190742024)
External Contribution
LazyVerticalGrid
now accepts both horizontal and vertical arrangement parameters. (If9c92)
Version 1.0
Version 1.0.5
November 3, 2021
androidx.compose.foundation:foundation:1.0.5
and androidx.compose.foundation:foundation-layout:1.0.5
are released. Version 1.0.5 contains these commits.
Bug Fixes
- Fixed a crash tracking derivedStateOf instances. (aosp/1792247)
Version 1.0.4
October 13, 2021
androidx.compose.foundation:foundation:1.0.4
and androidx.compose.foundation:foundation-layout:1.0.4
are released. Version 1.0.4 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.31
Version 1.0.3
September 29, 2021
androidx.compose.foundation:foundation:1.0.3
and androidx.compose.foundation:foundation-layout:1.0.3
are released. Version 1.0.3 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.30
Version 1.0.2
September 1, 2021
androidx.compose.foundation:foundation:1.0.2
and androidx.compose.foundation:foundation-layout:1.0.2
are released. Version 1.0.2 contains these commits.
Updated to support the Compose 1.0.2
release. Compose 1.0.2
is still compatible with Kotlin 1.5.21
.
Version 1.0.1
August 4, 2021
androidx.compose.foundation:foundation:1.0.1
and androidx.compose.foundation:foundation-layout:1.0.1
are released. Version 1.0.1 contains these commits.
Dependency Updates
- Updated to depend on Kotlin
1.5.21
.
Version 1.0.0
July 28, 2021
androidx.compose.foundation:foundation:1.0.0
and androidx.compose.foundation:foundation-layout:1.0.0
are released. Version 1.0.0 contains these commits.
Major features of 1.0.0
This is the first stable release of Compose. Please see the official Compose Release blog for more details!
Known Issues
If you are using Android Studio Bumblebee Canary 4 or AGP
7.1.0-alpha04
/7.1.0-alpha05
, you may hit the following crash:java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
To fix, temporarily increase your minSdkVersion to 24+ in your
build.gradle
file. This issue will be fixed in the next version of Android Studio Bumblebee and AGP7.1
. (b/194289155)
Version 1.0.0-rc02
July 14, 2021
androidx.compose.foundation:foundation:1.0.0-rc02
and androidx.compose.foundation:foundation-layout:1.0.0-rc02
are released. Version 1.0.0-rc02 contains these commits.
- Updated border rendering for generic shapes to address issues with paths defined with fixed dimensions. (aosp/1748871, b/191817116)
Version 1.0.0-rc01
July 1, 2021
androidx.compose.foundation:foundation:1.0.0-rc01
and androidx.compose.foundation:foundation-layout:1.0.0-rc01
are released. Version 1.0.0-rc01 contains these commits.
API Changes
- Canvas now supports a contentDescription parameter for accessibility. (Ib547c)
Bug Fixes
- Disabled Button, Card, Checkboxes and overall
Modifier.clickable(enabled=false)
will block clicks from going up to the parent. (Ic2c3b, b/183908811)
Version 1.0.0-beta09
June 16, 2021
androidx.compose.foundation:foundation:1.0.0-beta09
and androidx.compose.foundation:foundation-layout:1.0.0-beta09
are released. Version 1.0.0-beta09 contains these commits.
API Changes
- Removed
ManualFrameClock
. If you need to control animations, usecomposeTestRule.mainClock
instead. (I3c3e8, b/189951065) - change enum Role and LiveRegionMode to inline classes with private constructor (Id1890)
- KeyboardCapitalization is converted into inline class. (Id5a1c)
- TextOverflow is changed to an inline class. (I433af)
Bug Fixes
- Now when you specify the unique keys for LazyColumn/Row items the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. (Id263f, b/184257857)
- Key constants are @ExperimentalComposeUiApi for now. Consuming code can declare private constants prior to stabilization. (Ia5d48)
- Added IdlingStrategy to AndroidComposeTestRule that can be
used by testing frameworks to install an alternative mechanism to await
or achieve quiescence. Use
AndroidComposeTestRule.setIdlingStrategyFactory()
before your test starts to install your own strategy. (I608fa)
Added Profile Rules
This release adds profile rules to the following compose modules (I14ed6):
- androidx.compose.animation
- androidx.compose.animation-core
- androidx.compose.foundation
- androidx.compose.foundation-layout
- androidx.compose.material
- androidx.compose.material-ripple
- androidx.compose.runtime
- androidx.compose.ui
- androidx.compose.ui.geometry
- androidx.compose.ui.graphics
- androidx.compose.ui.text
- androidx.compose.ui.text
- androidx.compose.ui.unit
- androidx.compose.ui.util
What are profile rules?
Profile rules for a library are specified in a text file
baseline-prof.txt
located in thesrc/main
or equivalent directory. The file specifies a rule per line, where a rule in this case is a pattern for matching to methods or classes in the library. The syntax for these rules is a superset of the human-readable ART profile format that is used when usingadb shell profman --dump-classes-and-methods ...
. These rules take one of two forms to target either methods or classes.A method rule will have the following pattern:
<FLAGS><CLASS_DESCRIPTOR>-><METHOD_SIGNATURE>
And a class rule will have the following pattern:
<CLASS_DESCRIPTOR>
Here
<FLAGS>
is one or more of the charactersH
,S
, andP
to indicate whether or not this method should be flagged as "Hot", "Startup", or "Post Startup".The
<CLASS_DESCRIPTOR>
is the descriptor for the class that the targeted method belongs to. For example, the classandroidx.compose.runtime.SlotTable
would have a descriptor ofLandroidx/compose/runtime/SlotTable;
.The
<METHOD_SIGNATURE>
is the signature of the method, and includes the name, parameter types, and return types of the method. For example, the methodfun isPlaced(): Boolean
onLayoutNode
has the signatureisPlaced()Z
.These patterns can have wildcards (
**
,*
, and?
) in order to have a single rule encompass multiple methods or classes.
What do the rules do?
A method that has the flag
H
indicates that this method is a "hot" method, and should be compiled ahead of time.A method that has the flag
S
indicates that it is a method which is called at startup, and should be compiled ahead of time to avoid the cost of compilation and interpreting the method at startup time.A method that has the flag
P
indicates that it is a method which is called after startup.A class that is present in this file indicates that it is used during startup and should be pre-allocated in the heap to avoid the cost of class loading.
How does this work?
- Libraries can define these rules which will be packaged in AAR artifacts. When an app is then built which includes these artifacts, these rules are merged together and the merged rules are used to build a compact binary ART profile that is specific to the app. ART can then leverage this profile when the app is installed on devices in order to ahead-of-time compile a specific subset of the application to improve the performance of the application, especially the first run. Note that this will have no effect on debuggable applications.
Version 1.0.0-beta08
June 2, 2021
androidx.compose.foundation:foundation:1.0.0-beta08
and androidx.compose.foundation:foundation-layout:1.0.0-beta08
are released. Version 1.0.0-beta08 contains these commits.
API Changes
- NestedScrollSource enum is replaced by an inline class. (Ie321b, b/187055290)
- Refactored enum usages to inline classes to avoid issues with exhaustive when statements when new enum values are added. (I2b5eb)
- Adds a tap timeout to clickable / toggleable to prevent showing a ripple during a scroll / drag (Ia2704, b/168524931)
- ContentDescription and Text semantics properties are no longer single values but lists. This enables to merge them as they are instead of concatenations. Also provided better testing APIs to utilize these changes (Ica6bf, b/184825850)
Modifier.focusModifier()
is deprecated and replaced byModifier.focusTarget()
(I6c860)- KeyboardType enum is replaced by an inline class. (I73045, b/187055290)
- Replaced
FocusState
enum with aFocusState
interface (Iccc1a, b/187055290) - ImeAction enum is replaced by an inline class. (I18be5, b/187055290)
AnnotatedString.withAnnotation
functions are now ExperimentalTextApi instead of ExperimentalComposeApi. (I0cd0a)- TextUnit constructor with TextUnitType is now ExperimentalTextApi instead of ExperimentalComposeApi.
- PaddingValues is now
@Stable
rather than@Immutable
(I88c50)
Bug Fixes
- Fix crashes of long press the blank area in non-empty text. (I33ab5, b/187437299)
- Show Toolbar after SelectAll (I495d9, b/185919613)
- Fix for scrollable containers clipping its children on the cross axis. It was easily reproducible if you have a LazyRow with Card items. now the shadow will not be clipped. (Icb635, b/186318448)
- Fixed an issue where ripples / other indication would sometimes get stuck on a long click when using Modifier.combinedClickable (I2298c, b/186223077)
- Now
detectDragGesures
,detectVerticalGestures
, anddetectHorizontalGestures
will consume the position change automatically, no need to call change.consumePositionChange in the onDrag callbacks (I42fc4, b/185096350, b/187320697) Modifier.onGloballyPositioned()
was changed to report the coordinates of this modifier in the modifier chain, not the layout coordinates after applying all the modifiers. This means that now the ordering of modifiers is affecting what coordinates would be reported. (Ieb67d, b/177926591)
Version 1.0.0-beta07
May 18, 2021
androidx.compose.foundation:foundation:1.0.0-beta07
and androidx.compose.foundation:foundation-layout:1.0.0-beta07
are released. Version 1.0.0-beta07 contains these commits.
API Changes
- The next visible item prefetching logic is introduced for LazyColumn/Row (I8a4bc, b/184940225)
- Added Clip Selection Handle (Iff80d, b/183408447)
Bug Fixes
- LazyColumn/Row will now keep up to 2 previously visible items active (not disposed) even when they are scrolled out already. This allows the component to reuse the active subcompositions when we will need to compose a new item which improves the scrolling performance. (Ie5555)
- Remove paintBackground. (I38660)
- Draw Selection Background using DrawScope. (I73c61, b/186674472)
- A beta06 regression affecting Row/Column using spacedBy arrangements to layout weighted children was fixed. (Ifaf8c, b/187326588)
Version 1.0.0-beta06
May 5, 2021
androidx.compose.foundation:foundation:1.0.0-beta06
and androidx.compose.foundation:foundation-layout:1.0.0-beta06
are released. Version 1.0.0-beta06 contains these commits.
API Changes
- Solve Conflict with Navigation Gesture (I1145e)
- Added CollectionInfo and CollectionItemInfo accessibility APIs that allows to mark collection and its items for accessibility services (Id54ef, b/180479017)
- Added
SemanticsActions.ScrollToIndex
to scroll a list with indexed items to the item with a certain index, andSemanticsProperties.IndexForKey
to get the index of an item in a list with keyed items. Both actions are implemented by LazyList.- Added
SemanticsNodeInteraction.performScrollToIndex
that scrolls a list to the given index, andSemanticsNodeInteraction.performScrollToKey
that scrolls a list to the item with the given key. (I4fe63, b/178483889, b/161584524)
- Added
- AnnotatedString save support to TextFieldValue.Saver. Added addTtsAnnotation and withAnnotation utility functions to AnnotatedString.Builder (I8cbdc, b/178446304)
- Default
0.dp
parameter values were added toPaddingValues(horizontal, vertical)
(I05571, b/181336792)
Bug Fixes
- Row & Column children with
weight(fill = false)
are no longer making the parent fill the entire available main axis space. (Ied94d, b/186012444, b/184355105)
Version 1.0.0-beta05
April 21, 2021
androidx.compose.foundation:foundation:1.0.0-beta05
and androidx.compose.foundation:foundation-layout:1.0.0-beta05
are released. Version 1.0.0-beta05 contains these commits.
API Changes
- FlingBehavior interface is now marked as @Stable. All implementations should comply with the
@Stable
contract. (I93354, b/184830577)
Bug Fixes
- Fixed
ACTION_SCROLL_FORWARD
,ACTION_SCROLL_BACKWARD
,accessibilityActionScrollLeft
,accessibilityActionScrollUp
,accessibilityActionScrollRight
andaccessibilityActionScrollDown
accessibility scroll actions. Instead of scrolling to the end of the scrollable, it will now scroll by one screen in the given direction. (Ieccb0) - The AndroidManifest files from ui-test-manifest and ui-tooling-data are now compatible with Android 12 (I6f9de, b/184718994)
Version 1.0.0-beta04
April 7, 2021
androidx.compose.foundation:foundation:1.0.0-beta04
and androidx.compose.foundation:foundation-layout:1.0.0-beta04
are released. Version 1.0.0-beta04 contains these commits.
API Changes
- Rename hideSoftwareKeyboard and showSoftwareKeyboard on
SoftwareKeyboardController to
hide()
andshow()
respectively.- Provide the full CompositionLocal interface for LocalSoftwareKeyboardController, allowing it to be set (especially useful in tests) (I579a6)
TextOverflow.Visible
is introduced. (Ic8f89)- Public instances of
RowScope
,ColumnScope
,BoxScope
,BoxWithConstraintsScope
were removed. (I4e83e, b/181869067)
Bug Fixes
- Fixed the issue when items of
LazyColumn
/LazyRow
located on the edges were incorrectly positioned after fast fling (Ie4d13, b/183877420) Prior to this change, local composable functions were skippable based on their parameters. After this change, no local composable functions will skip. This change is done because it is common and expected for local functions to capture parameters from the parent and them skipping is a common source of bugs.
To summarize, consider the example:
@Composable fun Counter(count: Int, onCountChange: (Int) -> Unit) { @Composable fun ShowCount() { Text("Count: $count") } ShowCount() Button(onClick={ onCountChange(count + 1) }) { Text("Increment") } }
Prior to this change, the
ShowCount
composable function would always skip, even after thecount
parameter was updated. This is no longer the case. (I5648a)
Version 1.0.0-beta03
March 24, 2021
androidx.compose.foundation:foundation:1.0.0-beta03
and androidx.compose.foundation:foundation-layout:1.0.0-beta03
are released. Version 1.0.0-beta03 contains these commits.
API Changes
DefaultMonotonicFrameClock
is deprecated. CallingwithFrameNanos
orRecomposer.runRecomposeAndApplyChanges
with noMonotonicFrameClock
will now throwIllegalStateException
. (I4eb0d)
Bug Fixes
FlingBehavior.performFling()
is now called even when velocity is 0 (I0b6e5, b/181237123)
Version 1.0.0-beta02
March 10, 2021
androidx.compose.foundation:foundation:1.0.0-beta02
and androidx.compose.foundation:foundation-layout:1.0.0-beta02
are released. Version 1.0.0-beta02 contains these commits.
API Changes
- Multiple small optimizations in LazyColumn measuring logic were added (Ic6889)
- Added new
LocalSoftwareKeyboardController
composition local API to replace previous SoftwareKeyboardController interface on TextField. (I5951e, b/168778053) - Added new
LocalSoftwareKeyboardController
composition local API to replace previous SoftwareKeyboardController interface on TextField. (I84472, b/168778053)
Bug Fixes
- Enforce restrictions on public usage of experimental APIs (I6aa29, b/174531520)
Version 1.0.0-beta01
February 24, 2021
androidx.compose.foundation:foundation:1.0.0-beta01
and androidx.compose.foundation:foundation-layout:1.0.0-beta01
are 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)
- Removed dp assertions (I798d2)
- Removed SoftwareKeyboardController callback from all text fields to be replaced by a new API shortly. (Iae869, b/168778053)
- 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 asButton
andModifier.clickable()
, useinteractionSource = 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)
- Removed deprecated LayoutCoordinates methods, use function instead of the property for positionInParent and boundsInParent (I580ed, b/169874631, b/175142755)
- 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)
Add LazyListState.animateScrollToItem
This method smooth scrolls to a specific item in the list. (I4bfd7)
ScrollableState.smoothScrollBy() was renamed to animateScrollBy() LazyListState.snapToItemIndex() was renamed to scrollToItem() ScrollState.smoothScrollTo() was renamed to animateScrollTo() (I35ded)
Modifier.zoomable has been replaced my Modifier.transformable. smoothPanBy, smoothRotationBy have been added as a functionality. (Ifc32b, b/175294473)
The
defaultFactory
forcompositionLocalOf
andstaticCompositionLocalOf
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)Changed
Indication#createIndication()
toIndication#rememberUpdatedIndication(InteractionState)
and removesInteractionState
parameter from IndicationInstance#drawIndication()
. IndicationInstance should only be responsible for drawing visual effects, and not launching animations / writing state in response to InteractionState changes. These animations and state writes should happen withinrememberUpdatedIndication()
instead. Theindication
parameter inModifier.indication
was also changed to be a required parameter. (Ic1764, b/152525426)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)
smoothScrollBy and scrollBy methods' packages changed to
androidx.compose.foundation.gestures.*
(I3f7c1, b/175294473)FlingConfig has been renamed to FlingBehavior now allows for customization of suspend animation rather than predefined Decays. (I02b86, b/175294473)
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)
defaultMinSizeConstraints was renamed to defaultMinSize. (I4eaae)
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)
AnimationClockObservable and subclasses have been removed. AnimatedFloat has been removed. (Icde52, b/177457083)
drawerState.open() and drawerState.close() are now suspending functions. Use rememberCoroutineScope() to get the scope of the composition to call them (I16f60, b/175294473)
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)
Modifier.scrollable has been reworked. Now it uses Scrollable interface instead of ScrollableController class (I4f5a5, b/174485541, b/175294473)
Modifier.draggable now accepts DraggableState instead of a simple lambda. you can create state via
rememberDraggableState { delta -> }
to get the same behaviour as before (Ica70f, b/175294473)requiredWidth(IntrinsicSize) and requiredHeight(IntrinsicSize) modifiers were added for required sizing to intrinsic sizes. (I0a6b4)
Deprecated
emptyContent()
is removed. Use{}
instead. (Idb33f, b/179432510)Deleted some previously deprecated APIs (Ice5da, b/178633932)
Bug Fixes
- 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.foundation:foundation:1.0.0-alpha12
and androidx.compose.foundation:foundation-layout:1.0.0-alpha12
are released. Version 1.0.0-alpha12 contains these commits.
API Changes
- Modifier.pointerInput now requires remember keys to indicate when the pointer input detection coroutine should restart for new dependencies. (I849cd)
- Testing update: hasText() will check for both input and label/hint/placeholder texts in the text field (Iab803)
- PaddingValues.Absolute was added and can be used in APIs accepting PaddingValues. (Ia5f30)
- onImeActionPerformed is deprecated. use KeyboardActions instead (If0bbd, b/179071523)
- 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)
- Introduced an
InfiniteAnimationPolicy
coroutine context element that will be applied in infinite animations. By default no policy is installed, except when running tests withComposeTestRule
. (I50ec4, b/151940543) - Animatable.snapTo and Animatable.stop are now suspend functions (If4288)
- 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)
Custom keys support for LazyColumn/LazyRow was added. This allows us to smarter handle items reordering. So the state you stored in remember {} blocks will move together with the item when you reorder elements or removed the item from the middle.
LazyColumn { items(users, key = { user -> user.id }) { ... } }
Changed Indication#createInstance to be @Composable, and changed LocalIndication to contain an Indication, not () -> Indication. (I5eeea, b/157150564)
Constraints.enforce
was replaced withConstraints.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)
Modifier.clickable now doesn't have double and long click support. Use Modifier.combinedClickable to achieve this functionality. (Iafad1)
toIntPx() was renamed to roundToPx(). (I9b7e4, b/173502290)
IntBounds was renamed to IntRect and the API was improved. (I1f6ff)
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)
Selection was moved to foundation. (I7892b)
Similarly to how we previously removed
state { 0 }
composable and now promote usage likeremember { mutableStateOf(0) }
we are going to removesavedInstanceState { 0 }
composable. You should userememberSaveable { 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 thestateSaver
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)
Playtime in animation is now unfiied to nanoseconds (If776a)
@ComposableContract has been deprecated in favor of three more specific annotations.
@ComposableContract(restartable = false)
has become@NonRestartableComposable
@ComposableContract(readonly = true)
has become@ReadOnlyComposable
@ComposableContract(preventCapture = true)
has become@DisallowComposableCalls
@ComposableContract(tracked = true)
has been removed. (I60a9d)emptyContent()
and(@Composable () -> Unit).orEmpty()
utilities have been deprecated as they no longer have any positive performance impact or value (I0484d)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)
APIs related to LazyVerticalGrid are marked as experimental (Ia53e3, b/178519862)
rememberSavedInstanceState() was renamed to rememberSaveable() and moved to androidx.compose.runtime.saveable package. (I1366e, b/177338004)
RestorableStateHolder was renamed to SaveableStateHolder and moved to androidx.compose.runtime.saveable package. Inner method RestorableStateProvider was renamed to SaveableStateProvider. Generic type was removed so you can just pass Any as a key. Experimental annotation is not needed anymore. (I0902e, b/174598702)
Saver, listSaver(), mapSaver(), autoSaver was moved from androidx.compose.runtime.savedinstancestate to androidx.compose.runtime.saveable (I77fe6)
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)
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)
canDrag has been removed from the Modifier.scrollable. (Id66e7, b/175294473)
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)
Modifier.scaleGestureFilter has been removed. Use Modifier.zoomable instead. Alternatively, use
Modifier.pointerInput { detectMultitouchGestures { ... }}
(Id5da1, b/175294473)AnimatedValue/Float is now deprecated. Please use Animatable instead. (I71345, b/177457083)
- Removed CoreText and CoreTextField from public API
- Removed deprecated SelectionContainer overload (I99c19)
Remove deprecated non-suspend scrolling functions Continuing with the changes from last release, the non-suspend scrolling functions are now removed entirely. Please convert to the suspend functions with the same names. A coroutine scope can be obtained via rememberCoroutineScope(). (I3d39c, b/178169563)
androidx.compose.foundation.layout.ConstraintLayout was deprecated in favor of androidx.constraintlayout.compose.ConstraintLayout. You will need to add a dependency on
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha01
. (I87adc)tapGestureFilter, doubleTapGestureFilter, longPressGestureFilter and pressIndicaitonGestureFilter have been deprecated. Use Modifier.clickable or Modifier.pointerInput with detectTapGestures function instead. (I6baf9, b/175294473)
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)
Version 1.0.0-alpha11
January 28, 2021
androidx.compose.foundation:foundation:1.0.0-alpha11
and androidx.compose.foundation:foundation-layout:1.0.0-alpha11
are released. Version 1.0.0-alpha11 contains these commits.
API Changes
Deprecate non-suspend scrollBy, remove non-suspend scrollTo
We now recommend using suspend functions to control scrolling and wait for the scroll to finish. We are deprecating and/or removing the non-suspend versions of these functions as part of this transition. (Ie9ced)
Deprecate non-suspend smoothScrollBy We now recommend using suspend functions to control scrolling and wait for the scroll to finish. We are deprecating the non-suspend versions of these functions as part of this transition. (I12880)
Content description parameter has been added to the Image and Icon. It is used to provide description to the accessibility services (I2ac4c)
BasicTextField received a new parameter called 'decorationBox'. It allows to add the decorations like icons, placeholder, label and similar to the text field and increase the hit target area of it. (I16996)
canDrag parameter has been removed from the Modifier.draggable (Ic4bec, b/175294473)
AnimatedFloat.fling that accepts FlingConfig has been removed. Please use suspend Animatable.animateDecay instead. (I4659b, b/177457083)
Removed
data class
from the following classes:- InlineTextContent
- LocaleList
- (I605c7)
clickable, toggleable and selectable can be created outside of composition now (I0a130, b/172938345, b/175294473)
ScrollableColumn/Row were deprecated. Using ScrollableColumn is less efficient comparing 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 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)
anditemsIndexed(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)The deprecated AbsoluteArrangement was removed. (Iffa96, b/177641870)
The propagateMinConstraints parameter was added to Box, for specifying whether the incoming min constraints should be passed to the content of the Box or not. Default is false. (I0125b, b/152613457)
Bug Fixes
- onCommit, onDispose, and onActive have been deprecated in favor of SideEffect and DisposableEffect APIs (If760e)
- WithConstraints was reworked as BoxWithConstraints and moved to foundation.layout. (I9420b, b/173387208)
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 extendsComposeTestRule
and definessetContent
, which has been removed fromComposeTestRule
. Added a factory methodcreateEmptyComposeRule()
that returns aComposeTestRule
and does not launch an Activity for you. Use this when you want to launch your Activity during your test, e.g. usingActivityScenario.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)
Density is now receiver scope for Arrangement interfaces. (I18aad)
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)
- Removed
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)
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)
RememberObserver replaces CompositionLifecycleObserver and CompositionLifecycleObserver is now deprecated.
RememberObserver
is a replacement forCompositionLifecycleObserver
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 compositiononRemembered
is called for each reference whereonEnter
is only called once.onEnter
was called multiple time if the object was used in subcompositions, such asWithConstraints
andScaffold
making the singleonEnter
call guarantee unreliable and it was removed forRememberObserver
.RememberObserver
addsonAbandoned
which is called if theRememberObserver
instance is returned from the callback passed toremember
but was not remembered in the composition state and, therefore, will never haveonRemembered
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 ofRememberObserver
following the single reference recommendation above is tracking an external resource bothonForgotten
andonAbandoned
each indicate that the resource is no longer needed. If the object is tracking work started or resources allocated inonRemembered
,onAbandoned
can be ignored as it will not be called ifonRemembered
is called. (I02c36)Renamed TransformedText.transformedText to TransformedText.text
- TransformedText is no longer a data class (Ie672a)
The following classes are not data classes anymore:
- AnnotatedString
- ParagraphStyle
- SpanStyle
- TextStyle
- FontWeight
- TextDecoration
- TextGeometricTransform
- TextIndex
- TextLayoutResult
- TextLayoutInput (Iaff99)
Removed experimental monotonicFrameAnimationClockOf methods (Ib753f, b/170708374)
Deprecated global coordinates methods and made new window-based coordinates methods. (Iee284)
Please use ImeAction.None instead of ImeAction.NoAction
- Please use ImeAction.Default instead of ImeAction.Unspecified (Ie1bcc)
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)
Changed VisualTransformation to be a functional interface (I3bba4)
Leverage TestCoroutineDispatcher in testing (I532b6)
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)
Renamed TextInputService.onStateUpdated as updateState (Id4853)
Remove displaySize as it should be avoided. Typically it is better to use size of onRoot() or window size at least. (I62db4)
Version 1.0.0-alpha10
January 13, 2021
androidx.compose.foundation:foundation:1.0.0-alpha10
and androidx.compose.foundation:foundation-layout:1.0.0-alpha10
are released. Version 1.0.0-alpha10 contains these commits.
API Changes
- 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)
- 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)
- 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)
- Added experimental stickyHeader method for LazyColumn/LazyRow (I0a81d)
- Ranamed Color.useOrElse() to Color.takeOrElse() (Ifdcf5)
- Deprecated TestUiDispatcher. Use Dispatchers.Main instead (Ic171f, b/175385255)
- 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)
- FlowRow and FlowColumn were deprecated. Please use a custom layout instead. (I09027)
- 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)
- Changed
fun Dp.isFinite()
to aval Dp.isFinite
(I50e00) - Constraints#satisfiedBy was renamed to isSatisfiedBy. (I9cf5c)
- Added isSpecified, isUnspecified, and useOrElse for inline classes with an Unspecified constant. (I93f7b, b/174310811)
Bug Fixes
- New coroutine-based API
Animatable
that ensures mutual exclusiveness among its animations. New DecayAnimationSpec to support multi-dimensional decay animation (I820f2, b/168014930) - Added support for disabled and read-only text fields (I35279, b/171040474, b/166478534)
animate()
is now replaced withanimateAsState()
, which returns aState<T>
instead ofT
. 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)
- The native keyEvent can now be accessed through keyEvent.nativeKeyEvent (I87c57, b/173086397)
Version 1.0.0-alpha09
December 16, 2020
androidx.compose.foundation:foundation:1.0.0-alpha09
and androidx.compose.foundation:foundation-layout:1.0.0-alpha09
are released. Version 1.0.0-alpha09 contains these commits.
API Changes
Add Scrollable interface
This allows ScrollState and LazyListState to be treated as a common type, allowing custom scrolling to be implemented across both types.
This also moves smoothScrollBy to an extension function on Scrollable, taking advantage of this functionality. (I2153b)
LazyVerticalGrid is added. (I17267, b/162213211)
Deprecate LazyColumnFor, LazyRowFor, LazyColumnForIndexed and LazyRowForIndexed. Use LazyColumn and LazyRow instead (I5b48c)
For suspending pointer input APIs, renamed HandlePointerInputScope to AwaitPointerEventScope and handlePointerInput() to awaitPointerEventScope(). (Idf0a1, b/175142755)
LazyListState.layoutInfo was added which exposes the list of sizes and offsets of the currently visible items (If8678, b/170472532)
Removed ExperimentalPointerInput annotation (Ia7a24)
InteractionState support for TextFields has been added. (I61d91)
Add reverseLayout param for LazyColumn/Row. when
true
items will be composed from the bottom to the top andLazyListState.firstVisibleItemIndex == 0
will mean the first item is located at the bottom. (I552ae, b/166589935)verticalArrangement param was added for LazyColumn. horizontalArrangement param was added for LazyRow. Arrangement allows us to add a spacing between items and specify the arrangement of the items when we do not have enough of them to fill the whole minimum size. (Icf79a, b/170394300)
detectMultitouchGestures now uses one callback with combined centroid, pan, zoom and rotate parameters. (Ie6e1c)
Moved ContentDrawScope to ui-graphics module to be with DrawScope. (Iee043, b/173832789)
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)
Modifier.focusObserver is deprecated. Use Modifier.onFocusChanged or Modifier.onFocusEvent instead (I30f17, b/168511863, b/168511484)
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)
Introduced several new functions in SelectionRegistrar and also renamed onPositionChange to notifyPositionChange. (Ifbaf7)
AndroidOwner made internal (Ibcad0, b/170296980)
New infiniteRepeatable function for creating an InfiniteRepeatableSpec (I668e5)
The
Applier
interface has changed to simplify building trees bottom-up instead of top-down.The
insert()
method has been renamed toinsertTopDown()
.A new method,
insertBottomUp()
, was added.An applier either inserts nodes into the tree it is editing using
insertTopDown()
orinsertBottomUp()
depending on which performs better.Some trees, such as
LayoutNode
andView
, 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 anApplier
overridesinsertBottomUp()
to build a tree bottom-up andinsertTopDown()
to build the tree top-down. (Icbdc2)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 buildAnnotatedString factory function in order to build an AnnotatedString. Deprecated annotatedString builder function. (Idfe0b)
Version 1.0.0-alpha08
December 2, 2020
androidx.compose.foundation:foundation:1.0.0-alpha08
and androidx.compose.foundation:foundation-layout:1.0.0-alpha08
are released. Version 1.0.0-alpha08 contains these commits.
API Changes
- Removed
maxLines
parameter from theCoreTextField
. If you'd like to constraint the height of the text field by the number of lines, useBasicTextField
instead. (Iec002) - Changed the
await*TouchSlop()
methods to not detect the pointer down and renamed them to*OrCancellation
. Also removed the need fororientationLock
parameter. (Ie96e1) - 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 tocontent
, according to the lint check and guidance. (Iec48e) foundation:foundation-text
apis moved tofoundation:foundation
. The package structure remained the same (Id3eb2)- New multitouch gesture detector, including helpers for detecting rotation, zoom, and panning. (Ic459d)
- 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 council guidelines. Added typealias of VectorAssetBuilder to link to ImageVector.Builder for compat. (Icfdc8)
- Renamed ImageAsset and related methods to ImageBitmap. (Ia2d99)
- Moved foundation semantics properties to ui (I6f05c)
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)
Added a singeLine parameter into BasicTextField, TextField and OutlinedTextField. Set this parameter to true to make the text field a single horizontally scrollable line. (I57004, b/168187755)
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)
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)
Previously deprecated APIs have been removed: Border was removed, use BorderStroke instead. Modifier.drawBorder was removed, use Modifier.border instead. Modifier.gravity was removed, use Modifier.align instead. Stack was removed, use Box instead (I32c2b, b/172470874)
AbsoluteArrangement was renamed to Arrangement.Absolute. (If26f2)
Bug Fixes
- 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 council feedback. (I0bd29, b/173834241)
<T>
was removed from SubcomposeLayout declaration. You can use it without specifying a type now. (Ib60c8)- 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)
- 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 WindowManager.isWindowFocused to check if the host window is in focus, and a WindowFocusObserver that provides an onWindowFocusChanged callback. (I53b2a, b/170932874)
- Added resetInput parameter to TextInputService#onStateUpdated (I3e8f5, b/172239032, b/171860947)
- Updated TextFieldValue API
- made TextFieldValue.composition readonly
- removed exception thrown for invalid selection range (I4a675, b/172239032)
- 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) - Added Android Typeface wrapper. You can load an Android
Typeface via
typeface
function i.e.typeface(Typeface.DEFAULT)
. Also renamedtypefaceFromFontFamily()
totypeface()
(I52ab7) - Added lint check to check that Modifier factories use
androidx.compose.ui.composed {}
internally, instead of being marked as@Composable
. (I3c4bc) - Added lint check to check that Modifier factory functions are defined as extensions on Modifier, so they can be fluently chained together. (I07981)
- Semantics argument mergeAllDescendants was renamed to mergeDescendants. (Ib6250)
- Time control in tests (TestAnimationClock and its usages) is now experimental (I6ef86, b/171378521)
- Remove old ui-test module and its stubs (I3a7cb)
- TextUnit.Inherit is renamed to TextUnit.Unspecified in consistent with other units. (Ifce19)
- The Alignment interface was updated and made functional. (I46a07, b/172311734)
foundation:foundation-text
module has been merged intofoundation:foundation
(Idac0f)- Deprecate place(Offset) and placeRelative(Offset). Use overloads with int offsets instead (I4c5e7)
id
was renamed tolayoutId
forLayoutIdParentData
.Measurable.id
was renamed toMeasurable.layoutId
. (Iadbcb, b/172449643)
Version 1.0.0-alpha07
November 11, 2020
androidx.compose.foundation:foundation:1.0.0-alpha07
, androidx.compose.foundation:foundation-layout:1.0.0-alpha07
, and androidx.compose.foundation:foundation-text:1.0.0-alpha07
are released. Version 1.0.0-alpha07 contains these commits.
API Changes
- Similarly to
Modifier.fillMaxSize[Width|Height]
we now support fractions inModifier.fillParentMaxSize[Width|Height]
inside the scope ofLazyColumn/Row
(I797e2, b/166586426) - Removed
KeyboardOptions.toImeOptions
from public API. (Ic2e45) - The foundation AmbientTextStyle, ProvideTextStyle, and AmbientContentColor have been deprecated. Instead use the new versions available in the Material library. For non-Material applications, you should instead create your own design system specific theming ambients that can be consumed in your own components. (I74acc, b/172067770)
- 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 androidx.compose.foundation.BasicText. (If64cb)
- Added maxLines to TextFields (Ib2a5b)
- Update TextFields to accept KeyboardOptions (Ida7f3)
- Added KeyboardOptions for use in TextFields (I9ca32)
- Adds BasicText as a design-unopinionated API for text, parallel to BasicTextField. (I28268)
- ExperimentalLazyDsl annotation was removed. LazyColumn/LazyRow can now be used without adding @OptIn (Idab7a, b/166584730)
- BaseTextField has been deprecated. Use BasicTextField instead. (I896eb)
- BasicTextField has been added as a replacement for both CoreTextField and BaseTextField (Id4cea)
- Remove deprecated LazyColumnItems/LazyRowItems (I1d8a8)
- The deprecated composables for sizing to intrinsic measurements were removed. (I18537, b/171811496)
- relativePaddingFrom was renamed to paddingFrom. The paddingFromBaseline modifier was added, as convenience for specifying distances from layout bounds to text baselines. (I0440a, b/170633813)
- The matchHeightConstraintsFirst parameter was added to the aspectRatio modifier, which can be used to specify the modifier to size to height constraints before trying the width correspondents. (Ie7c43, b/155290593)
- The deprecated DpConstraints was removed. (I87884, b/171702471)
Bug Fixes
- 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)
- captureToBitmap moved to captureToImage. (I86385)
- Marks CoreText as @InternalTextApi. Use BasicText instead. (I6aaeb)
- Rename KeyboardOptions as ImeOptions (I82f36)
- Moved KeyboardType and ImeAction into KeyboardOptions (I910ce)
- CoreTextField has been marked as @InternalTextApi. Use BasicTextField instead (Ie2469)
- ExperimentalSubcomposeLayoutApi annotation was removed. SubcomposeLayout can now be used without adding @OptIn (I708ad)
- Introduce ui-test-junit4 module (Ib91f8)
- Updated Icon API to take in Color.Unspecified as a possible tint color which will draw the provided asset or painter without a ColorFilter. Previously attempts to ignore tinting with Color.Unspecified would tint with a transparent color ending up with nothing rendered at all. (I049e2, b/171624632)
- 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)
- androidx.ui.test moved to androidx.compose.ui.test (I9ffdb)
- FirstBaseline and LastBaseline were moved to androidx.compose.ui.layout package (Ied2e7)
- Added SelectionContainer without the callback (Ibfadb)
- Add Tests for SelectionHandles' Positions in SelectionContainer. (Ie93db)
- Added Keyboard auto correct IME Option (I57b8d)
Version 1.0.0-alpha06
October 28, 2020
androidx.compose.foundation:foundation:1.0.0-alpha06
, androidx.compose.foundation:foundation-layout:1.0.0-alpha06
, and androidx.compose.foundation:foundation-text:1.0.0-alpha06
are released. Version 1.0.0-alpha06 contains these commits.
API Changes
- androidx.compose.foundation.Icon has been moved to androidx.compose.material.Icon. You can also use the Image component / Modifier.paint() with a Painter if you do not want to use the Material library. (I9f622)
- Added interactionState to Modifier.scrollable, ScrollableColumn and LazyColumnFor (I81566, b/169509805)
- alignByBaseline was added to RowScope and alignWithSiblings was renamed to alignBy (I06503, b/170628732)
- Box was made an inline function. (Ibce0c, b/155056091)
- Added maxLines to CoreTextField (Ibee58, b/143687793)
- Added softwrap to CoreTextField. (I21a4b)
Bug Fixes
- Deprecate VectorPainter in favor of rememberVectorPainter to better indicate that the composable API internally leverages 'remember' to persist data across compositions. (Ifda43)
- Enable transitions in ComposeTestRule; remove option to enable the blinking cursor from ComposeTestRule. (If0de3)
- Added single line keyboard option to CoreTextField (I72e6d)
- 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)
- Add ability to specify inspector info in composed modifier (Idee08, b/163494569)
- Added KeyboardCapitalization IME Option (I8ac38)
- Fix Rtl Handle Position. (I6e1e0)
- 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)
- Added SelectAll option into selection menu (Ief02b)
Version 1.0.0-alpha05
October 14, 2020
androidx.compose.foundation:foundation:1.0.0-alpha05
, androidx.compose.foundation:foundation-layout:1.0.0-alpha05
, and androidx.compose.foundation:foundation-text:1.0.0-alpha05
are released. Version 1.0.0-alpha05 contains these commits.
API Changes
- CoreTextField now supports cursor functionality (Id23aa)
Deprecates contentColor() and currentTextStyle() APIs, and replaces them with AmbientContentColor and AmbientTextStyle ambients respectively. You can access the current value by using
.current
on the ambient property, as with any other ambient. This was change was made for consistency and to avoid having multiple ways to accomplish the same thing. Additionally renames some ambient properties to better describe their purpose as follows:- ContentColorAmbient -> AmbientContentColor
- TextStyleAmbient -> AmbientTextStyle
- IndicationAmbient -> AmbientIndication
- EmphasisAmbient -> AmbientEmphasisLevels
- RippleThemeAmbient -> AmbientRippleTheme (I37b6d)
Bug Fixes
- 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)
- Added Copy/Paste/Cut accessibility actions (I6db4f)
- 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)
- 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)
- Added Paging Compose module and paging integration (Ib85da)
- Modify LazyListScope to receive nullable values (I1765b)
- OnPositionedModifier is renamed to OnGloballyPositionedModifier and onPositioned() is renamed to onGloballyPositioned(). (I587e8, b/169083903)
- Added samples for LazyColumn/Row (Idc16d)
- Fix for the items and itemsIndexed methods to allow emptyList (I06647)
- Add a DSL for specifying inspector information (Ic9a22)
- Move LongPress into Text. (Iff2bc)
- Disable Selection in Text, and a Demo. (Ie7e97)
- Support AnnotatedString to SpannableString conversion for accessibility. (Ief907)
- Removed
PointerInputFilter.onPointerInput(...)
.PointerInputFilter.onPointerEvent(...)
should be used in its place. (I6f04a)
Version 1.0.0-alpha04
October 1, 2020
androidx.compose.foundation:foundation:1.0.0-alpha04
, androidx.compose.foundation:foundation-layout:1.0.0-alpha04
, and androidx.compose.foundation:foundation-text:1.0.0-alpha04
are released. Version 1.0.0-alpha04 contains these commits.
API Changes
- Stack was renamed to Box. The previously existing foundation.Box will be deprecated in favor of the new Box in compose.foundation.layout. 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)
- Add a new LazyListState class. This allows for observation and control of the scroll position of LazyRow and LazyColumn components. Instances can be created using rememberLazyListState() and passed into the state parameter of the component. Currently, the first visible item and offsets can be observed in this initial version. (Ic7cb7, b/159307669)
- Lazy list position and scroll offset are now saved and restored across Activity recreation (Ie045f, b/166589058)
- Add long click semantics action (I6281b, b/156468846)
- MutatorMutex utility added for keeping a single mutator of shared state over time and cancelling conflicting mutators by priority (I3f975)
- Annotated rootAnimationClockFactory, transitionsEnabled, blinkingCursorEnabled and textInputServiceFactory with @VisibleForTesting, make them internal API and hide their kdoc (I554eb, b/168308412)
- Removed inlineContent parameter from Text with String input. It won't be used because inlineContent must work with AnnotatedString. (Ief403)
- The deprecated custom Arrangement APIs were removed. (Ic576d, b/168297922, b/168297923)
- The
unbounded
parameter was added to wrapContentSize modifiers, which enables measuring the layout element with infinite max constraints. (I77951, b/158559319) - We prevented static imports of contents of layout scopes (e.g. alignWithSiblings in RowScope). The explicit scope alternative should be used instead:
with(RowScope) { Modifier.alignWithSiblings(FirstBaseline) }
. (I216be, b/166760797)
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 RoundRect.center 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)
- Performance optimizations for LazyColumnFor/LazyRowFor scrolling by not doing unnecessary recompositions during every scroll (I64f65, b/168293643, b/167972292, b/165028371)
- Fixed crash in LazyColumnFor/LazyRowFor after scrolling and then changing items and implemented auto scrolling up when the previously visible item was removed so we don't display empty gaps in the end anymore (I220ab, b/161480164, b/167855468)
- Nesting scrollable in the same direction containers like ScrollableContainer and LazyColumnFor is not allowed anymore. It was never supported and was breaking the fling and all the laziness of composing the items of LazyColumnFor (I6e101)
- 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)
- add AccessibilityScrollState to semantics properties. (Ifeda9)
- Make TextRange inline to avoid object creation. (Id034b)
- ParagraphConstraints is removed. Width is directly passed to Paragraph now. (Ica712)
Version 1.0.0-alpha03
September 16, 2020
androidx.compose.foundation:foundation:1.0.0-alpha03
, androidx.compose.foundation:foundation-layout:1.0.0-alpha03
, and androidx.compose.foundation:foundation-text:1.0.0-alpha03
are released. Version 1.0.0-alpha03 contains these commits.
API Changes
- InnerPadding was renamed to PaddingValues. (I195f1, b/167389171)
- Usages of gravity were consistently renamed to align or alignment in layout APIs. (I2421a, b/164077038)
- An alignment parameter was added to Stack, which allows specifying the default alignment for all the Stack children. (Ie80ca, b/164085265)
Bug Fixes
- DpConstraints and APIs using it were deprecated. (I90cdb, b/167389835)
- The parameters
minWidth
andmaxWidth
ofwidthIn
were renamed tomin
andmax
. Similarly forpreferredWidthIn
,heightIn
,preferredHeightIn
. (I0e5e1, b/167389544) - 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)
- Moved
createAndroidComposeRule
andAndroidInputDispatcher
fromandroidx.ui.test.android
toandroidx.ui.test
(Idef08, b/164060572)
Version 1.0.0-alpha02
September 2, 2020
androidx.compose.foundation:foundation:1.0.0-alpha02
, androidx.compose.foundation:foundation-layout:1.0.0-alpha02
, and androidx.compose.foundation:foundation-text:1.0.0-alpha02
are released. Version 1.0.0-alpha02 contains these commits.
Bug Fixes
- TestUiDispatcher is marked experimental (Iae99d, b/161247083)
Added
ManualFrameClock.hasAwaiters
to see if anything is awaiting a frame from that clock;runWithManualClock
as a replacement forrunBlocking
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") } }
Version 1.0.0-alpha01
August 26, 2020
androidx.compose.foundation:foundation:1.0.0-alpha01
, androidx.compose.foundation:foundation-layout:1.0.0-alpha01
, and androidx.compose.foundation:foundation-text: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.compose.foundation:foundation:0.1.0-dev17
, androidx.compose.foundation:foundation-layout:0.1.0-dev17
, and androidx.compose.foundation:foundation-text:0.1.0-dev17
are released. Version 0.1.0-dev17 contains these commits.
API Changes
- The spacedBy Arrangement was added for Row and Column, to enable positioning layout children with a fixed spacing. The aligned Arrangment 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)
- Offset has become an inline class (Iaec70)
- 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)
- VerticalScroller and HorizontalScroller have been removed. Use ScrollableColumn/Row instead. Modifier.drawBackground has been removed. Use Modifier.background (I73b0d, b/163019183)
- Remove marked as deprecated fillMax* modifiers from LazyItemScope as they are making it harder to add such modifiers correctly for items which are not direct children of LazyColumnFor (Ifa78d)
- added LazyColumn/LazyRow implementation as DSL (I93cc6)
- Constraints is now an inline class (I88736)
- Added the ability to size a layout to a fraction of the available space, using the fillMaxWidth, fillMaxHeight and fillMaxSize modifiers. (I945bb, b/161562591)
Bug Fixes
- Added a modifier param to SelectionContainer (I4aada, b/161487952)
- 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)
PlacementScope.placeAbsolute()
was renamed toPlacementScope.place()
, and the previousPlacementScope.place()
was renamed toPlacementScope.placeRelative()
. As a result, thePlacementScope.place()
method will not automatically mirror the position in right-to-left contexts anymore. If this is desired, usePlacementScope.placeRelative()
instead. (I873ac, b/162916675)- Removed deprecated FilledTextField component. Please use TextField instead to get the Material Design implementation of the Filled text field. (I5e889)
- Added backgroundColor parameter to LinearProgressIndicator and removed internal padding from CircularProgressIndicator. Added new ProgressIndicatorConstants.DefaultProgressAnimationSpec which can be used as the default AnimationSpec when animating progress between values (If38b5, b/161809914, b/161804677)
- The
state { ... }
composable is now deprecated in favor of explicit calls toremember { mutableStateOf(...) }
for clarity. This reduces the overall API surface and number of concepts for state management, and matches theby 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)
- Removed onChildPositioned and OnChildPositionedModifier. Developers should use onPositioned and OnPositionedModifier on the child layout instead. (I4522e, b/162109766)
- IntSize is now an inline class (I2bf42)
- LongPress the Blank Area to Edit. (Ib1e5b)
- Hide FloatingToolbar After Tapping on the Text. (If4525)
- Hide FloatingToolbar When Updating the Selection. (I8444c)
- Deselect When Blur. (I781a2)
Version 0.1.0-dev16
August 5, 2020
androidx.compose.foundation:foundation:0.1.0-dev16
, androidx.compose.foundation:foundation-layout:0.1.0-dev16
, and androidx.compose.foundation:foundation-text:0.1.0-dev16
are released. Version 0.1.0-dev16 contains these commits.
API Changes
- 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)
- Move dialog to ui (I47fa6)
- Added LazyColumnForIndexed/LazyRowForIndexed - versions of LazyColumnFor/LazyRowFor which provides both index and item in the itemCallback. It is useful when in addition to a current item you need to know a current index. (I65ff3)
- Modifier.deternimateProgress has been renamed to Modifier.progressSemantics (I9c0b4)
- LazyColumnItems was renamed to LazyColumnFor. LazyRowItems was renamed to LazyRowFor (I84f84)
- Add some Marks/Annotations for best practice reason. (I66b20)
- foundation.shape.corner package were flatten to foundation.share (I46491, b/161887429)
- Added сrossaxis gravity param for LazyRowItems/LazyColumnItems. LazyRowItems/LazyColumnItems now support wrap content behaviour. (Ib39fc)
- ZoomableState has been renamed to ZoomableController. Custom curve support has been added for smoothScale.
enabled
andonZoomStarted
functionality has been added (If8b8f) - 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)
- Previously deprecated AdapterList has been removed. Use LazyColumnItems instead (I12b9b)
- Modifier.drawBackground has been renamed to Modifier.background (I13677)
- The old ConstraintLayout DSL was removed. ConstraintSet2 has been renamed to ConstraintSet. (If58d1, b/162450908)
- Added Modifier.absoluteOffset() and Modifier.absoluteOffsetPx(). Unlike offset modifiers, absolute offset modifiers will not auto-mirror in right-to-left context (I3aa21)
Row
andColumn
are now inline function significantly reducing the overhead of using them. (I75c10)
Bug Fixes
- Address broad API fixes (I077bc)
- Remove unused OffsetBase interface
- Align Offset and IntOffset classes to have a consistent API surface
- Rename IntOffset.Origin to IntOffset.Zero to be consistent with Offset API
- Moved nativeCanvas method off of Canvas interface to support consumers to create their own Canvas instances
- Created stub EmptyCanvas class to refactor DrawScope to be a non-null parameter instead of lateinit and ensure non-nullability of the field
- Renamed ClipOp enums to be Pascal Case
- Renamed FilterQuality enums to be Pascal Case
- Renamed StrokeJoin enums to be Pascal Case
- Renamed PointMode enums to be Pascal Case
- Renamed PaintingStyle enums to be Pascal Case
- Renamed PathFillType enums to be Pascal Case
- Renamed StrokeCap enums to be Pascal Case
- Updated DrawCache implementation to no longer use lateinit params
- Updated DrawScope to no longer use lazy delegation for fillPaint and strokePaint internal parameters
- Updated Image composable to avoid Box usage for less overhead
- Updated Outline class to have @Immutable annotations
- Updated PathNode to have @Immutable annotations for each path instruction
- Updated Vector subcomposition to remove redundant conditional checks for equality as compose already handles them
- Deprecated Rect companion constructor methods in favor of function constructors
- Updated Brush classes and function constructors with @Immutable and @Stable APIs
- Updated VertexMode enum to be PascalCase
- Updated DrawScope selectPaint method to conditionally overwrite stroke parameters on the paint if they have changed
- Updated Size to add destructuring API, rename UnspecifiedSize to Unspecified and removed unused methods
Added MonotonicFrameAnimationClock that enables you to use a MonotonicFrameClock as an AnimationClockObservable to bridge the gap between the new coroutines based clocks and APIs that still use the old callback based clocks.
The MonotonicFrameClock equivalent of ManualAnimationClock is now ManualFrameClock. (I111c7, b/161247083)
Removed
SemanticsNodeInteraction.performPartialGesture
. UseSemanticsNodeInteraction.performGesture
instead. (Id9b62)Renamed
SemanticsNodeInteraction.getBoundsInRoot()
toSemanticsNodeInteraction.getUnclippedBoundsInRoot()
(Icafdf, b/161336532)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)
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)Added
isFocused()
andisNotFocused()
SemanticsMatcher. (I0b760)RemeasurementModifier was added. It allows users 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)
isSystemInDarkTheme now always considers the system-wide dark theme setting, and ignores power saving status before Q, following latest guidance. (I0c10c)
OnChildPositioned has been deprecated. Use OnPositioned on the child instead. (I87f95, b/162109766)
Renamed AndroidComposeTestRule to createAndroidComposeRule. (I70aaf)
Add accessibility action to get TextLayoutResult (I9d6e6)
Version 0.1.0-dev15
July 22, 2020
androidx.compose.foundation:foundation:0.1.0-dev15
, androidx.compose.foundation:foundation-layout:0.1.0-dev15
, and androidx.compose.foundation:foundation-text:0.1.0-dev15
are released. Version 0.1.0-dev15 contains these commits.
To use the 0.1.0-dev15
version of Compose, you will need to:
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
- Similarly to the new param in ScrollableColumn/ScrollableRow LazyColumnItems/LazyRowItems now also have contentPadding param which allows to add a padding for the content after it has been clipped, which is not possible via just a modifier param. It also allows to add a spacing only before first item/after last item. (Ibc24e)
- 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)
- Modifier.draggable and Modifier.scrollable APIs were reworked. DragDirection was removed in favor of Orientation. State required for scrollable has beed simplified. ScrollableState has been renamed to ScrollableController (Iab63c, b/149460415)
- 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) - Corner sizes used by RoundedCornerShape and CutCornerShape can now be larger than 50% (Id2340, b/160400213)
- Changed the default ContentScale parameter for the Image composable from Inside to Fit. This was done in order to get behavior to scale up the underlying Painter if the layout size is larger than the intrinsic size of the painter while maintaining the aspect ratio. This behavior better matches expectations for providing fixed sizes to the Image while not affecting the default behavior if only the intrinsic size is used to compute the size of the composable. (I40ae3, b/159838006)
- 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)
- Clickable was removed. Use Modifier.clickable (I84bdf)
- Added LazyRowItems - Horizontally scrolling analogue of LazyColumnItems (Ibbcf7)
- Introduced low level stateless animation APIs. These APIs (I63bf7)
- 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)
- Replaced usage of IntPx with Int. Replaced IntPxPosition with IntOffset. Replaced IntPxSize with IntSize. (Ib7b44)
- androidx.ui.foundation.shape.RectangleShape removed; use androidx.ui.graphics.RectangleShape (I94939, b/154507984)
- 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)
- Added Modifier.zoomable for pinch-to-zoom functionality (Id5d63)
- Toggleable component has been deprecated. Use Modifier.toggleable instead (I35220, b/157642842)
- MutuallyExclusiveSetItem has been deprecated. Use Modifier.selectable instead. (I02b47, b/157642842)
- TestTag is now deprecated. Use Modifier.testTag instead. (If5110, b/157173105)
- Adds fontWeight parameter to Text, which was accidentally not added previously (I56937)
- 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)
- VerticalScroller now provides Column out of the box. HorizontalScroller now provides Row out of the box. (Ieca5d, b/157020670)
- 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)
- Modifier.indication 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 is isReversed is set on ScrollerPosition (I953bd)
- Support adding composables into text layout. (I1373c)
- 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)
- 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)
- 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)
- HorizontalScroller and VerticalScroller not restores their scroll position using saved instance state. (Ia0fae, b/155075048)
- FocusManagerAmbient is removed. Use FocusModifier.requestFocus 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 state object for configuring drawing operations.
Added CanvasScopeSample as well as updated the demo app to include a declarative graphics demo (Ifd86d)
ColoredRect has been removed. User Box with drawBackground modifier instead (I983c7, b/152753731)
Add cursor color customisation to the TextField (I6e33f)
Now it is possible to hide/show software keyboard by using SoftwareKeyboardController which is delivered by onTextInputStarted 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)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)Replaced CoreTextField/TextField focusIdentifier parameter with FocusNode 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)
Added InteractionState and Interaction, making it easier to build components that react to UI state changes such as press, and drag (Icfe25, b/152525426)
RectangleShape moved from androidx.ui.foundation.shape.* to androidx.ui.graphics.* (Ia74d5, b/154507984)
Replaced all nullable Color uses in API with non-nullable and use Color.Unset instead of null (Iabaa7)
TextField API update - merged onFocus and onBlur callbacks into a single onFocusChange(Boolean) callback with parameter (I66cd3)
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 (I45f09, b/152842521)
Removes ProvideContentColor, instead just use ContentColorAmbient directly with
Providers
(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)
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)
ColoredRect has been deprecated. Use
Box(Modifier.preferredSize(width, height).drawBackground(color))
instead. (I499fa, b/152753731)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)
Replaced Modifier plus operator with factory extension functions (I225e4)
Draggable has been moved to modifier (Id9b16, b/151959544)
Moved
Text
to androidx.ui.foundation package, from androidx.ui.core. (I87ce5)add
enabled
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)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 toPaintBox(Painter)
Created Vector composable that behaves like the Image composable except with a VectorAsset instead of an ImageAsset (I9af9a, b/149030271)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)
Button, FloatingActionButton and Clickable now have a separate
enabled
param. Some of the params on Button were renamed or reordered. (I54b5a)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.
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)DrawImage composable was removed. Use ImagePainter to draw image on existing layout, or SimpleImage to introduce Image that takes space (I595e1, b/149827027)
Stack component supports right-to-left directionality (Ic9e00)
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)
DrawShape composable was removed. Use DrawBackground modifier instead. (I7ceb2)
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)
Scrollable component has been added, which allows creation of custom Scrollers/Lists (I5fd37)
Renamed background to DrawBackground and make it to be memorized by default (Ia0bd3)
Add paddings, border, shape and background param to Box (I05027, b/148147281)
Added Canvas component. This composable takes up some size (provided by user) and allows you to draw using CanvasScope (I0d622)
rename
Border
modifier toDrawBorder
(I8ffcc)Added Box component for combining layout and drawing common functionality. (I6e2a7)
Scrollers now exhibit native Android fling motion behavior. (I922af, b/147493715)
Replaced DrawBorder in favor of Border Modifier (Id335a)
Modifier.tag was renamed to Modifier.layoutId, to avoid confusion with Modifier.testTag. (I995f0)
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)
Modifier.padding(InnerPadding)
has been added (I94985, b/157133803)Removed deprecated RowAlign, ColumnAlign in Row and Column. (If60d4, b/155858731)
Removed deprecated LayoutTag(), please use Modifier.tag() instead. Removed deprecated Modifier.matchParent(), please use Modifier.matchParentSize() instead. (If8044)
Added the offsetPx layout modifier, which can be used to define (dynamic) offsets in px. (I5af57)
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)
Container has been removed. Use Box instead (Ibbc2b, b/151407926)
Removed deprecated LayoutWidth/Height/Size modifiers. (Ib0bc1)
Added default parameter values for the offset modifier. (I37f06)
Added symmetric padding modifier. (I39840)
Removed deprecated LayoutAspectRatio modifier. (I65a74)
Removed deprecated LayoutAlign modifiers. (I10877)
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)
Added verticalGravity and horizontalGravity parameters to Row and Column, respectively. (I7dc5a)
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 Alignments. (Ib0728)
Made Alignment instantiable with arbitrary values. Added 1D Alignments. (Ia0c05)
Renamed EdgeInsets to InnerPadding. Renamed innerPadding parameter of Material Buttons to paddding. (I66165)
alignToSiblings now accepts a Measured instead of Placeable. (I5788d)
Added modifiers for sizing to intrinsic measurements and deprecated the components serving this purpose. (I8295d)
Added support for customizing dimensions of children of ConstraintLayout (Idb1a5)
Removed deprecated Wrap and Center composables. (I29e23)
Added LayoutModifier2, a new API for defining layout modifiers; deprecated LayoutModifier (If32ac)
RowScope and ColumnScope members are now accessible outside Row and Column. (I3a641)
Container has been deprecated. Use Box instead. (I675ce, b/151407926)
Added the LayoutOffset modifier for offsetting layout position (I0b8a3)
Initial support for Rtl in Compose layout (Ia5519)
Updated LayoutAlign to not fill the available space anymore (I2b14f)
Removed AspectRatio composable in favor of modifier. Deleted obsolete FlexColumn, FlexRow composables and Spacing modifier (Iec8a7)
Removed the LayoutInflexible modifier for Row and Column (I0d820)
Implement Drag Selection Handles to change selection for TextField. (I27032)
Implements LongPressAndDrag for TextField Selection. (I17919)
Bug Fixes
- 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)
runOnIdleCompose
renamed torunOnIdle
(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)
- Removes previously 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. (I663b2, b/155375067)
- Removed obsolete size testing APIs. (Iba0a0)
- Made LayoutNode experimental API (I4f2e9)
- Version 1 of scroll orientation locking is implemented across Compose. (I1ce7a, b/150289741)
- Popups, Dialogs and Menus are now inheriting the contextual MaterialTheme (Ia3665, b/156527485)
- 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)
- Add AbsoluteArrangement - allows for arrangement of the children inside the Row without automatic mirroring in RTL (I3a1df)
- @Untracked annotation has been deprecated. Replace with @ComposableContract(tracked=false) (Id211e)
- 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)
- Add
viewModel()
composable which allows to create or get already created ViewModel similarly to how it works in Activity or Fragment (I5fdd1) 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)
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)
TextField's cursor has a blinking animation (Id10a7)
Partial gestures no longer require passing around of a GestureToken (Id7ae5)
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)
Rename AnnotatedString.Builder.addAnnotationString to addStringAnnotation. (I5059e)
Updated Alignment API and added support for absolute alignment (which does not auto-mirror in Rtl context) (I38cd3)
Layout and LayoutModifier children can be measured with a different layout direction. (Ibd731)
Introduce additional optional rect parameter to ImagePainter to support drawing a subsection of underlying ImageAsset (I0ea9e)
Fixed a crash in AdapterList when removing items (Ic64b0, b/153195921)
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)
ui-text-compose module is renamed as ui-text. ui-text now contains CoreText and CoreTextField composables (Ib7d47)
ui-text module is renamed as ui-text-core (I57dec)
Moved ui-framework/CoreText, CoreTextField composables under ui-text-compose. You might want to include ui-text-compose in your project. (I32042)
runOnIdleCompose
andrunOnUiThread
are now global functions instead of methods on ComposeTestRule. (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 { ... }
orby mutableStateOf(...)
. (I5312c)DrawLayerModifier and drawLayer() now default clipToBounds and clipToOutline to false. (I0eb8b, b/152810850)
Renamed LayoutResult to MeasureResult. (Id8c68)
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)
Renamed LayoutFlexible to LayoutWeight. Renamed tight parameter to fill. (If4738)
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)
androidx.compose.ViewComposer has been moved to androidx.ui.node.UiComposer androidx.compose.Emittable has been removed. It was redundant with ComponentNode. androidx.compose.ViewAdapters has been removed. They are no longer a supported use case. Compose.composeInto has been deprecated. Use
setContent
orsetViewContent
instead. Compose.disposeComposition has been deprecated. Use thedispose
method on theComposition
returned bysetContent
instead. androidx.compose.Compose.subcomposeInto has moved to androidx.ui.core.subcomposeInto ComponentNode#emitInsertAt has been renamed to ComponentNode#insertAt ComponentNode#emitRemoveAt has been renamed to ComponentNode#removeAt ComponentNode#emitMode has been renamed to ComponentNode#move (Idef00)Deprecated Wrap composable. It can be replaced either with the LayoutAlign modifier or with the Stack composable (Ib237f)
Made the layout direction be propagated from parent layout node to children. Added layout direction modifier. (I3d955)
Rename 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)
Support right-to-left direction in LayoutPadding modifier (I9e8da)
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)
Removed ValueHolder class. Restructured AnimatedValue, AnimatedFloat classes to make the animation value field abstract so that subclasses can watch the value update.
- Added model classes for AnimatedValue, AnimatedFloat, etc.
- Added a new set of light-weight @Composable API for animating between values.
- (I79530)
Breaking changes to the ambients API. See log and
Ambient<T>
documentation for details (I4c7ee, b/143769776)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)
Fixed a ConstraintLayout bug causing a crash on recompositions. (Ibee5a, b/158164341)
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)
Intrinsic measurements functions in Layout and LayoutModifier2 have an IntrinsicMeasureScope receiver now which provides intrinsics query API with implicitly propagated layout direction. (Id9945)
LayoutDirectionAmbient is deprecated. To read the layout direction defined by the locale, use localeLayoutDirection on ConfigurationAmbient (I851b1)
Added positionInParent and boundsInParent for LayoutCoordinates. (Icacdd, b/152735784)
ParentData composable is deprecated. You should either create a modifier which implements ParentDataModifier interface, or use LayoutTag modifier if you simply need to tag layout children to recognize them inside the measure block. (I51368, b/150953183)
Add OnPositionedModifier and OnChildPositionedModifier to replace OnPositioned and OnChildPositioned composable functions. (I2ec8f)
Disallow negative padding in LayoutPadding. LayoutOffset should be used instead for negative position offsets. (Ifb5b1)
WithConstraints got LayoutDirection parameter (I6d6f7)
Updated the
ComposeFlags.COMPOSER_PARAM
flag to betrue
, which will change the code generation strategy for the compose plugin. At a high level, this causes @Composable functions to be generated with an additional synthetic parameter, which is passed through to subsequent @Composable calls in order for the runtime to properly manage execution. This is a significant binary breaking change, however, should preserve source-level compatibility in all sanctioned usage of compose. (I7971c)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)
Added TextDirection.Content (I48f36)
Ajdust the Toolbar Menu to show copy, cut, paste properly. (Id3955)
Add FloatingToolbar for TextField Selection. (Ie8b07)
TextDirectionAlgorithm is renamed as TextDirection (I75ce8)
TextDirection is renamed as ResolvedTextDirection (I3ff38)
Add HapticFeedback to TextField Selection. (I58050)
Add Copy, Cut, and Paste methods to TextField Selection. (Idb70b)
TestTag and Semantics have been deleted. Use Modifier.testTag and Modifier.semantics instead (I15ff0, b/158841414)
Changed the package name for Locale and LocaleList from androidx.ui.text to androidx.ui.intl (I8132c)
API change:
AnnotatedString(builder: Builder)
is renamed toannotatedString(builder: Builder)
. (Ia6377)API change:
AnnotatedString.Item
is renamed toAnnotatedString.Range
. (I2d44d)Add Toolbar for text related operations. (I49d53)
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)
ui-android-text package name (androidx.text) replaced with androidx.ui.text.platform in order to align with androidx policy. (I42711)