Improve contact pull-to-refresh performance.

This commit is contained in:
Greyson Parrelli
2022-10-27 15:06:45 -04:00
committed by Cody Henthorne
parent 2cfa685ae2
commit 4077dc829a
10 changed files with 229 additions and 89 deletions

View File

@@ -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

View File

@@ -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);