오디션 역할 상세 문자열 리소스화
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.audition.role
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.net.Uri
|
||||
@@ -28,6 +29,7 @@ import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.RealPathUtil
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.common.ToastMessage
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityAuditionRoleDetailBinding
|
||||
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||
import kr.co.vividnext.sodalive.explorer.profile.creator_community.write.RecordingVoiceFragment
|
||||
@@ -66,14 +68,14 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this,
|
||||
"잘못된 녹음 파일 입니다.\n다시 선택해 주세요.",
|
||||
getString(R.string.screen_audition_invalid_audio_file),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this,
|
||||
"잘못된 녹음 파일 입니다.\n다시 선택해 주세요.",
|
||||
getString(R.string.screen_audition_invalid_audio_file),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
@@ -87,7 +89,7 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
if (auditionRoleId <= 0) {
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"잘못된 요청입니다.\n다시 시도해 주세요.",
|
||||
getString(R.string.screen_audition_error_invalid_request),
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
|
||||
@@ -137,7 +139,7 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
isOpenInformation = !isOpenInformation
|
||||
if (isOpenInformation) {
|
||||
binding.tvInformation.maxLines = Int.MAX_VALUE
|
||||
binding.tvOpen.text = "접기"
|
||||
binding.tvOpen.text = getString(R.string.screen_audition_detail_collapse)
|
||||
binding.tvOpen.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.ic_live_detail_top,
|
||||
0,
|
||||
@@ -146,7 +148,7 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
)
|
||||
} else {
|
||||
binding.tvInformation.maxLines = 3
|
||||
binding.tvOpen.text = "펼치기"
|
||||
binding.tvOpen.text = getString(R.string.screen_audition_detail_expand)
|
||||
binding.tvOpen.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.ic_live_detail_bottom,
|
||||
0,
|
||||
@@ -162,9 +164,9 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
SodaDialog(
|
||||
activity = this@AuditionRoleDetailActivity,
|
||||
layoutInflater = layoutInflater,
|
||||
title = "재지원 안내",
|
||||
desc = "재지원 시 이전 지원 내역은 삭제되며 받은 투표수는 무효 처리됩니다.",
|
||||
confirmButtonTitle = "확인",
|
||||
title = getString(R.string.dialog_audition_reapply_title),
|
||||
desc = getString(R.string.dialog_audition_reapply_desc),
|
||||
confirmButtonTitle = getString(R.string.confirm),
|
||||
confirmButtonClick = { showApplicationMethodDialog() }
|
||||
).show(screenWidth)
|
||||
} else {
|
||||
@@ -174,9 +176,9 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
SodaDialog(
|
||||
activity = this@AuditionRoleDetailActivity,
|
||||
layoutInflater = layoutInflater,
|
||||
title = "- 본인인증 -",
|
||||
desc = "마이페이지에서 '본인인증'을 하고 다시 오디션에 지원해 주세요.",
|
||||
confirmButtonTitle = "확인",
|
||||
title = getString(R.string.dialog_audition_auth_title),
|
||||
desc = getString(R.string.dialog_audition_auth_desc),
|
||||
confirmButtonTitle = getString(R.string.confirm),
|
||||
confirmButtonClick = {}
|
||||
).show(screenWidth)
|
||||
}
|
||||
@@ -211,23 +213,23 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
SodaDialog(
|
||||
activity = this@AuditionRoleDetailActivity,
|
||||
layoutInflater = layoutInflater,
|
||||
"[오디션 응원]",
|
||||
"오디션을 응원하셨습니다\n(무료응원 : 1계정당 1일 1회)\n1캔으로 추가 응원을 해보세요.",
|
||||
confirmButtonTitle = "확인",
|
||||
getString(R.string.dialog_audition_vote_title),
|
||||
getString(R.string.dialog_audition_vote_desc),
|
||||
confirmButtonTitle = getString(R.string.confirm),
|
||||
confirmButtonClick = {
|
||||
isShowNotifyVote = false
|
||||
},
|
||||
descGravity = Gravity.CENTER
|
||||
).show(screenWidth)
|
||||
descGravity = Gravity.CENTER
|
||||
).show(screenWidth)
|
||||
}
|
||||
},
|
||||
onFailure = {
|
||||
SodaDialog(
|
||||
activity = this@AuditionRoleDetailActivity,
|
||||
layoutInflater = layoutInflater,
|
||||
"[오늘 응원 제한]",
|
||||
"오늘 응원은 여기까지!\n하루 최대 10회까지 이용이 가능합니다.\n내일 다시 이용해주세요.",
|
||||
confirmButtonTitle = "확인",
|
||||
getString(R.string.dialog_audition_vote_limit_title),
|
||||
getString(R.string.dialog_audition_vote_limit_desc),
|
||||
confirmButtonTitle = getString(R.string.confirm),
|
||||
confirmButtonClick = {},
|
||||
descGravity = Gravity.CENTER
|
||||
).show(screenWidth)
|
||||
@@ -307,7 +309,7 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
selectAudioActivityResultLauncher.launch(
|
||||
Intent.createChooser(
|
||||
intent,
|
||||
"Select Audio"
|
||||
getString(R.string.screen_audition_select_audio)
|
||||
)
|
||||
)
|
||||
},
|
||||
@@ -339,9 +341,15 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
auditionApplyDialogFragment.show(supportFragmentManager, auditionApplyDialogFragment.tag)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun bindData() {
|
||||
viewModel.toastLiveData.observe(this) {
|
||||
it?.let { Toast.makeText(applicationContext, it, Toast.LENGTH_LONG).show() }
|
||||
it?.let { toastMessage ->
|
||||
val message = toastMessage.message ?: toastMessage.resId?.let(::getString)
|
||||
message?.let { text ->
|
||||
Toast.makeText(applicationContext, text, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.isLoading.observe(this) {
|
||||
@@ -381,10 +389,10 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
|
||||
if (roleDetail.isAlreadyApplicant) {
|
||||
reApplication = true
|
||||
binding.tvApplicant.text = "오디션 재지원"
|
||||
binding.tvApplicant.text = getString(R.string.screen_audition_apply_again)
|
||||
} else {
|
||||
reApplication = false
|
||||
binding.tvApplicant.text = "오디션 지원"
|
||||
binding.tvApplicant.text = getString(R.string.screen_audition_apply)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +402,7 @@ class AuditionRoleDetailActivity : BaseActivity<ActivityAuditionRoleDetailBindin
|
||||
|
||||
if (it > 0) {
|
||||
binding.groupApplicant.visibility = View.VISIBLE
|
||||
binding.tvApplicantCount.text = "$it"
|
||||
binding.tvApplicantCount.text = " $it"
|
||||
} else {
|
||||
binding.groupNoApplicant.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ import kr.co.vividnext.sodalive.audition.applicant.ApplyAuditionRoleRequest
|
||||
import kr.co.vividnext.sodalive.audition.applicant.GetAuditionRoleApplicantItem
|
||||
import kr.co.vividnext.sodalive.audition.vote.VoteAuditionApplicantRequest
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.ToastMessage
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.MultipartBody
|
||||
@@ -24,8 +26,8 @@ import java.io.File
|
||||
import java.util.TimeZone
|
||||
|
||||
class AuditionRoleDetailViewModel(private val repository: AuditionRepository) : BaseViewModel() {
|
||||
private val _toastLiveData = MutableLiveData<String?>()
|
||||
val toastLiveData: LiveData<String?>
|
||||
private val _toastLiveData = MutableLiveData<ToastMessage?>()
|
||||
val toastLiveData: LiveData<ToastMessage?>
|
||||
get() = _toastLiveData
|
||||
|
||||
private val _isLoading = MutableLiveData(false)
|
||||
@@ -90,9 +92,10 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
_auditionRoleDetailLiveData.value = roleDetailResponse.data!!
|
||||
} else {
|
||||
if (roleDetailResponse.message != null) {
|
||||
_toastLiveData.value = roleDetailResponse.message
|
||||
_toastLiveData.value = ToastMessage(message = roleDetailResponse.message)
|
||||
} else {
|
||||
_toastLiveData.value = "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.value =
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
}
|
||||
|
||||
if (onFailure != null) {
|
||||
@@ -113,9 +116,10 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
}
|
||||
} else {
|
||||
if (applicantListResponse.message != null) {
|
||||
_toastLiveData.value = applicantListResponse.message
|
||||
_toastLiveData.value = ToastMessage(message = applicantListResponse.message)
|
||||
} else {
|
||||
_toastLiveData.value = "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.value =
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
}
|
||||
|
||||
if (onFailure != null) {
|
||||
@@ -128,7 +132,9 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
_toastLiveData.postValue(
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
)
|
||||
if (onFailure != null) {
|
||||
onFailure()
|
||||
}
|
||||
@@ -166,9 +172,10 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
}
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.value = it.message
|
||||
_toastLiveData.value = ToastMessage(message = it.message)
|
||||
} else {
|
||||
_toastLiveData.value = "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.value =
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +184,9 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
_toastLiveData.postValue(
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -186,7 +195,8 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
|
||||
fun applyAudition(auditionRoleId: Long, phoneNumber: String, onSuccess: () -> Unit) {
|
||||
if (audioFile == null) {
|
||||
_toastLiveData.value = "잘못된 녹음 파일 입니다.\n다시 선택해 주세요."
|
||||
_toastLiveData.value =
|
||||
ToastMessage(resId = R.string.screen_audition_invalid_audio_file)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -236,10 +246,10 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
onSuccess()
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
_toastLiveData.postValue(ToastMessage(message = it.message))
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -248,7 +258,7 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -304,11 +314,11 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
) {
|
||||
onFailure()
|
||||
} else {
|
||||
_toastLiveData.value = it.message
|
||||
_toastLiveData.value = ToastMessage(message = it.message)
|
||||
}
|
||||
} else {
|
||||
_toastLiveData.value =
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +327,8 @@ class AuditionRoleDetailViewModel(private val repository: AuditionRepository) :
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.value = "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.value =
|
||||
ToastMessage(resId = R.string.common_error_unknown)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user