This commit is contained in:
Thomas 2022-10-05 17:48:09 +02:00
parent 68f779c943
commit 63a5423d7d

View file

@ -763,11 +763,9 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
public void run() { public void run() {
String fedilabHugsTrigger = ":fedilab_hugs:"; String fedilabHugsTrigger = ":fedilab_hugs:";
String fedilabMorseTrigger = ":fedilab_morse:"; String fedilabMorseTrigger = ":fedilab_morse:";
if (s.toString().contains(fedilabHugsTrigger)) { if (s.toString().contains(fedilabHugsTrigger)) {
newContent[0] = s.toString().replaceAll(fedilabHugsTrigger, ""); newContent[0] = s.toString().replaceAll(Pattern.quote(fedilabHugsTrigger), "").trim();
int toFill = 500 - newContent[0].length();
int toFill = 500 - currentLength;
if (toFill <= 0) { if (toFill <= 0) {
return; return;
} }
@ -782,6 +780,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
newContent[0] = newContent[0] + hugs; newContent[0] = newContent[0] + hugs;
holder.binding.content.setText(newContent[0]); holder.binding.content.setText(newContent[0]);
holder.binding.content.setSelection(holder.binding.content.getText().length()); holder.binding.content.setSelection(holder.binding.content.getText().length());
statusList.get(holder.getBindingAdapterPosition()).text = newContent[0];
autocomplete = false; autocomplete = false;
updateCharacterCount(holder); updateCharacterCount(holder);
}; };
@ -826,6 +825,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
Runnable myRunnable = () -> { Runnable myRunnable = () -> {
holder.binding.content.setText(newContent[0]); holder.binding.content.setText(newContent[0]);
statusList.get(holder.getBindingAdapterPosition()).text = newContent[0];
holder.binding.content.setSelection(holder.binding.content.getText().length()); holder.binding.content.setSelection(holder.binding.content.getText().length());
autocomplete = false; autocomplete = false;
updateCharacterCount(holder); updateCharacterCount(holder);