Skip to content

Commit 312241f

Browse files
committed
♻️ companion object 컨벤션에 맞게 위치 수정
1 parent bbcb4a2 commit 312241f

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

presentation/src/main/java/com/whyranoid/presentation/community/MyGroupAdapter.kt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@ import com.whyranoid.presentation.model.GroupInfoUiModel
1111
class MyGroupAdapter(private val onClickListener: (GroupInfoUiModel) -> Unit) :
1212
ListAdapter<GroupInfoUiModel, MyGroupAdapter.MyGroupViewHolder>(diffUtil) {
1313

14-
companion object {
15-
val diffUtil = object : DiffUtil.ItemCallback<GroupInfoUiModel>() {
16-
override fun areItemsTheSame(
17-
oldItem: GroupInfoUiModel,
18-
newItem: GroupInfoUiModel
19-
): Boolean =
20-
oldItem.groupId == newItem.groupId
21-
22-
override fun areContentsTheSame(
23-
oldItem: GroupInfoUiModel,
24-
newItem: GroupInfoUiModel
25-
): Boolean =
26-
oldItem == newItem
27-
}
28-
}
29-
3014
class MyGroupViewHolder(private val binding: MyGroupItemBinding) :
3115
RecyclerView.ViewHolder(binding.root) {
3216
fun bind(groupInfo: GroupInfoUiModel) {
@@ -51,4 +35,20 @@ class MyGroupAdapter(private val onClickListener: (GroupInfoUiModel) -> Unit) :
5135
bind(groupInfo = curItem)
5236
}
5337
}
38+
39+
companion object {
40+
val diffUtil = object : DiffUtil.ItemCallback<GroupInfoUiModel>() {
41+
override fun areItemsTheSame(
42+
oldItem: GroupInfoUiModel,
43+
newItem: GroupInfoUiModel
44+
): Boolean =
45+
oldItem.groupId == newItem.groupId
46+
47+
override fun areContentsTheSame(
48+
oldItem: GroupInfoUiModel,
49+
newItem: GroupInfoUiModel
50+
): Boolean =
51+
oldItem == newItem
52+
}
53+
}
5454
}

presentation/src/main/java/com/whyranoid/presentation/community/PostAdapter.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@ class PostAdapter(
2222

2323
private lateinit var myGroupList: List<GroupInfoUiModel>
2424

25-
companion object {
26-
val diffUtil = object : DiffUtil.ItemCallback<Post>() {
27-
override fun areItemsTheSame(oldItem: Post, newItem: Post) =
28-
oldItem.postId == newItem.postId
29-
30-
override fun areContentsTheSame(oldItem: Post, newItem: Post) =
31-
oldItem == newItem
32-
}
33-
34-
const val RECRUIT_POST_TYPE = 0
35-
const val RUNNING_POST_TYPE = 1
36-
}
37-
3825
abstract class PostViewHolder(binding: ViewDataBinding) :
3926
RecyclerView.ViewHolder(binding.root) {
4027
abstract fun bind(post: Post)
@@ -110,4 +97,17 @@ class PostAdapter(
11097
fun setMyGroupList(myGroupList: List<GroupInfoUiModel>) {
11198
this.myGroupList = myGroupList
11299
}
100+
101+
companion object {
102+
val diffUtil = object : DiffUtil.ItemCallback<Post>() {
103+
override fun areItemsTheSame(oldItem: Post, newItem: Post) =
104+
oldItem.postId == newItem.postId
105+
106+
override fun areContentsTheSame(oldItem: Post, newItem: Post) =
107+
oldItem == newItem
108+
}
109+
110+
const val RECRUIT_POST_TYPE = 0
111+
const val RUNNING_POST_TYPE = 1
112+
}
113113
}

0 commit comments

Comments
 (0)