Skip to content

Commit fe285f8

Browse files
committed
Diff callback when subject
1 parent af5f6ce commit fe285f8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

app/src/main/java/com/wstxda/switchai/ui/adapter/AssistantSelectorDiffCallback.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ import androidx.recyclerview.widget.DiffUtil
55
class AssistantSelectorDiffCallback : DiffUtil.ItemCallback<AssistantSelectorRecyclerView>() {
66
override fun areItemsTheSame(
77
oldItem: AssistantSelectorRecyclerView, newItem: AssistantSelectorRecyclerView
8-
): Boolean = when {
9-
oldItem is AssistantSelectorRecyclerView.AssistantSelector && newItem is AssistantSelectorRecyclerView.AssistantSelector -> oldItem.assistantItem.key == newItem.assistantItem.key
10-
11-
oldItem is AssistantSelectorRecyclerView.CategoryHeader && newItem is AssistantSelectorRecyclerView.CategoryHeader -> oldItem.title == newItem.title
12-
13-
oldItem is AssistantSelectorRecyclerView.ReorderTip && newItem is AssistantSelectorRecyclerView.ReorderTip -> true
14-
8+
): Boolean = when (oldItem) {
9+
is AssistantSelectorRecyclerView.AssistantSelector if newItem is AssistantSelectorRecyclerView.AssistantSelector -> oldItem.assistantItem.key == newItem.assistantItem.key
10+
is AssistantSelectorRecyclerView.CategoryHeader if newItem is AssistantSelectorRecyclerView.CategoryHeader -> oldItem.title == newItem.title
11+
is AssistantSelectorRecyclerView.ReorderTip if newItem is AssistantSelectorRecyclerView.ReorderTip -> true
1512
else -> false
1613
}
1714

0 commit comments

Comments
 (0)