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 557f3ad6..88447f6a 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 @@ -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( 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( 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( } } + @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( 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( 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( } } - 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( startActivity(shareIntent) } } - - val introduce = creator.introduce.ifBlank { - "채널 소개내용이 없습니다." - } - - binding.layoutUserProfileIntroduce.tvIntroduce.text = introduce } - @SuppressLint("NotifyDataSetChanged") - private fun setAudioContentList(audioContentList: List) { + @SuppressLint("NotifyDataSetChanged", "SetTextI18n") + private fun setAudioContentList( + audioContentList: List, + totalContentCount: Long, + ownedContentCount: Long + ) { binding.layoutUserProfileAudioContent.root.visibility = if (userId == SharedPreferenceManager.userId || audioContentList.isNotEmpty()) { View.VISIBLE @@ -737,9 +804,34 @@ class UserProfileActivity : BaseActivity( ) } 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( @SuppressLint("NotifyDataSetChanged") private fun setUserDonationRanking(userDonationRanking: List) { 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() diff --git a/app/src/main/res/layout/activity_user_profile.xml b/app/src/main/res/layout/activity_user_profile.xml index ccdcbfb4..c3d1bf71 100644 --- a/app/src/main/res/layout/activity_user_profile.xml +++ b/app/src/main/res/layout/activity_user_profile.xml @@ -101,13 +101,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + android:layout_marginHorizontal="24dp" + android:layout_marginTop="48dp" + android:visibility="gone" /> + android:layout_marginHorizontal="24dp" + android:layout_marginTop="48dp" /> diff --git a/app/src/main/res/layout/item_user_profile_donation.xml b/app/src/main/res/layout/item_user_profile_donation.xml index 8b8c8513..b2413bee 100644 --- a/app/src/main/res/layout/item_user_profile_donation.xml +++ b/app/src/main/res/layout/item_user_profile_donation.xml @@ -1,14 +1,14 @@ + android:layout_width="76dp" + android:layout_height="76dp"> @@ -39,7 +39,7 @@ android:layout_height="wrap_content" android:layout_marginTop="6.7dp" android:ellipsize="end" - android:fontFamily="@font/gmarket_sans_medium" + android:fontFamily="@font/pretendard_medium" android:lines="1" android:textColor="@color/color_eeeeee" android:textSize="12sp" /> diff --git a/app/src/main/res/layout/layout_creator_channel_series.xml b/app/src/main/res/layout/layout_creator_channel_series.xml index 02baf4b4..c9d786ad 100644 --- a/app/src/main/res/layout/layout_creator_channel_series.xml +++ b/app/src/main/res/layout/layout_creator_channel_series.xml @@ -8,10 +8,10 @@ android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:fontFamily="@font/gmarket_sans_bold" + android:fontFamily="@font/pretendard_bold" android:text="시리즈" - android:textColor="@color/color_eeeeee" - android:textSize="18.3sp" + android:textColor="@color/white" + android:textSize="26sp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -19,10 +19,10 @@ android:id="@+id/tv_all" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:fontFamily="@font/gmarket_sans_light" + android:fontFamily="@font/pretendard_light" android:text="전체보기" - android:textColor="@color/color_eeeeee" - android:textSize="11.3sp" + android:textColor="#78909C" + android:textSize="14sp" app:layout_constraintBottom_toBottomOf="@+id/tv_title" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/tv_title" /> @@ -31,7 +31,7 @@ android:id="@+id/rv_series" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginTop="13.3dp" + android:layout_marginTop="16dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/tv_title" /> diff --git a/app/src/main/res/layout/layout_creator_community_post.xml b/app/src/main/res/layout/layout_creator_community_post.xml index f4c0bc4e..6614a030 100644 --- a/app/src/main/res/layout/layout_creator_community_post.xml +++ b/app/src/main/res/layout/layout_creator_community_post.xml @@ -4,10 +4,21 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + @@ -24,33 +25,83 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" + android:layout_centerVertical="true" android:fontFamily="@font/pretendard_light" android:gravity="center" android:text="전체보기" - android:textColor="@color/color_bbbbbb" - android:textSize="11.3sp" /> + android:textColor="#78909C" + android:textSize="14sp" /> + + + + + + + + + + + diff --git a/app/src/main/res/layout/layout_user_profile_donation.xml b/app/src/main/res/layout/layout_user_profile_donation.xml index 3af08faf..a9ea51fe 100644 --- a/app/src/main/res/layout/layout_user_profile_donation.xml +++ b/app/src/main/res/layout/layout_user_profile_donation.xml @@ -8,10 +8,10 @@ android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:fontFamily="@font/gmarket_sans_bold" + android:fontFamily="@font/pretendard_bold" android:text="후원랭킹" - android:textColor="@color/color_eeeeee" - android:textSize="16.7sp" + android:textColor="@color/white" + android:textSize="26sp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -19,11 +19,11 @@ android:id="@+id/tv_all" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:fontFamily="@font/gmarket_sans_light" + android:fontFamily="@font/pretendard_light" android:gravity="center" android:text="전체보기" - android:textColor="@color/color_bbbbbb" - android:textSize="11.3sp" + android:textColor="#78909C" + android:textSize="14sp" app:layout_constraintBottom_toBottomOf="@+id/tv_title" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/tv_title" /> @@ -32,7 +32,7 @@ android:id="@+id/rv_donation" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginTop="26.7dp" + android:layout_marginTop="14dp" android:clipToPadding="false" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/layout_user_profile_fan_talk.xml b/app/src/main/res/layout/layout_user_profile_fan_talk.xml index 6e598f97..c98e1b41 100644 --- a/app/src/main/res/layout/layout_user_profile_fan_talk.xml +++ b/app/src/main/res/layout/layout_user_profile_fan_talk.xml @@ -7,28 +7,28 @@ + android:layout_height="wrap_content"> + android:textColor="@color/white" + android:textSize="26sp" /> + android:textColor="#78909C" + android:textSize="14sp" /> @@ -64,18 +63,10 @@ - - - - @@ -127,11 +110,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginVertical="60dp" - android:fontFamily="@font/gmarket_sans_light" + android:fontFamily="@font/pretendard_light" android:gravity="center" - android:visibility="gone" android:text="응원이 없습니다.\n\n처음으로 응원을 해보세요!" android:textColor="@color/color_bbbbbb" - android:textSize="13.3sp" /> + android:textSize="13.3sp" + android:visibility="gone" />