diff --git a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java index 2232a927..7a53ec2d 100644 --- a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java @@ -613,7 +613,11 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im bundle.putString("shortCode", media.getCode()); bundle.putString("postId", media.getPk()); bundle.putLong("postUserId", user.getPk()); - navController.navigate(R.id.action_global_commentsViewerFragment, bundle); + try { + navController.navigate(R.id.action_global_commentsViewerFragment, bundle); + } catch (Exception e) { + Log.e(TAG, "setupComment: ", e); + } }); binding.comment.setOnLongClickListener(v -> { Utils.displayToastAboveView(context, v, getString(R.string.comment)); diff --git a/app/src/main/java/awais/instagrabber/fragments/SavedCollectionsFragment.java b/app/src/main/java/awais/instagrabber/fragments/SavedCollectionsFragment.java index b7b0ed5c..880aae27 100644 --- a/app/src/main/java/awais/instagrabber/fragments/SavedCollectionsFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/SavedCollectionsFragment.java @@ -41,7 +41,7 @@ import awais.instagrabber.webservices.ServiceCallback; import static awais.instagrabber.utils.Utils.settingsHelper; public class SavedCollectionsFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener { - private static final String TAG = "SavedCollectionsFragment"; + private static final String TAG = SavedCollectionsFragment.class.getSimpleName(); public static boolean pleaseRefresh = false; private MainActivity fragmentActivity; @@ -147,13 +147,16 @@ public class SavedCollectionsFragment extends Fragment implements SwipeRefreshLa if (isSaving) { setNavControllerResult(navController, topicCluster.getId()); navController.navigateUp(); - } - else { - final FragmentNavigator.Extras.Builder builder = new FragmentNavigator.Extras.Builder() - .addSharedElement(cover, "collection-" + topicCluster.getId()); - final SavedCollectionsFragmentDirections.ActionSavedCollectionsFragmentToCollectionPostsFragment action = SavedCollectionsFragmentDirections - .actionSavedCollectionsFragmentToCollectionPostsFragment(topicCluster, titleColor, backgroundColor); - navController.navigate(action, builder.build()); + } else { + try { + final FragmentNavigator.Extras.Builder builder = new FragmentNavigator.Extras.Builder() + .addSharedElement(cover, "collection-" + topicCluster.getId()); + final SavedCollectionsFragmentDirections.ActionSavedCollectionsFragmentToCollectionPostsFragment action = SavedCollectionsFragmentDirections + .actionSavedCollectionsFragmentToCollectionPostsFragment(topicCluster, titleColor, backgroundColor); + navController.navigate(action, builder.build()); + } catch (Exception e) { + Log.e(TAG, "setupTopics: ", e); + } } }); binding.topicsRecyclerView.setAdapter(adapter); diff --git a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java index c13efdc1..a170a8a0 100644 --- a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java @@ -456,7 +456,7 @@ public class StoryViewerFragment extends Fragment { .setView(R.layout.dialog_opening_post) .create(); alertDialog.show(); - mediaService.fetch(Long.valueOf(mediaId), new ServiceCallback() { + mediaService.fetch(Long.parseLong(mediaId), new ServiceCallback() { @Override public void onSuccess(final Media feedModel) { final PostViewV2Fragment fragment = PostViewV2Fragment @@ -1136,7 +1136,6 @@ public class StoryViewerFragment extends Fragment { }); } - private void openProfile(final String username) { final ActionBar actionBar = fragmentActivity.getSupportActionBar(); if (actionBar != null) { diff --git a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java index bf13abb6..8c693374 100644 --- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java @@ -139,7 +139,11 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh public boolean onOptionsItemSelected(@NonNull final MenuItem item) { if (item.getItemId() == R.id.pending_requests) { final NavDirections directions = DirectMessageInboxFragmentDirections.actionInboxToPendingInbox(); - NavHostFragment.findNavController(this).navigate(directions); + try { + NavHostFragment.findNavController(this).navigate(directions); + } catch (Exception e) { + Log.e(TAG, "onOptionsItemSelected: ", e); + } return true; } return super.onOptionsItemSelected(item); @@ -251,7 +255,11 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh if (isAdded()) { final DirectMessageInboxFragmentDirections.ActionInboxToThread directions = DirectMessageInboxFragmentDirections .actionInboxToThread(thread.getThreadId(), thread.getThreadTitle()); - NavHostFragment.findNavController(this).navigate(directions); + try { + NavHostFragment.findNavController(this).navigate(directions); + } catch (Exception e) { + Log.e(TAG, "init: ", e); + } } navigating = false; });