Skip to content

Commit

Permalink
[FIX/#2] 리사이클러뷰의 데이터 변경이 가능하도록 ArrayList 타입으로 선언
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeha committed Apr 20, 2023
1 parent e292f43 commit 1db0929
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
initRecyclerView(dataSet)
}

private fun initRecyclerView(dataSet: List<MultiViewItem>) {
private fun initRecyclerView(dataSet: ArrayList<MultiViewItem>) {
binding.rvRepo.apply {
adapter = MultiViewAdapter(dataSet)
layoutManager = LinearLayoutManager(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView

class MultiViewAdapter(
private val itemList: List<MultiViewItem>
private val itemList: ArrayList<MultiViewItem>
) : RecyclerView.Adapter<MultiViewHolder<MultiViewItem>>() {
private val multiViewHolderFactory = MultiViewHolderFactory()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import org.android.go.sopt.ui.main.home.adapter.MultiViewItem
import org.android.go.sopt.R

object DataSource {
fun loadDataSources(): List<MultiViewItem> {
val dataSet: MutableList<MultiViewItem> = mutableListOf()
fun loadDataSources(): ArrayList<MultiViewItem> {
val dataSet: ArrayList<MultiViewItem> = arrayListOf()
dataSet.add(MultiViewItem.TextItem("하은의 레포지토리"))
for (i in 1..10) {
for (i in 1..20) {
dataSet.add(
MultiViewItem.ImageItem(
R.drawable.ic_launcher_background,
Expand Down

0 comments on commit 1db0929

Please sign in to comment.