Commit 96ed9731 authored by Thomas's avatar Thomas
Browse files

Limit the number of highlighted hashtags at the bottom of messages

parent fe5c59bd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;
+16 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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>

+3 −0
Original line number Diff line number Diff line
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
 No newline at end of file