콘텐츠 플레이어
- 현재 재생 중인 콘텐츠 배경 변경
This commit is contained in:
		| @@ -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)) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -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() | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,8 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <solid android:color="@color/color_333bb9f1" /> | ||||
|     <corners android:radius="6.7dp" /> | ||||
|     <stroke | ||||
|         android:width="1dp" | ||||
|         android:color="@color/color_333bb9f1" /> | ||||
| </shape> | ||||
| @@ -3,7 +3,8 @@ | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content"> | ||||
|     android:layout_height="wrap_content" | ||||
|     android:padding="13.3dp"> | ||||
|  | ||||
|     <ImageView | ||||
|         android:id="@+id/iv_cover" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user