|
@@ -8,8 +8,10 @@ import androidx.fragment.app.Fragment
|
|
|
import androidx.lifecycle.ViewModelProvider
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import com.khmer9.boxingapplication.R
|
|
|
-import com.khmer9.boxingapplication.adapter.TopNewCardAdapter
|
|
|
+import com.khmer9.boxingapplication.adapter.TopNewsCardAdapter
|
|
|
import com.khmer9.boxingapplication.adapter.CardItem
|
|
|
+import com.khmer9.boxingapplication.adapter.NewsFeedCardAdapter
|
|
|
+import com.khmer9.boxingapplication.adapter.SubTopNewsCardAdapter
|
|
|
import com.khmer9.boxingapplication.databinding.FragmentHomeBinding
|
|
|
|
|
|
class HomeFragment : Fragment() {
|
|
@@ -33,6 +35,7 @@ class HomeFragment : Fragment() {
|
|
|
val root: View = binding.root
|
|
|
setTopNews()
|
|
|
setSubTopNews()
|
|
|
+ setNewsFeed()
|
|
|
|
|
|
return root
|
|
|
}
|
|
@@ -45,7 +48,7 @@ class HomeFragment : Fragment() {
|
|
|
private fun setTopNews() {
|
|
|
val recyclerView = binding.recyclerViewTopNews
|
|
|
val cardList = createCardList() // Create your card data list here
|
|
|
- val cardAdapter = TopNewCardAdapter(cardList)
|
|
|
+ val cardAdapter = TopNewsCardAdapter(cardList)
|
|
|
|
|
|
recyclerView.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
|
|
recyclerView.adapter = cardAdapter
|
|
@@ -54,12 +57,21 @@ class HomeFragment : Fragment() {
|
|
|
private fun setSubTopNews() {
|
|
|
val recyclerView = binding.recyclerViewSubTopNews
|
|
|
val cardList = createCardList() // Create your card data list here
|
|
|
- val cardAdapter = TopNewCardAdapter(cardList)
|
|
|
+ val cardAdapter = SubTopNewsCardAdapter(cardList)
|
|
|
|
|
|
recyclerView.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
|
|
recyclerView.adapter = cardAdapter
|
|
|
}
|
|
|
|
|
|
+ private fun setNewsFeed(){
|
|
|
+ val recyclerView = binding.recyclerViewNewsFeed
|
|
|
+ val cardList = createCardList() // Create your card data list here
|
|
|
+ val cardAdapter = NewsFeedCardAdapter(cardList)
|
|
|
+
|
|
|
+ recyclerView.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
|
|
+ recyclerView.adapter = cardAdapter
|
|
|
+ }
|
|
|
+
|
|
|
private fun createCardList(): List<CardItem> {
|
|
|
// Create and return your list of CardItems
|
|
|
return listOf(
|