dola 1 tahun lalu
induk
melakukan
ec1262d24d

+ 4 - 0
.idea/codeStyles/Project.xml

@@ -1,8 +1,12 @@
 <component name="ProjectCodeStyleConfiguration">
   <code_scheme name="Project" version="173">
+    <option name="RIGHT_MARGIN" value="300" />
     <JetCodeStyleSettings>
       <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
     </JetCodeStyleSettings>
+    <codeStyleSettings language="JAVA">
+      <option name="WRAP_LONG_LINES" value="true" />
+    </codeStyleSettings>
     <codeStyleSettings language="XML">
       <indentOptions>
         <option name="CONTINUATION_INDENT_SIZE" value="4" />

+ 35 - 0
app/src/main/java/com/sambath/kunkhmer/adapter/EventAdapter.kt

@@ -0,0 +1,35 @@
+package com.sambath.kunkhmer.adapter
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.sambath.kunkhmer.R
+
+class EventAdapter(private val cardList: List<EventCardItem>) : RecyclerView.Adapter<EventAdapter.ViewHolder>() {
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EventAdapter.ViewHolder {
+        val itemView = LayoutInflater.from(parent.context).inflate(R.layout.layout_event_item_card, parent, false)
+        return EventAdapter.ViewHolder(itemView)
+    }
+
+    override fun onBindViewHolder(holder: EventAdapter.ViewHolder, position: Int) {
+        val currentItem = cardList[position]
+
+        holder.imageView.setImageResource(currentItem.imageResource)
+        holder.subTitleTextView.text = currentItem.subTitle
+        holder.titleTextView.text = currentItem.title
+        holder.dateTitleTextView.text = currentItem.dateTitle
+    }
+
+    override fun getItemCount() = cardList.size
+
+    class ViewHolder(ItemView: View) : RecyclerView.ViewHolder(ItemView) {
+        val imageView: ImageView = itemView.findViewById(R.id.imageView)
+        val subTitleTextView: TextView = itemView.findViewById(R.id.subTitleTextView)
+        val titleTextView: TextView = itemView.findViewById(R.id.titleTextView)
+        val dateTitleTextView: TextView = itemView.findViewById(R.id.dateTitleTextView)
+    }
+}

+ 3 - 0
app/src/main/java/com/sambath/kunkhmer/adapter/EventCardItem.kt

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

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

@@ -8,13 +8,10 @@ import android.widget.TextView
 import androidx.recyclerview.widget.RecyclerView
 import com.sambath.kunkhmer.R
 
