Status Update
Comments
il...@google.com <il...@google.com> #2
Once Navigation switches to AndroidX (post 1.0), we'll use FragmentFactory directly.
jo...@gmail.com <jo...@gmail.com> #3
Branch: androidx-master-dev
commit 1b215f0d93828286782776b9a12d2387097947f9
Author: Ian Lake <ilake@google.com>
Date: Sun Nov 25 21:45:56 2018
Move Fragment creation to FragmentNavigator
Provide an instantiateFragment() method on
FragmentNavigator which serves as the
centralized place to instantiate new
Fragment instances for FragmentNavigator.
Besides moving this business logic out of
the dumb POJO FragmentNavigator.Destination,
this also provides a future extension point
for integrating in FragmentFactory.
Test: existing tests passes, testapp still works
BUG: 119054429
Change-Id: If60471a704ef77bc35b30838e152a31cde8bc235
M navigation/fragment/ktx/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilderTest.kt
M navigation/fragment/ktx/src/main/java/androidx/navigation/fragment/FragmentNavigatorDestinationBuilder.kt
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
ka...@gmail.com <ka...@gmail.com> #4
However, in alpha08, you'll be able to subclass FragmentNavigator and override instantiateFragment(), calling into FragmentFactory if you're using AndroidX Fragment 1.1.0+. You'd also need to subclass NavHostFragment and override createFragmentNavigator() to return your custom FragmentNavigator subclass (or, if you're not using app:navGraph, you can set it via navHostFragment.navController.navigatorProvider += YourFragmentNavigator(context, navHostFragment.childFragmentManager)).
We'll keep this open until Navigation has moved to AndroidX and can directly use FragmentFactory as its default implementation of instantiateFragment().
[Deleted User] <[Deleted User]> #5
g....@gmail.com <g....@gmail.com> #6
For us is a major blocking feature and we don't want to proceed overriding all the necessary classes.
Thank you Ian and the rest of the navigation team.
ka...@gmail.com <ka...@gmail.com> #7
Branch: androidx-master-dev
commit 74c3760e428648d00249dc1d38865b7802f48a9a
Author: Ian Lake <ilake@google.com>
Date: Wed Mar 13 13:11:57 2019
Use FragmentFactory in FragmentNavigator
Rely on the FragmentManager's FragmentFactory
to instantiate Fragments created for
FragmentNavigator.
Test: new FragmentNavigatorTest
Fixes: 119054429
Change-Id: Icbeb2771e29cafdc52e4c4ea770ce89f739921d1
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
g....@gmail.com <g....@gmail.com> #8
al...@linguistica360.com <al...@linguistica360.com> #9
si...@gmail.com <si...@gmail.com> #10
Branch: androidx-master-dev
commit 3dd6d1fcdb3ffa7d4bd265a023f0ac7c94e14d19
Author: Ian Lake <ilake@google.com>
Date: Mon Mar 18 09:36:37 2019
Deprecate FragmentNavigator.instantiateFragment
Instead of providing a custom subclass of
FragmentNavigator, instantiation of Fragments
should be controlled by setting a custom
FragmentFactory, which is the default behavior
of instantiateFragment() now.
By deprecating the class, we ensure that
developers who were overriding this method
are informed of the changes and can change
their code to use FragmentFactory.
Test: ./gradlew checkApi
BUG: 119054429
Change-Id: Iff46919face98baa6dc62835ca3fc105d987d141
M navigation/fragment/api/2.1.0-alpha01.txt
M navigation/fragment/api/current.txt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
il...@google.com <il...@google.com>
al...@linguistica360.com <al...@linguistica360.com> #11
Do you know when this will be released?
il...@google.com <il...@google.com> #12
Re #11 - The public hotlist listed at the top of this bug says "androidx-navigation-2.4.0-alpha01" - that's the expected release.
ho...@gmail.com <ho...@gmail.com> #13
It seems this has been included in the
But is there any additional setup required besides updating the navigation dependencies? With the following dependencies on my project
object Navigation {
private const val version = "2.4.0-alpha01"
const val compose = "androidx.navigation:navigation-compose:$version"
const val fragment = "androidx.navigation:navigation-fragment-ktx:$version"
const val safeArgsPlugin = "androidx.navigation:navigation-safe-args-gradle-plugin:$version"
const val ui = "androidx.navigation:navigation-ui-ktx:$version"
}
my safeargs don't generate fromSavedStateHandle()
.
fromBundle()
is still the only auto-complete suggestion.
FooFragmentArgs.fromSavedStateHandle(savedStateHandle)
is an unresolved reference in my ViewModel.
ok...@gmail.com <ok...@gmail.com> #14
Android Studio : 4.2.1
com.android.tools.build:gradle:4.2.1
androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0-alpha01
Is there any thing we can do about this?
il...@google.com <il...@google.com> #15
Re #13, #14 - please upgrade to the latest version of Android Studio and file a bug against Android Studio if you are still not seeing this method in the Studio generated light classes.
ho...@gmail.com <ho...@gmail.com> #16
I'm using Arctic Fox | 2020.3.1 Canary 9. I've just updated Navigation to 2.4.0-alpha02 and still seeing the bug, so I've filed a bug against AS.
ho...@gmail.com <ho...@gmail.com> #17
As mentioned in the linked issue, manually downloading the latest version of Android Studio Preview fixes the issue
Description
androidx.navigation:navigation-safe-args-gradle-plugin:2.0.0
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha02
Allow SafeArgs to be created `fromSavedStateHandle` as one would from a bundle.