feat(user-channel): 유저 채널 UI 수정

- 최신 콘텐츠 아이템 표시
- 후원 순위 아이템 사이즈 수정
- 섹션 제목 사이즈 업
This commit is contained in:
2025-10-16 23:04:45 +09:00
parent 9ba053b807
commit ae92921b7b
8 changed files with 401 additions and 122 deletions

View File

@@ -9,6 +9,7 @@ import android.graphics.Rect
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.style.ForegroundColorSpan
import android.view.LayoutInflater
import android.view.View
import android.view.inputmethod.InputMethodManager
@@ -16,6 +17,7 @@ import android.widget.LinearLayout
import android.widget.Toast
import androidx.annotation.OptIn
import androidx.appcompat.widget.PopupMenu
import androidx.core.graphics.toColorInt
import androidx.media3.common.util.UnstableApi
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -24,6 +26,10 @@ import coil.transform.BlurTransformation
import coil.transform.CircleCropTransformation
import coil.transform.RoundedCornersTransformation
import coil.transform.Transformation
import com.bumptech.glide.Glide
import com.bumptech.glide.load.MultiTransformation
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.audio_content.AudioContentActivity
import kr.co.vividnext.sodalive.audio_content.AudioContentAdapter
@@ -108,6 +114,11 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
override fun setupView() {
loadingDialog = LoadingDialog(this, layoutInflater)
binding.tvBack.setOnClickListener { finish() }
binding.ivMenu.visibility = if (userId != SharedPreferenceManager.userId) {
View.VISIBLE
} else {
View.GONE
}
binding.ivMenu.setOnClickListener {
showOptionMenu(
this,
@@ -591,7 +602,12 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
if (it.isCreator) {
setSeriesList(it.seriesList)
setAudioContentList(it.contentList)
setLatestContent(it.latestContent)
setAudioContentList(
it.contentList,
it.totalContentCount,
it.ownedContentCount
)
setLiveRoomList(it.liveRoomList)
setUserDonationRanking(it.userDonationRanking)
setCommunityPostList(it.communityPostList)
@@ -599,6 +615,58 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
}
}
@OptIn(UnstableApi::class)
private fun setLatestContent(latestContent: GetAudioContentListItem?) {
if (latestContent != null) {
binding.clLatestContent.visibility = View.VISIBLE
Glide.with(this)
.load(latestContent.coverImageUrl)
.placeholder(R.drawable.ic_place_holder)
.transform(
MultiTransformation(
CenterCrop(),
RoundedCorners(16f.dpToPx().toInt())
)
)
.into(binding.ivLatestContentCover)
binding.tvLatestContentPoint.visibility = if (latestContent.isPointAvailable) {
View.VISIBLE
} else {
View.GONE
}
binding.tvScheduledToOpen.visibility = if (latestContent.isScheduledToOpen) {
View.VISIBLE
} else {
View.GONE
}
binding.tvLatestContentTitle.text = latestContent.title
binding.tvLatestContentTheme.text = latestContent.themeStr
binding.tvLatestContentDuration.text = latestContent.duration
binding.tvLatestContentLikeCount.text = latestContent.likeCount.toString()
binding.tvLatestContentCommentCount.text = latestContent.commentCount.toString()
binding.clLatestContent.setOnClickListener {
startActivity(
Intent(
applicationContext,
AudioContentDetailActivity::class.java
).apply {
putExtra(
Constants.EXTRA_AUDIO_CONTENT_ID,
latestContent.contentId
)
}
)
}
} else {
binding.clLatestContent.visibility = View.GONE
}
}
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
private fun setCheers(cheers: GetCheersResponse) {
binding.layoutUserProfileFanTalk.etCheer.setText("")
@@ -635,8 +703,9 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
binding.tvNickname.text = creator.nickname
if (creator.creatorId == SharedPreferenceManager.userId) {
binding.tvFollowerList.visibility = View.VISIBLE
binding.ivNotification.visibility = View.GONE
binding.tvNotificationCount.visibility = View.GONE
binding.tvFollowerList.visibility = View.VISIBLE
binding.tvFollowerList.setOnClickListener {
val intent = Intent(applicationContext, UserFollowerListActivity::class.java)
@@ -644,8 +713,12 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
startActivity(intent)
}
} else {
binding.ivNotification.visibility = View.VISIBLE
binding.tvFollowerList.visibility = View.GONE
binding.ivNotification.visibility = View.VISIBLE
binding.tvNotificationCount.visibility = View.VISIBLE
binding
.tvNotificationCount
.text = "팔로워 ${creator.notificationRecipientCount.moneyFormat()}"
}
if (creator.isFollow) {
@@ -682,10 +755,6 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
}
}
binding
.tvNotificationCount
.text = "팔로워 ${creator.notificationRecipientCount.moneyFormat()}"
binding.nestedScrollView.setOnScrollChangeListener { _, _, scrollY, _, _ ->
if (scrollY >= screenWidth) {
binding.toolbar.setBackgroundColor(Color.BLACK)
@@ -709,16 +778,14 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
startActivity(shareIntent)
}
}
val introduce = creator.introduce.ifBlank {
"채널 소개내용이 없습니다."
}
binding.layoutUserProfileIntroduce.tvIntroduce.text = introduce
}
@SuppressLint("NotifyDataSetChanged")
private fun setAudioContentList(audioContentList: List<GetAudioContentListItem>) {
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
private fun setAudioContentList(
audioContentList: List<GetAudioContentListItem>,
totalContentCount: Long,
ownedContentCount: Long
) {
binding.layoutUserProfileAudioContent.root.visibility =
if (userId == SharedPreferenceManager.userId || audioContentList.isNotEmpty()) {
View.VISIBLE
@@ -737,9 +804,34 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
)
}
binding.layoutUserProfileAudioContent.tvNewContent.visibility = View.VISIBLE
binding.layoutUserProfileAudioContent.clRatio.visibility = View.GONE
} else {
binding.layoutUserProfileAudioContent.tvTitle.text = "콘텐츠"
binding.layoutUserProfileAudioContent.tvNewContent.visibility = View.GONE
binding.layoutUserProfileAudioContent.clRatio.visibility = View.VISIBLE
val ownedStr = ownedContentCount.toString()
val totalStr = totalContentCount.toString()
val fullText = "$ownedStr / ${totalStr}"
val spannable = android.text.SpannableString(fullText)
val ownedColor = "#FDD453".toColorInt()
spannable.setSpan(
ForegroundColorSpan(ownedColor),
/* start */ 0,
/* end */ ownedStr.length,
android.text.Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
// 나머지는 TextView의 기본 색상(white)을 사용
binding.layoutUserProfileAudioContent.tvRatioRight.text = spannable
val ratio = ownedContentCount.toFloat() / totalContentCount.toFloat()
val percent = (ratio * 100).toInt()
binding.layoutUserProfileAudioContent.tvRatioLeft.text = if (ownedContentCount > 0) {
"${percent}% 보유중"
} else {
"소장 중인 작품이 없어요!"
}
binding.layoutUserProfileAudioContent.progressRatio.progress = percent
}
audioContentAdapter.items.clear()
@@ -793,9 +885,9 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
@SuppressLint("NotifyDataSetChanged")
private fun setUserDonationRanking(userDonationRanking: List<UserDonationRankingResponse>) {
if (userDonationRanking.isEmpty()) {
binding.llUserProfileDonation.visibility = View.GONE
binding.layoutUserProfileDonation.root.visibility = View.GONE
} else {
binding.llUserProfileDonation.visibility = View.VISIBLE
binding.layoutUserProfileDonation.root.visibility = View.VISIBLE
donationAdapter.items.clear()
donationAdapter.items.addAll(userDonationRanking)
donationAdapter.notifyDataSetChanged()