UserProfile 문자열 리소스화

UserProfile 화면 및 어댑터 문구를 ko/en/ja 리소스로 정리
This commit is contained in:
2025-12-03 19:38:26 +09:00
parent f8769e97f9
commit 237d112dec
17 changed files with 247 additions and 110 deletions

View File

@@ -100,7 +100,11 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
if (userId <= 0) {
Toast.makeText(applicationContext, "잘못된 요청입니다.", Toast.LENGTH_LONG).show()
Toast.makeText(
applicationContext,
getString(R.string.error_invalid_request),
Toast.LENGTH_LONG
).show()
finish()
}
bindData()
@@ -195,18 +199,17 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
private fun showUserBlockDialog() {
val dialog = AlertDialog.Builder(this)
dialog.setTitle("사용자 차단")
dialog.setTitle(getString(R.string.screen_live_room_block_title))
dialog.setMessage(
"${binding.tvNickname.text}님을 차단하시겠습니까?\n\n" +
"사용자를 차단하면 사용자는 아래 기능이 제한됩니다.\n" +
"- 내가 개설한 라이브 입장 불가\n" +
"- 나에게 메시지 보내기 불가\n" +
"- 내 채널의 팬Talk 작성불가"
getString(
R.string.screen_live_room_block_message_creator,
binding.tvNickname.text
)
)
dialog.setPositiveButton("차단") { _, _ ->
dialog.setPositiveButton(getString(R.string.screen_live_room_block_confirm)) { _, _ ->
viewModel.userBlock(userId)
}
dialog.setNegativeButton("취소") { _, _ -> }
dialog.setNegativeButton(getString(R.string.cancel)) { _, _ -> }
dialog.show()
}
@@ -375,9 +378,9 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
SodaDialog(
activity = this@UserProfileActivity,
layoutInflater = layoutInflater,
title = "응원글 삭제",
desc = "삭제하시겠습니까?",
confirmButtonTitle = "삭제",
title = getString(R.string.screen_user_profile_cheer_delete_title),
desc = getString(R.string.confirm_delete_message),
confirmButtonTitle = getString(R.string.confirm_delete_title),
confirmButtonClick = {
viewModel.modifyCheers(
cheersId = it,
@@ -385,7 +388,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
isActive = false
)
},
cancelButtonTitle = "취소",
cancelButtonTitle = getString(R.string.cancel),
cancelButtonClick = {}
).show(screenWidth)
},
@@ -547,7 +550,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
if (it.isBlank()) {
Toast.makeText(
applicationContext,
"신고 이유를 선택해 주세요.",
getString(R.string.screen_audio_content_detail_report_reason_required),
Toast.LENGTH_LONG
).show()
} else {
@@ -667,7 +670,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
}
}
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
@SuppressLint("NotifyDataSetChanged")
private fun setCheers(cheers: GetCheersResponse) {
binding.layoutUserProfileFanTalk.etCheer.setText("")
cheersAdapter.items.clear()
@@ -697,7 +700,6 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
seriesAdapter.notifyDataSetChanged()
}
@SuppressLint("SetTextI18n")
private fun setCreatorProfile(creator: CreatorResponse) {
binding.ivProfile.load(creator.profileUrl)
binding.tvNickname.text = creator.nickname
@@ -718,7 +720,10 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
binding.tvNotificationCount.visibility = View.VISIBLE
binding
.tvNotificationCount
.text = "팔로워 ${creator.notificationRecipientCount.moneyFormat()}"
.text = getString(
R.string.screen_user_profile_follower_count,
creator.notificationRecipientCount.moneyFormat()
)
}
if (creator.isFollow) {
@@ -774,13 +779,16 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "채널 공유")
val shareIntent = Intent.createChooser(
intent,
getString(R.string.screen_user_profile_share_channel)
)
startActivity(shareIntent)
}
}
}
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
@SuppressLint("NotifyDataSetChanged")
private fun setAudioContentList(
audioContentList: List<GetAudioContentListItem>,
totalContentCount: Long,
@@ -794,7 +802,8 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
}
if (userId == SharedPreferenceManager.userId) {
binding.layoutUserProfileAudioContent.tvTitle.text = "내 콘텐츠"
binding.layoutUserProfileAudioContent.tvTitle.text =
getString(R.string.screen_user_profile_my_content_title)
binding.layoutUserProfileAudioContent.tvNewContent.setOnClickListener {
startActivity(
Intent(
@@ -806,12 +815,17 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
binding.layoutUserProfileAudioContent.tvNewContent.visibility = View.VISIBLE
binding.layoutUserProfileAudioContent.clRatio.visibility = View.GONE
} else {
binding.layoutUserProfileAudioContent.tvTitle.text = "콘텐츠"
binding.layoutUserProfileAudioContent.tvTitle.text =
getString(R.string.screen_user_profile_content_title)
binding.layoutUserProfileAudioContent.tvNewContent.visibility = View.GONE
binding.layoutUserProfileAudioContent.clRatio.visibility = View.VISIBLE
val ownedStr = ownedContentCount.toString()
val totalStr = totalContentCount.toString()
val fullText = "$ownedStr / ${totalStr}"
val fullText = getString(
R.string.screen_user_profile_audio_ratio_detail,
ownedStr,
totalStr
)
val spannable = android.text.SpannableString(fullText)
val ownedColor = "#FDD453".toColorInt()
spannable.setSpan(
@@ -826,9 +840,9 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
val ratio = ownedContentCount.toFloat() / totalContentCount.toFloat()
val percent = (ratio * 100).toInt()
binding.layoutUserProfileAudioContent.tvRatioLeft.text = if (ownedContentCount > 0) {
"${percent}% 보유중"
getString(R.string.screen_user_profile_audio_ratio_owned, percent)
} else {
"소장 중인 작품이 없어요!"
getString(R.string.screen_user_profile_audio_ratio_empty)
}
binding.layoutUserProfileAudioContent.progressRatio.progress = percent
@@ -997,7 +1011,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
private fun reservationRoom(roomId: Long) {
liveViewModel.getRoomDetail(roomId) {
if (it.manager.id == SharedPreferenceManager.userId) {
showToast("내가 만든 라이브는 예약할 수 없습니다.")
showToast(getString(R.string.screen_user_profile_live_reservation_self_blocked))
} else {
if (it.isPrivateRoom) {
LiveRoomPasswordDialog(
@@ -1017,11 +1031,17 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
LivePaymentDialog(
activity = this,
layoutInflater = layoutInflater,
title = "${it.price.moneyFormat()}캔으로 예약",
desc = "'${it.title}' 라이브에 참여하기 위해 결제합니다.",
confirmButtonTitle = "예약하기",
title = getString(
R.string.screen_user_profile_reservation_title,
it.price.moneyFormat()
),
desc = getString(
R.string.screen_user_profile_reservation_desc,
it.title
),
confirmButtonTitle = getString(R.string.screen_live_room_reserve),
confirmButtonClick = { processLiveReservation(roomId) },
cancelButtonTitle = "취소",
cancelButtonTitle = getString(R.string.cancel),
cancelButtonClick = {}
).show(screenWidth)
}
@@ -1098,7 +1118,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
LivePaymentDialog(
activity = this,
layoutInflater = layoutInflater,
title = "유료 라이브 입장",
title = getString(R.string.live_paid_title),
startDateTime = if (hours >= 1) {
dateFormat.format(beginDate)
} else {
@@ -1109,17 +1129,17 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
} else {
null
},
desc = "${it.price}캔을 차감하고\n라이브에 입장 하시겠습니까?",
desc = getString(R.string.live_paid_desc, it.price),
desc2 = if (hours >= 1) {
"라이브를 시작한 지 ${hours}시간 ${mins}분이 지났습니다. 라이브에 입장 후 30분 이내에 라이브가 종료될 수도 있습니다."
getString(R.string.live_paid_warning, hours, mins)
} else {
null
},
confirmButtonTitle = "결제 후 입장",
confirmButtonTitle = getString(R.string.live_paid_confirm),
confirmButtonClick = {
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
},
cancelButtonTitle = "취소",
cancelButtonTitle = getString(R.string.cancel),
cancelButtonClick = {}
).show(screenWidth)
}

View File

@@ -1,6 +1,5 @@
package kr.co.vividnext.sodalive.explorer.profile
import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
@@ -27,7 +26,6 @@ class UserProfileLiveAdapter(
private val context: Context,
private val binding: ItemCreatorProfileLiveCardBinding
) : RecyclerView.ViewHolder(binding.root) {
@SuppressLint("SetTextI18n")
fun bind(item: LiveRoomResponse) {
Glide.with(context)
.load(item.coverImageUrl)
@@ -57,7 +55,7 @@ class UserProfileLiveAdapter(
binding.tvOnAir.visibility = View.VISIBLE
binding.llDate.visibility = View.GONE
binding.tvTime.text = "On Air"
binding.tvTime.text = context.getString(R.string.screen_user_profile_on_air)
binding.tvCompleteReservation.visibility = View.GONE
if (item.price <= 0) {
@@ -77,7 +75,10 @@ class UserProfileLiveAdapter(
binding.llDate.visibility = View.VISIBLE
binding.tvTime.text = dateMap["time"]
binding.tvMonth.text = "${dateMap["month"]}"
binding.tvMonth.text = context.getString(
R.string.screen_user_profile_month_format,
dateMap["month"]
)
binding.tvDay.text = dateMap["day"]
if (item.isReservation) {

View File

@@ -24,7 +24,6 @@ class UserProfileSeriesListAdapter(
inner class ViewHolder(
private val binding: ItemSeriesListBigBinding
) : RecyclerView.ViewHolder(binding.root) {
@SuppressLint("SetTextI18n")
fun bind(item: GetSeriesListResponse.SeriesListItem) {
binding.ivCover.load(item.coverImage) {
crossfade(true)
@@ -33,7 +32,10 @@ class UserProfileSeriesListAdapter(
}
binding.tvTitle.text = item.title
binding.tvSeriesContentCount.text = "${item.numberOfContent}"
binding.tvSeriesContentCount.text = binding.root.context.getString(
R.string.screen_user_profile_series_total_count,
item.numberOfContent
)
binding.tvPublishedDaysOfWeek.text = item.publishedDaysOfWeek
binding.tvNew.visibility = if (item.isNew) {