Skip to content

Commit

Permalink
refactor : 아이템 클릭리스너 로직 실행 시점 명시
Browse files Browse the repository at this point in the history
  • Loading branch information
m6z1 committed Mar 10, 2024
1 parent 5490547 commit 1cb7f6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.dongyang.android.youdongknowme.data.remote.entity.Notice
import com.dongyang.android.youdongknowme.databinding.ItemNoticeBinding
import com.dongyang.android.youdongknowme.ui.viewholder.NoticeViewHolder

class NoticeAdapter(private val clickListener: (url: String) -> Unit) :
class NoticeAdapter(private val onItemClick: (url: String) -> Unit) :
RecyclerView.Adapter<NoticeViewHolder>() {

private val noticeList = arrayListOf<Notice>()
Expand All @@ -24,7 +24,7 @@ class NoticeAdapter(private val clickListener: (url: String) -> Unit) :
return NoticeViewHolder(
ItemNoticeBinding.inflate(
LayoutInflater.from(parent.context), parent, false
), clickListener
), onItemClick
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SearchFragment : BaseFragment<FragmentSearchBinding, SearchViewModel>() {
override fun initAfterBinding() = Unit

private fun setupUI() {
adapter = NoticeAdapter { url -> navigateToDetail(url) }
adapter = NoticeAdapter (onItemClick = { url -> navigateToDetail(url) })
binding.rvSearchResult.apply {
adapter = this@SearchFragment.adapter
layoutManager = LinearLayoutManager(requireActivity())
Expand Down

0 comments on commit 1cb7f6f

Please sign in to comment.