forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] androidx-main from androidx:androidx-main #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test: existing tests Change-Id: Id53ff79d58d283d9c5ead18debdec73dc4b460c2
Bug: 475610120 Test: N/A Change-Id: I00a3ab3fe21b194fcd74c54db157bb567e273fc4
Introduces the public API surface for the new `Grid` layout composable in `androidx.compose.foundation.layout`. This layout enables developers to arrange UI elements in a two-dimensional grid structure. Key components introduced: * `Grid`: The main composable for creating the layout, taking a configuration lambda to define the structure. * `GridConfigurationScope`: The DSL receiver for defining track sizes (rows/columns) and gaps. * `GridTrackSize`: Defines sizing specifications, including `Fixed`, `Percentage`, `Flex` (using the new `Fr` unit), `MinContent`, `MaxContent`, and `Auto`. * `GridFlow`: Controls the direction of auto-placement (Row or Column). * `Modifier.gridItem`: Allows explicit placement and spanning of items within grid cells using 1-based indexing. Convenience extensions `columns(...)` and `rows(...)` are provided on `GridConfigurationScope` for defining multiple tracks. Note that the implementation of the `Grid` layout logic is currently stubbed. This commit strictly establishes the API contracts, with the measure policy logic to follow in subsequent changes. Relnote: "Introduced the API for `Grid`, a new non-lazy 2D layout composable inspired by CSS Grid. This allows defining explicit grid structures with `Fixed`, `Percentage`, `Flex(Fr)`, and content-based track sizes via the `config` block. Items are placed using `Modifier.gridItem()`." Bug: 462550392 Test: NA Change-Id: I04907884457dbffb9653b09807c03b96506517c0
This change implements the core layout logic for the `Grid` composable,
enabling it to measure and place children based on explicit
configuration.
Key features implemented:
- **Track Sizing:** Handles `Fixed`, `Percentage`, and `Flex` track
sizes for both columns and rows. The calculation process
prioritizes column widths to correctly inform row height
calculations, especially for content like text that wraps.
Flex tracks distribute remaining space after considering content
minimums.
- **Explicit Placement:** Children tagged with the `Modifier.gridItem()`
and providing specific row/column values are now placed at their
designated locations.
- **Spanning Support:** The sizing logic accounts for items spanning
multiple tracks, ensuring tracks expand as needed to accommodate
the content of spanning items.
- **Constraint Handling:** The grid layout respects incoming min/max
constraints from the parent layout.
RelNote: "Implemented core layout logic for Grid, enabling explicit
placement and support for Fixed, Flex, and Percentage sizing."
Bug: 462550392
Test: GridTest
Change-Id: I7d3c9578e82b996c7f9d7bc4e1f6a110e8cd426f
This commit introduces gap support to the `Grid` composable, allowing
developers to define spacing between rows and columns.
Key changes:
- Configuration: `GridConfigurationScope` now supports `gap`,
`rowGap`, and `columnGap` methods to configure spacing.
- Track Sizing: Grid track size calculation logic has been updated
to subtract total gap space from the available container size before
allocating space for fractional and flexible tracks.
- Measurement: Measurement phase now accounts for gaps when calculating
the size of items that span multiple tracks (e.g., width = sum of
columns + gaps between them).
- Layout: Offset now includes gap pixels when
determining the start position of each track.
Also updated integration demos and added unit tests to verify gap behavior
and alignment with spanning items.
Bug: 462550392
Test: GridTest
Change-Id: I38eb4f640aa4d8d29ee0858ca246f4e23ed26767
This commit adds support for aligning grid items within their allocated
cells.
Key changes:
- Alignment Support: Use the
`alignment` property from `Modifier.gridItem` to calculate the item's
offset within its cell.
- RTL Handling: The alignment logic respects the layout direction,
correctly adjusting the x-offset for RTL layouts when using
`place`.
- Alignment Demo: Added a new demo showcasing different alignment
options (TopStart, Center, BottomEnd, etc.) within grid cells.
- Tests: Added unit tests to verify correct item placement with
various alignments and spanning scenarios.
Bug: 462550392
Test: GridTest
Change-Id: I8751ddee9b516aa0d9053e56b8f741490514da5b
This commit implements intrinsic sizing for the `Grid` composable, enabling `MinContent`, `MaxContent`, and `Auto` track sizes. Added new unit tests and a demo to verify behavior for wrapping text and mixed sizing modes. Bug: 462550392 Test: GridTest Change-Id: I7cf995661f2e0b37edb08b5f238de51cba148780
This commit implements the auto-placement algorithm for the `Grid` composable, allowing items without explicit row/column coordinates to automatically flow into available cells. Added `AutoPlacementDemo` and unit tests to verify flow direction, wrapping behavior, and implicit track creation. Bug: 462550392 Test: GridTest Change-Id: I2c988e2f444344202448b05ae4044b0832521d87
Bug: 475521540 Relnote: "All Grid related APIs are currently experimental and require opt-in with @OptIn(ExperimentalGridApi::class). We are actively seeking feedback on this new layout!" Test: NA Change-Id: I20d0df09dba18c49111c5f9234a09a11abfcd29b
As being discussed in aosp/3908200, calls to use interactions happens synchronously. setPressed and isPressed happen in the UI thread and blocks the next frame until it's finished. So, it's useful to measure the performance of processing Press/Release interactions. 7,814 ns 3 allocs SurfaceBenchmark.surface_secondDrawFocusAnimation 69,521 ns 87 allocs SurfaceBenchmark.surface_secondFrameFocusAnimation 362,557 ns 108 allocs SurfaceBenchmark.surface_thirdFrameFocusAnimation 59,598 ns 41 allocs SurfaceBenchmark.surface_firstFrameReleaseAnimation 157,582 ns 216 allocs SurfaceBenchmark.surface_firstFramePressAnimation 57,409 ns 29 allocs SurfaceBenchmark.surface_firstDraw 286,793 ns 28 allocs SurfaceBenchmark.surface_thirdDrawFocusAnimation 671,456 ns 584 allocs SurfaceBenchmark.surface_firstFrame Test: Run benchmark Change-Id: I4c89410a87a3c1cb8158b43386aa20a02e72e769
Calling `variant` within the lambda provider causes an issue with serialization. Extract `flavorName`, `buildType`, and `name` into local variables to prevent the `Variant` object from being captured within the `map` lambda. RelNote: "Navigation SafeArgs no longer has configuration caching issues when being used with Google Services." Test: tested with sample project Bug: 458071608 Change-Id: I57cda144676def56d47091ed93e25c9fe068d6f3
Reverting a regression introduced on Dec. 8th in https://android-review.googlesource.com/c/platform/frameworks/support/+/3881841 Bug: 475276359 Test: Tested on g3 tests Change-Id: Iad17ae7fab5f3a4ff4a9d59f28009bfae5c5f385 (cherry picked from commit c3939bb15213aa868a5a7589afd60a66be7bd787)
Test: manual RelNote: "Added support for animationSpecForContentExpand and animationSpecForContentCollapse." Change-Id: I033a5fc3e829c992a5c051d74390ee2ddfe1329d
…d" into androidx-main
…rks" into androidx-main
This commit changes the current offset modifier to respond for layout direction. Also adds a new absoluteOffset modifier that doesn't consider layout direction. Bug: 474409165 Test: Added Unit tests for RTL layout direction and absoluteOffset Change-Id: Ia417533759b6cf21d32c5925a99ccdd36031db4a
Relnote: "Making SpatialRow an inline function" Bug: 469149576 Test: N/A Change-Id: Ia2f20b8af183cf5064676fb597ed587cba240266
We added baseline profiles in aosp/3867894 and aosp/3891625 But these needed to be merged into a single baseline profile due to b/469127532 This CL adds merged baseline profiles for datastore so that we can publish datastore with baseline profiles. These merged baseline profiles should be removed once b/469127532 is fixed. Bug: 469127532 Test: Verified that the generated aar files have baseline profiles Change-Id: I9be890ef458f476aa6911230fa013f7db0d3c0ea
Bug: 460511639 Bug: 460508283 Bug: 454429920 Test: running these tests on emulator locally Change-Id: If4f2788c6865a65930b7f499a8fe67428e717b1a
…ctual" into androidx-main
Change-Id: Ia9dccdc4f4a8df18684ce8262efded480ab776e6
Implements the Java side of the JNI marshalling tests for the 'ToggleGltfModelAnimation' API. The corresponding native C++ changes are covered in CL/846641826. Bug: 471145916 Test: On the emulator Change-Id: I56ea85c688bc541400eacefafdfdadf5de8eaa46
* changes: Annotate Grid layout with ExperimentalGridApi annotation Implement Grid auto-placement Implement Grid content-based sizing Implement Grid item alignment Add support for gaps in Grid layout Implement Grid sizing and explicit placement Introduce Grid layout API surface
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )