From 7dc195606cea98ea84c0c2fcb69f12df723b6839 Mon Sep 17 00:00:00 2001 From: sk Date: Sat, 31 Dec 2022 03:07:14 +0100 Subject: [PATCH] fix empty space when no text --- .../org/joinmastodon/android/fragments/ComposeFragment.java | 6 +++++- mastodon/src/main/res/layout/display_item_text.xml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index d8a31d655..cdb2374ac 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -33,6 +33,7 @@ import android.provider.OpenableColumns; import android.text.Editable; import android.text.InputFilter; import android.text.Layout; +import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; import android.text.TextWatcher; @@ -625,7 +626,10 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr ((TextView) view.findViewById(R.id.spoiler_title_inline)).setText(replyTo.spoilerText); } - ((LinkedTextView) view.findViewById(R.id.text)).setText(HtmlParser.parse(replyTo.content, replyTo.emojis, replyTo.mentions, replyTo.tags, accountID)); + SpannableStringBuilder content = HtmlParser.parse(replyTo.content, replyTo.emojis, replyTo.mentions, replyTo.tags, accountID); + LinkedTextView text = view.findViewById(R.id.text); + if (content.length() > 0) text.setText(content); + else view.findViewById(R.id.display_item_text).setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, V.dp(16))); replyText.setText(getString(R.string.in_reply_to, replyTo.account.displayName)); int visibilityNameRes = switch (replyTo.visibility) { diff --git a/mastodon/src/main/res/layout/display_item_text.xml b/mastodon/src/main/res/layout/display_item_text.xml index 08a3fe331..15907788e 100644 --- a/mastodon/src/main/res/layout/display_item_text.xml +++ b/mastodon/src/main/res/layout/display_item_text.xml @@ -1,6 +1,7 @@