라이브 상세 - 다국어 설정 시 날짜 포맷이 섞이는 버그 수정

앱 내 설정 언어와 디바이스 언어가 다를 때 날짜 포맷에 여러 언어가
섞여서 표시되는 문제를 해결하기 위해 앱 설정 언어를 명시적으로
적용하도록 수정. 래핑된 컨텍스트를 사용하여 리소스를 가져오고
날짜 변환 시에도 해당 로케일을 전달하도록 개선.
This commit is contained in:
2026-01-21 16:39:36 +09:00
parent f44eacaf52
commit 5adfecf689

View File

@@ -28,7 +28,10 @@ import kr.co.vividnext.sodalive.databinding.ItemLiveDetailUserSummaryBinding
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
import kr.co.vividnext.sodalive.extensions.convertDateFormat import kr.co.vividnext.sodalive.extensions.convertDateFormat
import kr.co.vividnext.sodalive.extensions.dpToPx import kr.co.vividnext.sodalive.extensions.dpToPx
import kr.co.vividnext.sodalive.settings.language.LanguageManager
import kr.co.vividnext.sodalive.settings.language.LocaleHelper
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.util.Locale
import java.util.TimeZone import java.util.TimeZone
class LiveRoomDetailFragment( class LiveRoomDetailFragment(
@@ -116,6 +119,9 @@ class LiveRoomDetailFragment(
@SuppressLint("SetTextI18n", "NotifyDataSetChanged") @SuppressLint("SetTextI18n", "NotifyDataSetChanged")
private fun setRoomDetail(response: GetRoomDetailResponse) { private fun setRoomDetail(response: GetRoomDetailResponse) {
val locale = Locale(LanguageManager.getEffectiveLanguage(requireContext()))
val wrappedContext = LocaleHelper.wrap(requireContext())
binding.tv19.visibility = if (response.isAdult) { binding.tv19.visibility = if (response.isAdult) {
View.VISIBLE View.VISIBLE
} else { } else {
@@ -125,7 +131,8 @@ class LiveRoomDetailFragment(
binding.tvTitle.text = response.title binding.tvTitle.text = response.title
binding.tvDate.text = response.beginDateTimeUtc.convertDateFormat( binding.tvDate.text = response.beginDateTimeUtc.convertDateFormat(
from = "yyyy-MM-dd'T'HH:mm:ss", from = "yyyy-MM-dd'T'HH:mm:ss",
to = getString(R.string.screen_live_room_detail_date_format), to = wrappedContext.getString(R.string.screen_live_room_detail_date_format),
outputLocale = locale,
inputTimeZone = TimeZone.getTimeZone("UTC") inputTimeZone = TimeZone.getTimeZone("UTC")
) )
@@ -138,7 +145,7 @@ class LiveRoomDetailFragment(
0 0
) )
} else { } else {
binding.tvCan.text = getString(R.string.screen_live_room_free) binding.tvCan.text = wrappedContext.getString(R.string.screen_live_room_free)
binding.tvCan.setCompoundDrawablesWithIntrinsicBounds( binding.tvCan.setCompoundDrawablesWithIntrinsicBounds(
0, 0,
0, 0,
@@ -226,7 +233,7 @@ class LiveRoomDetailFragment(
binding.rvParticipate.visibility = View.VISIBLE binding.rvParticipate.visibility = View.VISIBLE
binding.tvParticipateExpression.visibility = View.VISIBLE binding.tvParticipateExpression.visibility = View.VISIBLE
binding.tvOpenAllProfile.text = binding.tvOpenAllProfile.text =
getString(R.string.screen_live_room_collapse) wrappedContext.getString(R.string.screen_live_room_collapse)
binding.tvOpenAllProfile.setCompoundDrawablesWithIntrinsicBounds( binding.tvOpenAllProfile.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.ic_live_detail_top, R.drawable.ic_live_detail_top,
0, 0,
@@ -238,7 +245,7 @@ class LiveRoomDetailFragment(
binding.rvParticipate.visibility = View.GONE binding.rvParticipate.visibility = View.GONE
binding.tvParticipateExpression.visibility = View.GONE binding.tvParticipateExpression.visibility = View.GONE
binding.tvOpenAllProfile.text = binding.tvOpenAllProfile.text =
getString(R.string.screen_live_room_expand) wrappedContext.getString(R.string.screen_live_room_expand)
binding.tvOpenAllProfile.setCompoundDrawablesWithIntrinsicBounds( binding.tvOpenAllProfile.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.ic_live_detail_bottom, R.drawable.ic_live_detail_bottom,
0, 0,
@@ -351,6 +358,7 @@ class LiveRoomDetailFragment(
} }
private fun shareRoom(response: GetRoomDetailResponse) { private fun shareRoom(response: GetRoomDetailResponse) {
val wrappedContext = LocaleHelper.wrap(requireContext())
viewModel.shareRoomLink( viewModel.shareRoomLink(
response.roomId, response.roomId,
response.isPrivateRoom, response.isPrivateRoom,
@@ -362,7 +370,7 @@ class LiveRoomDetailFragment(
val shareIntent = Intent.createChooser( val shareIntent = Intent.createChooser(
intent, intent,
getString(R.string.screen_live_room_share_title) wrappedContext.getString(R.string.screen_live_room_share_title)
) )
startActivity(shareIntent) startActivity(shareIntent)
} }