From 4a94426d38ccbe8690787c8f47da9169503b15ab Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 May 2021 12:52:21 +0200 Subject: [PATCH] Fix warning 1.5: 'sumBy((T) -> Int): Int' is deprecated --- .../matrix/android/sdk/internal/session/DefaultFileService.kt | 2 +- vector/src/main/java/im/vector/app/core/utils/FileUtils.kt | 2 +- .../home/room/detail/timeline/helper/MatrixItemColorProvider.kt | 2 +- .../im/vector/app/features/reactions/EmojiRecyclerAdapter.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt index 891858d857..a284d976d0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt @@ -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() { diff --git a/vector/src/main/java/im/vector/app/core/utils/FileUtils.kt b/vector/src/main/java/im/vector/app/core/utils/FileUtils.kt index fc9aa692b1..7ce6dd1c67 100644 --- a/vector/src/main/java/im/vector/app/core/utils/FileUtils.kt +++ b/vector/src/main/java/im/vector/app/core/utils/FileUtils.kt @@ -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() } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MatrixItemColorProvider.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MatrixItemColorProvider.kt index 0a9bf96a22..ed343d52ef 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MatrixItemColorProvider.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MatrixItemColorProvider.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt b/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt index 92bc21be25..1533ce7fdb 100644 --- a/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt +++ b/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt @@ -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?)