|
@@ -3,10 +3,12 @@ package com.khmer9.sbcmain.screen.main
|
|
|
import android.view.View
|
|
|
import android.widget.ImageView
|
|
|
import android.widget.TextView
|
|
|
+import androidx.appcompat.widget.LinearLayoutCompat
|
|
|
import com.gdtlib.lib.adapter.BaseListItem
|
|
|
import com.gdtlib.lib.viewholder.BaseListViewHolder
|
|
|
import com.google.android.material.card.MaterialCardView
|
|
|
import com.khmer9.sbcmain.R
|
|
|
+import com.khmer9.sbcmain.config.Config
|
|
|
import com.khmer9.sbcmain.extension.btnClick
|
|
|
import com.khmer9.sbcmain.extension.setSafeOnClickListener
|
|
|
import com.khmer9.sbcmain.remote.ModuleData
|
|
@@ -15,16 +17,12 @@ import com.squareup.picasso.Picasso
|
|
|
|
|
|
class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((String, String, Int) -> Unit)? = null) : BaseListViewHolder(itemView) {
|
|
|
private val picasso = Picasso.get()
|
|
|
- private val LOTTO_APP_ID = "630780f0f635dd035329f5b7"
|
|
|
- private val LOTTO_PLUS_APP_ID = "62e397edae71cfa8782aa3a0"
|
|
|
- private val COCK_ID = "631c17831da02749e7e23f35"
|
|
|
- private val YUKI_ID = "630478c22983a591133f0492"
|
|
|
- private val APONG_ID = "631c1d1a0d213229fc5fd11a"
|
|
|
|
|
|
override fun bindView(item: BaseListItem) {
|
|
|
val imgIcon = itemView.findViewById<ImageView>(R.id.img_icon)
|
|
|
val tvName = itemView.findViewById<TextView>(R.id.tv_name)
|
|
|
val itemModule = itemView.findViewById<MaterialCardView>(R.id.item_module)
|
|
|
+ val backgroundModule = itemView.findViewById<LinearLayoutCompat>(R.id.background_module)
|
|
|
|
|
|
if (item is ModuleData) {
|
|
|
tvName.text = item.name
|
|
@@ -48,41 +46,49 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
|
|
|
imgIcon.layoutParams.width = height.toInt()
|
|
|
|
|
|
when (item.appId) {
|
|
|
- LOTTO_APP_ID -> {
|
|
|
+ Config.LOTTO_APP_ID -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_lotto_80)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
}
|
|
|
- LOTTO_PLUS_APP_ID -> {
|
|
|
+ Config.LOTTO_PLUS_APP_ID -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_lotto_plus)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
}
|
|
|
- COCK_ID -> {
|
|
|
+ Config.COCK_FIGHT_APP_ID -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_logo_cock)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
+
|
|
|
+ backgroundModule.setBackgroundResource(R.drawable.chickenbg)
|
|
|
}
|
|
|
- YUKI_ID -> {
|
|
|
+ Config.YUKI_APP_ID -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_yuki)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
+
|
|
|
+ backgroundModule.setBackgroundResource(R.drawable.yukibg)
|
|
|
}
|
|
|
- APONG_ID -> {
|
|
|
+ Config.APONG_APP_ID -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_apong)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
+
|
|
|
+ backgroundModule.setBackgroundResource(R.drawable.apongbg)
|
|
|
}
|
|
|
else -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_lotto_main)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
+
|
|
|
+ backgroundModule.setBackgroundResource(R.drawable.lottobg)
|
|
|
}
|
|
|
}
|
|
|
} catch (e: Exception) {
|
|
@@ -115,17 +121,21 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
|
|
|
imgIcon.layoutParams.width = height.toInt()
|
|
|
|
|
|
when (item.appId) {
|
|
|
- LOTTO_APP_ID -> {
|
|
|
+ Config.LOTTO_APP_ID -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_lotto_80)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
+
|
|
|
+ backgroundModule.setBackgroundResource(R.drawable.lottobg)
|
|
|
}
|
|
|
- LOTTO_PLUS_APP_ID -> {
|
|
|
+ Config.LOTTO_PLUS_APP_ID -> {
|
|
|
picasso
|
|
|
.load(R.drawable.ic_lotto_plus)
|
|
|
.placeholder(R.drawable.animal_seven)
|
|
|
.into(imgIcon)
|
|
|
+
|
|
|
+ backgroundModule.setBackgroundResource(R.drawable.lottobg)
|
|
|
}
|
|
|
else -> {
|
|
|
picasso
|