Dola TENG 1 ano atrás
pai
commit
a592c1e2d1

+ 2 - 1
app/src/main/java/com/sambath/kunkhmer/adapter/LivesAdapter.kt

@@ -7,6 +7,7 @@ import android.widget.ImageView
 import android.widget.TextView
 import androidx.recyclerview.widget.RecyclerView
 import com.sambath.kunkhmer.R
+import com.squareup.picasso.Picasso
 
 class LivesAdapter(private val cardList: List<LivesCardItem>) : RecyclerView.Adapter<LivesAdapter.ViewHolder>() {
 
@@ -18,7 +19,7 @@ class LivesAdapter(private val cardList: List<LivesCardItem>) : RecyclerView.Ada
     override fun onBindViewHolder(holder: LivesAdapter.ViewHolder, position: Int) {
         val currentItem = cardList[position]
 
-        holder.imageView.setImageResource(currentItem.imageResource)
+        Picasso.get().load(currentItem.imageResource).into(holder.imageView)
         holder.subTitleTextView.text = currentItem.subTitle
         holder.titleTextView.text = currentItem.title
     }

+ 1 - 1
app/src/main/java/com/sambath/kunkhmer/adapter/LivesCardItem.kt

@@ -1,3 +1,3 @@
 package com.sambath.kunkhmer.adapter
 
-data class LivesCardItem(val imageResource: Int, val title: String, val subTitle: String)
+data class LivesCardItem(val imageResource: String, val title: String, val subTitle: String)

+ 10 - 5
app/src/main/java/com/sambath/kunkhmer/screen/lives/LivesFragment.kt

@@ -45,11 +45,16 @@ class LivesFragment : Fragment() {
     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"),
+            LivesCardItem("https://i.ytimg.com/vi/Lh5O00zo_pc/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCEQ100buCWUuyBKWe_96UbevbIEA",
+                "ផ្សាយបន្តផ្ទាល់កម្មវិធីប្រដាល់ Krud គុនខ្មែរ", "ឃឹម បូរ៉ា (ខ្មែរ) Vs ពេជ្រ សម្បត្តិ"),
+            LivesCardItem("https://i.ytimg.com/vi/Lh5O00zo_pc/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCEQ100buCWUuyBKWe_96UbevbIEA",
+                "ផ្សាយបន្តផ្ទាល់កម្មវិធីប្រដាល់ Krud គុនខ្មែរ", "ឃឹម បូរ៉ា (ខ្មែរ) Vs ពេជ្រ សម្បត្តិ"),
+            LivesCardItem("https://i.ytimg.com/vi/Lh5O00zo_pc/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCEQ100buCWUuyBKWe_96UbevbIEA",
+                "ផ្សាយបន្តផ្ទាល់កម្មវិធីប្រដាល់ Krud គុនខ្មែរ", "ឃឹម បូរ៉ា (ខ្មែរ) Vs ពេជ្រ សម្បត្តិ"),
+            LivesCardItem("https://i.ytimg.com/vi/Lh5O00zo_pc/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCEQ100buCWUuyBKWe_96UbevbIEA",
+                "ផ្សាយបន្តផ្ទាល់កម្មវិធីប្រដាល់ Krud គុនខ្មែរ", "ឃឹម បូរ៉ា (ខ្មែរ) Vs ពេជ្រ សម្បត្តិ"),
+            LivesCardItem("https://i.ytimg.com/vi/Lh5O00zo_pc/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCEQ100buCWUuyBKWe_96UbevbIEA",
+                "ផ្សាយបន្តផ្ទាល់កម្មវិធីប្រដាល់ Krud គុនខ្មែរ", "ឃឹម បូរ៉ា (ខ្មែរ) Vs ពេជ្រ សម្បត្តិ"),
             // Add more card items as needed
         )
     }

+ 2 - 1
app/src/main/res/layout/fragment_lives.xml

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:background="@color/color_black"
     tools:context=".screen.lives.LivesFragment">
 
     <androidx.recyclerview.widget.RecyclerView

+ 5 - 3
app/src/main/res/layout/layout_lives_item_card.xml

@@ -15,15 +15,16 @@
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:background="@color/color_black"
             android:orientation="vertical"
-            android:paddingTop="5dp"
-            android:paddingBottom="5dp">
+            android:padding="5dp">
 
             <TextView
                 android:id="@+id/titleTextView"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="Your Title"
+                android:textColor="@color/color_white"
                 android:textSize="14sp"
                 android:textStyle="bold" />
 
@@ -33,6 +34,7 @@
                 android:layout_height="match_parent"
                 android:gravity="center_vertical"
                 android:text="Your Date"
+                android:textColor="@color/color_white"
                 android:textSize="12sp" />
         </LinearLayout>
 
@@ -40,7 +42,7 @@
             android:id="@+id/imageView"
             android:layout_width="match_parent"
             android:layout_height="200dp"
-            android:background="@color/color_green_800"
+            android:background="@color/color_gray_300"
             android:scaleType="centerCrop" />
 
     </LinearLayout>