Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Project: platform/frameworks/support
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
https://android-review.googlesource.com/1360099
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
ja...@gmail.com <ja...@gmail.com> #3
R2 requires special handling for use by an annotation processor only. It's not a direct replacement for R as its value is effectively opaque.
ub...@gmail.com <ub...@gmail.com> #4
As #3 suggests, the "workaround" from #2 does not actually seem to work. Resources$NotFoundException
ja...@gmail.com <ja...@gmail.com> #5
I would advocate for this annotations removal if it's still in alpha.
ub...@gmail.com <ub...@gmail.com> #6
From my perspective a more forward-looking solution would be to conceive a way to make resource IDs final again. In a modularized world, having them be non-final leads to nothing but problems. It was a lesser problem back when they were made non-final originally (somewhere in Jelly Bean I believe).
ja...@gmail.com <ja...@gmail.com> #7
I'd rather eliminate the need to have anyone use an R.layout or R.id reference. You don't care about final IDs when you never touch them directly. Layout XMLs are a schema and we should treat them as such by generating interaction types that abstract the underlying mechanics.
il...@google.com <il...@google.com>
al...@google.com <al...@google.com> #8
Given that a) we intended to lock down annotation APIs about two weeks ago so that we could finalize betas and b) this API surface seems to need further discussion, I'm with #5. Please remove this API and re-add for further discussion in the next feature cycle (about four weeks from now).
se...@google.com <se...@google.com> #9
There is aosp/931676 inflight, that doesn't have this issue, but need to check if tools team can create integration with it, it looks good.
ap...@google.com <ap...@google.com> #10
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 2f634eec2143acd6a4ea19a375a6e3877cdcc2ed
Author: Ian Lake <ilake@google.com>
Date: Tue Mar 19 10:14:07 2019
Convert @ContentView to constructor annotation
As layout IDs are non-final in library modules
(and in the future, app modules), change
@ContentView to only be a marker annotation for
a constructor which developers can call with
a specific layout ID.
Fixes: 128352521
Fixes: 127531658
Test: updated tests
Change-Id: I15e2edee8cbd68180991f89fbc3b04e12c961ede
M activity/api/1.0.0-alpha06.txt
M activity/api/current.txt
M activity/src/androidTest/java/androidx/activity/ContentViewTest.kt
M activity/src/main/java/androidx/activity/ComponentActivity.java
M annotations/api/1.1.0-beta01.txt
M annotations/api/current.txt
M annotations/src/main/java/androidx/annotation/ContentView.java
M appcompat/api/1.1.0-alpha04.txt
M appcompat/api/current.txt
M appcompat/src/main/java/androidx/appcompat/app/AppCompatActivity.java
M fragment/api/1.1.0-alpha06.txt
M fragment/api/current.txt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentFactoryTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentLifecycleTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentTransactionTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentViewTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/NestedInflatedFragmentTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/StrictFragment.kt
M fragment/src/androidTest/java/androidx/fragment/app/StrictViewFragment.kt
M fragment/src/androidTest/java/androidx/fragment/app/test/FragmentTestActivity.kt
M fragment/src/androidTest/java/androidx/fragment/app/test/LoaderActivity.kt
M fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/src/main/java/androidx/fragment/app/FragmentActivity.java
M testutils/src/main/java/androidx/testutils/RecreatedActivity.kt
https://android-review.googlesource.com/931676
https://goto.google.com/android-sha1/2f634eec2143acd6a4ea19a375a6e3877cdcc2ed
Branch: androidx-master-dev
commit 2f634eec2143acd6a4ea19a375a6e3877cdcc2ed
Author: Ian Lake <ilake@google.com>
Date: Tue Mar 19 10:14:07 2019
Convert @ContentView to constructor annotation
As layout IDs are non-final in library modules
(and in the future, app modules), change
@ContentView to only be a marker annotation for
a constructor which developers can call with
a specific layout ID.
Fixes: 128352521
Fixes: 127531658
Test: updated tests
Change-Id: I15e2edee8cbd68180991f89fbc3b04e12c961ede
M activity/api/1.0.0-alpha06.txt
M activity/api/current.txt
M activity/src/androidTest/java/androidx/activity/ContentViewTest.kt
M activity/src/main/java/androidx/activity/ComponentActivity.java
M annotations/api/1.1.0-beta01.txt
M annotations/api/current.txt
M annotations/src/main/java/androidx/annotation/ContentView.java
M appcompat/api/1.1.0-alpha04.txt
M appcompat/api/current.txt
M appcompat/src/main/java/androidx/appcompat/app/AppCompatActivity.java
M fragment/api/1.1.0-alpha06.txt
M fragment/api/current.txt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentFactoryTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentLifecycleTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentTransactionTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentViewTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/NestedInflatedFragmentTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/StrictFragment.kt
M fragment/src/androidTest/java/androidx/fragment/app/StrictViewFragment.kt
M fragment/src/androidTest/java/androidx/fragment/app/test/FragmentTestActivity.kt
M fragment/src/androidTest/java/androidx/fragment/app/test/LoaderActivity.kt
M fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/src/main/java/androidx/fragment/app/FragmentActivity.java
M testutils/src/main/java/androidx/testutils/RecreatedActivity.kt
il...@google.com <il...@google.com> #11
We've changed how @ContentView functions. The previous form of:
@ContentView(R.layout.main)
class MainFragment : Fragment() {
}
becomes
class MainFragment : Fragment(R.layout.main) {
}
While the default FragmentFactory (and AppComponentFactory for Activities on API 28+) still require a no-argument constructor, Fragment and ComponentActivity/FragmentActivity/AppCompatActivity allow your no-argument constructor or custom constructor to call up to a second constructor which takes a @LayoutRes int of the layout you want to inflate. That second constructor is annotated with @ContentView and will be used for future Tools integrations.
@ContentView(R.layout.main)
class MainFragment : Fragment() {
}
becomes
class MainFragment : Fragment(R.layout.main) {
}
While the default FragmentFactory (and AppComponentFactory for Activities on API 28+) still require a no-argument constructor, Fragment and ComponentActivity/FragmentActivity/AppCompatActivity allow your no-argument constructor or custom constructor to call up to a second constructor which takes a @LayoutRes int of the layout you want to inflate. That second constructor is annotated with @ContentView and will be used for future Tools integrations.
zh...@gmail.com <zh...@gmail.com> #12
Layout IDs will become non-usable in annotations, in application modules?
------
Is it to deliberately kill code such as:
https://github.com/square/mortar/blob/d7bb8e5b5dd773376d940319a49bce9bf7c1058c/mortar-sample/src/main/java/com/example/mortar/screen/ChatListScreen.java#L33
and
https://github.com/lyft/scoop/blob/8d8e499bf3e6399676d314a18094a99a57b99a46/scoop-basics/src/main/java/com/example/scoop/basics/ui/layoutsample/screen/LayoutScreen.java#L10
?
------
Is it to deliberately kill code such as:
and
?
il...@google.com <il...@google.com> #13
For discussion on non-final IDs in app modules and why the Tools team is considering it, see the section on resource namespacing part of the "What's New With the Android Gradle Plugin" talk from AndroidDevSummit: https://www.youtube.com/watch?v=GlwvVJNWlWg&t=1318
ta...@gmail.com <ta...@gmail.com> #14
I've seen in recent changelog that giving layout in constructors is also supported in AppCompatActivity. Is this something supported in older API levels?
il...@google.com <il...@google.com> #15
Re #14 as per the Javadoc: https://developer.android.com/reference/androidx/appcompat/app/AppCompatActivity?hl=en#AppCompatActivity(int)
"This should generally be called from your constructor that takes no parameters, as is required for API 27 and lower or when using the default AppComponentFactory."
"This should generally be called from your constructor that takes no parameters, as is required for API 27 and lower or when using the default AppComponentFactory."
Description
Version used: Version 1.0.0-alpha04
Since `R.layout` is non-final in library projects, we can't use the `@ContentView` annotation.