|
@@ -5,29 +5,19 @@ import androidx.fragment.app.Fragment
|
|
import android.view.LayoutInflater
|
|
import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
|
|
+import androidx.recyclerview.widget.LinearLayoutManager
|
|
import com.sambath.kunkhmer.R
|
|
import com.sambath.kunkhmer.R
|
|
|
|
+import com.sambath.kunkhmer.adapter.LivesAdapter
|
|
|
|
+import com.sambath.kunkhmer.adapter.LivesCardItem
|
|
|
|
+import kotlinx.android.synthetic.main.fragment_event.view.recyclerViewEvent
|
|
|
|
+import kotlinx.android.synthetic.main.fragment_lives.view.recyclerViewLives
|
|
|
|
|
|
-// TODO: Rename parameter arguments, choose names that match
|
|
|
|
-// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
|
|
|
-private const val ARG_PARAM1 = "param1"
|
|
|
|
-private const val ARG_PARAM2 = "param2"
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * A simple [Fragment] subclass.
|
|
|
|
- * Use the [LivesFragment.newInstance] factory method to
|
|
|
|
- * create an instance of this fragment.
|
|
|
|
- */
|
|
|
|
class LivesFragment : Fragment() {
|
|
class LivesFragment : Fragment() {
|
|
- // TODO: Rename and change types of parameters
|
|
|
|
- private var param1: String? = null
|
|
|
|
- private var param2: String? = null
|
|
|
|
|
|
+ private var _root: View? = null
|
|
|
|
+ private val binding get() = _root!!
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
super.onCreate(savedInstanceState)
|
|
- arguments?.let {
|
|
|
|
- param1 = it.getString(ARG_PARAM1)
|
|
|
|
- param2 = it.getString(ARG_PARAM2)
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
override fun onCreateView(
|
|
override fun onCreateView(
|
|
@@ -35,26 +25,32 @@ class LivesFragment : Fragment() {
|
|
savedInstanceState: Bundle?
|
|
savedInstanceState: Bundle?
|
|
): View? {
|
|
): View? {
|
|
// Inflate the layout for this fragment
|
|
// Inflate the layout for this fragment
|
|
- return inflater.inflate(R.layout.fragment_lives, container, false)
|
|
|
|
|
|
+ _root = inflater.inflate(R.layout.fragment_lives, container, false)
|
|
|
|
+
|
|
|
|
+ setEvent()
|
|
|
|
+
|
|
|
|
+ return binding
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun setEvent() {
|
|
|
|
+ val recyclerView = binding.recyclerViewLives
|
|
|
|
+ val cardList = createCardList() // Create your card data list here
|
|
|
|
+ val cardAdapter = LivesAdapter(cardList)
|
|
|
|
+
|
|
|
|
+ recyclerView.layoutManager =
|
|
|
|
+ LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
|
|
|
+ recyclerView.adapter = cardAdapter
|
|
}
|
|
}
|
|
|
|
|
|
- companion object {
|
|
|
|
- /**
|
|
|
|
- * Use this factory method to create a new instance of
|
|
|
|
- * this fragment using the provided parameters.
|
|
|
|
- *
|
|
|
|
- * @param param1 Parameter 1.
|
|
|
|
- * @param param2 Parameter 2.
|
|
|
|
- * @return A new instance of fragment LivesFragment.
|
|
|
|
- */
|
|
|
|
- // TODO: Rename and change types and number of parameters
|
|
|
|
- @JvmStatic
|
|
|
|
- fun newInstance(param1: String, param2: String) =
|
|
|
|
- LivesFragment().apply {
|
|
|
|
- arguments = Bundle().apply {
|
|
|
|
- putString(ARG_PARAM1, param1)
|
|
|
|
- putString(ARG_PARAM2, param2)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ private fun createCardList(): List<LivesCardItem> {
|
|
|
|
+ // Create and return your list of CardItems
|
|
|
|
+ return listOf(
|
|
|
|
+ LivesCardItem(R.drawable.ic_bg_dashboard, "Title 1", "SubTitle 1"),
|
|
|
|
+ LivesCardItem(R.drawable.ic_bg_dashboard, "Title 2", "SubTitle 2"),
|
|
|
|
+ LivesCardItem(R.drawable.ic_bg_dashboard, "Title 3", "SubTitle 3"),
|
|
|
|
+ LivesCardItem(R.drawable.ic_bg_dashboard, "Title 4", "SubTitle 4"),
|
|
|
|
+ LivesCardItem(R.drawable.ic_bg_dashboard, "Title 5", "SubTitle 5"),
|
|
|
|
+ // Add more card items as needed
|
|
|
|
+ )
|
|
}
|
|
}
|
|
}
|
|
}
|