mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 10:51:27 +01:00
Add mentions for v2 group chats.
This commit is contained in:
committed by
Greyson Parrelli
parent
0bb9c1d650
commit
b2d4c5d14b
@@ -180,4 +180,21 @@ public final class StringUtil {
|
||||
.appendCodePoint(Bidi.PDI)
|
||||
.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims a {@link CharSequence} of starting and trailing whitespace. Behavior matches
|
||||
* {@link String#trim()} to preserve expectations around results.
|
||||
*/
|
||||
public static CharSequence trimSequence(CharSequence text) {
|
||||
int length = text.length();
|
||||
int startIndex = 0;
|
||||
|
||||
while ((startIndex < length) && (text.charAt(startIndex) <= ' ')) {
|
||||
startIndex++;
|
||||
}
|
||||
while ((startIndex < length) && (text.charAt(length - 1) <= ' ')) {
|
||||
length--;
|
||||
}
|
||||
return (startIndex > 0 || length < text.length()) ? text.subSequence(startIndex, length) : text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +176,10 @@ public class Util {
|
||||
return value != null ? value : "";
|
||||
}
|
||||
|
||||
public static @NonNull CharSequence emptyIfNull(@Nullable CharSequence value) {
|
||||
return value != null ? value : "";
|
||||
}
|
||||
|
||||
public static <E> List<List<E>> chunk(@NonNull List<E> list, int chunkSize) {
|
||||
List<List<E>> chunks = new ArrayList<>(list.size() / chunkSize);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user