Browse Source

Changed background color when rearranging playlist items.

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
7feac4e400
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 9
      app/src/main/java/com/github/apognu/otter/adapters/PlaylistTracksAdapter.kt

9
app/src/main/java/com/github/apognu/otter/adapters/PlaylistTracksAdapter.kt

@ -6,6 +6,7 @@ import android.graphics.Color @@ -6,6 +6,7 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.*
import androidx.appcompat.widget.PopupMenu
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
import com.github.apognu.otter.R
@ -67,12 +68,12 @@ class PlaylistTracksAdapter(private val context: Context?, private val favoriteL @@ -67,12 +68,12 @@ class PlaylistTracksAdapter(private val context: Context?, private val favoriteL
holder.artist.text = track.track.artist.name
context?.let {
holder.itemView.background = context.getDrawable(R.drawable.ripple)
holder.itemView.background = ContextCompat.getDrawable(context, R.drawable.ripple)
}
if (track.track == currentTrack || track.track.current) {
context?.let {
holder.itemView.background = context.getDrawable(R.drawable.current)
holder.itemView.background = ContextCompat.getDrawable(context, R.drawable.current)
}
}
@ -182,7 +183,9 @@ class PlaylistTracksAdapter(private val context: Context?, private val favoriteL @@ -182,7 +183,9 @@ class PlaylistTracksAdapter(private val context: Context?, private val favoriteL
override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
if (actionState == ItemTouchHelper.ACTION_STATE_DRAG) {
viewHolder?.itemView?.background = ColorDrawable(Color.argb(255, 100, 100, 100))
context?.let {
viewHolder?.itemView?.background = ColorDrawable(context.getColor(R.color.colorSelected))
}
}
super.onSelectedChanged(viewHolder, actionState)

Loading…
Cancel
Save