android-architecture-navigation

Android Jetpack Navigation How to handle the Toolbar and BottomNavBar content

陌路散爱 提交于 2021-02-07 11:21:49
问题 I am a bit confused on how the Navigation component fits in the app behavior. It all looks nice and shiny in tutorials where you don't do things too complex but when implementing in real app, things seem different. Before Navigation Before implementing navigation I had to manually run fragment transactions. In order to do this, my fragment would implement an interface onFragmentAction which passed a bundle to the main Activity and in the activity based on the actions, replace the current

NavDeepLinkBuilder destination ignored when app not in foreground

拈花ヽ惹草 提交于 2021-02-07 06:51:19
问题 I am using NavDeepLinkBuilder to generate a pending intent for a push notification to open the app at a particular destination. return NavDeepLinkBuilder(this) .setComponentName(MainActivity::class.java) .setGraph(R.navigation.main_navigation) .setDestination(destinationId) .setArguments(args) .createPendingIntent() When the app is in the foreground, the notification will navigate to the destination set in the pending intent built by the NavDeepLinkBuilder. 👍 However when the app is not in

Issue with Navigation Component Duplicate NavArgs

百般思念 提交于 2021-02-07 04:16:30
问题 I have a fragment: class SomeFragment { private val args by navArgs<SomeFragmentArgs>() } this fragment is used in two navigation graph: first_nav.xml .... <fragment android:id="@+id/initialFragment" android:name="com.example.InitialFragment" android:label="Initial Fragment"> <action android:id="@+id/action_to_some_fragment" app:destination="@id/someFragment" /> </fragment> <fragment android:id="@+id/someFragment" android:name="com.example.SomeFragment" android:label="Some Label"> <argument

Issue with Navigation Component Duplicate NavArgs

倾然丶 夕夏残阳落幕 提交于 2021-02-07 04:14:45
问题 I have a fragment: class SomeFragment { private val args by navArgs<SomeFragmentArgs>() } this fragment is used in two navigation graph: first_nav.xml .... <fragment android:id="@+id/initialFragment" android:name="com.example.InitialFragment" android:label="Initial Fragment"> <action android:id="@+id/action_to_some_fragment" app:destination="@id/someFragment" /> </fragment> <fragment android:id="@+id/someFragment" android:name="com.example.SomeFragment" android:label="Some Label"> <argument

Z-Index conflict when animating fragment transition using the Android Navigation component

允我心安 提交于 2021-02-07 03:44:27
问题 I'm trying to use Android Navigation instead of fragment transaction. There is one problem however which is starting to be cumbersome. Upon using a slide-in animation for the Enter Animation the new fragment goes beneath the current fragment. Be sure to check the following video to see the bug in action. https://youtu.be/gFnXiEyiypM The bug seems not to be from the Navigation component though the hacky solutions (this and this) which have been introduced for this specific problem doesn't seem

Z-Index conflict when animating fragment transition using the Android Navigation component

二次信任 提交于 2021-02-07 03:42:38
问题 I'm trying to use Android Navigation instead of fragment transaction. There is one problem however which is starting to be cumbersome. Upon using a slide-in animation for the Enter Animation the new fragment goes beneath the current fragment. Be sure to check the following video to see the bug in action. https://youtu.be/gFnXiEyiypM The bug seems not to be from the Navigation component though the hacky solutions (this and this) which have been introduced for this specific problem doesn't seem

Android Navigation library deep linking: How to synthesise backstack

南楼画角 提交于 2021-02-06 08:51:47
问题 Using Android Architecture's Navigation component, I have the following navigation graph -> [Home] -> [Articles List] -> [Specific Article] I also have a deeplink to [Specific Article] . When it is opened, navigating up currently goes to [Home] . I'd like to synthesise a backstack such that navigating up instead goes back to [Articles List] (and then on to [Home] if navigating again). What is the Navigation way of doing this? 回答1: Per the NavDeepLinkBuilder documentation, Navigation uses the

Android Navigation library deep linking: How to synthesise backstack

强颜欢笑 提交于 2021-02-06 08:49:35
问题 Using Android Architecture's Navigation component, I have the following navigation graph -> [Home] -> [Articles List] -> [Specific Article] I also have a deeplink to [Specific Article] . When it is opened, navigating up currently goes to [Home] . I'd like to synthesise a backstack such that navigating up instead goes back to [Articles List] (and then on to [Home] if navigating again). What is the Navigation way of doing this? 回答1: Per the NavDeepLinkBuilder documentation, Navigation uses the

How to create a custom fragment that extends NavHostFragment with it's own back stack?

ⅰ亾dé卋堺 提交于 2021-02-05 09:13:25
问题 I'm looking for a generic way to create my custom fragment with that has OnBackPressedCallback and viewModel that extends NavHostFragment using navigation graph i intend to put as child fragments into it's back stack. Normally i create NavHostFragment for each tab or fragment with their FragmentContainerView , it's easy but repetitive to create for each host with fragment_nav_host_home.xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android

How to create a custom fragment that extends NavHostFragment with it's own back stack?

吃可爱长大的小学妹 提交于 2021-02-05 09:02:19
问题 I'm looking for a generic way to create my custom fragment with that has OnBackPressedCallback and viewModel that extends NavHostFragment using navigation graph i intend to put as child fragments into it's back stack. Normally i create NavHostFragment for each tab or fragment with their FragmentContainerView , it's easy but repetitive to create for each host with fragment_nav_host_home.xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android