Fix warning 1.5: 'sumBy((T) -> Int): Int' is deprecated

This commit is contained in:
Benoit Marty 2021-05-14 12:52:21 +02:00 committed by Benoit Marty
parent babbcedd87
commit 4a94426d38
4 changed files with 4 additions and 4 deletions

View File

@ -291,7 +291,7 @@ internal class DefaultFileService @Inject constructor(
Timber.v("Get size of ${it.absolutePath}")
true
}
.sumBy { it.length().toInt() }
.sumOf { it.length().toInt() }
}
override fun clearCache() {

View File

@ -131,5 +131,5 @@ fun getSizeOfFiles(root: File): Int {
Timber.v("Get size of ${it.absolutePath}")
true
}
.sumBy { it.length().toInt() }
.sumOf { it.length().toInt() }
}

View File

@ -66,7 +66,7 @@ class MatrixItemColorProvider @Inject constructor(
@ColorRes
private fun getColorFromRoomId(roomId: String?): Int {
return when ((roomId?.toList()?.sumBy { it.code } ?: 0) % 3) {
return when ((roomId?.toList()?.sumOf { it.code } ?: 0) % 3) {
1 -> R.color.riotx_avatar_fill_2
2 -> R.color.riotx_avatar_fill_3
else -> R.color.riotx_avatar_fill_1

View File

@ -221,7 +221,7 @@ class EmojiRecyclerAdapter @Inject constructor(
}
override fun getItemCount() = dataSource.rawData.categories
.sumBy { emojiCategory -> 1 /* Section */ + emojiCategory.emojis.size }
.sumOf { emojiCategory -> 1 /* Section */ + emojiCategory.emojis.size }
abstract class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
abstract fun bind(s: String?)