오디오 콘텐츠 전체 화면 문자열 리소스화
This commit is contained in:
@@ -38,6 +38,7 @@ class AudioContentActivity : BaseActivity<ActivityAudioContentBinding>(
|
||||
|
||||
private var userId: Long = 0
|
||||
private lateinit var activityResultLauncher: ActivityResultLauncher<Intent>
|
||||
private val allCategoryLabel by lazy { getString(R.string.audio_content_label_all) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
userId = intent.getLongExtra(Constants.EXTRA_USER_ID, 0)
|
||||
@@ -53,7 +54,11 @@ class AudioContentActivity : BaseActivity<ActivityAudioContentBinding>(
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (userId <= 0) {
|
||||
Toast.makeText(applicationContext, "잘못된 요청입니다.", Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
getString(R.string.screen_audio_content_error_invalid_request),
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
finish()
|
||||
}
|
||||
|
||||
@@ -64,7 +69,7 @@ class AudioContentActivity : BaseActivity<ActivityAudioContentBinding>(
|
||||
|
||||
override fun setupView() {
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
binding.toolbar.tvBack.text = "콘텐츠 전체보기"
|
||||
binding.toolbar.tvBack.text = getString(R.string.screen_audio_content_title)
|
||||
binding.toolbar.tvBack.setOnClickListener { finish() }
|
||||
|
||||
audioContentAdapter = AudioContentAdapter {
|
||||
@@ -75,7 +80,9 @@ class AudioContentActivity : BaseActivity<ActivityAudioContentBinding>(
|
||||
activityResultLauncher.launch(intent)
|
||||
}
|
||||
|
||||
categoryAdapter = AudioContentCategoryAdapter {
|
||||
categoryAdapter = AudioContentCategoryAdapter(
|
||||
allCategoryLabel = allCategoryLabel
|
||||
) {
|
||||
viewModel.selectCategory(it, userId = userId)
|
||||
}
|
||||
|
||||
@@ -259,7 +266,7 @@ class AudioContentActivity : BaseActivity<ActivityAudioContentBinding>(
|
||||
if (it.isNotEmpty()) {
|
||||
binding.rvCategory.visibility = View.VISIBLE
|
||||
val items = it as MutableList<GetCategoryListResponse>
|
||||
items.add(0, GetCategoryListResponse(0, "전체"))
|
||||
items.add(0, GetCategoryListResponse(0, allCategoryLabel))
|
||||
categoryAdapter.addItems(items = items)
|
||||
} else {
|
||||
binding.rvCategory.visibility = View.GONE
|
||||
|
||||
@@ -66,7 +66,8 @@ class AudioContentAdapter(
|
||||
} else {
|
||||
binding.tvPrice.visibility = View.VISIBLE
|
||||
if (item.price < 1) {
|
||||
binding.tvPrice.text = "무료"
|
||||
binding.tvPrice.text =
|
||||
binding.root.context.getString(R.string.audio_content_price_free)
|
||||
binding.tvPrice.setCompoundDrawables(null, null, null, null)
|
||||
} else {
|
||||
binding.tvPrice.text = item.price.moneyFormat()
|
||||
|
||||
@@ -6,9 +6,11 @@ import com.google.gson.annotations.SerializedName
|
||||
import com.orhanobut.logger.Logger
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.category.GetCategoryListResponse
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.common.SodaLiveApplicationHolder
|
||||
import kr.co.vividnext.sodalive.explorer.profile.GetAudioContentListResponse
|
||||
|
||||
class AudioContentViewModel(private val repository: AudioContentRepository) : BaseViewModel() {
|
||||
@@ -80,7 +82,8 @@ class AudioContentViewModel(private val repository: AudioContentRepository) : Ba
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
SodaLiveApplicationHolder.get()
|
||||
.getString(R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -94,7 +97,10 @@ class AudioContentViewModel(private val repository: AudioContentRepository) : Ba
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
_toastLiveData.postValue(
|
||||
SodaLiveApplicationHolder.get()
|
||||
.getString(R.string.common_error_unknown)
|
||||
)
|
||||
if (onFailure != null) {
|
||||
onFailure()
|
||||
}
|
||||
@@ -134,7 +140,8 @@ class AudioContentViewModel(private val repository: AudioContentRepository) : Ba
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
SodaLiveApplicationHolder.get()
|
||||
.getString(R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -144,7 +151,10 @@ class AudioContentViewModel(private val repository: AudioContentRepository) : Ba
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
_toastLiveData.postValue(
|
||||
SodaLiveApplicationHolder.get()
|
||||
.getString(R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -57,9 +57,9 @@ class AudioContentAllActivity : BaseActivity<ActivityAudioContentAllBinding>(
|
||||
override fun setupView() {
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
binding.toolbar.tvBack.text = when {
|
||||
isPointOnly -> "포인트 대여 전체"
|
||||
isFree -> "무료 콘텐츠 전체"
|
||||
else -> "콘텐츠 전체보기"
|
||||
isPointOnly -> getString(R.string.screen_audio_content_all_title_point_only)
|
||||
isFree -> getString(R.string.screen_audio_content_all_title_free)
|
||||
else -> getString(R.string.screen_audio_content_title)
|
||||
}
|
||||
binding.toolbar.tvBack.setOnClickListener { finish() }
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@ import androidx.lifecycle.MutableLiveData
|
||||
import com.orhanobut.logger.Logger
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentRepository
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentViewModel
|
||||
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.home.AudioContentMainItem
|
||||
|
||||
@@ -46,6 +48,7 @@ class AudioContentAllViewModel(
|
||||
isFree: Boolean? = null,
|
||||
isPointAvailableOnly: Boolean? = null
|
||||
) {
|
||||
val unknownError = SodaLiveApplicationHolder.get().getString(R.string.common_error_unknown)
|
||||
compositeDisposable.add(
|
||||
repository.getAudioContentActiveThemeList(
|
||||
isFree = isFree,
|
||||
@@ -60,22 +63,20 @@ class AudioContentAllViewModel(
|
||||
_themeListLiveData.postValue(it.data)
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
)
|
||||
}
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(unknownError)
|
||||
}
|
||||
|
||||
_isLoading.value = false
|
||||
},
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
}
|
||||
)
|
||||
|
||||
_isLoading.value = false
|
||||
},
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue(unknownError)
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -85,6 +86,7 @@ class AudioContentAllViewModel(
|
||||
) {
|
||||
if (_isLoading.value == true || isLast) return
|
||||
_isLoading.value = true
|
||||
val unknownError = SodaLiveApplicationHolder.get().getString(R.string.common_error_unknown)
|
||||
|
||||
compositeDisposable.add(
|
||||
repository.getAllAudioContents(
|
||||
@@ -110,7 +112,7 @@ class AudioContentAllViewModel(
|
||||
_isLoading.value = false
|
||||
}, { t ->
|
||||
_isLoading.value = false
|
||||
_toastLiveData.postValue(t.message ?: "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
_toastLiveData.postValue(t.message ?: unknownError)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.ItemContentCategoryBinding
|
||||
|
||||
class AudioContentCategoryAdapter(
|
||||
private val allCategoryLabel: String,
|
||||
private val onClick: (Long) -> Unit
|
||||
) : RecyclerView.Adapter<AudioContentCategoryAdapter.ViewHolder>() {
|
||||
|
||||
@@ -24,7 +25,7 @@ class AudioContentCategoryAdapter(
|
||||
fun bind(item: GetCategoryListResponse) {
|
||||
if (
|
||||
item.category == selectedCategory ||
|
||||
(selectedCategory == "" && item.category == "전체")
|
||||
(selectedCategory.isEmpty() && item.category == allCategoryLabel)
|
||||
) {
|
||||
binding.tvCategory.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_16_7_transparent_3bb9f1
|
||||
|
||||
@@ -7,9 +7,9 @@ import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.ItemPlaylistListBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.R
|
||||
|
||||
class AudioContentPlaylistListAdapter(
|
||||
private val onClickItem: (Long) -> Unit
|
||||
@@ -20,7 +20,6 @@ class AudioContentPlaylistListAdapter(
|
||||
inner class ViewHolder(
|
||||
private val binding: ItemPlaylistListBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun bind(item: GetPlaylistsItem) {
|
||||
binding.ivCover.load(item.coverImageUrl) {
|
||||
crossfade(true)
|
||||
@@ -29,7 +28,10 @@ class AudioContentPlaylistListAdapter(
|
||||
}
|
||||
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvContentCount.text = "총 ${item.contentCount}개"
|
||||
binding.tvContentCount.text = binding.root.context.getString(
|
||||
R.string.audio_content_playlist_content_count,
|
||||
item.contentCount
|
||||
)
|
||||
|
||||
if (item.desc.isNotBlank()) {
|
||||
binding.tvDesc.text = item.desc
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.playlist
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.appcompat.app.AppCompatActivity.RESULT_OK
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.playlist.create.AudioContentPlaylistCreateActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.playlist.detail.AudioContentPlaylistDetailActivity
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
@@ -43,6 +45,7 @@ class AudioContentPlaylistListFragment : BaseFragment<FragmentAudioContentPlayli
|
||||
viewModel.getPlaylistList()
|
||||
}
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
private fun setupView() {
|
||||
loadingDialog = LoadingDialog(requireActivity(), layoutInflater)
|
||||
adapter = AudioContentPlaylistListAdapter { playlistId ->
|
||||
@@ -107,7 +110,6 @@ class AudioContentPlaylistListFragment : BaseFragment<FragmentAudioContentPlayli
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun bindData() {
|
||||
viewModel.isLoading.observe(viewLifecycleOwner) {
|
||||
if (it) {
|
||||
@@ -122,7 +124,8 @@ class AudioContentPlaylistListFragment : BaseFragment<FragmentAudioContentPlayli
|
||||
}
|
||||
|
||||
viewModel.totalCountLiveData.observe(viewLifecycleOwner) {
|
||||
binding.tvTotalCount.text = "${it}개"
|
||||
binding.tvTotalCount.text =
|
||||
getString(R.string.audio_content_playlist_total_count, it)
|
||||
}
|
||||
|
||||
viewModel.playlistLiveData.observe(viewLifecycleOwner) {
|
||||
|
||||
@@ -5,8 +5,10 @@ import androidx.lifecycle.MutableLiveData
|
||||
import com.orhanobut.logger.Logger
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.common.SodaLiveApplicationHolder
|
||||
|
||||
class AudioContentPlaylistListViewModel(
|
||||
private val repository: AudioContentPlaylistRepository
|
||||
@@ -44,7 +46,8 @@ class AudioContentPlaylistListViewModel(
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
SodaLiveApplicationHolder.get()
|
||||
.getString(R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -52,7 +55,10 @@ class AudioContentPlaylistListViewModel(
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
_toastLiveData.postValue(
|
||||
SodaLiveApplicationHolder.get()
|
||||
.getString(R.string.common_error_unknown)
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user