mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Only allow emojis as reactions.
This commit is contained in:
@@ -6,6 +6,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.text.BidiFormatter;
|
||||
|
||||
import org.signal.core.util.BreakIteratorCompat;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -265,4 +267,13 @@ public final class StringUtil {
|
||||
int end = (maxChars - 1) - start;
|
||||
return text.subSequence(0, start) + "…" + text.subSequence(text.length() - end, text.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of graphemes in the provided string.
|
||||
*/
|
||||
public static int getGraphemeCount(@NonNull CharSequence text) {
|
||||
BreakIteratorCompat iterator = BreakIteratorCompat.getInstance();
|
||||
iterator.setText(text);
|
||||
return iterator.countBreaks();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user