feat(creator): 후원 floating button 위치를 조정한다
This commit is contained in:
@@ -103,6 +103,7 @@ class CreatorChannelActivity :
|
||||
private var lastSelectedCreatorChannelTabPosition: Int? = null
|
||||
private var isOwnerFabExpanded: Boolean = false
|
||||
private var isOwnerFabAnimating: Boolean = false
|
||||
private var isDonationFloatingButtonVisible: Boolean = false
|
||||
private lateinit var loadingDialog: LoadingDialog
|
||||
private val baseTitleBarHeight: Int by lazy { 60.dpToPx().toInt() }
|
||||
private val liveCoordinator: CreatorChannelLiveCoordinator by lazy {
|
||||
@@ -189,6 +190,9 @@ class CreatorChannelActivity :
|
||||
binding.ownerFabCommunityButton.setOnClickListener { onOwnerFabCommunityClicked() }
|
||||
binding.ownerFabAudioButton.setOnClickListener { onOwnerFabAudioClicked() }
|
||||
binding.ownerFabLiveButton.setOnClickListener { onOwnerFabLiveClicked() }
|
||||
binding.btnCreatorChannelDonationWrite.setOnClickListener {
|
||||
findDonationFragment()?.onCreatorChannelDonationFloatingButtonClicked()
|
||||
}
|
||||
binding.btnCreatorChannelOwnerCta.setOnClickListener { onOwnerCtaClicked() }
|
||||
binding.tvChatButton.setOnClickListener {
|
||||
currentHeader?.characterId?.let { characterId -> homeActionDelegate?.createChatRoom(characterId) }
|
||||
@@ -419,6 +423,7 @@ class CreatorChannelActivity :
|
||||
collapseOwnerFab(animate = false)
|
||||
}
|
||||
updateOwnerFabVisibility()
|
||||
updateDonationFloatingButtonVisibility()
|
||||
updateOwnerCtaVisibility()
|
||||
updateCreatorChannelTabViewportHeight()
|
||||
updateViewPagerHeight()
|
||||
@@ -453,6 +458,7 @@ class CreatorChannelActivity :
|
||||
bindHeader(header)
|
||||
bindTitleBar(header)
|
||||
updateOwnerFabVisibility()
|
||||
updateDonationFloatingButtonVisibility()
|
||||
updateOwnerCtaVisibility()
|
||||
if (binding.viewPager.currentItem == CreatorChannelTab.Audio.ordinal) {
|
||||
binding.viewPager.post {
|
||||
@@ -565,6 +571,11 @@ class CreatorChannelActivity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreatorChannelDonationFloatingButtonVisibilityChanged(isVisible: Boolean) {
|
||||
isDonationFloatingButtonVisible = isVisible
|
||||
updateDonationFloatingButtonVisibility()
|
||||
}
|
||||
|
||||
override fun onCreatorChannelDonationRequested(
|
||||
onSubmit: (can: Int, isSecret: Boolean, message: String) -> Unit
|
||||
) {
|
||||
@@ -817,6 +828,14 @@ class CreatorChannelActivity :
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateDonationFloatingButtonVisibility() {
|
||||
val shouldShowDonationFloatingButton =
|
||||
isDonationFloatingButtonVisible &&
|
||||
currentHeader?.isOwner != true &&
|
||||
binding.viewPager.currentItem == CreatorChannelTab.Donation.ordinal
|
||||
binding.btnCreatorChannelDonationWrite.isVisible = shouldShowDonationFloatingButton
|
||||
}
|
||||
|
||||
private fun onOwnerFabCommunityClicked() {
|
||||
collapseOwnerFab(animate = false)
|
||||
communityWriteLauncher.launch(Intent(this, CreatorCommunityWriteActivity::class.java))
|
||||
|
||||
@@ -34,6 +34,9 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
if (isAdded) {
|
||||
host.onCreatorChannelDonationFloatingButtonVisibilityChanged(false)
|
||||
}
|
||||
lastContentLayoutKey = null
|
||||
binding.rvCreatorChannelDonation.adapter = null
|
||||
super.onDestroyView()
|
||||
@@ -57,6 +60,12 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
binding.root.minimumHeight = minHeight
|
||||
}
|
||||
|
||||
fun onCreatorChannelDonationFloatingButtonClicked() {
|
||||
host.onCreatorChannelDonationRequested { can, isSecret, message ->
|
||||
viewModel.postChannelDonation(can, isSecret, message)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupDonationList() = with(binding.rvCreatorChannelDonation) {
|
||||
layoutManager = LinearLayoutManager(requireContext())
|
||||
adapter = donationAdapter
|
||||
@@ -66,11 +75,6 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
btnCreatorChannelDonationRetry.setOnClickListener {
|
||||
viewModel.retryDonations()
|
||||
}
|
||||
btnCreatorChannelDonationWrite.setOnClickListener {
|
||||
host.onCreatorChannelDonationRequested { can, isSecret, message ->
|
||||
viewModel.postChannelDonation(can, isSecret, message)
|
||||
}
|
||||
}
|
||||
btnCreatorChannelDonationEmptyWrite.setOnClickListener {
|
||||
host.onCreatorChannelDonationRequested { can, isSecret, message ->
|
||||
viewModel.postChannelDonation(can, isSecret, message)
|
||||
@@ -99,7 +103,7 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
btnCreatorChannelDonationEmptyWrite.isVisible = false
|
||||
tvCreatorChannelDonationErrorMessage.isVisible = false
|
||||
btnCreatorChannelDonationRetry.isVisible = false
|
||||
btnCreatorChannelDonationWrite.isVisible = false
|
||||
host.onCreatorChannelDonationFloatingButtonVisibilityChanged(false)
|
||||
}
|
||||
|
||||
private fun bindEmpty(state: CreatorChannelDonationUiState.Empty) = with(binding) {
|
||||
@@ -117,7 +121,7 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
)
|
||||
tvCreatorChannelDonationErrorMessage.isVisible = false
|
||||
btnCreatorChannelDonationRetry.isVisible = false
|
||||
btnCreatorChannelDonationWrite.isVisible = false
|
||||
host.onCreatorChannelDonationFloatingButtonVisibilityChanged(false)
|
||||
host.onCreatorChannelDonationContentChanged()
|
||||
}
|
||||
|
||||
@@ -130,7 +134,7 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
tvCreatorChannelDonationErrorMessage.isVisible = true
|
||||
tvCreatorChannelDonationErrorMessage.text = state.message ?: getString(R.string.creator_channel_donation_error_message)
|
||||
btnCreatorChannelDonationRetry.isVisible = true
|
||||
btnCreatorChannelDonationWrite.isVisible = false
|
||||
host.onCreatorChannelDonationFloatingButtonVisibilityChanged(false)
|
||||
host.onCreatorChannelDonationContentChanged()
|
||||
}
|
||||
|
||||
@@ -143,7 +147,7 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
btnCreatorChannelDonationEmptyWrite.isVisible = false
|
||||
tvCreatorChannelDonationErrorMessage.isVisible = false
|
||||
btnCreatorChannelDonationRetry.isVisible = false
|
||||
btnCreatorChannelDonationWrite.isVisible = !state.isOwner
|
||||
host.onCreatorChannelDonationFloatingButtonVisibilityChanged(!state.isOwner)
|
||||
notifyContentChangedIfLayoutChanged(state)
|
||||
state.paginationErrorMessage?.let {
|
||||
Toast.makeText(requireContext(), it, Toast.LENGTH_SHORT).show()
|
||||
@@ -179,6 +183,7 @@ class CreatorChannelDonationFragment : BaseFragment<FragmentCreatorChannelDonati
|
||||
interface Host {
|
||||
fun isCreatorChannelOwner(): Boolean
|
||||
fun onCreatorChannelDonationContentChanged()
|
||||
fun onCreatorChannelDonationFloatingButtonVisibilityChanged(isVisible: Boolean)
|
||||
fun onCreatorChannelDonationRequested(onSubmit: (can: Int, isSecret: Boolean, message: String) -> Unit)
|
||||
fun onCreatorChannelDonationRankingAllClicked()
|
||||
fun onCreatorChannelDonationCompleted()
|
||||
|
||||
@@ -382,6 +382,31 @@
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_creator_channel_donation_write"
|
||||
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_donation_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_new_donation"
|
||||
app:tint="@color/white" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/owner_fab_button"
|
||||
android:layout_width="66dp"
|
||||
|
||||
@@ -137,16 +137,4 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_creator_channel_donation_error_message" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_creator_channel_donation_write"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="58dp"
|
||||
android:layout_marginEnd="@dimen/spacing_14"
|
||||
android:layout_marginBottom="@dimen/spacing_14"
|
||||
android:background="@drawable/bg_creator_channel_fantalk_write_button"
|
||||
android:contentDescription="@string/creator_channel_donation_action"
|
||||
android:padding="@dimen/spacing_16"
|
||||
android:src="@drawable/ic_new_donation"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user