Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit bf23aacd166159c9d787688d013de6c9261e9ade
Author: Clara Fok <clarafok@google.com>
Date: Fri Oct 07 15:46:50 2022
Add NavType support for serializing a value
Previously users have to serialize a value of NavType separately outside of NavType class. This `NavType<T>.serializeAsValue` function provides default implementation for serialization as well as support for custom serialization during initialization of custom NavType.
Test: ./gradlew navigation:navigation-common:test
Bug: 247637434
Relnote: Added new NavType function to serialize a value of NavType into a String. The function can be override for custom serialization implementation.
Change-Id: Ie52134e58058b8b33b9b0810fab2b342dffb6ec9
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavTypeTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavType.kt
https://android-review.googlesource.com/2244017
Branch: androidx-main
commit bf23aacd166159c9d787688d013de6c9261e9ade
Author: Clara Fok <clarafok@google.com>
Date: Fri Oct 07 15:46:50 2022
Add NavType support for serializing a value
Previously users have to serialize a value of NavType separately outside of NavType class. This `NavType<T>.serializeAsValue` function provides default implementation for serialization as well as support for custom serialization during initialization of custom NavType.
Test: ./gradlew navigation:navigation-common:test
Bug: 247637434
Relnote: Added new NavType function to serialize a value of NavType into a String. The function can be override for custom serialization implementation.
Change-Id: Ie52134e58058b8b33b9b0810fab2b342dffb6ec9
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavTypeTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavType.kt
cl...@google.com <cl...@google.com> #3
This has been fixed internally and will be available in the Navigation 2.6.0-alpha04
release
na...@google.com <na...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.6.0-alpha04
Description
Component used: Navigation
Version used: 2.6.0-alpha01
Right now when providing a custom type half of the serialization/deserialization logic need to live in the
NavType
, but the other half, serializing the value into the route to callnavigate
with, is completely separate:and later
It would be nice if
NavType
could be the single source of truth for both sides of the equation, thus allowing you to write something like:And use it like:
By default, I think this method should just call
toString()
on the class. The one exception could beStringType
, which couldUri.encode()
for you.