콘텐츠 플레이어

- 현재 재생 중인 콘텐츠 배경 변경
This commit is contained in:
2025-02-25 18:30:20 +09:00
parent 7d15179be0
commit 5d7db2d7e9
5 changed files with 31 additions and 1 deletions

View File

@@ -390,6 +390,8 @@ class AudioContentPlayerFragment(
placeholder(R.drawable.ic_place_holder)
transformations(RoundedCornersTransformation(8f.dpToPx()))
}
adapter.updateCurrentPlayingId(it.extras?.getLong(Constants.EXTRA_AUDIO_CONTENT_ID))
}
}

View File

@@ -229,6 +229,10 @@ class AudioContentPlayerService : MediaSessionService() {
Constants.EXTRA_AUDIO_CONTENT_CREATOR_PROFILE_IMAGE,
content.creatorProfileUrl
)
putLong(
Constants.EXTRA_AUDIO_CONTENT_ID,
content.id
)
}
val mediaMetadata = MediaMetadata.Builder()

View File

@@ -14,6 +14,7 @@ class AudioContentPlaylistDetailAdapter :
RecyclerView.Adapter<AudioContentPlaylistDetailAdapter.ViewHolder>() {
private val items = mutableListOf<AudioContentPlaylistContent>()
private var currentPlayingContentId = 0L
inner class ViewHolder(
private val binding: ItemPlaylistContentBinding
@@ -29,6 +30,12 @@ class AudioContentPlaylistDetailAdapter :
binding.tvTheme.text = item.category
binding.tvDuration.text = item.duration
binding.tvCreatorNickname.text = item.creatorNickname
if (currentPlayingContentId == item.id) {
binding.root.setBackgroundResource(R.drawable.bg_round_corner_6_7_333bb9f1)
} else {
binding.root.setBackgroundResource(0)
}
}
}
@@ -52,4 +59,12 @@ class AudioContentPlaylistDetailAdapter :
this.items.addAll(items)
notifyDataSetChanged()
}
@SuppressLint("NotifyDataSetChanged")
fun updateCurrentPlayingId(contentId: Long?) {
if (contentId != null) {
this.currentPlayingContentId = contentId
}
notifyDataSetChanged()
}
}