Status Update
Comments
ap...@google.com <ap...@google.com> #2
Android 5.0, 5.1: it shows context menu at top of screen, not as popup. See screenshots.
Android framework doesn't support floating toolbar before 23. So this is intended behavior.
The crash information suggests that this is an error from Snapshot. chuckj@ can you please take a look? I don't know what exactly caused the readError
in Snapshot, any suggestions? Thanks a lot!
ap...@google.com <ap...@google.com> #3
This looks like another instance of 193006595 which I am looking at now.
ap...@google.com <ap...@google.com> #4
Branch: androidx-main
commit beeb84e7be604088ad40e080a8d0adb1bacbf695
Author: Chuck Jazdzewski <chuckj@google.com>
Date: Thu Jul 08 10:04:28 2021
Remove updating the transparent snapshot
A transparent snapshot is create for the block exeucted by
`Snapshot.observe()` which registers read and write observers
but without creating a snapshot. The code to advance the
global snapshot, however, created a new transparent snapshot in
an attempt to update it to the new global snapshot it just
created. This is not necessary, however, as the transparent
snapshot will retrieve the current global snapshot from
`currentGlobalSnapshot` instead of `previousSnapshot` if
`previousSnapshot` is `null`. With the previous code, if the
global snapshot is advanced by applying a new snapshot the
"updated" transparent snapshot will be left referring to an
older snapshot instead of the most recent global snapshot.
Any snapshot object created in the newly applied snapshot
will throw an exception when it is accessed, as reported in
the bugs. The solution is to remove the apparent vetiagal code.
Test: ./gradlew :compose:r:r:tDUT
Fixes:
Change-Id: I2c0d0b8f57bf70e5a98ea36ed141d97142a5e53e
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/Snapshot.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/snapshots/SnapshotTests.kt
ma...@google.com <ma...@google.com> #5
For the future reference, there's roughly the reasons this change has been made:
-
There's no good proper name for the concept of layout that stacks children in Z axis. It's called
FrameLayout
in android,ZStack
in swiftui etc. We received some feedback that people expectStack
to be vertical, or even horizontal. People have different backgrounds and different expectation from that name. Overall we've decided that being 100% semantically correct is not worth it, and just having simple name for a simple concept will work just fine, henceBox
. -
We wanted to reduce number of APIs for general layouts. People used
Box
as a modifier wrapper or even as a leaf node with just modifiers on it. Sometimes they usedBox
to wrap many children as well. NameBox
can be both (layouts that overlays children AND thing that you apply modifiers), allowing us to reduce complexity be reducing amount of API for people to learn.Stack
wasn't striking us as smth that would read nicely without children. -
We can concentrate on one thing performance wise and tune it nicely as we expect
Box
to be used quite regularly. -
it's shorter to type (2 chars saved! :P)
Description
Rename Stack to Box, remove all params from Box and Stack besides children and gravity (alignment)
See discussion and context in the doc:https://docs.google.com/document/d/1EoadTJCmqQHqzZtW01DxA8msZ2oBhrPLvb-SWyFQt8s/edit?usp=sharing