mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-09-15 08:20:18 +03:00
Limit the number of highlighted hashtags at the bottom of messages
This commit is contained in:
parent
fe5c59bdd0
commit
96ed973163
4 changed files with 22 additions and 0 deletions
|
@ -175,6 +175,8 @@ public class Status implements Serializable, Cloneable {
|
|||
public transient Spannable contentSpan;
|
||||
|
||||
public transient String[] bottomTags;
|
||||
|
||||
public boolean bottomTagsAllDisplayed = false;
|
||||
public transient Spannable contentSpoilerSpan;
|
||||
public transient Spannable contentTranslateSpan;
|
||||
public transient MathJaxView mathJaxView;
|
||||
|
|
|
@ -1520,7 +1520,22 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
if (statusToDeal.getBottomTags().length > 0) {
|
||||
holder.binding.statusHashtags.setVisibility(View.VISIBLE);
|
||||
holder.binding.statusHashtags.removeAllViews();
|
||||
int index = 0;
|
||||
for (String tag : statusToDeal.getBottomTags()) {
|
||||
if(!statusToDeal.bottomTagsAllDisplayed && index > 2 && statusToDeal.getBottomTags().length > 3) {
|
||||
Chip chip = new Chip(context);
|
||||
chip.setClickable(true);
|
||||
chip.setEnsureMinTouchTargetSize(false);
|
||||
int remaining = statusToDeal.getBottomTags().length - 3;
|
||||
chip.setText(context.getString(R.string.remaining_tags, remaining));
|
||||
chip.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorPrimary));
|
||||
chip.setOnClickListener(v -> {
|
||||
statusToDeal.bottomTagsAllDisplayed = true;
|
||||
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
|
||||
});
|
||||
holder.binding.statusHashtags.addView(chip);
|
||||
break;
|
||||
}
|
||||
Chip chip = new Chip(context);
|
||||
chip.setClickable(true);
|
||||
chip.setEnsureMinTouchTargetSize(false);
|
||||
|
@ -1539,6 +1554,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
});
|
||||
});
|
||||
holder.binding.statusHashtags.addView(chip);
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
holder.binding.statusHashtags.setVisibility(View.GONE);
|
||||
|
|
|
@ -2096,6 +2096,7 @@
|
|||
|
||||
<string name="truncate_links">Truncate links</string>
|
||||
<string name="underline_bottom_hashtags">Highlight bottom hashtags</string>
|
||||
<string name="remaining_tags">…and %d more</string>
|
||||
<string name="underline_links">Underline clickable elements</string>
|
||||
<string name="truncate_links_max">Max chars in links</string>
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Added:
|
||||
- Quote support for Mastodon
|
||||
|
||||
Changed:
|
||||
- Limit the number of highlighted hashtags at the bottom of messages
|
||||
|
||||
Fixed:
|
||||
- Fix a crash with threads
|
||||
- Fix empty Hashtags
|
Loading…
Reference in a new issue