mastodon-web-like trailing hashtag bar (#4761)
Rationale: Since the mastodon web UI has started stripping "trailing" hashtags from post content and shoving it into an ellipsized section at the bottom of posts, the general hashtag : content ratio is rising. This is an attempt at adopting a similar functionality for Tusky. Before: <img width="420" alt="Screenshot of a hashtag-heavy post on Tusky nightly" src="https://github.com/user-attachments/assets/09c286e8-6822-482a-904c-5cb3323ea0e1"> After: 
This commit is contained in:
parent
9fb4e03ba7
commit
d3feca3a10
9 changed files with 190 additions and 15 deletions
|
|
@ -121,6 +121,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
protected final ConstraintLayout statusContainer;
|
||||
private final TextView translationStatusView;
|
||||
private final Button untranslateButton;
|
||||
private final TextView trailingHashtagView;
|
||||
|
||||
|
||||
private final NumberFormat numberFormat = NumberFormat.getNumberInstance();
|
||||
|
|
@ -183,6 +184,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
|
||||
translationStatusView = itemView.findViewById(R.id.status_translation_status);
|
||||
untranslateButton = itemView.findViewById(R.id.status_button_untranslate);
|
||||
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);
|
||||
|
|
@ -284,7 +286,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
|
||||
if (expanded) {
|
||||
CharSequence emojifiedText = CustomEmojiHelper.emojify(content, emojis, this.content, statusDisplayOptions.animateEmojis());
|
||||
LinkHelper.setClickableText(this.content, emojifiedText, mentions, tags, listener);
|
||||
LinkHelper.setClickableText(this.content, emojifiedText, mentions, tags, listener, this.trailingHashtagView);
|
||||
for (int i = 0; i < mediaLabels.length; ++i) {
|
||||
updateMediaLabel(i, sensitive, true);
|
||||
}
|
||||
|
|
@ -295,6 +297,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
}
|
||||
} else {
|
||||
hidePoll();
|
||||
if (trailingHashtagView != null) {
|
||||
trailingHashtagView.setVisibility(View.GONE);
|
||||
}
|
||||
LinkHelper.setClickableMentions(this.content, mentions, listener);
|
||||
}
|
||||
if (TextUtils.isEmpty(this.content.getText())) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue