From 9900ac02f53d0b1a0119fca9ecf58ebdad743b73 Mon Sep 17 00:00:00 2001 From: klaus Date: Tue, 16 Jun 2026 21:18:38 +0900 Subject: [PATCH] =?UTF-8?q?fix(creator):=20=EC=B1=84=EB=84=90=20=ED=99=88?= =?UTF-8?q?=20=EC=B9=B4=EB=93=9C=20=ED=83=9C=EA=B7=B8=20=ED=81=AC=EA=B8=B0?= =?UTF-8?q?=EB=A5=BC=20=EB=B3=B4=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/CreatorChannelHomeSectionAdapter.kt | 54 ++++++++++++++----- ...tem_creator_channel_home_audio_content.xml | 4 +- ...em_creator_channel_home_series_content.xml | 12 +++-- 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/ui/CreatorChannelHomeSectionAdapter.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/ui/CreatorChannelHomeSectionAdapter.kt index 958feab9..5bfaedc4 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/ui/CreatorChannelHomeSectionAdapter.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/ui/CreatorChannelHomeSectionAdapter.kt @@ -171,8 +171,12 @@ class CreatorChannelHomeSectionAdapter( R.string.creator_channel_donation_empty_title } ) - donationButton?.setOnClickListener(if (isDonationButtonVisible) View.OnClickListener { onDonationClick() } else null) - donationEmptyButton?.setOnClickListener(if (isDonationEmptyButtonVisible) View.OnClickListener { onDonationClick() } else null) + donationButton?.setOnClickListener( + if (isDonationButtonVisible) View.OnClickListener { onDonationClick() } else null + ) + donationEmptyButton?.setOnClickListener( + if (isDonationEmptyButtonVisible) View.OnClickListener { onDonationClick() } else null + ) val visibleDonations = item.donations.take(MAX_DONATION_ITEM_COUNT) visibleDonations.forEachIndexed { index, donation -> val row = LayoutInflater.from(itemView.context).inflate( @@ -291,9 +295,17 @@ class CreatorChannelHomeSectionAdapter( private fun bindAudioContents(item: CreatorChannelHomeSection.AudioContents) { val visibleAudioContents = item.audioContents.take(MAX_AUDIO_ITEM_COUNT) + updateAudioContentsGridSpan(visibleAudioContents.size) audioContentGridAdapter.submitItems(visibleAudioContents) } + private fun updateAudioContentsGridSpan(itemCount: Int) { + (audioContentsRecyclerView?.layoutManager as? GridLayoutManager)?.spanCount = itemCount.coerceIn( + 1, + AUDIO_GRID_SPAN_COUNT + ) + } + private fun setupAudioContentsRecyclerView() { audioContentsRecyclerView?.apply { if (layoutManager == null) { @@ -427,7 +439,7 @@ class CreatorChannelHomeSectionAdapter( private fun bindActivity(item: CreatorChannelHomeSection.Activity) { val activity = item.activity - activityDebutValue?.text = formatDebutActivityValue(activity.debutDateUtc, activity.dDay) + activityDebutValue?.text = formatCreatorChannelDebutActivityValue(activity.debutDateUtc, activity.dDay) activityLiveCountValue?.text = itemView.context.getString( R.string.creator_channel_activity_live_count_format, activity.liveCount @@ -473,15 +485,6 @@ class CreatorChannelHomeSectionAdapter( } } - private fun formatDebutActivityValue(debutDateUtc: String?, dDay: String): String { - val debutDate = debutDateUtc.orEmpty() - return if (debutDate.isBlank()) { - dDay - } else { - itemView.context.getString(R.string.creator_channel_activity_debut_format, debutDate, dDay) - } - } - private fun Int.dp(): Int = (this * itemView.resources.displayMetrics.density).toInt() } @@ -611,16 +614,41 @@ internal fun formatCreatorChannelScheduleTime( locale: Locale = Locale.getDefault() ): String = formatCreatorChannelScheduleUtc(scheduledAtUtc, "a hh:mm", timeZone, locale) +internal fun formatCreatorChannelDebutActivityValue( + debutDateUtc: String?, + dDay: String, + timeZone: TimeZone = TimeZone.getDefault(), + locale: Locale = Locale.getDefault() +): String { + val debutDate = debutDateUtc?.takeIf(String::isNotBlank)?.let { dateUtc -> + formatCreatorChannelUtcOrNull(dateUtc, "yyyy.MM.dd", timeZone, locale) + } + return if (debutDate.isNullOrBlank()) { + dDay + } else { + "$debutDate($dDay)" + } +} + private fun formatCreatorChannelScheduleUtc( scheduledAtUtc: String, pattern: String, timeZone: TimeZone, locale: Locale ): String { + return formatCreatorChannelUtcOrNull(scheduledAtUtc, pattern, timeZone, locale).orEmpty() +} + +private fun formatCreatorChannelUtcOrNull( + utc: String, + pattern: String, + timeZone: TimeZone, + locale: Locale +): String? { val date = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US).apply { this.timeZone = TimeZone.getTimeZone("UTC") isLenient = false - }.parse(scheduledAtUtc) ?: return "" + }.runCatching { parse(utc) }.getOrNull() ?: return null return SimpleDateFormat(pattern, locale).apply { this.timeZone = timeZone }.format(date) } diff --git a/app/src/main/res/layout/item_creator_channel_home_audio_content.xml b/app/src/main/res/layout/item_creator_channel_home_audio_content.xml index 03a6248a..894b4af7 100644 --- a/app/src/main/res/layout/item_creator_channel_home_audio_content.xml +++ b/app/src/main/res/layout/item_creator_channel_home_audio_content.xml @@ -66,11 +66,13 @@ diff --git a/app/src/main/res/layout/item_creator_channel_home_series_content.xml b/app/src/main/res/layout/item_creator_channel_home_series_content.xml index 84c9f49e..6d977d21 100644 --- a/app/src/main/res/layout/item_creator_channel_home_series_content.xml +++ b/app/src/main/res/layout/item_creator_channel_home_series_content.xml @@ -21,17 +21,19 @@ + android:background="@drawable/bg_series_original_tag" + android:minHeight="24dp" + android:paddingStart="8dp" + android:paddingEnd="8dp"> @@ -39,7 +41,7 @@ android:id="@+id/tv_series_original_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="26dp" + android:layout_marginStart="18dp" android:layout_marginTop="2dp" android:fontFamily="@font/phosphate_solid" android:text="Only"