Status Update
Comments
b9...@gmail.com <b9...@gmail.com> #2
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
je...@google.com <je...@google.com>
il...@google.com <il...@google.com> #3
Camera apps are not required to deliver a thumbnail, that is correct as per the
Note: When you use
ACTION_IMAGE_CAPTURE
to capture a photo, the camera may also return a downscaled copy (a thumbnail) of the photo in the resultIntent
, saved as aBitmap
in an extra field named"data"
.
We can update the documentation to make this more clear.
b9...@gmail.com <b9...@gmail.com> #4
#3 That's the context of TakePicturePreview()
not TakePicture()
. The later use MediaStore.EXTRA_OUTPUT
from client side and save whole picture instead of preview to the Uri destination we provide.
al...@gmail.com <al...@gmail.com> #5
#3 I find it problematic if it does not return a thumbnail. I already created an uri for the image, what if user decides not to take a photo in the camera? I would need to do extra work to find out whether the uri has been written to..
ap...@google.com <ap...@google.com> #6
Branch: androidx-master-dev
commit 8dba38c1762e31c606fcc9a924549da933465e59
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Apr 30 17:37:00 2020
Adjust the TakePicture() docs
The TakePicture ActivityResultContract uses the
MediaStore.ACTION_IMAGE_CAPTURE intent action which does not guarantee a
thumbnail will be returned. We should specify that in the TakePicture
docs
Test: ./gradlew bOS
Bug: 154302879
Change-Id: I42caaae32380c172f7e4ff6b0ec5db6c2eaa7ab4
M activity/activity/src/main/java/androidx/activity/result/contract/ActivityResultContracts.java
al...@gmail.com <al...@gmail.com> #7
This makes the contract useless because the result is always null. Can there be at least some indications of success please?
il...@google.com <il...@google.com> #8
The result is not always null - that'll depend on what Camera app is handling the ACTION_IMAGE_CAPTURE
- camera apps absolutely can both save the output and provide a thumbnail Bitmap.
That being said, I agree that the role of the provided contracts is to cover the most common behavior - which in this case would mean returning a boolean result rather than the thumbnail.
As a short term workaround until the next release, you can create your own
ap...@google.com <ap...@google.com> #9
Branch: androidx-master-dev
commit 5277ad9de4c6cdc4d5d4a5808644b8e019ce5925
Author: Ian Lake <ilake@google.com>
Date: Fri May 01 11:25:24 2020
Change TakePicture to return a boolean result
The primary use case for using the TakePicture
contract is to save an image to a given Uri
therefore the return type should reflect this
by using a boolean result, avoiding the need
to distinguish between a null result due to
the user cancelling taking a picture and a
null result due to the Camera app not also
returning a thumbnail Bitmap.
Test: updated activity testapp
BUG: 154302879
Change-Id: I46caa5bc865473f083dfd95013cad661296c0029
M activity/activity/api/1.2.0-alpha05.txt
M activity/activity/api/current.txt
M activity/activity/api/public_plus_experimental_1.2.0-alpha05.txt
M activity/activity/api/public_plus_experimental_current.txt
M activity/activity/api/restricted_1.2.0-alpha05.txt
M activity/activity/api/restricted_current.txt
M activity/activity/src/main/java/androidx/activity/result/contract/ActivityResultContracts.java
M activity/integration-tests/testapp/src/main/AndroidManifest.xml
M activity/integration-tests/testapp/src/main/java/androidx/activity/integration/testapp/MainActivity.kt
A activity/integration-tests/testapp/src/main/res/xml/file_paths.xml
il...@google.com <il...@google.com> #10
We've updated the TakePicture
contract to return a boolean indicating success or not. This will be available in Activity 1.2.0-alpha05.
b9...@gmail.com <b9...@gmail.com> #11
Great! Thanks.
al...@gmail.com <al...@gmail.com> #12
Thanks!
Description
I am using the following code to take a picture and upload. During this process, I will need a thumbnail for preview. I am using
androidx.activity:activity-ktx:1.2.0-alpha03
andandroidx.fragment:fragment-ktx:1.3.0-alpha03
, tested on Pixel 2 Xl API 29 on emulator.The code in invoked by a view, which is owned by a fragment(
caller
), which is owned by an activityThe current result is that
ActivityResultContracts.TakePicture()
always return null, but images are correctly saved into the provided uri... I also found out thatintent
doesn't seem to have any extras when it returns.Please let me know if you need any information. Thanks in advanced!