android-architecture-navigation

How to perform custom navigation?

我们两清 提交于 2019-12-24 12:13:15
问题 I try to using new architecture component called navigation. It's very thrilling and make lesser code than using FragmentManager . Now, I ended up in a case where I have 5 fragments with navigation looks like this: A -> B -> C -> D -> E Sometime I have to move user from fragment A directly to E and if back button pressed, I want something like this: E -> D -> C -> B -> A But what I got now is: E -> A Is there any approachable way to make it happen? 回答1: OK! if you want to go from E -> A then

Android: Navigation Component not working with both: <navigation> and NavigationItemSelectedListener

安稳与你 提交于 2019-12-24 06:34:55
问题 What I have done: I have created Navigation Drawer Activity , As updated new format of Navigation Drawer Activity , As per new Android architecture I got it with Navigation Component structure. The NavigationView code with NavController and NavigationUI as below which is opening fragment when I click on any navigation item. DrawerLayout drawer = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); // Passing each menu ID as a set of Ids because each /

Navigation architecture: How to manage proper navigation without using clearTask as it is deprecated

梦想与她 提交于 2019-12-23 18:53:21
问题 While using navigation architecture as from here , here clearTask is deprecated. My scenario is this: There are 2 screens Login and Registration, both have links to each other. So you can go to Registration from Login and also Login from Registration. But on back Press App should be closed. It could simply be done by just adding clearTask to both actions as below. <?xml version="1.0" encoding="utf-8"?> <navigation xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/

Android Jetpack Navigation - Custom Action with Drawer Item

可紊 提交于 2019-12-23 09:07:39
问题 I am using the new Jetpack Android Navigation in combination with a Drawer Layout. Everything is working as expected when using the same IDs in the Drawer XML in combination with Fragments in the Navigation Graph. I set everything up with: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val navController = findNavController(R.id.navigation_host_fragment) setupActionBarWithNavController(navController, find(R.id.drawer_layout)) val navigationView =

How to create BottomSheetDialogFragment using Navigation Architecture Component?

六月ゝ 毕业季﹏ 提交于 2019-12-23 07:22:16
问题 I am using BottomSheetDialogFragment for displaying few custom setting's. Requirement: When i click on any tab in BottomSheetDialogFragment i replace the fragment and add it to backstack so that when user click's onBackPress or Up action it should go back the the last setting's fragment of BottomSheetDialogFragment. I want to use Navigation Architecture Component to simplify my transaction's. Issue: if i use Navigation Architecture Component to navigate from FragmentA to

How to create BottomSheetDialogFragment using Navigation Architecture Component?

故事扮演 提交于 2019-12-23 07:21:33
问题 I am using BottomSheetDialogFragment for displaying few custom setting's. Requirement: When i click on any tab in BottomSheetDialogFragment i replace the fragment and add it to backstack so that when user click's onBackPress or Up action it should go back the the last setting's fragment of BottomSheetDialogFragment. I want to use Navigation Architecture Component to simplify my transaction's. Issue: if i use Navigation Architecture Component to navigate from FragmentA to

Android Navigation Component navigate between graphs

老子叫甜甜 提交于 2019-12-23 04:40:58
问题 I've got two navigation graphs nav_graph_red and nav_graph_blue and two Activities ActivityRed and ActivityBlue . In each navigation graph I have a flow with 3 Fragments. redFragmentOne , redFragmentTwo , redFragmentThree and blueFragmentOne , blueFragmentTwo , blueFragmentThree Now I want to navigate from ActivityRed - redFragmentOne to the destination blueFragmentTwo . Is there a way to accomplish this? I tried it this way: Navigation.findNavController(ActivityBlue.newInstance(),R.id.host

Send argument through PendingIntent of NavDeepLinkBuilder

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 09:55:20
问题 I'm having some difficulties sending an argument through a PendingIntent of a notification using NavDeepLinkBuilder . I'm able to get the destination Activity to launch by clicking the notification, but the Activity 's Intent doesn't contain the argument value that I passed it through the NavDeepLinkBuilder . The Intent instead returns the defaultValue that I set in the nav graph - "noJobId". Notification creation : val notification = NotificationCompat.Builder(context, context.getString(R

Manifest marge error after migrating to androidX

南楼画角 提交于 2019-12-22 00:13:14
问题 Recently I have dived into learning new andoirdX artefacts including Android Architecture Components. After reading through the officials docs and a google code samples I have successfully added the necessary dependencies in both my project and app level Gradle files. They are as follows dependencies { classpath 'com.android.tools.build:gradle:3.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:

Navigation Component set transition animation programmatically

北城余情 提交于 2019-12-18 13:41:53
问题 yesterday i come across with a problem that i needed to set animation from nav_graph.xml in my baseFragment and programatically get action object from current node which includes enterAnim and exitAnim resource. Could not find solution here so here we go. First we need to feed anim folder with our animations in res folder because its hungry. slide_in_left.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:duration=