mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 04:28:35 +00:00
Improve contact pull-to-refresh performance.
This commit is contained in:
committed by
Cody Henthorne
parent
2cfa685ae2
commit
4077dc829a
@@ -91,4 +91,17 @@ inline fun <T> Cursor.readToList(predicate: (T) -> Boolean = { true }, mapper: (
|
||||
return list
|
||||
}
|
||||
|
||||
inline fun <T> Cursor.readToSet(predicate: (T) -> Boolean = { true }, mapper: (Cursor) -> T): Set<T> {
|
||||
val set = mutableSetOf<T>()
|
||||
use {
|
||||
while (moveToNext()) {
|
||||
val record = mapper(this)
|
||||
if (predicate(record)) {
|
||||
set += mapper(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
return set
|
||||
}
|
||||
|
||||
fun Boolean.toInt(): Int = if (this) 1 else 0
|
||||
|
||||
@@ -127,7 +127,7 @@ public final class Log {
|
||||
logger.e(tag, message, t, keepLonger);
|
||||
}
|
||||
|
||||
public static String tag(Class<?> clazz) {
|
||||
public static @NonNull String tag(Class<?> clazz) {
|
||||
String simpleName = clazz.getSimpleName();
|
||||
if (simpleName.length() > 23) {
|
||||
return simpleName.substring(0, 23);
|
||||
|
||||
Reference in New Issue
Block a user