Fix some crashes

This commit is contained in:
Thomas 2023-03-09 17:44:22 +01:00
parent 6a1a144ca3
commit 915841aa04
2 changed files with 15 additions and 14 deletions

View file

@ -1631,8 +1631,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
int finalMediaPosition = mediaPosition;
layoutMediaBinding.mediaVideo.setOnClickListener(v -> {
final int timeout = sharedpreferences.getInt(context.getString(R.string.SET_NSFW_TIMEOUT), 5);
if (status.sensitive && !expand_media) {
status.sensitive = false;
if (statusToDeal.sensitive && !expand_media) {
statusToDeal.sensitive = false;
int position = holder.getBindingAdapterPosition();
adapter.notifyItemChanged(position);
@ -1642,7 +1642,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
public void onFinish() {
status.sensitive = true;
statusToDeal.sensitive = true;
adapter.notifyItemChanged(position);
}
}.start();
@ -1652,15 +1652,15 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive;
statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
});
} else {
@ -1695,8 +1695,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
int finalMediaPosition = mediaPosition;
layoutMediaBinding.mediaVideo.setOnClickListener(v -> {
final int timeout = sharedpreferences.getInt(context.getString(R.string.SET_NSFW_TIMEOUT), 5);
if (status.sensitive && !expand_media) {
status.sensitive = false;
if (statusToDeal.sensitive && !expand_media) {
statusToDeal.sensitive = false;
int position = holder.getBindingAdapterPosition();
adapter.notifyItemChanged(position);
@ -1706,7 +1706,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
public void onFinish() {
status.sensitive = true;
statusToDeal.sensitive = true;
adapter.notifyItemChanged(position);
}
}.start();
@ -1716,15 +1716,15 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive;
statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
});
} else {

View file

@ -2,7 +2,7 @@ Added:
- Add a button to fetch remote media when it fails
- Add a settings to automatically fetch remote media when it fails (default: disabled)
- Display on profiles & list of accounts if users have requested to follow you
- Warn before boosting a message having no media description (default: enabled)
- Warn before boosting a message having no media descriptions (default: enabled)
Changed:
- Warn when there are missing descriptions enabled by default
@ -11,3 +11,4 @@ Fixed:
- Some settings not properly restored (multiple choices)
- Cancel a follow request
- Media with a lot of height in landscape
- Some crashes