|
@ -83,9 +83,12 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre |
|
|
new FeedStoriesAdapter.OnFeedStoryClickListener() { |
|
|
new FeedStoriesAdapter.OnFeedStoryClickListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onFeedStoryClick(FeedStoryModel model, int position) { |
|
|
public void onFeedStoryClick(FeedStoryModel model, int position) { |
|
|
|
|
|
final NavController navController = NavHostFragment.findNavController(FeedFragment.this); |
|
|
|
|
|
if (isSafeToNavigate(navController)) { |
|
|
final NavDirections action = FeedFragmentDirections |
|
|
final NavDirections action = FeedFragmentDirections |
|
|
.actionFeedFragmentToStoryViewerFragment(StoryViewerOptions.forFeedStoryPosition(position)); |
|
|
.actionFeedFragmentToStoryViewerFragment(StoryViewerOptions.forFeedStoryPosition(position)); |
|
|
NavHostFragment.findNavController(FeedFragment.this).navigate(action); |
|
|
|
|
|
|
|
|
navController.navigate(action); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -437,4 +440,9 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre |
|
|
binding.feedRecyclerView.smoothScrollToPosition(0); |
|
|
binding.feedRecyclerView.smoothScrollToPosition(0); |
|
|
// binding.storiesContainer.setExpanded(true); |
|
|
// binding.storiesContainer.setExpanded(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isSafeToNavigate(final NavController navController) { |
|
|
|
|
|
return navController.getCurrentDestination() != null |
|
|
|
|
|
&& navController.getCurrentDestination().getId() == R.id.feedFragment; |
|
|
|
|
|
} |
|
|
} |
|
|
} |