오픈 예정 콘텐츠 상세

- 댓글 창, 좋아요, 공유, 후원 버튼 숨김
This commit is contained in:
klaus 2024-04-02 14:34:46 +09:00
parent be46893555
commit 0556d5a067
2 changed files with 46 additions and 32 deletions

View File

@ -433,7 +433,11 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
} }
private fun setupCommentArea(response: GetAudioContentDetailResponse) { private fun setupCommentArea(response: GetAudioContentDetailResponse) {
if (response.isCommentAvailable) { if (
response.isCommentAvailable &&
response.contentUrl.isNotBlank() &&
response.releaseDate == null
) {
binding.llDonation.visibility = View.VISIBLE binding.llDonation.visibility = View.VISIBLE
binding.llComment.visibility = View.VISIBLE binding.llComment.visibility = View.VISIBLE
binding.tvCommentCount.text = "${response.commentCount}" binding.tvCommentCount.text = "${response.commentCount}"
@ -657,45 +661,54 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
binding.tvTag.visibility = View.GONE binding.tvTag.visibility = View.GONE
} }
binding.ivLike.setImageResource( if (response.contentUrl.isNotBlank() && response.releaseDate == null) {
if (response.isLike) { binding.svActionButtons.visibility = View.VISIBLE
R.drawable.ic_audio_content_heart_pressed binding.llLike.visibility = View.VISIBLE
} else { binding.ivLike.setImageResource(
R.drawable.ic_audio_content_heart_normal if (response.isLike) {
} R.drawable.ic_audio_content_heart_pressed
)
binding.tvLike.text = "${response.likeCount}"
binding.llLike.setOnClickListener {
viewModel.likeContent(contentId = audioContentId) {
val likeCount = binding.tvLike.text.toString().toInt()
if (it) {
binding.tvLike.text = "${likeCount + 1}"
binding.ivLike.setImageResource(R.drawable.ic_audio_content_heart_pressed)
} else { } else {
binding.tvLike.text = if (likeCount - 1 < 0) { R.drawable.ic_audio_content_heart_normal
"0" }
)
binding.tvLike.text = "${response.likeCount}"
binding.llLike.setOnClickListener {
viewModel.likeContent(contentId = audioContentId) {
val likeCount = binding.tvLike.text.toString().toInt()
if (it) {
binding.tvLike.text = "${likeCount + 1}"
binding.ivLike.setImageResource(R.drawable.ic_audio_content_heart_pressed)
} else { } else {
"${likeCount - 1}" binding.tvLike.text = if (likeCount - 1 < 0) {
"0"
} else {
"${likeCount - 1}"
}
binding.ivLike.setImageResource(R.drawable.ic_audio_content_heart_normal)
} }
binding.ivLike.setImageResource(R.drawable.ic_audio_content_heart_normal)
} }
} }
}
binding.tvShare.setOnClickListener { binding.tvShare.visibility = View.VISIBLE
viewModel.shareAudioContent( binding.tvShare.setOnClickListener {
audioContentId = audioContentId, viewModel.shareAudioContent(
contentImage = response.coverImageUrl, audioContentId = audioContentId,
contentTitle = "${response.title} - ${response.creator.nickname}" contentImage = response.coverImageUrl,
) { contentTitle = "${response.title} - ${response.creator.nickname}"
val intent = Intent(Intent.ACTION_SEND) ) {
intent.type = "text/plain" val intent = Intent(Intent.ACTION_SEND)
intent.putExtra(Intent.EXTRA_TEXT, it) intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "오디오콘텐츠 공유") val shareIntent = Intent.createChooser(intent, "오디오콘텐츠 공유")
startActivity(shareIntent) startActivity(shareIntent)
}
} }
} else {
binding.svActionButtons.visibility = View.GONE
binding.llLike.visibility = View.GONE
binding.tvShare.visibility = View.GONE
} }
if (response.totalContentCount != null && response.remainingContentCount != null) { if (response.totalContentCount != null && response.remainingContentCount != null) {

View File

@ -295,6 +295,7 @@
tools:text="매버릭 팔레트 (feat. J-DRAGON)" /> tools:text="매버릭 팔레트 (feat. J-DRAGON)" />
<ScrollView <ScrollView
android:id="@+id/sv_action_buttons"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="13.3dp"> android:layout_marginTop="13.3dp">