Fix copy/paste

This commit is contained in:
Thomas 2023-01-15 18:38:26 +01:00
parent 97e15dd37f
commit 7751646d50
4 changed files with 11 additions and 10 deletions

View file

@ -731,18 +731,20 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
Status status = new Status(); Status status = new Status();
status.id = Helper.generateIdString(); status.id = Helper.generateIdString();
status.mentions = statusList.get(position).mentions; status.mentions = statusList.get(position - 1).mentions;
status.visibility = statusList.get(position).visibility; status.visibility = statusList.get(position - 1).visibility;
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this); final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this);
boolean unlistedReplies = sharedpreferences.getBoolean(getString(R.string.SET_UNLISTED_REPLIES), true); boolean unlistedReplies = sharedpreferences.getBoolean(getString(R.string.SET_UNLISTED_REPLIES), true);
if (status.visibility.equalsIgnoreCase("public") && unlistedReplies) { if (status.visibility.equalsIgnoreCase("public") && unlistedReplies) {
status.visibility = "unlisted"; status.visibility = "unlisted";
} }
status.spoiler_text = statusList.get(position).spoiler_text; status.spoiler_text = statusList.get(position - 1).spoiler_text;
status.sensitive = statusList.get(position).sensitive; status.sensitive = statusList.get(position - 1).sensitive;
statusList.add(status); statusList.add(status);
composeAdapter.notifyItemInserted(position + 1); composeAdapter.notifyItemInserted(position);
binding.recyclerView.smoothScrollToPosition(position + 1); composeAdapter.notifyItemRangeChanged(0, statusList.size());
binding.recyclerView.smoothScrollToPosition(statusList.size());
} }
@Override @Override

View file

@ -28,7 +28,6 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -119,7 +118,6 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
mediaFromProfile = b.getBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, false); mediaFromProfile = b.getBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, false);
status = (Status) b.getSerializable(Helper.ARG_STATUS); status = (Status) b.getSerializable(Helper.ARG_STATUS);
} }
Log.v(Helper.TAG, "mediaPosition: " + mediaPosition);
if (mediaFromProfile && mediaAttachmentProfile != null) { if (mediaFromProfile && mediaAttachmentProfile != null) {
attachments = new ArrayList<>(); attachments = new ArrayList<>();
attachments.addAll(mediaAttachmentProfile); attachments.addAll(mediaAttachmentProfile);

View file

@ -459,7 +459,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
holder.binding.addRemoveStatus.setIconResource(R.drawable.ic_compose_thread_add_status); holder.binding.addRemoveStatus.setIconResource(R.drawable.ic_compose_thread_add_status);
holder.binding.addRemoveStatus.setContentDescription(context.getString(R.string.add_status)); holder.binding.addRemoveStatus.setContentDescription(context.getString(R.string.add_status));
holder.binding.addRemoveStatus.setOnClickListener(v -> { holder.binding.addRemoveStatus.setOnClickListener(v -> {
manageDrafts.onItemDraftAdded(holder.getLayoutPosition()); manageDrafts.onItemDraftAdded(statusList.size());
buttonVisibility(holder); buttonVisibility(holder);
}); });
} }
@ -467,7 +467,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
holder.binding.addRemoveStatus.setIconResource(R.drawable.ic_compose_thread_add_status); holder.binding.addRemoveStatus.setIconResource(R.drawable.ic_compose_thread_add_status);
holder.binding.addRemoveStatus.setContentDescription(context.getString(R.string.add_status)); holder.binding.addRemoveStatus.setContentDescription(context.getString(R.string.add_status));
holder.binding.addRemoveStatus.setOnClickListener(v -> { holder.binding.addRemoveStatus.setOnClickListener(v -> {
manageDrafts.onItemDraftAdded(holder.getLayoutPosition()); manageDrafts.onItemDraftAdded(statusList.size());
buttonVisibility(holder); buttonVisibility(holder);
}); });
} }

View file

@ -3,5 +3,6 @@ Changed:
Fixed: Fixed:
- Fix crashes with pinch zoom - Fix crashes with pinch zoom
- Copy/Paste in threads
- Fix crash when checking redirection on http links - Fix crash when checking redirection on http links
- Displaying menu in media preview reset zoom - Displaying menu in media preview reset zoom