-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 초대할 친구 리사이클러뷰 adapter 연결 - 친구 선택/해제에 따른 처리 Related to: #347
- Loading branch information
Showing
6 changed files
with
113 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
.../namo/presentation/ui/community/moim/schedule/adapter/FriendInvitePreparatoryRVAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.mongmong.namo.presentation.ui.community.moim.schedule.adapter | ||
|
||
import android.annotation.SuppressLint | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.mongmong.namo.databinding.ItemFriendToInviteBinding | ||
import com.mongmong.namo.domain.model.Friend | ||
|
||
class FriendInvitePreparatoryRVAdapter: RecyclerView.Adapter<FriendInvitePreparatoryRVAdapter.ViewHolder>(){ | ||
|
||
private var friendList = emptyList<Friend>() | ||
private lateinit var mItemClickListener: MyItemClickListener | ||
|
||
fun setItemClickListener(itemClickListener: MyItemClickListener) { | ||
mItemClickListener = itemClickListener | ||
} | ||
|
||
@SuppressLint("NotifyDataSetChanged") | ||
fun addFriend(friendList: List<Friend>) { | ||
this.friendList = friendList | ||
notifyDataSetChanged() | ||
} | ||
|
||
interface MyItemClickListener { | ||
fun onDeleteBtnClick(position: Int) | ||
} | ||
|
||
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder { | ||
val binding: ItemFriendToInviteBinding = ItemFriendToInviteBinding.inflate( | ||
LayoutInflater.from(viewGroup.context), viewGroup, false | ||
) | ||
|
||
return ViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
holder.bind(friendList[position]) | ||
holder.apply { | ||
// 삭제 버튼 클릭 | ||
binding.imageDeleteBtn.setOnClickListener { | ||
mItemClickListener.onDeleteBtnClick(position) | ||
} | ||
} | ||
} | ||
|
||
override fun getItemCount(): Int = friendList.size | ||
|
||
inner class ViewHolder(val binding: ItemFriendToInviteBinding) : RecyclerView.ViewHolder(binding.root) { | ||
fun bind(friend: Friend) { | ||
binding.friend = friend | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters