mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-25 08:07:29 +00:00
Check navigation. Fixes https://github.com/austinhuang0131/barinsta/issues/380
This commit is contained in:
parent
043b0d50eb
commit
7005527150
@ -83,9 +83,12 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
||||
new FeedStoriesAdapter.OnFeedStoryClickListener() {
|
||||
@Override
|
||||
public void onFeedStoryClick(FeedStoryModel model, int position) {
|
||||
final NavController navController = NavHostFragment.findNavController(FeedFragment.this);
|
||||
if (isSafeToNavigate(navController)) {
|
||||
final NavDirections action = FeedFragmentDirections
|
||||
.actionFeedFragmentToStoryViewerFragment(StoryViewerOptions.forFeedStoryPosition(position));
|
||||
NavHostFragment.findNavController(FeedFragment.this).navigate(action);
|
||||
navController.navigate(action);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -437,4 +440,9 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
||||
binding.feedRecyclerView.smoothScrollToPosition(0);
|
||||
// binding.storiesContainer.setExpanded(true);
|
||||
}
|
||||
|
||||
private boolean isSafeToNavigate(final NavController navController) {
|
||||
return navController.getCurrentDestination() != null
|
||||
&& navController.getCurrentDestination().getId() == R.id.feedFragment;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user