feat(creator): 채널 상단 액션을 연결한다

This commit is contained in:
2026-06-16 17:27:38 +09:00
parent 0bb5796da1
commit 1cd676bcb4
5 changed files with 93 additions and 20 deletions

View File

@@ -6,7 +6,7 @@ import android.graphics.Color
import android.view.View import android.view.View
import android.view.View.MeasureSpec import android.view.View.MeasureSpec
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.Toast import androidx.appcompat.app.AlertDialog
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
@@ -22,11 +22,12 @@ import kr.co.vividnext.sodalive.base.BaseActivity
import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity
import kr.co.vividnext.sodalive.common.Constants import kr.co.vividnext.sodalive.common.Constants
import kr.co.vividnext.sodalive.databinding.ActivityCreatorChannelBinding import kr.co.vividnext.sodalive.databinding.ActivityCreatorChannelBinding
import kr.co.vividnext.sodalive.explorer.profile.CreatorFollowNotifyFragment
import kr.co.vividnext.sodalive.extensions.dpToPx import kr.co.vividnext.sodalive.extensions.dpToPx
import kr.co.vividnext.sodalive.extensions.loadUrl import kr.co.vividnext.sodalive.extensions.loadUrl
import kr.co.vividnext.sodalive.extensions.moneyFormat import kr.co.vividnext.sodalive.extensions.moneyFormat
import kr.co.vividnext.sodalive.live.room.detail.LiveRoomDetailFragment import kr.co.vividnext.sodalive.live.room.detail.LiveRoomDetailFragment
import kr.co.vividnext.sodalive.report.ProfileReportDialog
import kr.co.vividnext.sodalive.report.UserReportDialog
import kr.co.vividnext.sodalive.v2.common.CreatorActivityType import kr.co.vividnext.sodalive.v2.common.CreatorActivityType
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelScheduleResponse import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelScheduleResponse
@@ -34,6 +35,7 @@ import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelHeaderUiM
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelScrollState import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelScrollState
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTab import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTab
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTitleBarState import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTitleBarState
import kr.co.vividnext.sodalive.v2.main.MainV2Activity
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
class CreatorChannelActivity : class CreatorChannelActivity :
@@ -68,18 +70,23 @@ class CreatorChannelActivity :
private fun setupClickListeners() { private fun setupClickListeners() {
binding.ivBack.setOnClickListener { finish() } binding.ivBack.setOnClickListener { finish() }
binding.ivMore.setOnClickListener { onMoreClicked() } binding.ivMore.setOnClickListener { onMoreClicked() }
binding.layoutFollowCapsule.setOnClickListener { onFollowActionClicked() } binding.layoutFollowCapsule.setOnClickListener { onFollowCapsuleClicked() }
binding.ivBell.setOnClickListener { onFollowActionClicked() } binding.ivBell.setOnClickListener { onBellClicked() }
binding.tvChatButton.setOnClickListener { binding.tvChatButton.setOnClickListener {
currentHeader?.characterId?.let { characterId -> homeActionDelegate?.createChatRoom(characterId) } currentHeader?.characterId?.let { characterId -> homeActionDelegate?.createChatRoom(characterId) }
} }
binding.tvDmButton.setOnClickListener { binding.tvDmButton.setOnClickListener {
startActivity(DmChatRoomActivity.newIntentByCreatorId(this, creatorId)) if (currentHeader?.isOwner == true) {
startActivity(MainV2Activity.newChatDmIntent(this))
} else {
startActivity(DmChatRoomActivity.newIntentByCreatorId(this, creatorId))
}
} }
} }
private fun bindHeader(header: CreatorChannelHeaderUiModel) { private fun bindHeader(header: CreatorChannelHeaderUiModel) {
binding.tvNickname.text = header.nickname binding.tvNickname.text = header.nickname
binding.tvTitleNickname.text = header.nickname
binding.tvFollowerCount.text = getString( binding.tvFollowerCount.text = getString(
R.string.creator_channel_follower_count, R.string.creator_channel_follower_count,
header.followerCount.moneyFormat() header.followerCount.moneyFormat()
@@ -89,12 +96,24 @@ class CreatorChannelActivity :
error(R.drawable.ic_placeholder_profile) error(R.drawable.ic_placeholder_profile)
} }
updateActionButtonLayout( updateActionButtonLayout(
isChatVisible = header.isAiChatAvailable && header.characterId != null, isChatVisible = !header.isOwner && header.isAiChatAvailable && header.characterId != null,
isDmVisible = header.isDmAvailable isDmVisible = header.isOwner || header.isDmAvailable
)
binding.tvDmButton.setText(
if (header.isOwner) R.string.creator_channel_dm_check_button else R.string.creator_channel_dm_button
) )
} }
private fun bindTitleBar(header: CreatorChannelHeaderUiModel) { private fun bindTitleBar(header: CreatorChannelHeaderUiModel) {
if (header.isOwner) {
binding.layoutFollowCapsule.visibility = View.GONE
binding.ivBell.visibility = View.GONE
binding.ivMore.visibility = View.GONE
return
}
binding.layoutFollowCapsule.visibility = View.VISIBLE
binding.ivMore.visibility = View.VISIBLE
val titleBarState = CreatorChannelTitleBarState.from( val titleBarState = CreatorChannelTitleBarState.from(
isFollow = header.isFollow, isFollow = header.isFollow,
isNotify = header.isNotify, isNotify = header.isNotify,
@@ -122,24 +141,25 @@ class CreatorChannelActivity :
} }
} }
private fun onFollowActionClicked() { private fun onFollowCapsuleClicked() {
if (isFollowInProgress) return if (isFollowInProgress) return
val header = currentHeader ?: return val header = currentHeader ?: return
if (header.isOwner) return
if (!header.isFollow) { if (!header.isFollow) {
homeActionDelegate?.follow(follow = true, notify = true) homeActionDelegate?.follow(follow = true, notify = true)
return return
} }
showFollowNotifyFragment() homeActionDelegate?.follow(follow = false, notify = false)
} }
private fun showFollowNotifyFragment() { private fun onBellClicked() {
val notifyFragment = CreatorFollowNotifyFragment( if (isFollowInProgress) return
onClickNotifyAll = { homeActionDelegate?.follow(follow = true, notify = true) }, val header = currentHeader ?: return
onClickNotifyNone = { homeActionDelegate?.follow(follow = true, notify = false) }, if (header.isOwner) return
onClickUnFollow = { homeActionDelegate?.follow(follow = false, notify = false) } if (!header.isFollow) return
)
notifyFragment.show(supportFragmentManager, CreatorFollowNotifyFragment::class.java.simpleName) homeActionDelegate?.follow(follow = true, notify = !header.isNotify)
} }
private fun setTitleBarTopInset() { private fun setTitleBarTopInset() {
@@ -181,6 +201,7 @@ class CreatorChannelActivity :
binding.titleBarContainer.setBackgroundColor( binding.titleBarContainer.setBackgroundColor(
if (shouldUseBlackTitleBar) Color.BLACK else Color.TRANSPARENT if (shouldUseBlackTitleBar) Color.BLACK else Color.TRANSPARENT
) )
binding.tvTitleNickname.isVisible = shouldUseBlackTitleBar
} }
private fun setStatusBarIconAppearance() { private fun setStatusBarIconAppearance() {
@@ -196,7 +217,38 @@ class CreatorChannelActivity :
} }
private fun onMoreClicked() { private fun onMoreClicked() {
Toast.makeText(applicationContext, getString(R.string.creator_channel_more_ready), Toast.LENGTH_SHORT).show() val header = currentHeader ?: return
if (header.isOwner) return
CreatorChannelMoreBottomSheet.newInstance().apply {
onClickBlock = { showUserBlockDialog() }
onClickUserReport = { showUserReportDialog() }
onClickProfileReport = { showProfileReportDialog() }
}.show(supportFragmentManager, CreatorChannelMoreBottomSheet::class.java.simpleName)
}
private fun showUserBlockDialog() {
val nickname = currentHeader?.nickname.orEmpty()
AlertDialog.Builder(this)
.setTitle(getString(R.string.screen_live_room_block_title))
.setMessage(getString(R.string.screen_live_room_block_message_user, nickname))
.setPositiveButton(getString(R.string.screen_live_room_block_confirm)) { _, _ ->
homeActionDelegate?.blockUser()
}
.setNegativeButton(getString(R.string.cancel)) { _, _ -> }
.show()
}
private fun showUserReportDialog() {
UserReportDialog(this, layoutInflater) { reason ->
homeActionDelegate?.reportUser(reason)
}.show(resources.displayMetrics.widthPixels)
}
private fun showProfileReportDialog() {
ProfileReportDialog(this, layoutInflater) {
homeActionDelegate?.reportProfile()
}.show(resources.displayMetrics.widthPixels)
} }
private fun setupTabsAndPager() { private fun setupTabsAndPager() {

View File

@@ -37,6 +37,18 @@ class CreatorChannelHomeFragment : BaseFragment<FragmentCreatorChannelHomeBindin
override fun createChatRoom(characterId: Long) { override fun createChatRoom(characterId: Long) {
viewModel.createChatRoom(characterId) viewModel.createChatRoom(characterId)
} }
override fun blockUser() {
viewModel.blockUser()
}
override fun reportUser(reason: String) {
viewModel.reportUser(reason)
}
override fun reportProfile() {
viewModel.reportProfile()
}
} }
) )
if (creatorId > 0L) { if (creatorId > 0L) {
@@ -98,6 +110,9 @@ class CreatorChannelHomeFragment : BaseFragment<FragmentCreatorChannelHomeBindin
interface HomeActionDelegate { interface HomeActionDelegate {
fun follow(follow: Boolean, notify: Boolean) fun follow(follow: Boolean, notify: Boolean)
fun createChatRoom(characterId: Long) fun createChatRoom(characterId: Long)
fun blockUser()
fun reportUser(reason: String)
fun reportProfile()
} }
companion object { companion object {

View File

@@ -281,7 +281,10 @@
<string name="creator_channel_follower_count">%1$s followers</string> <string name="creator_channel_follower_count">%1$s followers</string>
<string name="creator_channel_chat_button">Chat Now</string> <string name="creator_channel_chat_button">Chat Now</string>
<string name="creator_channel_dm_button">Send DM</string> <string name="creator_channel_dm_button">Send DM</string>
<string name="creator_channel_dm_check_button">Check DMs</string>
<string name="creator_channel_follow_button">Follow</string> <string name="creator_channel_follow_button">Follow</string>
<string name="creator_channel_unfollow_success">Following has been canceled.</string>
<string name="creator_channel_block_success">Blocked.</string>
<string name="creator_channel_section_live">Live now</string> <string name="creator_channel_section_live">Live now</string>
<string name="creator_channel_section_latest_audio">Latest audio</string> <string name="creator_channel_section_latest_audio">Latest audio</string>
<string name="creator_channel_section_donation">Support</string> <string name="creator_channel_section_donation">Support</string>
@@ -299,7 +302,6 @@
<string name="creator_channel_fantalk_summary">%1$s · Total %2$d</string> <string name="creator_channel_fantalk_summary">%1$s · Total %2$d</string>
<string name="creator_channel_fantalk_empty_title">Be the first\nto cheer them on!</string> <string name="creator_channel_fantalk_empty_title">Be the first\nto cheer them on!</string>
<string name="creator_channel_fantalk_support_action">Leave support</string> <string name="creator_channel_fantalk_support_action">Leave support</string>
<string name="creator_channel_activity_summary">Live %1$d · %2$d hours · %3$d contributors · Audio %4$d · Series %5$d</string>
<string name="creator_channel_activity_debut">Debut</string> <string name="creator_channel_activity_debut">Debut</string>
<string name="creator_channel_activity_debut_format">%1$s (%2$s)</string> <string name="creator_channel_activity_debut_format">%1$s (%2$s)</string>
<string name="creator_channel_activity_live_count">Total lives</string> <string name="creator_channel_activity_live_count">Total lives</string>

View File

@@ -281,7 +281,10 @@
<string name="creator_channel_follower_count">フォロワー %1$s人</string> <string name="creator_channel_follower_count">フォロワー %1$s人</string>
<string name="creator_channel_chat_button">トークする</string> <string name="creator_channel_chat_button">トークする</string>
<string name="creator_channel_dm_button">DMを送る</string> <string name="creator_channel_dm_button">DMを送る</string>
<string name="creator_channel_dm_check_button">DMを確認</string>
<string name="creator_channel_follow_button">フォロー</string> <string name="creator_channel_follow_button">フォロー</string>
<string name="creator_channel_unfollow_success">フォローを解除しました。</string>
<string name="creator_channel_block_success">ブロックしました。</string>
<string name="creator_channel_section_live">配信中</string> <string name="creator_channel_section_live">配信中</string>
<string name="creator_channel_section_latest_audio">最新オーディオ</string> <string name="creator_channel_section_latest_audio">最新オーディオ</string>
<string name="creator_channel_section_donation">応援</string> <string name="creator_channel_section_donation">応援</string>
@@ -299,7 +302,6 @@
<string name="creator_channel_fantalk_summary">%1$s · 全体 %2$d</string> <string name="creator_channel_fantalk_summary">%1$s · 全体 %2$d</string>
<string name="creator_channel_fantalk_empty_title">最初の応援を\n待っています</string> <string name="creator_channel_fantalk_empty_title">最初の応援を\n待っています</string>
<string name="creator_channel_fantalk_support_action">応援を残す</string> <string name="creator_channel_fantalk_support_action">応援を残す</string>
<string name="creator_channel_activity_summary">ライブ %1$d回 · 累計 %2$d時間 · 参加者 %3$d人 · オーディオ %4$d件 · シリーズ %5$d件</string>
<string name="creator_channel_activity_debut">デビュー</string> <string name="creator_channel_activity_debut">デビュー</string>
<string name="creator_channel_activity_debut_format">%1$s(%2$s)</string> <string name="creator_channel_activity_debut_format">%1$s(%2$s)</string>
<string name="creator_channel_activity_live_count">ライブ総配信数</string> <string name="creator_channel_activity_live_count">ライブ総配信数</string>

View File

@@ -280,7 +280,10 @@
<string name="creator_channel_follower_count">팔로워 %1$s명</string> <string name="creator_channel_follower_count">팔로워 %1$s명</string>
<string name="creator_channel_chat_button">대화하기</string> <string name="creator_channel_chat_button">대화하기</string>
<string name="creator_channel_dm_button">DM 보내기</string> <string name="creator_channel_dm_button">DM 보내기</string>
<string name="creator_channel_dm_check_button">DM 확인하기</string>
<string name="creator_channel_follow_button">팔로우</string> <string name="creator_channel_follow_button">팔로우</string>
<string name="creator_channel_unfollow_success">팔로잉이 취소되었습니다.</string>
<string name="creator_channel_block_success">차단하였습니다.</string>
<string name="creator_channel_section_live">현재 라이브</string> <string name="creator_channel_section_live">현재 라이브</string>
<string name="creator_channel_section_latest_audio">최신 오디오</string> <string name="creator_channel_section_latest_audio">최신 오디오</string>
<string name="creator_channel_section_donation">후원</string> <string name="creator_channel_section_donation">후원</string>
@@ -298,7 +301,6 @@
<string name="creator_channel_fantalk_summary">%1$s · 전체 %2$d</string> <string name="creator_channel_fantalk_summary">%1$s · 전체 %2$d</string>
<string name="creator_channel_fantalk_empty_title">당신의 첫 응원을\n기다리고 있어요!</string> <string name="creator_channel_fantalk_empty_title">당신의 첫 응원을\n기다리고 있어요!</string>
<string name="creator_channel_fantalk_support_action">응원 남기기</string> <string name="creator_channel_fantalk_support_action">응원 남기기</string>
<string name="creator_channel_activity_summary">라이브 %1$d회 · 누적 %2$d시간 · 참여자 %3$d명 · 오디오 %4$d개 · 시리즈 %5$d개</string>
<string name="creator_channel_activity_debut">데뷔</string> <string name="creator_channel_activity_debut">데뷔</string>
<string name="creator_channel_activity_debut_format">%1$s(%2$s)</string> <string name="creator_channel_activity_debut_format">%1$s(%2$s)</string>
<string name="creator_channel_activity_live_count">라이브 총 진행 수</string> <string name="creator_channel_activity_live_count">라이브 총 진행 수</string>