Browse Source
navigation fixes related to more tab
renovate/androidx.fragment-fragment-ktx-1.x
Austin Huang
4 years ago
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
4 changed files with
15 additions and
7 deletions
-
app/src/main/java/awais/instagrabber/activities/MainActivity.kt
-
app/src/main/java/awais/instagrabber/fragments/settings/MorePreferencesFragment.java
-
app/src/main/res/navigation/more_nav_graph.xml
-
app/src/main/res/navigation/settings_nav_graph.xml
|
|
@ -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()) |
|
|
|
|
|
@ -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; |
|
|
|
})); |
|
|
|
|
|
@ -14,6 +14,10 @@ |
|
|
|
android:id="@+id/action_to_settings" |
|
|
|
app:destination="@id/settings_nav_graph" /> |
|
|
|
|
|
|
|
<action |
|
|
|
android:id="@+id/action_to_discover" |
|
|
|
app:destination="@id/discover_nav_graph" /> |
|
|
|
|
|
|
|
<action |
|
|
|
android:id="@+id/action_to_about" |
|
|
|
app:destination="@id/aboutFragment" /> |
|
|
@ -517,6 +521,8 @@ |
|
|
|
|
|
|
|
<include app:graph="@navigation/settings_nav_graph" /> |
|
|
|
|
|
|
|
<include app:graph="@navigation/discover_nav_graph" /> |
|
|
|
|
|
|
|
<fragment |
|
|
|
android:id="@+id/storyListViewerFragment" |
|
|
|
android:name="awais.instagrabber.fragments.StoryListViewerFragment" |
|
|
|
|
|
@ -41,10 +41,6 @@ |
|
|
|
android:id="@+id/themePreferencesFragment" |
|
|
|
android:name="awais.instagrabber.fragments.settings.ThemePreferencesFragment" |
|
|
|
android:label="@string/theme_settings" /> |
|
|
|
<fragment |
|
|
|
android:id="@+id/favoritesFragment" |
|
|
|
android:name="awais.instagrabber.fragments.FavoritesFragment" |
|
|
|
android:label="@string/title_favorites" /> |
|
|
|
<fragment |
|
|
|
android:id="@+id/backupPreferencesFragment" |
|
|
|
android:name="awais.instagrabber.fragments.settings.BackupPreferencesFragment" |
|
|
|