Resize native radios icons to be more legible.

This commit is contained in:
Antoine POPINEAU 2020-06-01 17:05:13 +02:00
parent ce05acad21
commit 80554796d3
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
2 changed files with 26 additions and 11 deletions

View File

@ -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

View File

@ -13,6 +13,16 @@
android:transitionGroup="true"
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
android:id="@+id/art"
android:layout_width="48dp"