From a120fcf068b1f432b1c10094f5cc8244e8da4f75 Mon Sep 17 00:00:00 2001 From: Balazs Toldi Date: Wed, 16 Aug 2023 08:11:23 +0200 Subject: [PATCH] Better post layout on post listing This commit fixes the issue where the user and community names had multiple line breaks in them if they were too long. I broke the instance part to a different textview with different colours. --- .../adapters/PostRecyclerViewAdapter.java | 105 ++++++-- .../customtheme/CustomThemeWrapper.java | 13 + .../layout/item_post_card_2_gallery_type.xml | 51 +++- .../main/res/layout/item_post_card_2_text.xml | 50 +++- .../item_post_card_2_video_autoplay.xml | 52 +++- ...ard_2_video_autoplay_legacy_controller.xml | 49 +++- .../layout/item_post_card_2_with_preview.xml | 52 +++- app/src/main/res/layout/item_post_compact.xml | 52 ++-- .../item_post_compact_right_thumbnail.xml | 52 ++-- .../res/layout/item_post_gallery_type.xml | 235 ++++++++-------- app/src/main/res/layout/item_post_text.xml | 250 ++++++++++-------- .../layout/item_post_video_type_autoplay.xml | 233 ++++++++-------- ..._video_type_autoplay_legacy_controller.xml | 232 ++++++++-------- .../res/layout/item_post_with_preview.xml | 233 ++++++++-------- 14 files changed, 1002 insertions(+), 657 deletions(-) diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/eu/toldi/infinityforlemmy/adapters/PostRecyclerViewAdapter.java index 3060dce5..a029e6d8 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/adapters/PostRecyclerViewAdapter.java @@ -61,6 +61,7 @@ import org.greenrobot.eventbus.EventBus; import java.util.ArrayList; import java.util.Locale; import java.util.concurrent.Executor; +import java.util.regex.Pattern; import javax.inject.Provider; @@ -539,8 +540,12 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter - + android:layout_height="match_parent"> + android:layout_height="24dp" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_gallery_type" + app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@+id/subreddit_name_text_view_item_post_card_2_gallery_type" + app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_card_2_gallery_type" /> + + + + - - + android:layout_height="match_parent"> + android:layout_height="24dp" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_text" + app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@+id/subreddit_name_text_view_item_post_card_2_text" + app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_card_2_text" /> - + + + - - + android:layout_height="match_parent"> + android:layout_height="24dp" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_video_autoplay" + app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@+id/subreddit_name_text_view_item_post_card_2_video_autoplay" + app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_card_2_video_autoplay" /> + + + + - - + android:layout_height="match_parent"> + android:layout_height="24dp" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_video_autoplay" + app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@+id/subreddit_name_text_view_item_post_card_2_video_autoplay" + app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_card_2_video_autoplay" /> - + + - - + android:layout_height="match_parent"> + android:layout_height="24dp" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_card_2_with_preview" + app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@+id/subreddit_name_text_view_item_post_card_2_with_preview" + app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_card_2_with_preview" /> + + + + - + + + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/name_text_view_item_post_compact" + app:layout_constraintTop_toTopOf="parent" /> - - - - + + + + + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/name_text_view_item_post_compact_right_thumbnail" + app:layout_constraintTop_toTopOf="parent" /> - - - - + + + app:layout_constraintHorizontal_bias="0" /> + + + + - - - - - + android:layout_height="match_parent"> - + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/flowLayout2" + app:layout_constraintTop_toTopOf="parent" /> - + android:padding="16dp" + app:flChildSpacing="16dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp"> - + - + - + - + - + - + - + + + + + + + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_text_type" + app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_text_type" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_text_type" + app:layout_constraintTop_toTopOf="parent" /> + + + + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_text_type" + app:layout_constraintTop_toBottomOf="@+id/subreddit_name_text_view_item_post_text_type" /> + + + - - - - - + android:layout_height="match_parent"> - + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/flowLayout" + app:layout_constraintTop_toTopOf="parent" /> - + android:padding="16dp" + app:flChildSpacing="16dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp"> - + - + - + - + - + - + - + + + + + + + + + + - - - - - + android:layout_height="match_parent"> - + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:padding="16dp" + app:flChildSpacing="16dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp"> - + - + - + - + - + - + - + + + + + + + + + + - - - - - + android:layout_height="match_parent"> - + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:padding="16dp" + app:flChildSpacing="16dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp"> - + - + - + - + - + - + - + + + + + + + app:layout_constraintHorizontal_bias="0" /> + + + + - - - - - + android:layout_height="match_parent"> - + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/flowLayout3" + app:layout_constraintTop_toTopOf="parent" /> - + android:padding="16dp" + app:flChildSpacing="16dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp"> - + - + - + - + - + - + - + + + + + +