재생목록 수정 문자열 리소스화
수정 화면 레이블과 검증/오류 문구를 ko/en/ja 리소스로 정리했습니다.
This commit is contained in:
@@ -16,6 +16,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kr.co.vividnext.sodalive.audio_content.playlist.create.add_content.PlaylistAddContentDialogFragment
|
||||
import kr.co.vividnext.sodalive.audio_content.playlist.detail.AudioContentPlaylistContent
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityAudioContentPlaylistModifyBinding
|
||||
@@ -70,8 +71,9 @@ class AudioContentPlaylistModifyActivity : BaseActivity<ActivityAudioContentPlay
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (playlistId <= 0) {
|
||||
showToast("잘못된 요청입니다.")
|
||||
showToast(getString(R.string.screen_audio_content_error_invalid_request))
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
imm = getSystemService(
|
||||
@@ -83,7 +85,6 @@ class AudioContentPlaylistModifyActivity : BaseActivity<ActivityAudioContentPlay
|
||||
}
|
||||
|
||||
override fun setupView() {
|
||||
binding.tvBack.text = "재생목록 수정"
|
||||
binding.tvBack.setOnClickListener { finish() }
|
||||
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
@@ -207,13 +208,21 @@ class AudioContentPlaylistModifyActivity : BaseActivity<ActivityAudioContentPlay
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setTitle(title: String) {
|
||||
binding.tvTitleLength.text = "${title.length}/30"
|
||||
binding.tvTitleLength.text = getString(
|
||||
R.string.audio_content_playlist_create_length_format,
|
||||
title.length,
|
||||
30
|
||||
)
|
||||
viewModel.title = title
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setDesc(desc: String) {
|
||||
binding.tvDescLength.text = "${desc.length}/40"
|
||||
binding.tvDescLength.text = getString(
|
||||
R.string.audio_content_playlist_create_length_format,
|
||||
desc.length,
|
||||
40
|
||||
)
|
||||
viewModel.desc = desc
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ import kr.co.vividnext.sodalive.audio_content.playlist.create.PlaylistContentIdA
|
||||
import kr.co.vividnext.sodalive.audio_content.playlist.detail.AudioContentPlaylistContent
|
||||
import kr.co.vividnext.sodalive.audio_content.playlist.detail.GetPlaylistDetailResponse
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SodaLiveApplicationHolder
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.R
|
||||
|
||||
class AudioContentPlaylistModifyViewModel(
|
||||
private val repository: AudioContentPlaylistRepository
|
||||
@@ -37,6 +39,9 @@ class AudioContentPlaylistModifyViewModel(
|
||||
var desc: String = ""
|
||||
private var playlistId: Long = 0
|
||||
|
||||
private val unknownErrorMessage: String
|
||||
get() = SodaLiveApplicationHolder.get().getString(R.string.common_error_unknown)
|
||||
|
||||
fun addContent(item: AudioContentPlaylistContent) {
|
||||
contentList.add(item)
|
||||
_contentListLiveData.value = contentList
|
||||
@@ -85,7 +90,7 @@ class AudioContentPlaylistModifyViewModel(
|
||||
if (it.message != null) {
|
||||
_toastLiveData.value = it.message
|
||||
} else {
|
||||
_toastLiveData.value = "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.value = unknownErrorMessage
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -94,7 +99,7 @@ class AudioContentPlaylistModifyViewModel(
|
||||
if (it.message != null) {
|
||||
_toastLiveData.value = it.message
|
||||
} else {
|
||||
_toastLiveData.value = "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.value = unknownErrorMessage
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -104,12 +109,18 @@ class AudioContentPlaylistModifyViewModel(
|
||||
|
||||
private fun validate(): Boolean {
|
||||
if (title.isBlank() || title.length < 3) {
|
||||
_toastLiveData.value = "제목을 3자 이상 입력하세요"
|
||||
_toastLiveData.value = SodaLiveApplicationHolder.get().getString(
|
||||
R.string.audio_content_playlist_create_title_min_length_error,
|
||||
3
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
if (contentList.isEmpty()) {
|
||||
_toastLiveData.value = "콘텐츠를 1개 이상 추가하세요"
|
||||
_toastLiveData.value = SodaLiveApplicationHolder.get().getString(
|
||||
R.string.audio_content_playlist_create_content_min_count_error,
|
||||
1
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -136,9 +147,7 @@ class AudioContentPlaylistModifyViewModel(
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
)
|
||||
_toastLiveData.postValue(unknownErrorMessage)
|
||||
}
|
||||
}
|
||||
_isLoading.value = false
|
||||
@@ -146,7 +155,7 @@ class AudioContentPlaylistModifyViewModel(
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
_toastLiveData.postValue(unknownErrorMessage)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user