Fixed
Status Update
Comments
da...@google.com <da...@google.com>
il...@google.com <il...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit fb1c82582399043b149eb2630f524c75de9c88dc
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Aug 15 11:34:36 2019
Disallow intercept, touch slop and canScroll in nestedPreScroll
* Disallow intercept (requestDisallowInterceptTouchEvent(true))
When scroll delta is consumed by dispatchNestedPreScroll, the parent
should be requested not to intercept subsequent touch events, just as
when scroll is consumed by the widget itself or dispatchNestedScroll.
* Touch slop
NestedScrollingChild implementations should only call
dispatchNestedPreScroll after the delta x/y has exceeded the touch slop.
* canScroll (canScrollHorizontally/canScrollVertically)
The dx/dy values passed to dispatchNestedPreScroll should be zero if the
child can't scroll in that direction.
Fixed in:
- RecyclerView
- NestedScrollView
Bug: 138668210
Bug: 139530818
Test: ./gradlew connectedCheck
Change-Id: I85b327ad096fbbd204adb92f630770ec7fad5990
M core/core/src/androidTest/java/androidx/core/widget/NestedScrollViewNestedScrollingChildTest.java
M core/core/src/main/java/androidx/core/widget/NestedScrollView.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrolling3RequestDisallowInterceptTouchTest.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrollingChildTest.java
M recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
https://android-review.googlesource.com/1105373
https://goto.google.com/android-sha1/fb1c82582399043b149eb2630f524c75de9c88dc
Branch: androidx-master-dev
commit fb1c82582399043b149eb2630f524c75de9c88dc
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Aug 15 11:34:36 2019
Disallow intercept, touch slop and canScroll in nestedPreScroll
* Disallow intercept (requestDisallowInterceptTouchEvent(true))
When scroll delta is consumed by dispatchNestedPreScroll, the parent
should be requested not to intercept subsequent touch events, just as
when scroll is consumed by the widget itself or dispatchNestedScroll.
* Touch slop
NestedScrollingChild implementations should only call
dispatchNestedPreScroll after the delta x/y has exceeded the touch slop.
* canScroll (canScrollHorizontally/canScrollVertically)
The dx/dy values passed to dispatchNestedPreScroll should be zero if the
child can't scroll in that direction.
Fixed in:
- RecyclerView
- NestedScrollView
Bug: 138668210
Bug: 139530818
Test: ./gradlew connectedCheck
Change-Id: I85b327ad096fbbd204adb92f630770ec7fad5990
M core/core/src/androidTest/java/androidx/core/widget/NestedScrollViewNestedScrollingChildTest.java
M core/core/src/main/java/androidx/core/widget/NestedScrollView.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrolling3RequestDisallowInterceptTouchTest.java
M recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewNestedScrollingChildTest.java
M recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
ma...@gmail.com <ma...@gmail.com> #3
<navigation xmlns:android="http://schemas.android.com/apk/res/android "
xmlns:app="http://schemas.android.com/apk/res-auto "
xmlns:tools="http://schemas.android.com/tools "
android:id="@+id/nav_main"
app:startDestination="@id/homeFragment">
<fragment
android:id="@+id/homeFragment"
android:name="com.example.navtest.HomeFragment"
android:label="HomeFragment"
tools:layout="@layout/fragment_home">
<action
android:id="@+id/action_homeFragment_to_nestedFragment"
app:destination="@id/nestedFragment"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</fragment>
<fragment
android:id="@+id/nestedFragment"
android:name="com.example.navtest.NestedFragment"
android:label="fragment_nested"
tools:layout="@layout/fragment_nested" >
<argument
android:name="foo"
android:defaultValue='"foo"'
app:argType="string" />
</fragment>
<action
android:id="@+id/action_global_nestedFragment"
app:destination="@id/nestedFragment" />
<include app:graph="@navigation/nav_home" />
</navigation>
The compilation error arises after including the nested graph. From this, the error is avoided by either commenting out the global <action> or the <include> tag.
xmlns:app="
xmlns:tools="
android:id="@+id/nav_main"
app:startDestination="@id/homeFragment">
<fragment
android:id="@+id/homeFragment"
android:name="com.example.navtest.HomeFragment"
android:label="HomeFragment"
tools:layout="@layout/fragment_home">
<action
android:id="@+id/action_homeFragment_to_nestedFragment"
app:destination="@id/nestedFragment"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</fragment>
<fragment
android:id="@+id/nestedFragment"
android:name="com.example.navtest.NestedFragment"
android:label="fragment_nested"
tools:layout="@layout/fragment_nested" >
<argument
android:name="foo"
android:defaultValue='"foo"'
app:argType="string" />
</fragment>
<action
android:id="@+id/action_global_nestedFragment"
app:destination="@id/nestedFragment" />
<include app:graph="@navigation/nav_home" />
</navigation>
The compilation error arises after including the nested graph. From this, the error is avoided by either commenting out the global <action> or the <include> tag.
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 4855906b13c3adf6bf85833ebf28c3bba74e5969
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Sep 26 12:44:33 2018
Detect <include> graphs as an included destination and not a nested one.
Even though included graphs can be considered nested graph, these are
not currently parsed by the plugin and end up being a stub destination.
This causes problems when there is a global action since a class will
be generated for the nested graph containing the global action, but
since the stub destination has no id nor name, the plugin fails.
This change adds a model, 'IncludedDestination' that represents an
included graph detected by the parser and is stored in a different set
within the containing Destination model. The included graph is not
further discovered. However, by treating it different than a nested
destination we avoid the issue described above. Moreover, this change
helps toward later supporting parsing included graphs.
Bug: 116542123
Test: ./gradlew \
:navigation:navigation-safe-args-gradle-plugin:test \
:navigation:navigation-safe-args-generator:test
Change-Id: I9eba5706e0209247a3a599f8e84d56d36b97938e
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Context.kt
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParser.kt
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParserErrors.kt
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/Destination.kt
A navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/IncludedDestination.kt
M navigation/safe-args-generator/src/tests/kotlin/androidx/navigation/safe/args/generator/InvalidXmlTest.kt
M navigation/safe-args-generator/src/tests/kotlin/androidx/navigation/safe/args/generator/NavParserTest.kt
A navigation/safe-args-generator/src/tests/test-data/invalid_xmls/invalid_include_graph_attr.xml
A navigation/safe-args-generator/src/tests/test-data/invalid_xmls/invalid_include_tag.xml
A navigation/safe-args-generator/src/tests/test-data/nested_include_login_test.xml
https://android-review.googlesource.com/769261
https://goto.google.com/android-sha1/4855906b13c3adf6bf85833ebf28c3bba74e5969
Branch: androidx-master-dev
commit 4855906b13c3adf6bf85833ebf28c3bba74e5969
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Sep 26 12:44:33 2018
Detect <include> graphs as an included destination and not a nested one.
Even though included graphs can be considered nested graph, these are
not currently parsed by the plugin and end up being a stub destination.
This causes problems when there is a global action since a class will
be generated for the nested graph containing the global action, but
since the stub destination has no id nor name, the plugin fails.
This change adds a model, 'IncludedDestination' that represents an
included graph detected by the parser and is stored in a different set
within the containing Destination model. The included graph is not
further discovered. However, by treating it different than a nested
destination we avoid the issue described above. Moreover, this change
helps toward later supporting parsing included graphs.
Bug: 116542123
Test: ./gradlew \
:navigation:navigation-safe-args-gradle-plugin:test \
:navigation:navigation-safe-args-generator:test
Change-Id: I9eba5706e0209247a3a599f8e84d56d36b97938e
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Context.kt
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParser.kt
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParserErrors.kt
M navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/Destination.kt
A navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/IncludedDestination.kt
M navigation/safe-args-generator/src/tests/kotlin/androidx/navigation/safe/args/generator/InvalidXmlTest.kt
M navigation/safe-args-generator/src/tests/kotlin/androidx/navigation/safe/args/generator/NavParserTest.kt
A navigation/safe-args-generator/src/tests/test-data/invalid_xmls/invalid_include_graph_attr.xml
A navigation/safe-args-generator/src/tests/test-data/invalid_xmls/invalid_include_tag.xml
A navigation/safe-args-generator/src/tests/test-data/nested_include_login_test.xml
il...@google.com <il...@google.com> #5
This is fixed and will be available in 1.0.0-alpha07
Description
Version used: 1.0.0-alpha06
After updating the safe-args plugin from alpha05 to alpha06, my build fails with the following stacktrace:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateSafeArgsDebug'
Caused by: java.lang.IllegalStateException: Destination with actions must have name
at androidx.navigation.safe.args.generator.NavWriterKt.generateDirectionsJavaFile(NavWriter.kt:419)
at androidx.navigation.safe.args.generator.NavSafeArgsGeneratorKt$generateSafeArgs$1.invoke(NavSafeArgsGenerator.kt:43)
at androidx.navigation.safe.args.generator.NavSafeArgsGeneratorKt$generateSafeArgs$1.invoke(NavSafeArgsGenerator.kt:55)
at androidx.navigation.safe.args.generator.NavSafeArgsGeneratorKt.generateSafeArgs(NavSafeArgsGenerator.kt:58)
at androidx.navigation.safeargs.gradle.ArgumentsGenerationTask.generateArgs(ArgumentsGenerationTask.kt:54)
at androidx.navigation.safeargs.gradle.ArgumentsGenerationTask.doFullTaskAction(ArgumentsGenerationTask.kt:90)
at androidx.navigation.safeargs.gradle.ArgumentsGenerationTask.taskAction$navigation_safe_args_gradle_plugin(ArgumentsGenerationTask.kt:79)
Reverting to alpha05 makes the build complete.
I think this is related to the commit addressing this issue:
My navigation graph has this structure:
<navigation>
<fragment>
<action />
<argument />
</fragment>
<include app:graph="@navigation/nav_graph_two" />
...
<action />
</navigation>
That is, there are global actions, fragment destinations with arguments, fragment destinations with actions and an included nested graph (in a separate xml). Every single destination has a valid name and every root <navigation> has an id (everything works with version alpha05 of the plugin). I might guess this is related with global actions, which expect the parent destination to have a name that is not resolved with the alpha06 update. In fact, commenting out all the global actions makes the generateSafeArgsDebug task pass. My graphs have ids in the form "@+id/nav_graph_one".