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.MeasureSpec
import android.widget.LinearLayout
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
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.common.Constants
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.loadUrl
import kr.co.vividnext.sodalive.extensions.moneyFormat
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.creator.channel.data.CreatorChannelAudioContentResponse
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.CreatorChannelTab
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
class CreatorChannelActivity :
@@ -68,18 +70,23 @@ class CreatorChannelActivity :
private fun setupClickListeners() {
binding.ivBack.setOnClickListener { finish() }
binding.ivMore.setOnClickListener { onMoreClicked() }
binding.layoutFollowCapsule.setOnClickListener { onFollowActionClicked() }
binding.ivBell.setOnClickListener { onFollowActionClicked() }
binding.layoutFollowCapsule.setOnClickListener { onFollowCapsuleClicked() }
binding.ivBell.setOnClickListener { onBellClicked() }
binding.tvChatButton.setOnClickListener {
currentHeader?.characterId?.let { characterId -> homeActionDelegate?.createChatRoom(characterId) }
}
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) {
binding.tvNickname.text = header.nickname
binding.tvTitleNickname.text = header.nickname
binding.tvFollowerCount.text = getString(
R.string.creator_channel_follower_count,
header.followerCount.moneyFormat()
@@ -89,12 +96,24 @@ class CreatorChannelActivity :
error(R.drawable.ic_placeholder_profile)
}
updateActionButtonLayout(
isChatVisible = header.isAiChatAvailable && header.characterId != null,
isDmVisible = header.isDmAvailable
isChatVisible = !header.isOwner && header.isAiChatAvailable && header.characterId != null,
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) {
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(
isFollow = header.isFollow,
isNotify = header.isNotify,
@@ -122,24 +141,25 @@ class CreatorChannelActivity :
}
}
private fun onFollowActionClicked() {
private fun onFollowCapsuleClicked() {
if (isFollowInProgress) return
val header = currentHeader ?: return
if (header.isOwner) return
if (!header.isFollow) {
homeActionDelegate?.follow(follow = true, notify = true)
return
}
showFollowNotifyFragment()
homeActionDelegate?.follow(follow = false, notify = false)
}
private fun showFollowNotifyFragment() {
val notifyFragment = CreatorFollowNotifyFragment(
onClickNotifyAll = { homeActionDelegate?.follow(follow = true, notify = true) },
onClickNotifyNone = { homeActionDelegate?.follow(follow = true, notify = false) },
onClickUnFollow = { homeActionDelegate?.follow(follow = false, notify = false) }
)
notifyFragment.show(supportFragmentManager, CreatorFollowNotifyFragment::class.java.simpleName)
private fun onBellClicked() {
if (isFollowInProgress) return
val header = currentHeader ?: return
if (header.isOwner) return
if (!header.isFollow) return
homeActionDelegate?.follow(follow = true, notify = !header.isNotify)
}
private fun setTitleBarTopInset() {
@@ -181,6 +201,7 @@ class CreatorChannelActivity :
binding.titleBarContainer.setBackgroundColor(
if (shouldUseBlackTitleBar) Color.BLACK else Color.TRANSPARENT
)
binding.tvTitleNickname.isVisible = shouldUseBlackTitleBar
}
private fun setStatusBarIconAppearance() {
@@ -196,7 +217,38 @@ class CreatorChannelActivity :
}
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() {

View File

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