Some fixes
This commit is contained in:
parent
6434b154b4
commit
578161d604
|
@ -111,7 +111,7 @@ public class BottomMenu implements Serializable {
|
|||
}
|
||||
|
||||
public static ItemMenuType getType(BottomMenu bottomMenu, int position) {
|
||||
if (bottomMenu == null || bottomMenu.bottom_menu == null || bottomMenu.bottom_menu.size() < position) {
|
||||
if (bottomMenu == null || bottomMenu.bottom_menu == null || bottomMenu.bottom_menu.size() <= position) {
|
||||
return null;
|
||||
}
|
||||
return bottomMenu.bottom_menu.get(position).item_menu_type;
|
||||
|
|
|
@ -2777,16 +2777,20 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
context.startActivity(intent, options.toBundle());
|
||||
});
|
||||
holder.bindingArt.artMedia.setOnClickListener(v -> {
|
||||
Intent mediaIntent = new Intent(context, MediaActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt(Helper.ARG_MEDIA_POSITION, 1);
|
||||
ArrayList<Attachment> attachments = new ArrayList<>();
|
||||
attachments.add(status.art_attachment);
|
||||
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
|
||||
mediaIntent.putExtras(b);
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat
|
||||
.makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url);
|
||||
context.startActivity(mediaIntent, options.toBundle());
|
||||
if (status.art_attachment != null) {
|
||||
Intent mediaIntent = new Intent(context, MediaActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt(Helper.ARG_MEDIA_POSITION, 1);
|
||||
ArrayList<Attachment> attachments = new ArrayList<>();
|
||||
attachments.add(status.art_attachment);
|
||||
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
|
||||
mediaIntent.putExtras(b);
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat
|
||||
.makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url);
|
||||
context.startActivity(mediaIntent, options.toBundle());
|
||||
} else {
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
holder.bindingArt.bottomBanner.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(context, ContextActivity.class);
|
||||
|
|
|
@ -753,7 +753,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
* @param direction - DIRECTION null if first call, then is set to TOP or BOTTOM depending of scroll
|
||||
*/
|
||||
private void routeCommon(DIRECTION direction, boolean fetchingMissing, Status status) {
|
||||
if (binding == null || getActivity() == null || !isAdded()) {
|
||||
if (binding == null || !isAdded() || getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
//Initialize with default params
|
||||
|
@ -964,7 +964,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
* @param direction - DIRECTION null if first call, then is set to TOP or BOTTOM depending of scroll
|
||||
*/
|
||||
private void route(DIRECTION direction, boolean fetchingMissing, Status statusToUpdate) {
|
||||
if (binding == null || getActivity() == null || !isAdded()) {
|
||||
if (binding == null || !isAdded() || getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
// --- HOME TIMELINE ---
|
||||
|
@ -1083,7 +1083,9 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
initializeStatusesCommonView(otherStatuses);
|
||||
}));
|
||||
} else {
|
||||
Toasty.error(requireActivity(), getString(R.string.toast_fetch_error), Toasty.LENGTH_LONG).show();
|
||||
if (isAdded() && !requireActivity().isFinishing()) {
|
||||
Toasty.error(requireActivity(), getString(R.string.toast_fetch_error), Toasty.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue