mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-08 07:57:28 +00:00
Wrap navigate calls with try catch to prevent double click exceptions. Closes austinhuang0131/barinsta#1132, austinhuang0131/barinsta#1150, austinhuang0131/barinsta#1156
This commit is contained in:
parent
627b1bfe76
commit
7658cacbc2
@ -613,7 +613,11 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
|
|||||||
bundle.putString("shortCode", media.getCode());
|
bundle.putString("shortCode", media.getCode());
|
||||||
bundle.putString("postId", media.getPk());
|
bundle.putString("postId", media.getPk());
|
||||||
bundle.putLong("postUserId", user.getPk());
|
bundle.putLong("postUserId", user.getPk());
|
||||||
|
try {
|
||||||
navController.navigate(R.id.action_global_commentsViewerFragment, bundle);
|
navController.navigate(R.id.action_global_commentsViewerFragment, bundle);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "setupComment: ", e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
binding.comment.setOnLongClickListener(v -> {
|
binding.comment.setOnLongClickListener(v -> {
|
||||||
Utils.displayToastAboveView(context, v, getString(R.string.comment));
|
Utils.displayToastAboveView(context, v, getString(R.string.comment));
|
||||||
|
@ -41,7 +41,7 @@ import awais.instagrabber.webservices.ServiceCallback;
|
|||||||
import static awais.instagrabber.utils.Utils.settingsHelper;
|
import static awais.instagrabber.utils.Utils.settingsHelper;
|
||||||
|
|
||||||
public class SavedCollectionsFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
|
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;
|
public static boolean pleaseRefresh = false;
|
||||||
|
|
||||||
private MainActivity fragmentActivity;
|
private MainActivity fragmentActivity;
|
||||||
@ -147,13 +147,16 @@ public class SavedCollectionsFragment extends Fragment implements SwipeRefreshLa
|
|||||||
if (isSaving) {
|
if (isSaving) {
|
||||||
setNavControllerResult(navController, topicCluster.getId());
|
setNavControllerResult(navController, topicCluster.getId());
|
||||||
navController.navigateUp();
|
navController.navigateUp();
|
||||||
}
|
} else {
|
||||||
else {
|
try {
|
||||||
final FragmentNavigator.Extras.Builder builder = new FragmentNavigator.Extras.Builder()
|
final FragmentNavigator.Extras.Builder builder = new FragmentNavigator.Extras.Builder()
|
||||||
.addSharedElement(cover, "collection-" + topicCluster.getId());
|
.addSharedElement(cover, "collection-" + topicCluster.getId());
|
||||||
final SavedCollectionsFragmentDirections.ActionSavedCollectionsFragmentToCollectionPostsFragment action = SavedCollectionsFragmentDirections
|
final SavedCollectionsFragmentDirections.ActionSavedCollectionsFragmentToCollectionPostsFragment action = SavedCollectionsFragmentDirections
|
||||||
.actionSavedCollectionsFragmentToCollectionPostsFragment(topicCluster, titleColor, backgroundColor);
|
.actionSavedCollectionsFragmentToCollectionPostsFragment(topicCluster, titleColor, backgroundColor);
|
||||||
navController.navigate(action, builder.build());
|
navController.navigate(action, builder.build());
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "setupTopics: ", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
binding.topicsRecyclerView.setAdapter(adapter);
|
binding.topicsRecyclerView.setAdapter(adapter);
|
||||||
|
@ -456,7 +456,7 @@ public class StoryViewerFragment extends Fragment {
|
|||||||
.setView(R.layout.dialog_opening_post)
|
.setView(R.layout.dialog_opening_post)
|
||||||
.create();
|
.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
mediaService.fetch(Long.valueOf(mediaId), new ServiceCallback<Media>() {
|
mediaService.fetch(Long.parseLong(mediaId), new ServiceCallback<Media>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(final Media feedModel) {
|
public void onSuccess(final Media feedModel) {
|
||||||
final PostViewV2Fragment fragment = PostViewV2Fragment
|
final PostViewV2Fragment fragment = PostViewV2Fragment
|
||||||
@ -1136,7 +1136,6 @@ public class StoryViewerFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void openProfile(final String username) {
|
private void openProfile(final String username) {
|
||||||
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
|
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
|
@ -139,7 +139,11 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh
|
|||||||
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
|
||||||
if (item.getItemId() == R.id.pending_requests) {
|
if (item.getItemId() == R.id.pending_requests) {
|
||||||
final NavDirections directions = DirectMessageInboxFragmentDirections.actionInboxToPendingInbox();
|
final NavDirections directions = DirectMessageInboxFragmentDirections.actionInboxToPendingInbox();
|
||||||
|
try {
|
||||||
NavHostFragment.findNavController(this).navigate(directions);
|
NavHostFragment.findNavController(this).navigate(directions);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "onOptionsItemSelected: ", e);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@ -251,7 +255,11 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh
|
|||||||
if (isAdded()) {
|
if (isAdded()) {
|
||||||
final DirectMessageInboxFragmentDirections.ActionInboxToThread directions = DirectMessageInboxFragmentDirections
|
final DirectMessageInboxFragmentDirections.ActionInboxToThread directions = DirectMessageInboxFragmentDirections
|
||||||
.actionInboxToThread(thread.getThreadId(), thread.getThreadTitle());
|
.actionInboxToThread(thread.getThreadId(), thread.getThreadTitle());
|
||||||
|
try {
|
||||||
NavHostFragment.findNavController(this).navigate(directions);
|
NavHostFragment.findNavController(this).navigate(directions);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "init: ", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
navigating = false;
|
navigating = false;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user