-class LivesAdapter(private val cardList: List<LivesCardItem>) :
-    RecyclerView.Adapter<LivesAdapter.ViewHolder>() {
-    class CardViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
+class LivesAdapter(private val cardList: List<LivesCardItem>) : RecyclerView.Adapter<LivesAdapter.ViewHolder>() {
 
     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LivesAdapter.ViewHolder {
-        val itemView = LayoutInflater.from(parent.context)
-            .inflate(R.layout.layout_event_item_card, parent, false)
+        val itemView = LayoutInflater.from(parent.context).inflate(R.layout.layout_lives_item_card, parent, false)
         return LivesAdapter.ViewHolder(itemView)
     }
 

+ 9 - 7
app/src/main/java/com/sambath/kunkhmer/screen/event/EventFragment.kt

@@ -7,6 +7,8 @@ import android.view.View
 import android.view.ViewGroup
 import androidx.recyclerview.widget.LinearLayoutManager
 import com.sambath.kunkhmer.R
+import com.sambath.kunkhmer.adapter.EventAdapter
+import com.sambath.kunkhmer.adapter.EventCardItem
 import com.sambath.kunkhmer.adapter.LivesAdapter
 import com.sambath.kunkhmer.adapter.LivesCardItem
 import kotlinx.android.synthetic.main.fragment_event.view.recyclerViewEvent
@@ -34,21 +36,21 @@ class EventFragment : Fragment() {
     private fun setEvent() {
         val recyclerView = binding.recyclerViewEvent
         val cardList = createCardList() // Create your card data list here
-        val cardAdapter = LivesAdapter(cardList)
+        val cardAdapter = EventAdapter(cardList)
 
         recyclerView.layoutManager =
             LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
         recyclerView.adapter = cardAdapter
     }
 
-    private fun createCardList(): List<LivesCardItem> {
+    private fun createCardList(): List<EventCardItem> {
         // 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"),
+            EventCardItem(R.drawable.ic_bg_dashboard, "Title 1", "SubTitle 1", "DateTitle"),
+            EventCardItem(R.drawable.ic_bg_dashboard, "Title 2", "SubTitle 2", "DateTitle"),
+            EventCardItem(R.drawable.ic_bg_dashboard, "Title 3", "SubTitle 3", "DateTitle"),
+            EventCardItem(R.drawable.ic_bg_dashboard, "Title 4", "SubTitle 4", "DateTitle"),
+            EventCardItem(R.drawable.ic_bg_dashboard, "Title 5", "SubTitle 5", "DateTitle"),
             // Add more card items as needed
         )
     }

+ 42 - 10
app/src/main/res/layout/layout_event_item_card.xml

@@ -7,14 +7,29 @@
     app:cardCornerRadius="5dp"
     app:cardElevation="4dp">
 
-    <LinearLayout
+    <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical">
 
+        <ImageView
+            android:id="@+id/imageView"
+            android:layout_width="match_parent"
+            android:layout_height="200dp"
+            android:background="@drawable/default_background"
+            android:scaleType="centerCrop" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="200dp"
+            android:alpha="0.5"
+            android:background="@color/color_black" />
+
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:gravity="center"
             android:orientation="vertical"
             android:paddingTop="5dp"
             android:paddingBottom="5dp">
@@ -24,6 +39,7 @@
                 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" />
 
@@ -32,16 +48,32 @@
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:gravity="center_vertical"
+                android:text="Your Subtitle"
+                android:textColor="@color/color_white"
+                android:textSize="14sp" />
+
+            <TextView
+                android:id="@+id/dateTitleTextView"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:gravity="center_vertical"
                 android:text="Your Date"
-                android:textSize="12sp" />
-        </LinearLayout>
+                android:textColor="@color/color_white"
+                android:textSize="14sp" />
 
-        <ImageView
-            android:id="@+id/imageView"
-            android:layout_width="match_parent"
-            android:layout_height="200dp"
-            android:background="@color/color_green_800"
-            android:scaleType="centerCrop" />
+            <com.google.android.material.button.MaterialButton
+                android:id="@+id/btn_login"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/tv_error"
+                android:layout_gravity="center"
+                android:layout_marginTop="8dp"
+                android:backgroundTint="@color/color_blue_600"
+                android:gravity="center"
+                android:text="@string/booking_now"
+                android:textColor="@color/color_white"
+                app:cornerRadius="5dp" />
+        </LinearLayout>
 
-    </LinearLayout>
+    </FrameLayout>
 </androidx.cardview.widget.CardView>

+ 47 - 0
app/src/main/res/layout/layout_lives_item_card.xml

@@ -0,0 +1,47 @@
+<androidx.cardview.widget.CardView 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="wrap_content"
+    android:layout_margin="5dp"
+    app:cardCornerRadius="5dp"
+    app:cardElevation="4dp">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:paddingTop="5dp"
+            android:paddingBottom="5dp">
+
+            <TextView
+                android:id="@+id/titleTextView"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Your Title"
+                android:textSize="14sp"
+                android:textStyle="bold" />
+
+            <TextView
+                android:id="@+id/subTitleTextView"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:gravity="center_vertical"
+                android:text="Your Date"
+                android:textSize="12sp" />
+        </LinearLayout>
+
+        <ImageView
+            android:id="@+id/imageView"
+            android:layout_width="match_parent"
+            android:layout_height="200dp"
+            android:background="@color/color_green_800"
+            android:scaleType="centerCrop" />
+
+    </LinearLayout>
+</androidx.cardview.widget.CardView>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -79,4 +79,5 @@
     <string name="title_vs">Vs</string>
     <string name="title_date">Date</string>
     <string name="agreement_hint"><![CDATA[By signing up, you agree with our <font color="#0000FF">Term & Condition</font> and <font color="#0000FF">Privacy Policy</font>]]></string>
+    <string name="booking_now">Booking Now</string>
 </resources>