diff --git a/app/src/main/java/kr/co/vividnext/sodalive/audio_content/series/GetSeriesListResponse.kt b/app/src/main/java/kr/co/vividnext/sodalive/audio_content/series/GetSeriesListResponse.kt new file mode 100644 index 0000000..4e5ac85 --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/audio_content/series/GetSeriesListResponse.kt @@ -0,0 +1,24 @@ +package kr.co.vividnext.sodalive.audio_content.series + +data class GetSeriesListResponse( + val totalCount: Int, + val items: List +) { + data class SeriesListItem( + val seriesId: Long, + val title: String, + val coverImage: String, + val publishedDaysOfWeek: String, + val isComplete: Boolean, + val creator: SeriesListItemCreator, + val numberOfContent: Int, + val isNew: Boolean, + val isPopular: Boolean + ) + + data class SeriesListItemCreator( + val creatorId: Long, + val nickname: String, + val profileImage: String + ) +} diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt index 2926d55..b74fae3 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/GetCreatorProfileResponse.kt @@ -1,6 +1,7 @@ package kr.co.vividnext.sodalive.explorer.profile import com.google.gson.annotations.SerializedName +import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse import kr.co.vividnext.sodalive.explorer.profile.creator_community.GetCommunityPostListResponse data class GetCreatorProfileResponse( @@ -20,6 +21,8 @@ data class GetCreatorProfileResponse( val cheers: GetCheersResponse, @SerializedName("activitySummary") val activitySummary: GetCreatorActivitySummary, + @SerializedName("seriesList") + val seriesList: List, @SerializedName("isBlock") val isBlock: Boolean ) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt index 21c0e4a..834e0ac 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt @@ -26,6 +26,7 @@ import kr.co.vividnext.sodalive.R import kr.co.vividnext.sodalive.audio_content.AudioContentActivity import kr.co.vividnext.sodalive.audio_content.AudioContentAdapter import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity +import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse import kr.co.vividnext.sodalive.audio_content.upload.AudioContentUploadActivity import kr.co.vividnext.sodalive.base.BaseActivity import kr.co.vividnext.sodalive.base.SodaDialog @@ -42,6 +43,7 @@ import kr.co.vividnext.sodalive.explorer.profile.donation.UserProfileDonationAda import kr.co.vividnext.sodalive.explorer.profile.donation.UserProfileDonationAllViewActivity import kr.co.vividnext.sodalive.explorer.profile.fantalk.UserProfileFantalkAllViewActivity import kr.co.vividnext.sodalive.explorer.profile.follow.UserFollowerListActivity +import kr.co.vividnext.sodalive.explorer.profile.series.CreatorChannelSeriesAdapter import kr.co.vividnext.sodalive.extensions.dpToPx import kr.co.vividnext.sodalive.extensions.loadUrl import kr.co.vividnext.sodalive.extensions.moneyFormat @@ -70,6 +72,7 @@ class UserProfileActivity : BaseActivity( private lateinit var loadingDialog: LoadingDialog private lateinit var liveAdapter: UserProfileLiveAdapter private lateinit var audioContentAdapter: AudioContentAdapter + private lateinit var seriesAdapter: CreatorChannelSeriesAdapter private lateinit var donationAdapter: UserProfileDonationAdapter private lateinit var cheersAdapter: UserProfileCheersAdapter @@ -117,6 +120,7 @@ class UserProfileActivity : BaseActivity( setupLiveView() setupDonationView() setupFanTalkView() + setupSeriesListView() setupAudioContentListView() setupCreatorCommunityView() } @@ -415,6 +419,53 @@ class UserProfileActivity : BaseActivity( rvCheers.adapter = cheersAdapter } + private fun setupSeriesListView() { + binding.layoutCreatorChannelSeries.tvAll.setOnClickListener { } + + val recyclerView = binding.layoutCreatorChannelSeries.rvSeries + recyclerView.layoutManager = LinearLayoutManager( + applicationContext, + LinearLayoutManager.HORIZONTAL, + false + ) + + seriesAdapter = CreatorChannelSeriesAdapter( + onClickItem = {}, + onClickCreator = {}, + isVisibleCreator = false + ) + + recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() { + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { + super.getItemOffsets(outRect, view, parent, state) + + when (parent.getChildAdapterPosition(view)) { + 0 -> { + outRect.left = 0 + outRect.right = 6.7f.dpToPx().toInt() + } + + seriesAdapter.itemCount - 1 -> { + outRect.right = 0 + outRect.left = 6.7f.dpToPx().toInt() + } + + else -> { + outRect.left = 6.7f.dpToPx().toInt() + outRect.right = 6.7f.dpToPx().toInt() + } + } + } + }) + + recyclerView.adapter = seriesAdapter + } + private fun setupAudioContentListView() { binding.layoutUserProfileAudioContent.tvAll.setOnClickListener { val intent = Intent(applicationContext, AudioContentActivity::class.java) @@ -517,6 +568,7 @@ class UserProfileActivity : BaseActivity( viewModel.creatorProfileLiveData.observe(this) { setCheers(it.cheers) + setSeriesList(it.seriesList) setCreatorProfile(it.creator) setAudioContentList(it.contentList) setLiveRoomList(it.liveRoomList) @@ -550,6 +602,19 @@ class UserProfileActivity : BaseActivity( } } + @SuppressLint("NotifyDataSetChanged") + private fun setSeriesList(seriesList: List) { + if (seriesList.isNotEmpty()) { + binding.layoutCreatorChannelSeries.root.visibility = View.VISIBLE + } else { + binding.layoutCreatorChannelSeries.root.visibility = View.GONE + } + + seriesAdapter.items.clear() + seriesAdapter.items.addAll(seriesList) + seriesAdapter.notifyDataSetChanged() + } + @SuppressLint("SetTextI18n") private fun setCreatorProfile(creator: CreatorResponse) { val layoutUserProfile = binding.layoutUserProfile diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/series/CreatorChannelSeriesAdapter.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/series/CreatorChannelSeriesAdapter.kt new file mode 100644 index 0000000..8f919af --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/series/CreatorChannelSeriesAdapter.kt @@ -0,0 +1,88 @@ +package kr.co.vividnext.sodalive.explorer.profile.series + +import android.annotation.SuppressLint +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import coil.load +import coil.transform.CircleCropTransformation +import coil.transform.RoundedCornersTransformation +import kr.co.vividnext.sodalive.R +import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse +import kr.co.vividnext.sodalive.databinding.ItemSeriesListBinding +import kr.co.vividnext.sodalive.extensions.dpToPx + +class CreatorChannelSeriesAdapter( + private val onClickItem: (Long) -> Unit, + private val onClickCreator: (Long) -> Unit, + private val isVisibleCreator: Boolean +) : RecyclerView.Adapter() { + + val items = mutableListOf() + + inner class ViewHolder( + private val binding: ItemSeriesListBinding + ) : RecyclerView.ViewHolder(binding.root) { + @SuppressLint("SetTextI18n") + fun bind(item: GetSeriesListResponse.SeriesListItem) { + binding.ivCover.load(item.coverImage) { + crossfade(true) + placeholder(R.drawable.bg_placeholder) + transformations(RoundedCornersTransformation(5f.dpToPx())) + } + + binding.tvTitle.text = item.title + binding.tvSeriesContentCount.text = "총 ${item.numberOfContent}화" + binding.tvPublishedDaysOfWeek.text = item.publishedDaysOfWeek + + binding.tvNew.visibility = if (item.isNew) { + View.VISIBLE + } else { + View.GONE + } + + binding.tvPopular.visibility = if (item.isPopular) { + View.VISIBLE + } else { + View.GONE + } + + if (item.isComplete) { + binding.tvNew.visibility = View.GONE + binding.tvComplete.visibility = View.VISIBLE + } else { + binding.tvComplete.visibility = View.GONE + } + + if (isVisibleCreator) { + binding.llCreator.visibility = View.VISIBLE + binding.tvCreator.text = item.creator.nickname + binding.ivCreator.load(item.creator.profileImage) { + crossfade(true) + placeholder(R.drawable.ic_place_holder) + transformations(CircleCropTransformation()) + } + binding.llCreator.setOnClickListener { onClickCreator(item.creator.creatorId) } + } else { + binding.llCreator.visibility = View.GONE + } + + binding.root.setOnClickListener { onClickItem(item.seriesId) } + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder( + ItemSeriesListBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + ) + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + holder.bind(items[position]) + } + + override fun getItemCount() = items.count() +} diff --git a/app/src/main/res/drawable/bg_round_corner_13_3_002abd.xml b/app/src/main/res/drawable/bg_round_corner_13_3_002abd.xml new file mode 100644 index 0000000..df2124e --- /dev/null +++ b/app/src/main/res/drawable/bg_round_corner_13_3_002abd.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/app/src/main/res/drawable/bg_round_corner_13_3_3bb9f1.xml b/app/src/main/res/drawable/bg_round_corner_13_3_3bb9f1.xml new file mode 100644 index 0000000..5a9578f --- /dev/null +++ b/app/src/main/res/drawable/bg_round_corner_13_3_3bb9f1.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/app/src/main/res/drawable/bg_round_corner_13_3_ec6033.xml b/app/src/main/res/drawable/bg_round_corner_13_3_ec6033.xml new file mode 100644 index 0000000..f0c936c --- /dev/null +++ b/app/src/main/res/drawable/bg_round_corner_13_3_ec6033.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/app/src/main/res/layout/activity_user_profile.xml b/app/src/main/res/layout/activity_user_profile.xml index 308d1f8..56fe581 100644 --- a/app/src/main/res/layout/activity_user_profile.xml +++ b/app/src/main/res/layout/activity_user_profile.xml @@ -211,6 +211,15 @@ android:layout_marginHorizontal="13.3dp" android:layout_marginTop="26.7dp" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/layout_creator_channel_series.xml b/app/src/main/res/layout/layout_creator_channel_series.xml new file mode 100644 index 0000000..02baf4b --- /dev/null +++ b/app/src/main/res/layout/layout_creator_channel_series.xml @@ -0,0 +1,38 @@ + + + + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 1a270ec..e908790 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -114,4 +114,6 @@ #FFECF7 #ECF9FF #14262D + #EC6033 + #002ABD