Skip to content

Commit

Permalink
Embed trailing tag view in a horizontal scrollview
Browse files Browse the repository at this point in the history
  • Loading branch information
Tak committed Nov 15, 2024
1 parent 59a6bd1 commit 9a98a6b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected StatusBaseViewHolder(@NonNull View itemView) {

translationStatusView = itemView.findViewById(R.id.status_translation_status);
untranslateButton = itemView.findViewById(R.id.status_button_untranslate);
trailingHashtagView = itemView.findViewById(R.id.status_trailing_hashtags);
trailingHashtagView = itemView.findViewById(R.id.status_trailing_hashtags_content);

this.avatarRadius48dp = itemView.getContext().getResources().getDimensionPixelSize(R.dimen.avatar_radius_48dp);
this.avatarRadius36dp = itemView.getContext().getResources().getDimensionPixelSize(R.dimen.avatar_radius_36dp);
Expand Down
24 changes: 17 additions & 7 deletions app/src/main/res/layout/item_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,25 +338,35 @@
app:layout_constraintTop_toBottomOf="@id/status_poll_button"
tools:text="7 votes • 7 hours remaining" />

<com.keylesspalace.tusky.view.ClickableSpanTextView
android:id="@+id/status_trailing_hashtags"
<HorizontalScrollView
android:id="@+id/status_trailing_hashtags_scroll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="14dp"
android:scrollbars="none"
app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_poll_description"
app:layout_constraintEnd_toEndOf="parent"
>

<com.keylesspalace.tusky.view.ClickableSpanTextView
android:id="@+id/status_trailing_hashtags_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hyphenationFrequency="full"
android:importantForAccessibility="no"
android:textColor="?android:textColorPrimary"
android:textIsSelectable="true"
android:textSize="?attr/status_text_medium"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="none"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_poll_description"
app:layout_constraintStart_toStartOf="parent"
tools:text="#one #two #three #four #five #six #seven #eight #nine #ten" />

</HorizontalScrollView>

<ImageButton
android:id="@+id/status_reply"
style="@style/TuskyImageButton"
Expand All @@ -369,7 +379,7 @@
app:layout_constraintEnd_toStartOf="@id/status_inset"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="@id/status_display_name"
app:layout_constraintTop_toBottomOf="@id/status_trailing_hashtags"
app:layout_constraintTop_toBottomOf="@id/status_trailing_hashtags_scroll"
app:srcCompat="@drawable/ic_reply_24dp"
tools:ignore="NegativeMargin" />

Expand Down
37 changes: 24 additions & 13 deletions app/src/main/res/layout/item_status_detailed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,24 +295,35 @@
app:layout_constraintTop_toBottomOf="@id/status_poll_button"
tools:text="7 votes • 7 hours remaining" />

<com.keylesspalace.tusky.view.ClickableSpanTextView
android:id="@+id/status_trailing_hashtags"
<HorizontalScrollView
android:id="@+id/status_trailing_hashtags_scroll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="14dp"
android:hyphenationFrequency="full"
android:importantForAccessibility="no"
android:textColor="?android:textColorPrimary"
android:textIsSelectable="true"
android:textSize="?attr/status_text_medium"
android:singleLine="true"
android:scrollHorizontally="true"
app:layout_constraintEnd_toEndOf="parent"
android:scrollbars="none"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_poll_description"
tools:text="#one #two #three #four #five #six #seven #eight #nine #ten" />
app:layout_constraintEnd_toEndOf="parent"
>

<com.keylesspalace.tusky.view.ClickableSpanTextView
android:id="@+id/status_trailing_hashtags_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hyphenationFrequency="full"
android:importantForAccessibility="no"
android:textColor="?android:textColorPrimary"
android:textIsSelectable="true"
android:textSize="?attr/status_text_medium"
android:singleLine="true"
android:ellipsize="none"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="#one #two #three #four #five #six #seven #eight #nine #ten" />

</HorizontalScrollView>

<TextView
android:id="@+id/status_meta_info"
Expand All @@ -328,7 +339,7 @@
android:textSize="?attr/status_text_medium"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_trailing_hashtags"
app:layout_constraintTop_toBottomOf="@id/status_trailing_hashtags_scroll"
tools:text="21 Dec 2018 18:45" />

<View
Expand Down

0 comments on commit 9a98a6b

Please sign in to comment.