fix(creator): 오디오 탭 표시를 보정한다
This commit is contained in:
@@ -32,7 +32,6 @@ class CreatorChannelAudioFragment : BaseFragment<FragmentCreatorChannelAudioBind
|
||||
private var sortPopup: CreatorChannelSortPopup? = null
|
||||
private var currentContentState: CreatorChannelAudioUiState.Content? = null
|
||||
private var lastContentLayoutKey: CreatorChannelAudioContentLayoutKey? = null
|
||||
private var emptyMinHeight: Int = 0
|
||||
private val creatorId: Long by lazy { arguments?.getLong(ARG_CREATOR_ID) ?: 0L }
|
||||
private val host: Host
|
||||
get() = requireActivity() as Host
|
||||
@@ -95,10 +94,8 @@ class CreatorChannelAudioFragment : BaseFragment<FragmentCreatorChannelAudioBind
|
||||
viewModel.loadMore()
|
||||
}
|
||||
|
||||
fun onCreatorChannelAudioViewportHeightChanged(minHeight: Int) {
|
||||
emptyMinHeight = minHeight.coerceAtLeast(0)
|
||||
applyEmptyMinHeight()
|
||||
}
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun onCreatorChannelAudioViewportHeightChanged(minHeight: Int) = Unit
|
||||
|
||||
fun onCreatorChannelAudioOwnerCtaVisibilityChanged(isVisible: Boolean) = with(binding) {
|
||||
val bottomPadding = if (isVisible) {
|
||||
@@ -110,10 +107,6 @@ class CreatorChannelAudioFragment : BaseFragment<FragmentCreatorChannelAudioBind
|
||||
layoutCreatorChannelAudioEmpty.updatePadding(bottom = bottomPadding)
|
||||
}
|
||||
|
||||
private fun applyEmptyMinHeight() = with(binding) {
|
||||
layoutCreatorChannelAudioEmpty.minimumHeight = emptyMinHeight
|
||||
}
|
||||
|
||||
private fun bindLoading() = with(binding) {
|
||||
currentContentState = null
|
||||
lastContentLayoutKey = null
|
||||
@@ -134,7 +127,6 @@ class CreatorChannelAudioFragment : BaseFragment<FragmentCreatorChannelAudioBind
|
||||
layoutCreatorChannelAudioRateCard.isVisible = false
|
||||
rvCreatorChannelAudioContents.isVisible = false
|
||||
layoutCreatorChannelAudioEmpty.isVisible = true
|
||||
applyEmptyMinHeight()
|
||||
tvCreatorChannelAudioErrorMessage.isVisible = false
|
||||
btnCreatorChannelAudioRetry.isVisible = false
|
||||
host.onCreatorChannelAudioContentChanged()
|
||||
@@ -204,11 +196,13 @@ class CreatorChannelAudioFragment : BaseFragment<FragmentCreatorChannelAudioBind
|
||||
ratePercentText
|
||||
)
|
||||
tvCreatorChannelAudioRateMessage.text = rateMessage.highlightRatePercent(ratePercentText)
|
||||
tvCreatorChannelAudioRateCount.text = getString(
|
||||
val purchasedCountText = rate.purchasedCount.moneyFormat()
|
||||
val rateCount = getString(
|
||||
R.string.creator_channel_audio_owned_rate_count,
|
||||
rate.purchasedCount.moneyFormat(),
|
||||
purchasedCountText,
|
||||
rate.paidCount.moneyFormat()
|
||||
)
|
||||
tvCreatorChannelAudioRateCount.text = rateCount.highlightPaidCount(purchasedCountText)
|
||||
viewCreatorChannelAudioRateFill.pivotX = 0f
|
||||
viewCreatorChannelAudioRateFill.scaleX = (rate.ratePercent / 100.0).toFloat().coerceIn(0f, 1f)
|
||||
}
|
||||
@@ -228,6 +222,20 @@ class CreatorChannelAudioFragment : BaseFragment<FragmentCreatorChannelAudioBind
|
||||
return spannable
|
||||
}
|
||||
|
||||
private fun String.highlightPaidCount(purchasedCountText: String): SpannableString {
|
||||
val spannable = SpannableString(this)
|
||||
val start = purchasedCountText.length
|
||||
if (start >= length) return spannable
|
||||
|
||||
spannable.setSpan(
|
||||
ForegroundColorSpan(ContextCompat.getColor(requireContext(), R.color.gray_500)),
|
||||
start,
|
||||
length,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
return spannable
|
||||
}
|
||||
|
||||
interface Host {
|
||||
fun isCreatorChannelOwner(): Boolean
|
||||
fun onCreatorChannelAudioContentClicked(audioContentId: Long)
|
||||
|
||||
@@ -149,9 +149,9 @@
|
||||
android:id="@+id/layout_creator_channel_audio_empty"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/spacing_48"
|
||||
android:paddingBottom="@dimen/spacing_32"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -162,7 +162,7 @@
|
||||
style="@style/Typography.Body3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_gravity="top|center_horizontal"
|
||||
android:gravity="center"
|
||||
android:text="@string/creator_channel_audio_empty_message"
|
||||
android:textColor="@color/gray_500" />
|
||||
|
||||
Reference in New Issue
Block a user