commit
912960fc31
|
@ -19,6 +19,8 @@ import android.view.View
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote.isPlaying
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote.playNextSong
|
||||
|
@ -26,6 +28,8 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote.removeFromQueue
|
|||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||
import com.bumptech.glide.Glide
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.DraggableItemAdapter
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.ItemDraggableRange
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.annotation.DraggableItemStateFlags
|
||||
|
@ -55,8 +59,8 @@ class PlayingQueueAdapter(
|
|||
|
||||
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
|
||||
super.onBindViewHolder(holder, position)
|
||||
holder.imageText?.text = (position - current).toString()
|
||||
holder.time?.text = MusicUtil.getReadableDurationString(dataSet[position].duration)
|
||||
val song = dataSet[position]
|
||||
holder.time?.text = MusicUtil.getReadableDurationString(song.duration)
|
||||
if (holder.itemViewType == HISTORY || holder.itemViewType == CURRENT) {
|
||||
setAlpha(holder, 0.5f)
|
||||
}
|
||||
|
@ -72,7 +76,17 @@ class PlayingQueueAdapter(
|
|||
}
|
||||
|
||||
override fun loadAlbumCover(song: Song, holder: SongAdapter.ViewHolder) {
|
||||
// We don't want to load it in this adapter
|
||||
if (holder.image == null) {
|
||||
return
|
||||
}
|
||||
SongGlideRequest.Builder.from(Glide.with(activity), song)
|
||||
.checkIgnoreMediaStore(activity)
|
||||
.generatePalette(activity).build()
|
||||
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||
//setColors(colors, holder)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun swapDataSet(dataSet: List<Song>, position: Int) {
|
||||
|
@ -90,7 +104,6 @@ class PlayingQueueAdapter(
|
|||
holder.image?.alpha = alpha
|
||||
holder.title?.alpha = alpha
|
||||
holder.text?.alpha = alpha
|
||||
holder.imageText?.alpha = alpha
|
||||
holder.paletteColorContainer?.alpha = alpha
|
||||
holder.dragView?.alpha = alpha
|
||||
holder.menu?.alpha = alpha
|
||||
|
@ -143,7 +156,6 @@ class PlayingQueueAdapter(
|
|||
}
|
||||
|
||||
init {
|
||||
imageText?.visibility = View.VISIBLE
|
||||
dragView?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,6 @@ open class SongAdapter(
|
|||
get() = dataSet[layoutPosition]
|
||||
|
||||
init {
|
||||
setImageTransitionName(activity.getString(R.string.transition_album_art))
|
||||
menu?.setOnClickListener(object : SongMenuHelper.OnClickSongMenu(activity) {
|
||||
override val song: Song
|
||||
get() = this@ViewHolder.song
|
||||
|
|
|
@ -51,6 +51,16 @@
|
|||
app:layout_constraintStart_toEndOf="@id/drag_view"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/imageText"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -52,6 +52,15 @@
|
|||
app:layout_constraintStart_toEndOf="@id/drag_view"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/imageText"
|
||||
|
|
Loading…
Reference in New Issue