From 1c09441c327d31c6a1ed8d193b3511c925e49569 Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Thu, 21 May 2020 18:32:22 +0200 Subject: [PATCH] Fix showing/hiding of preview cards in timeline posts that are collapsed for length. (#1796) Also properly places the preview card after the "collapse for length" button. --- .../keylesspalace/tusky/adapter/StatusBaseViewHolder.java | 6 +++++- app/src/main/res/layout/item_status.xml | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java index 3c03c03fa..eba803aec 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -973,7 +973,11 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder { } protected void setupCard(StatusViewData.Concrete status, CardViewMode cardViewMode) { - if (cardViewMode != CardViewMode.NONE && status.getAttachments().size() == 0 && status.getCard() != null && !TextUtils.isEmpty(status.getCard().getUrl())) { + if (cardViewMode != CardViewMode.NONE && + status.getAttachments().size() == 0 && + status.getCard() != null && + !TextUtils.isEmpty(status.getCard().getUrl()) && + !status.isCollapsed()) { final Card card = status.getCard(); cardView.setVisibility(View.VISIBLE); cardTitle.setText(card.getTitle()); diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index 37ddbbe46..a1447d2b7 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -168,7 +168,7 @@ android:minHeight="80dp" android:orientation="vertical" app:layout_constraintStart_toStartOf="@id/status_display_name" - app:layout_constraintTop_toBottomOf="@+id/status_content" + app:layout_constraintTop_toBottomOf="@+id/button_toggle_content" app:layout_constraintEnd_toEndOf="parent" tools:visibility="gone"> @@ -242,7 +242,7 @@ android:textSize="?attr/status_text_medium" android:visibility="gone" app:layout_constraintStart_toStartOf="@id/status_display_name" - app:layout_constraintTop_toBottomOf="@id/status_card_view" + app:layout_constraintTop_toBottomOf="@id/status_content" tools:text="@string/status_content_show_less" tools:visibility="visible" />