Skip to content

Commit 0fa5cb3

Browse files
Rename items into folders in FolderAdapter
1 parent 50188f2 commit 0fa5cb3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/src/main/java/com/infomaniak/mail/ui/main/menu/FolderAdapter.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class FolderAdapter @Inject constructor(
4545
private val globalCoroutineScope: CoroutineScope,
4646
) : ListAdapter<Folder, FolderViewHolder>(FolderDiffCallback()) {
4747

48-
private inline val items: List<Folder> get() = currentList
48+
private inline val folders: List<Folder> get() = currentList
4949

5050
private var setFoldersJob: Job? = null
5151

@@ -87,7 +87,7 @@ class FolderAdapter @Inject constructor(
8787

8888
override fun onBindViewHolder(holder: FolderViewHolder, position: Int, payloads: MutableList<Any>) = runCatchingRealm {
8989
if (payloads.firstOrNull() == Unit) {
90-
val folder = items[position]
90+
val folder = folders[position]
9191
if (getItemViewType(position) == DisplayType.SELECTABLE_FOLDER.layout) {
9292
(holder.binding as ItemSelectableFolderBinding).root.setSelectedState(currentFolderId == folder.id)
9393
}
@@ -97,7 +97,7 @@ class FolderAdapter @Inject constructor(
9797
}.getOrDefault(Unit)
9898

9999
override fun onBindViewHolder(holder: FolderViewHolder, position: Int) = with(holder.binding) {
100-
val folder = items[position]
100+
val folder = folders[position]
101101

102102
root.tag = if (folder.shouldDisplayDivider) null else UiUtils.IGNORE_DIVIDER_TAG
103103

@@ -111,7 +111,7 @@ class FolderAdapter @Inject constructor(
111111
return if (isInMenuDrawer) DisplayType.MENU_DRAWER.layout else DisplayType.SELECTABLE_FOLDER.layout
112112
}
113113

114-
override fun getItemCount(): Int = runCatchingRealm { items.size }.getOrDefault(0)
114+
override fun getItemCount(): Int = runCatchingRealm { folders.size }.getOrDefault(0)
115115

116116
private fun UnreadFolderItemView.displayMenuDrawerFolder(folder: Folder) {
117117

@@ -226,7 +226,7 @@ class FolderAdapter @Inject constructor(
226226
}
227227

228228
private fun notifyCurrentItem(folderId: String) {
229-
val position = items.indexOfFirst { it.id == folderId }
229+
val position = folders.indexOfFirst { it.id == folderId }
230230
notifyItemChanged(position)
231231
}
232232

0 commit comments

Comments
 (0)