feat(creator-channel): FanTalk 글쓰기 진입점을 연결한다
This commit is contained in:
@@ -65,6 +65,7 @@ import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelLiveRespon
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelScheduleResponse
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelSeriesResponse
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.CreatorChannelFanTalkFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.write.CreatorChannelFanTalkWriteActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.donation.CreatorChannelDonationFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.CreatorChannelLiveFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelHeaderUiModel
|
||||
@@ -103,6 +104,7 @@ class CreatorChannelActivity :
|
||||
private var isOwnerFabExpanded: Boolean = false
|
||||
private var isOwnerFabAnimating: Boolean = false
|
||||
private var isDonationFloatingButtonVisible: Boolean = false
|
||||
private var isFanTalkFixedPlusVisible: Boolean = false
|
||||
private lateinit var loadingDialog: LoadingDialog
|
||||
private val baseTitleBarHeight: Int by lazy { 60.dpToPx().toInt() }
|
||||
private val liveCoordinator: CreatorChannelLiveCoordinator by lazy {
|
||||
@@ -130,6 +132,14 @@ class CreatorChannelActivity :
|
||||
refreshCreatorChannelCommunity()
|
||||
}
|
||||
}
|
||||
private val fanTalkWriteLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == RESULT_OK) {
|
||||
refreshCreatorChannelFanTalk()
|
||||
homeActionDelegate?.refreshHome()
|
||||
}
|
||||
}
|
||||
private val liveRoomCreateLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
@@ -192,6 +202,7 @@ class CreatorChannelActivity :
|
||||
binding.btnCreatorChannelDonationWrite.setOnClickListener {
|
||||
findDonationFragment()?.onCreatorChannelDonationFloatingButtonClicked()
|
||||
}
|
||||
binding.btnCreatorChannelFantalkFixedPlus.setOnClickListener { openFanTalkWrite() }
|
||||
binding.btnCreatorChannelOwnerCta.setOnClickListener { onOwnerCtaClicked() }
|
||||
binding.tvChatButton.setOnClickListener {
|
||||
currentHeader?.characterId?.let { characterId -> homeActionDelegate?.createChatRoom(characterId) }
|
||||
@@ -410,6 +421,7 @@ class CreatorChannelActivity :
|
||||
}
|
||||
updateOwnerFabVisibility()
|
||||
updateDonationFloatingButtonVisibility()
|
||||
updateFanTalkFixedPlusVisibility()
|
||||
updateOwnerCtaVisibility()
|
||||
updateCreatorChannelTabViewportHeight()
|
||||
updateViewPagerHeight()
|
||||
@@ -445,6 +457,7 @@ class CreatorChannelActivity :
|
||||
bindTitleBar(header)
|
||||
updateOwnerFabVisibility()
|
||||
updateDonationFloatingButtonVisibility()
|
||||
updateFanTalkFixedPlusVisibility()
|
||||
updateOwnerCtaVisibility()
|
||||
if (binding.viewPager.currentItem == CreatorChannelTab.Audio.ordinal) {
|
||||
binding.viewPager.post {
|
||||
@@ -551,6 +564,15 @@ class CreatorChannelActivity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreatorChannelFanTalkWriteClicked() {
|
||||
openFanTalkWrite()
|
||||
}
|
||||
|
||||
override fun onCreatorChannelFanTalkFloatingButtonVisibilityChanged(isVisible: Boolean) {
|
||||
isFanTalkFixedPlusVisible = isVisible
|
||||
updateFanTalkFixedPlusVisibility()
|
||||
}
|
||||
|
||||
override fun onCreatorChannelDonationContentChanged() {
|
||||
updateViewPagerHeight {
|
||||
postCheckCreatorChannelCurrentTabNeedsMore()
|
||||
@@ -822,6 +844,21 @@ class CreatorChannelActivity :
|
||||
binding.btnCreatorChannelDonationWrite.isVisible = shouldShowDonationFloatingButton
|
||||
}
|
||||
|
||||
private fun updateFanTalkFixedPlusVisibility() {
|
||||
val shouldShowFanTalkFixedPlus =
|
||||
isFanTalkFixedPlusVisible && binding.viewPager.currentItem == CreatorChannelTab.FanTalk.ordinal
|
||||
binding.btnCreatorChannelFantalkFixedPlus.isVisible = shouldShowFanTalkFixedPlus
|
||||
}
|
||||
|
||||
private fun openFanTalkWrite() {
|
||||
if (creatorId <= 0L) return
|
||||
if (SharedPreferenceManager.token.isBlank()) {
|
||||
showLoginActivity()
|
||||
return
|
||||
}
|
||||
fanTalkWriteLauncher.launch(CreatorChannelFanTalkWriteActivity.newIntent(this, creatorId))
|
||||
}
|
||||
|
||||
private fun onOwnerFabCommunityClicked() {
|
||||
collapseOwnerFab(animate = false)
|
||||
communityWriteLauncher.launch(Intent(this, CreatorCommunityWriteActivity::class.java))
|
||||
|
||||
@@ -43,6 +43,7 @@ class CreatorChannelFanTalkFragment : BaseFragment<FragmentCreatorChannelFantalk
|
||||
morePopup?.dismiss()
|
||||
morePopup = null
|
||||
lastContentLayoutKey = null
|
||||
host.onCreatorChannelFanTalkFloatingButtonVisibilityChanged(false)
|
||||
binding.rvCreatorChannelFantalk.adapter = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
@@ -77,8 +78,8 @@ class CreatorChannelFanTalkFragment : BaseFragment<FragmentCreatorChannelFantalk
|
||||
btnCreatorChannelFantalkRetry.setOnClickListener {
|
||||
viewModel.retryFanTalks()
|
||||
}
|
||||
btnCreatorChannelFantalkWrite.setOnClickListener { }
|
||||
layoutCreatorChannelFantalkEmptyWriteButton.setOnClickListener { }
|
||||
btnCreatorChannelFantalkWrite.setOnClickListener { host.onCreatorChannelFanTalkWriteClicked() }
|
||||
layoutCreatorChannelFantalkEmptyWriteButton.setOnClickListener { host.onCreatorChannelFanTalkWriteClicked() }
|
||||
}
|
||||
|
||||
private fun observeViewModel() {
|
||||
@@ -100,6 +101,7 @@ class CreatorChannelFanTalkFragment : BaseFragment<FragmentCreatorChannelFantalk
|
||||
tvCreatorChannelFantalkErrorMessage.isVisible = false
|
||||
btnCreatorChannelFantalkRetry.isVisible = false
|
||||
btnCreatorChannelFantalkWrite.isVisible = false
|
||||
host.onCreatorChannelFanTalkFloatingButtonVisibilityChanged(false)
|
||||
}
|
||||
|
||||
private fun bindEmpty() = with(binding) {
|
||||
@@ -110,6 +112,7 @@ class CreatorChannelFanTalkFragment : BaseFragment<FragmentCreatorChannelFantalk
|
||||
tvCreatorChannelFantalkErrorMessage.isVisible = false
|
||||
btnCreatorChannelFantalkRetry.isVisible = false
|
||||
btnCreatorChannelFantalkWrite.isVisible = false
|
||||
host.onCreatorChannelFanTalkFloatingButtonVisibilityChanged(false)
|
||||
host.onCreatorChannelFanTalkContentChanged()
|
||||
}
|
||||
|
||||
@@ -122,6 +125,7 @@ class CreatorChannelFanTalkFragment : BaseFragment<FragmentCreatorChannelFantalk
|
||||
tvCreatorChannelFantalkErrorMessage.text = state.message ?: getString(R.string.creator_channel_fantalk_error_message)
|
||||
btnCreatorChannelFantalkRetry.isVisible = true
|
||||
btnCreatorChannelFantalkWrite.isVisible = false
|
||||
host.onCreatorChannelFanTalkFloatingButtonVisibilityChanged(false)
|
||||
host.onCreatorChannelFanTalkContentChanged()
|
||||
}
|
||||
|
||||
@@ -133,7 +137,8 @@ class CreatorChannelFanTalkFragment : BaseFragment<FragmentCreatorChannelFantalk
|
||||
layoutCreatorChannelFantalkEmpty.isVisible = false
|
||||
tvCreatorChannelFantalkErrorMessage.isVisible = false
|
||||
btnCreatorChannelFantalkRetry.isVisible = false
|
||||
btnCreatorChannelFantalkWrite.isVisible = true
|
||||
btnCreatorChannelFantalkWrite.isVisible = false
|
||||
host.onCreatorChannelFanTalkFloatingButtonVisibilityChanged(true)
|
||||
notifyContentChangedIfLayoutChanged(state)
|
||||
state.paginationErrorMessage?.let {
|
||||
Toast.makeText(requireContext(), it, Toast.LENGTH_SHORT).show()
|
||||
@@ -178,6 +183,8 @@ class CreatorChannelFanTalkFragment : BaseFragment<FragmentCreatorChannelFantalk
|
||||
interface Host {
|
||||
fun isCreatorChannelOwner(): Boolean
|
||||
fun onCreatorChannelFanTalkContentChanged()
|
||||
fun onCreatorChannelFanTalkWriteClicked()
|
||||
fun onCreatorChannelFanTalkFloatingButtonVisibilityChanged(isVisible: Boolean)
|
||||
fun onCreatorChannelFanTalkDeleteClicked(fanTalkId: Long)
|
||||
}
|
||||
|
||||
|
||||
@@ -407,6 +407,31 @@
|
||||
app:tint="@color/white" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_creator_channel_fantalk_fixed_plus"
|
||||
android:layout_width="66dp"
|
||||
android:layout_height="66dp"
|
||||
android:layout_marginEnd="@dimen/spacing_14"
|
||||
android:layout_marginBottom="@dimen/spacing_14"
|
||||
android:background="@drawable/bg_creator_channel_owner_fab"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/creator_channel_fantalk_support_action"
|
||||
android:elevation="8dp"
|
||||
android:focusable="true"
|
||||
android:padding="@dimen/spacing_14"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_plus_no_bg"
|
||||
app:tint="@color/white" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/owner_fab_button"
|
||||
android:layout_width="66dp"
|
||||
|
||||
@@ -151,7 +151,9 @@
|
||||
android:background="@drawable/bg_creator_channel_fantalk_write_button"
|
||||
android:contentDescription="@string/creator_channel_fantalk_support_action"
|
||||
android:padding="@dimen/spacing_16"
|
||||
android:src="@drawable/ic_new_fantalk_plus"
|
||||
android:src="@drawable/ic_plus_no_bg"
|
||||
android:visibility="gone"
|
||||
app:tint="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user