|
|
|
@ -30,26 +30,31 @@ class RadiosAdapter(val context: Context?, private val listener: OnRadioClickLis
@@ -30,26 +30,31 @@ class RadiosAdapter(val context: Context?, private val listener: OnRadioClickLis
|
|
|
|
|
override fun onBindViewHolder(holder: RadiosAdapter.ViewHolder, position: Int) { |
|
|
|
|
val radio = data[position] |
|
|
|
|
|
|
|
|
|
holder.art.visibility = View.VISIBLE |
|
|
|
|
holder.nativeArt.visibility = View.GONE |
|
|
|
|
holder.name.text = radio.name |
|
|
|
|
holder.description.text = radio.description |
|
|
|
|
|
|
|
|
|
context?.let { context -> |
|
|
|
|
when (radio.radio_type) { |
|
|
|
|
"random" -> { |
|
|
|
|
holder.art.setImageDrawable(context.getDrawable(R.drawable.shuffle)) |
|
|
|
|
holder.art.alpha = 0.7f |
|
|
|
|
holder.art.setColorFilter(context.getColor(R.color.controlForeground)) |
|
|
|
|
} |
|
|
|
|
"less-listened" -> { |
|
|
|
|
holder.art.setImageDrawable(context.getDrawable(R.drawable.sad)) |
|
|
|
|
holder.art.alpha = 0.7f |
|
|
|
|
holder.art.setColorFilter(context.getColor(R.color.controlForeground)) |
|
|
|
|
} |
|
|
|
|
val icon = when (radio.radio_type) { |
|
|
|
|
"random" -> R.drawable.shuffle |
|
|
|
|
"less-listened" -> R.drawable.sad |
|
|
|
|
else -> null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
icon?.let { |
|
|
|
|
holder.art.visibility = View.GONE |
|
|
|
|
holder.nativeArt.visibility = View.VISIBLE |
|
|
|
|
|
|
|
|
|
holder.nativeArt.setImageDrawable(context.getDrawable(icon)) |
|
|
|
|
holder.nativeArt.alpha = 0.7f |
|
|
|
|
holder.nativeArt.setColorFilter(context.getColor(R.color.controlForeground)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inner class ViewHolder(view: View, private val listener: OnRadioClickListener) : RecyclerView.ViewHolder(view), View.OnClickListener { |
|
|
|
|
val nativeArt = view.native_art |
|
|
|
|
val art = view.art |
|
|
|
|
val name = view.name |
|
|
|
|
val description = view.description |
|
|
|
|