1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-24 23:57:30 +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 it.startDestinationFragmentId
}.toMutableList().apply { }.toMutableList().apply {
add(R.id.postViewFragment) 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) add(R.id.profile_non_top)
} }
if (setDefaultTabFromSettings) { if (setDefaultTabFromSettings) {
@ -356,7 +357,7 @@ class MainActivity : BaseLanguageActivity() {
rootNavGraph.id = R.id.root_nav_graph rootNavGraph.id = R.id.root_nav_graph
rootNavGraph.label = "root_nav_graph" rootNavGraph.label = "root_nav_graph"
rootNavGraph.addDestinations(topLevelDestinations) 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 navController.graph = rootNavGraph
binding.bottomNavView.setupWithNavController(navController) binding.bottomNavView.setupWithNavController(navController)
appBarConfiguration = AppBarConfiguration(currentTabs.map { it.startDestinationFragmentId }.toSet()) appBarConfiguration = AppBarConfiguration(currentTabs.map { it.startDestinationFragmentId }.toSet())

View File

@ -194,7 +194,12 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
if (showExplore) { if (showExplore) {
screen.addPreference(getPreference(R.string.title_discover, R.drawable.ic_explore_24, preference -> { screen.addPreference(getPreference(R.string.title_discover, R.drawable.ic_explore_24, preference -> {
if (isSafeToNavigate(navController)) { 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; return true;
})); }));

View File

@ -14,6 +14,10 @@
android:id="@+id/action_to_settings" android:id="@+id/action_to_settings"
app:destination="@id/settings_nav_graph" /> app:destination="@id/settings_nav_graph" />
<action
android:id="@+id/action_to_discover"
app:destination="@id/discover_nav_graph" />
<action <action
android:id="@+id/action_to_about" android:id="@+id/action_to_about"
app:destination="@id/aboutFragment" /> app:destination="@id/aboutFragment" />
@ -517,6 +521,8 @@
<include app:graph="@navigation/settings_nav_graph" /> <include app:graph="@navigation/settings_nav_graph" />
<include app:graph="@navigation/discover_nav_graph" />
<fragment <fragment
android:id="@+id/storyListViewerFragment" android:id="@+id/storyListViewerFragment"
android:name="awais.instagrabber.fragments.StoryListViewerFragment" android:name="awais.instagrabber.fragments.StoryListViewerFragment"

View File

@ -41,10 +41,6 @@
android:id="@+id/themePreferencesFragment" android:id="@+id/themePreferencesFragment"
android:name="awais.instagrabber.fragments.settings.ThemePreferencesFragment" android:name="awais.instagrabber.fragments.settings.ThemePreferencesFragment"
android:label="@string/theme_settings" /> android:label="@string/theme_settings" />
<fragment
android:id="@+id/favoritesFragment"
android:name="awais.instagrabber.fragments.FavoritesFragment"
android:label="@string/title_favorites" />
<fragment <fragment
android:id="@+id/backupPreferencesFragment" android:id="@+id/backupPreferencesFragment"
android:name="awais.instagrabber.fragments.settings.BackupPreferencesFragment" android:name="awais.instagrabber.fragments.settings.BackupPreferencesFragment"