Resize native radios icons to be more legible.
This commit is contained in:
parent
ce05acad21
commit
80554796d3
|
@ -30,26 +30,31 @@ class RadiosAdapter(val context: Context?, private val listener: OnRadioClickLis
|
||||||
override fun onBindViewHolder(holder: RadiosAdapter.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: RadiosAdapter.ViewHolder, position: Int) {
|
||||||
val radio = data[position]
|
val radio = data[position]
|
||||||
|
|
||||||
|
holder.art.visibility = View.VISIBLE
|
||||||
|
holder.nativeArt.visibility = View.GONE
|
||||||
holder.name.text = radio.name
|
holder.name.text = radio.name
|
||||||
holder.description.text = radio.description
|
holder.description.text = radio.description
|
||||||
|
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
when (radio.radio_type) {
|
val icon = when (radio.radio_type) {
|
||||||
"random" -> {
|
"random" -> R.drawable.shuffle
|
||||||
holder.art.setImageDrawable(context.getDrawable(R.drawable.shuffle))
|
"less-listened" -> R.drawable.sad
|
||||||
holder.art.alpha = 0.7f
|
else -> null
|
||||||
holder.art.setColorFilter(context.getColor(R.color.controlForeground))
|
}
|
||||||
}
|
|
||||||
"less-listened" -> {
|
icon?.let {
|
||||||
holder.art.setImageDrawable(context.getDrawable(R.drawable.sad))
|
holder.art.visibility = View.GONE
|
||||||
holder.art.alpha = 0.7f
|
holder.nativeArt.visibility = View.VISIBLE
|
||||||
holder.art.setColorFilter(context.getColor(R.color.controlForeground))
|
|
||||||
}
|
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 {
|
inner class ViewHolder(view: View, private val listener: OnRadioClickListener) : RecyclerView.ViewHolder(view), View.OnClickListener {
|
||||||
|
val nativeArt = view.native_art
|
||||||
val art = view.art
|
val art = view.art
|
||||||
val name = view.name
|
val name = view.name
|
||||||
val description = view.description
|
val description = view.description
|
||||||
|
|
|
@ -13,6 +13,16 @@
|
||||||
android:transitionGroup="true"
|
android:transitionGroup="true"
|
||||||
tools:showIn="@layout/fragment_radios">
|
tools:showIn="@layout/fragment_radios">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/native_art"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/cover"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:src="@tools:sample/avatars" />
|
||||||
|
|
||||||
<com.github.apognu.otter.views.SquareImageView
|
<com.github.apognu.otter.views.SquareImageView
|
||||||
android:id="@+id/art"
|
android:id="@+id/art"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
|
|
Loading…
Reference in New Issue