Skip to content

Commit 3c4660e

Browse files
committed
feat #9: add a view holder
1 parent 4ce1871 commit 3c4660e

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

Affirmations/.idea/workspace.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
11
package com.example.affirmations.adapter
22

3-
class ItemAdapter {
3+
import android.content.Context
4+
import android.view.View
5+
import android.view.ViewGroup
6+
import android.widget.TextView
7+
import androidx.recyclerview.widget.RecyclerView
8+
import com.example.affirmations.R
9+
10+
import com.example.affirmations.model.Affirmation
11+
12+
// pass the list of affirmations into the adapter and
13+
// context object instance that pass into an ItemAdapter instance.
14+
class ItemAdapter(private val context: Context, private val dataset: List<Affirmation>) :
15+
RecyclerView.Adapter<ItemAdapter.ItemViewHolder>() {
16+
17+
// creating view holder for ItemAdapter
18+
class ItemViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
19+
val textView: TextView = view.findViewById(R.id.item_title)
20+
}
21+
22+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
23+
TODO("Not yet implemented")
24+
}
25+
26+
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
27+
TODO("Not yet implemented")
28+
}
29+
30+
override fun getItemCount(): Int {
31+
TODO("Not yet implemented")
32+
}
433
}

0 commit comments

Comments
 (0)