Fix a regression when adding media to a reply

This commit is contained in:
Thomas 2022-10-09 12:03:08 +02:00
parent a14962d977
commit 99d2976993
2 changed files with 3 additions and 2 deletions

View File

@ -245,7 +245,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
statusList.addAll(0, context.ancestors); statusList.addAll(0, context.ancestors);
composeAdapter.setStatusCount(context.ancestors.size() + 1); composeAdapter.setStatusCount(context.ancestors.size() + 1);
composeAdapter.notifyItemRangeInserted(0, context.ancestors.size()); composeAdapter.notifyItemRangeInserted(0, context.ancestors.size());
// composeAdapter.notifyItemChanged(context.ancestors.size() + 1);
composeAdapter.notifyItemRangeChanged(0, statusList.size());
if (binding.recyclerView.getItemDecorationCount() > 0) { if (binding.recyclerView.getItemDecorationCount() > 0) {
for (int i = 0; i < binding.recyclerView.getItemDecorationCount(); i++) { for (int i = 0; i < binding.recyclerView.getItemDecorationCount(); i++) {
binding.recyclerView.removeItemDecorationAt(i); binding.recyclerView.removeItemDecorationAt(i);

View File

@ -397,6 +397,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
if (position == -1) { if (position == -1) {
position = statusList.size() - 1; position = statusList.size() - 1;
} }
// position = statusCount-1+position;
if (statusList.get(position).media_attachments == null) { if (statusList.get(position).media_attachments == null) {
statusList.get(position).media_attachments = new ArrayList<>(); statusList.get(position).media_attachments = new ArrayList<>();
} }
@ -1096,7 +1097,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
} else if (getItemViewType(position) == TYPE_COMPOSE) { } else if (getItemViewType(position) == TYPE_COMPOSE) {
Status statusDraft = statusList.get(position); Status statusDraft = statusList.get(position);
ComposeViewHolder holder = (ComposeViewHolder) viewHolder; ComposeViewHolder holder = (ComposeViewHolder) viewHolder;
boolean displayEmoji = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_EMOJI), false); boolean displayEmoji = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_EMOJI), false);