1
0
Fork 0
mirror of https://github.com/KokaKiwi/BarInsta synced 2026-03-14 00:11:40 +00:00

navigation fixes related to more tab

This commit is contained in:
Austin Huang 2021-07-10 20:16:15 -04:00
parent db5f6b73fb
commit 114a0b090e
No known key found for this signature in database
GPG key ID: 84C23AA04587A91F
4 changed files with 15 additions and 7 deletions

View file

@ -340,7 +340,8 @@ class MainActivity : BaseLanguageActivity() {
it.startDestinationFragmentId
}.toMutableList().apply {
add(R.id.postViewFragment)
add(R.id.favoritesFragment)
add(R.id.favorites_non_top)
add(R.id.notifications_viewer_non_top)
add(R.id.profile_non_top)
}
if (setDefaultTabFromSettings) {
@ -356,7 +357,7 @@ class MainActivity : BaseLanguageActivity() {
rootNavGraph.id = R.id.root_nav_graph
rootNavGraph.label = "root_nav_graph"
rootNavGraph.addDestinations(topLevelDestinations)
rootNavGraph.setStartDestination(if (startNavRootId != 0) startNavRootId else R.id.profile_nav_graph)
rootNavGraph.startDestination = if (startNavRootId != 0) startNavRootId else R.id.profile_nav_graph
navController.graph = rootNavGraph
binding.bottomNavView.setupWithNavController(navController)
appBarConfiguration = AppBarConfiguration(currentTabs.map { it.startDestinationFragmentId }.toSet())

View file

@ -194,7 +194,12 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
if (showExplore) {
screen.addPreference(getPreference(R.string.title_discover, R.drawable.ic_explore_24, preference -> {
if (isSafeToNavigate(navController)) {
navController.navigate(R.id.discover_nav_graph);
try {
final NavDirections navDirections = MorePreferencesFragmentDirections.actionToDiscover();
navController.navigate(navDirections);
} catch (Exception e) {
Log.e(TAG, "setupPreferenceScreen: ", e);
}
}
return true;
}));