From 390b3c384bf4fa73308a0209deb60b678d0634eb Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Tue, 6 Jul 2021 17:22:53 -0400 Subject: [PATCH] follow-up on merge (story directions) --- .../fragments/StoryViewerFragment.kt | 22 +++++++++---------- app/src/main/res/navigation/nav_graph.xml | 4 ++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.kt b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.kt index 40362e0c..13c965b4 100644 --- a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.kt +++ b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.kt @@ -31,7 +31,6 @@ import awais.instagrabber.R import awais.instagrabber.adapters.StoriesAdapter import awais.instagrabber.customviews.helpers.SwipeGestureListener import awais.instagrabber.databinding.FragmentStoryViewerBinding -import awais.instagrabber.fragments.main.ProfileFragment import awais.instagrabber.fragments.settings.PreferenceKeys import awais.instagrabber.interfaces.SwipeEvent import awais.instagrabber.models.Resource @@ -641,20 +640,19 @@ class StoryViewerFragment : Fragment() { actionBar.title = null actionBar.subtitle = null } - when (data.second) { + val action = when (data.second) { FavoriteType.USER -> { - bundle.putString("username", data.first) - navController.navigate(R.id.action_global_profileFragment, bundle) + StoryViewerFragmentDirections.actionToProfile().apply { this.username = data.first!! } } FavoriteType.HASHTAG -> { - bundle.putString("hashtag", data.first) - navController.navigate(R.id.action_global_hashTagFragment, bundle) + StoryViewerFragmentDirections.actionToHashtag(data.first!!) } FavoriteType.LOCATION -> { - bundle.putLong("locationId", data.first!!.toLong()) - navController.navigate(R.id.action_global_locationFragment, bundle) + StoryViewerFragmentDirections.actionToLocation(data.first!!.toLong()) } + else -> null } + navController.navigate(action!!) } private fun releasePlayer() { @@ -799,12 +797,12 @@ class StoryViewerFragment : Fragment() { } private fun shareStoryViaDm() { - val actionGlobalUserSearch = UserSearchFragmentDirections.actionGlobalUserSearch().apply { + val actionGlobalUserSearch = StoryViewerFragmentDirections.actionToUserSearch().apply { title = getString(R.string.share) - setActionLabel(getString(R.string.send)) + actionLabel = getString(R.string.send) showGroups = true multiple = true - setSearchMode(UserSearchFragment.SearchMode.RAVEN) + searchMode = UserSearchMode.RAVEN } try { val navController = NavHostFragment.findNavController(this@StoryViewerFragment) @@ -871,7 +869,7 @@ class StoryViewerFragment : Fragment() { val bundle = Bundle() bundle.putSerializable(PostViewV2Fragment.ARG_MEDIA, it.data) try { - navController.navigate(R.id.action_global_post_view, bundle) + navController.navigate(StoryViewerFragmentDirections.actionToPost(it.data, 0)) } catch (e: Exception) { Log.e(TAG, "openPostDialog: ", e) } diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index a14a2d24..2107acf6 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -93,6 +93,10 @@ + +