Add autocompletion for custom emoji (#1089)
* Remove unnecessary //noinspection ConstantConditions * Add autocompletion for custom emoji * Update MentionTagTokenizer tests for emoji autocomplete support * Move 1) emoji list retrieval notifying and 2) setting of emojiList field into setEmojiList() method of ComposeActivity * Convert RelativeLayout in item_autocomplete_emoji.xml to LinearLayout * Rename MentionTag* to Compose* * Improve emoji autocomplete matching * Make hashtag autocomplete results bold * Use Context.getString()'s built-in formatting * Add a divider between emoji autocomplete results that *start with* the token and those that *contain* it
This commit is contained in:
parent
d43b4fef4b
commit
10fcee4798
14 changed files with 232 additions and 38 deletions
|
@ -15,16 +15,16 @@
|
|||
|
||||
package com.keylesspalace.tusky
|
||||
|
||||
import com.keylesspalace.tusky.util.MentionTagTokenizer
|
||||
import com.keylesspalace.tusky.util.ComposeTokenizer
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
@RunWith(Parameterized::class)
|
||||
class MentionTagTokenizerTest(private val text: CharSequence,
|
||||
private val expectedStartIndex: Int,
|
||||
private val expectedEndIndex: Int) {
|
||||
class ComposeTokenizerTest(private val text: CharSequence,
|
||||
private val expectedStartIndex: Int,
|
||||
private val expectedEndIndex: Int) {
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
|
@ -50,12 +50,18 @@ class MentionTagTokenizerTest(private val text: CharSequence,
|
|||
arrayOf("#tusky", 0, 6),
|
||||
arrayOf("#@tusky", 7, 7),
|
||||
arrayOf("@#tusky", 7, 7),
|
||||
arrayOf(" @#tusky", 8, 8)
|
||||
arrayOf(" @#tusky", 8, 8),
|
||||
arrayOf(":mastodon", 0, 9),
|
||||
arrayOf(":@mastodon", 10, 10),
|
||||
arrayOf("@:mastodon", 10, 10),
|
||||
arrayOf(" @:mastodon", 11, 11),
|
||||
arrayOf("#@:mastodon", 11, 11),
|
||||
arrayOf(" #@:mastodon", 12, 12)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private val tokenizer = MentionTagTokenizer()
|
||||
private val tokenizer = ComposeTokenizer()
|
||||
|
||||
@Test
|
||||
fun tokenIndices_matchExpectations() {
|
Loading…
Add table
Add a link
Reference in a new issue