Помогите разобраться с навигацией в android-приложении
MainActivity.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.appBarMain.toolbar);
DrawerLayout drawer = binding.drawerLayout;
NavigationView navigationView = binding.navView;
navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
AppBarConfiguration mAppBarConfiguration = new AppBarConfiguration.Builder(
navController.getGraph())
.setOpenableLayout(drawer)
.build();
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
queue = Volley.newRequestQueue(getApplicationContext());
getSupportActionBar().hide();
}
mobile_navigation.xml
<?xml version="1.0" encoding="utf-8"?>
<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/mobile_navigation"
app:startDestination="@+id/welcome">
<navigation android:id="@+id/welcome"
app:startDestination="@id/loginFragment">
<fragment
android:id="@+id/preloader"
android:name="ru.amgcompany.topcoal_2.ui.home.HomeFragment"
android:label="@string/menu_home"
tools:layout="@layout/fragment_home">
<action
android:id="@+id/action_preloader_to_loginFragment"
app:destination="@id/loginFragment" />
<action
android:id="@+id/action_preloader_to_registrationFragment"
app:destination="@id/registrationFragment" />
</fragment>
<fragment
android:id="@+id/registrationFragment"
android:name="ru.amgcompany.topcoal_2.ui.registration.RegistrationFragment"
android:label="fragment_registration"
tools:layout="@layout/fragment_registration">
<action
android:id="@+id/action_registrationFragment_to_loginFragment"
app:destination="@id/loginFragment" />
</fragment>
<fragment
android:id="@+id/loginFragment"
android:name="ru.amgcompany.topcoal_2.ui.login.LoginFragment"
android:label="fragment_login"
tools:layout="@layout/fragment_login">
<action
android:id="@+id/action_loginFragment_to_registrationFragment"
app:destination="@id/registrationFragment" />
<action
android:id="@+id/action_loginFragment_to_main"
app:destination="@id/nav_gallery" />
</fragment>
<action
android:id="@+id/action_global_welcome_to_main"
app:destination="@id/main"
app:popUpTo="@+id/nav_gallery"
/>
</navigation>
<navigation android:id="@+id/main"
app:startDestination="@id/fragment_gallery">
<fragment
android:id="@+id/fragment_gallery"
android:name="ru.amgcompany.topcoal_2.ui.gallery.GalleryFragment"
android:label="@string/menu_gallery"
tools:layout="@layout/fragment_gallery" >
<action
android:id="@+id/action_nav_gallery_to_viewOrderFragment"
app:destination="@id/viewOrderFragment" />
<action
android:id="@+id/action_nav_gallery_to_createOrderFragment"
app:destination="@id/createOrderFragment" />
</fragment>
<fragment
android:id="@+id/viewOrderFragment"
android:name="ru.amgcompany.topcoal_2.ViewOrderFragment"
android:label="fragment_view_order"
tools:layout="@layout/fragment_view_order" >
<action
android:id="@+id/action_viewOrderFragment_to_createOrderFragment"
app:destination="@id/createOrderFragment" />
</fragment>
<fragment
android:id="@+id/createOrderFragment"
android:name="ru.amgcompany.topcoal_2.CreateOrderFragment"
android:label="fragment_create_order"
tools:layout="@layout/fragment_create_order" >
<action
android:id="@+id/action_createOrderFragment_to_nav_gallery"
app:destination="@id/nav_gallery" />
<action
android:id="@+id/action_createOrderFragment_to_viewOrderFragment"
app:destination="@id/viewOrderFragment" />
</fragment>
</navigation>
</navigation>
Не могу понять, что нужно скармливать mAppBarConfiguration, чтобы у меня в меню-гамбургере был только второй граф?
Ошибок нет, но меню не появляется.
Пробовал и по id графа отправлять, и набор фрагментов.
Если ошибка в xml - кните, как надо, пожалуйста, а то уже все остатки мозга сломал =(