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
|
|
@ -3,10 +3,16 @@
|
|||
package com.keylesspalace.tusky.util
|
||||
|
||||
import android.text.Spanned
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.random.Random
|
||||
|
||||
private const val POSSIBLE_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
const val WORD_BREAK_EXPRESSION = """(^|$|[^\p{L}\p{N}_])"""
|
||||
const val WORD_BREAK_FROM_SPACE_EXPRESSION = """(^|$|\s)"""
|
||||
const val HASHTAG_EXPRESSION = "([\\w_]*[\\p{Alpha}_][\\w_]*)"
|
||||
val hashtagPattern = Pattern.compile(HASHTAG_EXPRESSION, Pattern.CASE_INSENSITIVE or Pattern.MULTILINE)
|
||||
|
||||
fun randomAlphanumericString(count: Int): String {
|
||||
val chars = CharArray(count)
|
||||
for (i in 0 until count) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue