From 16ef4513c69afd8bb51a4ec6fad69bce745b93d0 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 25 Jul 2022 17:25:05 +0200 Subject: [PATCH] Fix issue #241 - Don't force message to the character limit --- .../android/ui/drawer/ComposeAdapter.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java index 717d85fe..ccbe3cd0 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java @@ -30,6 +30,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.res.ColorStateList; import android.graphics.Bitmap; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; @@ -152,6 +153,7 @@ public class ComposeAdapter extends RecyclerView.Adapter statusList, ComposeAdapter composeAdapter, String instance, String user_id) { @@ -196,7 +198,7 @@ public class ComposeAdapter extends RecyclerView.Adapter 0) { //Retrieves mentioned accounts + OP and adds them at the beginin of the toot final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); - Mention inReplyToUser = null; + Mention inReplyToUser; inReplyToUser = statusDraft.mentions.get(0); if (statusDraft.text == null) { statusDraft.text = ""; @@ -481,9 +483,7 @@ public class ComposeAdapter extends RecyclerView.Adapter { - statusList.get(position).sensitive = isChecked; - }); + holder.binding.sensitiveMedia.setOnCheckedChangeListener((buttonView, isChecked) -> statusList.get(position).sensitive = isChecked); int mediaPosition = 0; for (Attachment attachment : attachmentList) { ComposeAttachmentItemBinding composeAttachmentItemBinding = ComposeAttachmentItemBinding.inflate(LayoutInflater.from(context), holder.binding.attachmentsList, false); @@ -658,8 +658,8 @@ public class ComposeAdapter extends RecyclerView.Adapter 0) { - Status statusDraft = statusList.get(holder.getAdapterPosition()); + if (holder.getBindingAdapterPosition() > 0) { + Status statusDraft = statusList.get(holder.getBindingAdapterPosition()); if (statusDraft.poll == null) { holder.binding.buttonAttachImage.setEnabled(true); holder.binding.buttonAttachVideo.setEnabled(true); @@ -729,7 +729,12 @@ public class ComposeAdapter extends RecyclerView.Adapter max_car + 1) { + if (currentLength > max_car) { + holder.binding.characterCount.setTextColor(Color.RED); + } else { + holder.binding.characterCount.setTextColor(holder.binding.content.getTextColors()); + } + /*if (currentLength > max_car + 1) { int from = max_car - holder.binding.contentSpoiler.getText().length(); int to = (currentLength - holder.binding.contentSpoiler.getText().length()); if (to <= s.length()) { @@ -739,13 +744,13 @@ public class ComposeAdapter extends RecyclerView.Adapter