홈 화면 문자열 리소스화
This commit is contained in:
@@ -35,6 +35,7 @@ class AudioContentAllActivity : BaseActivity<ActivityAudioContentAllBinding>(
|
|||||||
|
|
||||||
private var isFree: Boolean = false
|
private var isFree: Boolean = false
|
||||||
private var isPointOnly: Boolean = false
|
private var isPointOnly: Boolean = false
|
||||||
|
private val allThemeLabel by lazy { getString(R.string.screen_home_theme_all) }
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
isFree = intent.getBooleanExtra(Constants.EXTRA_AUDIO_CONTENT_FREE, false)
|
isFree = intent.getBooleanExtra(Constants.EXTRA_AUDIO_CONTENT_FREE, false)
|
||||||
@@ -75,9 +76,10 @@ class AudioContentAllActivity : BaseActivity<ActivityAudioContentAllBinding>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupTheme() {
|
private fun setupTheme() {
|
||||||
themeAdapter = HomeContentThemeAdapter {
|
themeAdapter = HomeContentThemeAdapter(allThemeLabel) { selectedTheme ->
|
||||||
adapter.addItems(emptyList())
|
adapter.addItems(emptyList())
|
||||||
viewModel.selectTheme(it, isFree = isFree, isPointOnly = isPointOnly)
|
val theme = if (selectedTheme == allThemeLabel) "" else selectedTheme
|
||||||
|
viewModel.selectTheme(theme, isFree = isFree, isPointOnly = isPointOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.rvTheme.layoutManager = LinearLayoutManager(
|
binding.rvTheme.layoutManager = LinearLayoutManager(
|
||||||
@@ -169,7 +171,9 @@ class AudioContentAllActivity : BaseActivity<ActivityAudioContentAllBinding>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewModel.themeListLiveData.observe(this) {
|
viewModel.themeListLiveData.observe(this) {
|
||||||
themeAdapter.addItems(it)
|
val themes = mutableListOf(allThemeLabel)
|
||||||
|
themes.addAll(it)
|
||||||
|
themeAdapter.addItems(themes)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.itemsLiveData.observe(this) { list ->
|
viewModel.itemsLiveData.observe(this) { list ->
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class AudioContentAllViewModel(
|
|||||||
private var page = 1
|
private var page = 1
|
||||||
private val size = 20
|
private val size = 20
|
||||||
private var isLast = false
|
private var isLast = false
|
||||||
private var selectedTheme = "전체"
|
private var selectedTheme = ""
|
||||||
|
|
||||||
fun reset() {
|
fun reset() {
|
||||||
page = 1
|
page = 1
|
||||||
@@ -57,8 +57,7 @@ class AudioContentAllViewModel(
|
|||||||
.subscribe(
|
.subscribe(
|
||||||
{
|
{
|
||||||
if (it.success && it.data != null) {
|
if (it.success && it.data != null) {
|
||||||
val themeList = listOf("전체").union(it.data).toList()
|
_themeListLiveData.postValue(it.data)
|
||||||
_themeListLiveData.postValue(themeList)
|
|
||||||
} else {
|
} else {
|
||||||
if (it.message != null) {
|
if (it.message != null) {
|
||||||
_toastLiveData.postValue(it.message)
|
_toastLiveData.postValue(it.message)
|
||||||
@@ -94,11 +93,7 @@ class AudioContentAllViewModel(
|
|||||||
isFree = isFree,
|
isFree = isFree,
|
||||||
isPointAvailableOnly = isPointAvailableOnly,
|
isPointAvailableOnly = isPointAvailableOnly,
|
||||||
sortType = _sortLiveData.value!!,
|
sortType = _sortLiveData.value!!,
|
||||||
theme = if (selectedTheme == "전체") {
|
theme = selectedTheme.ifBlank { null },
|
||||||
null
|
|
||||||
} else {
|
|
||||||
selectedTheme
|
|
||||||
},
|
|
||||||
token = "Bearer ${SharedPreferenceManager.token}"
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
)
|
)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import androidx.media3.common.util.UnstableApi
|
|||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kr.co.vividnext.sodalive.R
|
||||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||||
import kr.co.vividnext.sodalive.common.Constants
|
import kr.co.vividnext.sodalive.common.Constants
|
||||||
@@ -32,6 +33,7 @@ class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBindin
|
|||||||
|
|
||||||
private lateinit var newContentThemeAdapter: HomeContentThemeAdapter
|
private lateinit var newContentThemeAdapter: HomeContentThemeAdapter
|
||||||
private lateinit var newContentAdapter: AudioContentNewAllAdapter
|
private lateinit var newContentAdapter: AudioContentNewAllAdapter
|
||||||
|
private val allThemeLabel by lazy { getString(R.string.screen_home_theme_all) }
|
||||||
|
|
||||||
private var isFree: Boolean = false
|
private var isFree: Boolean = false
|
||||||
|
|
||||||
@@ -65,10 +67,11 @@ class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBindin
|
|||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private fun setupNewContentTheme() {
|
private fun setupNewContentTheme() {
|
||||||
newContentThemeAdapter = HomeContentThemeAdapter {
|
newContentThemeAdapter = HomeContentThemeAdapter(allThemeLabel) { selectedTheme ->
|
||||||
newContentAdapter.clear()
|
newContentAdapter.clear()
|
||||||
newContentAdapter.notifyDataSetChanged()
|
newContentAdapter.notifyDataSetChanged()
|
||||||
viewModel.selectTheme(it, isFree = isFree)
|
val theme = if (selectedTheme == allThemeLabel) "" else selectedTheme
|
||||||
|
viewModel.selectTheme(theme, isFree = isFree)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.rvNewContentTheme.layoutManager = LinearLayoutManager(
|
binding.rvNewContentTheme.layoutManager = LinearLayoutManager(
|
||||||
@@ -171,7 +174,9 @@ class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBindin
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewModel.themeListLiveData.observe(this) {
|
viewModel.themeListLiveData.observe(this) {
|
||||||
newContentThemeAdapter.addItems(it)
|
val themes = mutableListOf(allThemeLabel)
|
||||||
|
themes.addAll(it)
|
||||||
|
newContentThemeAdapter.addItems(themes)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.newContentListLiveData.observe(this) {
|
viewModel.newContentListLiveData.observe(this) {
|
||||||
|
|||||||
@@ -45,11 +45,7 @@ class AudioContentNewAllViewModel(
|
|||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
repository.getNewContentAllOfTheme(
|
repository.getNewContentAllOfTheme(
|
||||||
isFree = isFree,
|
isFree = isFree,
|
||||||
theme = if (selectedTheme == "전체") {
|
theme = selectedTheme,
|
||||||
""
|
|
||||||
} else {
|
|
||||||
selectedTheme
|
|
||||||
},
|
|
||||||
page = page,
|
page = page,
|
||||||
size = size,
|
size = size,
|
||||||
token = "Bearer ${SharedPreferenceManager.token}"
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
@@ -97,8 +93,7 @@ class AudioContentNewAllViewModel(
|
|||||||
.subscribe(
|
.subscribe(
|
||||||
{
|
{
|
||||||
if (it.success && it.data != null) {
|
if (it.success && it.data != null) {
|
||||||
val themeList = listOf("전체").union(it.data).toList()
|
_themeListLiveData.postValue(it.data)
|
||||||
_themeListLiveData.postValue(themeList)
|
|
||||||
} else {
|
} else {
|
||||||
if (it.message != null) {
|
if (it.message != null) {
|
||||||
_toastLiveData.postValue(it.message)
|
_toastLiveData.postValue(it.message)
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package kr.co.vividnext.sodalive.home
|
package kr.co.vividnext.sodalive.home
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.annotation.StringRes
|
||||||
import kr.co.vividnext.sodalive.R
|
import kr.co.vividnext.sodalive.R
|
||||||
import kr.co.vividnext.sodalive.databinding.ItemHomeContentThemeBinding
|
import kr.co.vividnext.sodalive.databinding.ItemHomeContentThemeBinding
|
||||||
|
|
||||||
@@ -23,7 +25,7 @@ class ContentRankingSortAdapter(
|
|||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
fun bind(type: ContentRankingSortType) {
|
fun bind(type: ContentRankingSortType) {
|
||||||
binding.tvTheme.text = type.toKoreanLabel()
|
binding.tvTheme.text = type.toLabel(binding.root.context)
|
||||||
if (type == selected) {
|
if (type == selected) {
|
||||||
binding.tvTheme.setBackgroundResource(R.drawable.bg_round_corner_999_3bb9f1)
|
binding.tvTheme.setBackgroundResource(R.drawable.bg_round_corner_999_3bb9f1)
|
||||||
} else {
|
} else {
|
||||||
@@ -51,9 +53,14 @@ class ContentRankingSortAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ContentRankingSortType.toKoreanLabel(): String = when (this) {
|
private fun ContentRankingSortType.toLabel(context: Context): String =
|
||||||
ContentRankingSortType.REVENUE -> "매출"
|
context.getString(labelRes)
|
||||||
ContentRankingSortType.SALES_COUNT -> "판매량"
|
|
||||||
ContentRankingSortType.COMMENT_COUNT -> "댓글"
|
private val ContentRankingSortType.labelRes: Int
|
||||||
ContentRankingSortType.LIKE_COUNT -> "좋아요"
|
@StringRes
|
||||||
}
|
get() = when (this) {
|
||||||
|
ContentRankingSortType.REVENUE -> R.string.screen_home_sort_revenue
|
||||||
|
ContentRankingSortType.SALES_COUNT -> R.string.screen_home_sort_sales_count
|
||||||
|
ContentRankingSortType.COMMENT_COUNT -> R.string.screen_home_sort_comment_count
|
||||||
|
ContentRankingSortType.LIKE_COUNT -> R.string.screen_home_sort_like_count
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ class CreatorRankingAdapter(
|
|||||||
if (SharedPreferenceManager.userId != item.id) {
|
if (SharedPreferenceManager.userId != item.id) {
|
||||||
binding.tvFollow.visibility = View.VISIBLE
|
binding.tvFollow.visibility = View.VISIBLE
|
||||||
if (item.follow) {
|
if (item.follow) {
|
||||||
binding.tvFollow.text = "팔로잉"
|
binding.tvFollow.text = context.getString(R.string.screen_home_following)
|
||||||
binding.tvFollow.setBackgroundResource(R.drawable.bg_round_corner_999_455a64)
|
binding.tvFollow.setBackgroundResource(R.drawable.bg_round_corner_999_455a64)
|
||||||
binding.tvFollow.setTextColor(context.getColor(R.color.white))
|
binding.tvFollow.setTextColor(context.getColor(R.color.white))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding.tvFollow.text = "팔로우"
|
binding.tvFollow.text = context.getString(R.string.screen_home_follow)
|
||||||
binding.tvFollow.setBackgroundResource(R.drawable.bg_round_corner_999_white)
|
binding.tvFollow.setBackgroundResource(R.drawable.bg_round_corner_999_white)
|
||||||
binding.tvFollow.setTextColor("#263238".toColorInt())
|
binding.tvFollow.setTextColor("#263238".toColorInt())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import kr.co.vividnext.sodalive.R
|
|||||||
import kr.co.vividnext.sodalive.databinding.ItemHomeContentThemeBinding
|
import kr.co.vividnext.sodalive.databinding.ItemHomeContentThemeBinding
|
||||||
|
|
||||||
class HomeContentThemeAdapter(
|
class HomeContentThemeAdapter(
|
||||||
|
private val allLabel: String,
|
||||||
private val onClickItem: (String) -> Unit
|
private val onClickItem: (String) -> Unit
|
||||||
) : RecyclerView.Adapter<HomeContentThemeAdapter.ViewHolder>() {
|
) : RecyclerView.Adapter<HomeContentThemeAdapter.ViewHolder>() {
|
||||||
private val themeList = mutableListOf<String>()
|
private val themeList = mutableListOf<String>()
|
||||||
private var selectedTheme = ""
|
private var selectedTheme = allLabel
|
||||||
|
|
||||||
inner class ViewHolder(
|
inner class ViewHolder(
|
||||||
private val binding: ItemHomeContentThemeBinding
|
private val binding: ItemHomeContentThemeBinding
|
||||||
@@ -19,7 +20,7 @@ class HomeContentThemeAdapter(
|
|||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
fun bind(theme: String) {
|
fun bind(theme: String) {
|
||||||
if (theme == selectedTheme ||
|
if (theme == selectedTheme ||
|
||||||
(selectedTheme == "" && theme == "전체")
|
(selectedTheme.isEmpty() && theme == allLabel)
|
||||||
) {
|
) {
|
||||||
binding.tvTheme.setBackgroundResource(R.drawable.bg_round_corner_999_3bb9f1)
|
binding.tvTheme.setBackgroundResource(R.drawable.bg_round_corner_999_3bb9f1)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
private lateinit var liveAdapter: HomeLiveAdapter
|
private lateinit var liveAdapter: HomeLiveAdapter
|
||||||
private lateinit var creatorRankingAdapter: CreatorRankingAdapter
|
private lateinit var creatorRankingAdapter: CreatorRankingAdapter
|
||||||
private lateinit var latestContentThemeAdapter: HomeContentThemeAdapter
|
private lateinit var latestContentThemeAdapter: HomeContentThemeAdapter
|
||||||
|
private val homeThemeAll by lazy { getString(R.string.screen_home_theme_all) }
|
||||||
|
|
||||||
private lateinit var homeContentAdapter: HomeContentAdapter
|
private lateinit var homeContentAdapter: HomeContentAdapter
|
||||||
private lateinit var contentBannerAdapter: AudioContentMainBannerAdapter
|
private lateinit var contentBannerAdapter: AudioContentMainBannerAdapter
|
||||||
@@ -341,8 +342,15 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupLatestContent() {
|
private fun setupLatestContent() {
|
||||||
latestContentThemeAdapter = HomeContentThemeAdapter {
|
latestContentThemeAdapter = HomeContentThemeAdapter(
|
||||||
viewModel.getLatestContentByTheme(theme = it)
|
allLabel = homeThemeAll
|
||||||
|
) { selectedTheme ->
|
||||||
|
val theme = if (selectedTheme == homeThemeAll) {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
selectedTheme
|
||||||
|
}
|
||||||
|
viewModel.getLatestContentByTheme(theme = theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
val rvTheme = binding.rvNewContentTheme
|
val rvTheme = binding.rvNewContentTheme
|
||||||
@@ -384,7 +392,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
|
|
||||||
viewModel.latestContentThemeListLiveData.observe(viewLifecycleOwner) {
|
viewModel.latestContentThemeListLiveData.observe(viewLifecycleOwner) {
|
||||||
binding.llNewContent.visibility = View.VISIBLE
|
binding.llNewContent.visibility = View.VISIBLE
|
||||||
latestContentThemeAdapter.addItems(it)
|
val themes = mutableListOf(homeThemeAll)
|
||||||
|
themes.addAll(it)
|
||||||
|
latestContentThemeAdapter.addItems(themes)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.tvNewContentAll.setOnClickListener {
|
binding.tvNewContentAll.setOnClickListener {
|
||||||
@@ -1191,7 +1201,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewModel.toastLiveData.observe(viewLifecycleOwner) {
|
viewModel.toastLiveData.observe(viewLifecycleOwner) {
|
||||||
it?.let { Toast.makeText(requireContext(), it, Toast.LENGTH_LONG).show() }
|
val text = it?.message ?: it?.resId?.let { resId -> getString(resId) }
|
||||||
|
if (!text.isNullOrBlank()) {
|
||||||
|
Toast.makeText(requireContext(), text, Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ class HomeSeriesAdapter(
|
|||||||
|
|
||||||
binding.tvTitle.text = item.title
|
binding.tvTitle.text = item.title
|
||||||
binding.tvNickname.text = item.creator.nickname
|
binding.tvNickname.text = item.creator.nickname
|
||||||
binding.tvSeriesContentCount.text = "총 ${item.numberOfContent}화"
|
binding.tvSeriesContentCount.text = binding.root.context.getString(
|
||||||
|
R.string.screen_home_series_episode_count,
|
||||||
|
item.numberOfContent
|
||||||
|
)
|
||||||
binding.tvNew.visibility = if (item.isNew) {
|
binding.tvNew.visibility = if (item.isNew) {
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package kr.co.vividnext.sodalive.home
|
package kr.co.vividnext.sodalive.home
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.orhanobut.logger.Logger
|
import com.orhanobut.logger.Logger
|
||||||
@@ -14,6 +15,7 @@ import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
|||||||
import kr.co.vividnext.sodalive.explorer.GetExplorerSectionCreatorResponse
|
import kr.co.vividnext.sodalive.explorer.GetExplorerSectionCreatorResponse
|
||||||
import kr.co.vividnext.sodalive.live.GetRoomListResponse
|
import kr.co.vividnext.sodalive.live.GetRoomListResponse
|
||||||
import kr.co.vividnext.sodalive.user.UserRepository
|
import kr.co.vividnext.sodalive.user.UserRepository
|
||||||
|
import kr.co.vividnext.sodalive.R
|
||||||
|
|
||||||
class HomeViewModel(
|
class HomeViewModel(
|
||||||
private val repository: HomeRepository,
|
private val repository: HomeRepository,
|
||||||
@@ -24,8 +26,8 @@ class HomeViewModel(
|
|||||||
val isLoading: LiveData<Boolean>
|
val isLoading: LiveData<Boolean>
|
||||||
get() = _isLoading
|
get() = _isLoading
|
||||||
|
|
||||||
private val _toastLiveData = MutableLiveData<String?>()
|
private val _toastLiveData = MutableLiveData<HomeToastMessage?>()
|
||||||
val toastLiveData: LiveData<String?>
|
val toastLiveData: LiveData<HomeToastMessage?>
|
||||||
get() = _toastLiveData
|
get() = _toastLiveData
|
||||||
|
|
||||||
private var _liveListLiveData = MutableLiveData<List<GetRoomListResponse>>()
|
private var _liveListLiveData = MutableLiveData<List<GetRoomListResponse>>()
|
||||||
@@ -100,7 +102,6 @@ class HomeViewModel(
|
|||||||
_creatorRankingLiveData.value = data.creatorRanking
|
_creatorRankingLiveData.value = data.creatorRanking
|
||||||
|
|
||||||
val themeList = data.latestContentThemeList.toMutableList()
|
val themeList = data.latestContentThemeList.toMutableList()
|
||||||
themeList.add(0, "전체")
|
|
||||||
_latestContentThemeListLiveData.value = themeList
|
_latestContentThemeListLiveData.value = themeList
|
||||||
_latestContentListLiveData.value = data.latestContentList
|
_latestContentListLiveData.value = data.latestContentList
|
||||||
_eventBannerListLiveData.value = data.bannerList
|
_eventBannerListLiveData.value = data.bannerList
|
||||||
@@ -113,20 +114,22 @@ class HomeViewModel(
|
|||||||
data.pointAvailableContentList
|
data.pointAvailableContentList
|
||||||
_recommendChannelListLiveData.value = data.recommendChannelList
|
_recommendChannelListLiveData.value = data.recommendChannelList
|
||||||
_recommendContentListLiveData.value = data.recommendContentList
|
_recommendContentListLiveData.value = data.recommendContentList
|
||||||
} else {
|
|
||||||
if (it.message != null) {
|
|
||||||
_toastLiveData.postValue(it.message)
|
|
||||||
} else {
|
} else {
|
||||||
_toastLiveData.postValue(
|
_toastLiveData.postValue(
|
||||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
if (it.message != null) {
|
||||||
)
|
HomeToastMessage(message = it.message)
|
||||||
|
} else {
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
it.message?.let { message -> Logger.e(message) }
|
it.message?.let { message -> Logger.e(message) }
|
||||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
_toastLiveData.postValue(
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -144,15 +147,19 @@ class HomeViewModel(
|
|||||||
_contentRankingLiveData.value = data
|
_contentRankingLiveData.value = data
|
||||||
} else {
|
} else {
|
||||||
if (it.message != null) {
|
if (it.message != null) {
|
||||||
_toastLiveData.postValue(it.message)
|
_toastLiveData.postValue(HomeToastMessage(message = it.message))
|
||||||
} else {
|
} else {
|
||||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
_toastLiveData.postValue(
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
it.message?.let { message -> Logger.e(message) }
|
it.message?.let { message -> Logger.e(message) }
|
||||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
_toastLiveData.postValue(
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -174,7 +181,9 @@ class HomeViewModel(
|
|||||||
{
|
{
|
||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
it.message?.let { message -> Logger.e(message) }
|
it.message?.let { message -> Logger.e(message) }
|
||||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
_toastLiveData.postValue(
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -185,11 +194,7 @@ class HomeViewModel(
|
|||||||
|
|
||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
repository.getLatestContentByTheme(
|
repository.getLatestContentByTheme(
|
||||||
theme = if (theme == "전체") {
|
theme = theme,
|
||||||
""
|
|
||||||
} else {
|
|
||||||
theme
|
|
||||||
},
|
|
||||||
token = "Bearer ${SharedPreferenceManager.token}"
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
)
|
)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@@ -204,7 +209,9 @@ class HomeViewModel(
|
|||||||
{
|
{
|
||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
it.message?.let { message -> Logger.e(message) }
|
it.message?.let { message -> Logger.e(message) }
|
||||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
_toastLiveData.postValue(
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -230,7 +237,9 @@ class HomeViewModel(
|
|||||||
{
|
{
|
||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
it.message?.let { message -> Logger.e(message) }
|
it.message?.let { message -> Logger.e(message) }
|
||||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
_toastLiveData.postValue(
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -252,10 +261,10 @@ class HomeViewModel(
|
|||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
if (!it.success || it.data == null) {
|
if (!it.success || it.data == null) {
|
||||||
if (it.message != null) {
|
if (it.message != null) {
|
||||||
_toastLiveData.postValue(it.message)
|
_toastLiveData.postValue(HomeToastMessage(message = it.message))
|
||||||
} else {
|
} else {
|
||||||
_toastLiveData.postValue(
|
_toastLiveData.postValue(
|
||||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,9 +272,16 @@ class HomeViewModel(
|
|||||||
{
|
{
|
||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
it.message?.let { message -> Logger.e(message) }
|
it.message?.let { message -> Logger.e(message) }
|
||||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
_toastLiveData.postValue(
|
||||||
|
HomeToastMessage(resId = R.string.screen_home_error_unknown)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class HomeToastMessage(
|
||||||
|
@StringRes val resId: Int? = null,
|
||||||
|
val message: String? = null
|
||||||
|
)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
android:fontFamily="@font/pretendard_regular"
|
android:fontFamily="@font/pretendard_regular"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:paddingVertical="4dp"
|
android:paddingVertical="4dp"
|
||||||
android:text="팔로우"
|
android:text="@string/screen_home_follow"
|
||||||
android:textColor="#263238"
|
android:textColor="#263238"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="@font/pretendard_regular"
|
android:fontFamily="@font/pretendard_regular"
|
||||||
android:text="콘텐츠"
|
android:text="@string/screen_home_recommend_channel_content_label"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
android:fontFamily="@font/pretendard_regular"
|
android:fontFamily="@font/pretendard_regular"
|
||||||
android:paddingHorizontal="10dp"
|
android:paddingHorizontal="10dp"
|
||||||
android:paddingVertical="3dp"
|
android:paddingVertical="3dp"
|
||||||
android:text="인기"
|
android:text="@string/screen_home_series_popular"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
android:fontFamily="@font/pretendard_regular"
|
android:fontFamily="@font/pretendard_regular"
|
||||||
android:paddingHorizontal="10dp"
|
android:paddingHorizontal="10dp"
|
||||||
android:paddingVertical="3dp"
|
android:paddingVertical="3dp"
|
||||||
android:text="신작"
|
android:text="@string/screen_home_series_new"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
android:fontFamily="@font/pretendard_regular"
|
android:fontFamily="@font/pretendard_regular"
|
||||||
android:paddingHorizontal="10dp"
|
android:paddingHorizontal="10dp"
|
||||||
android:paddingVertical="3dp"
|
android:paddingVertical="3dp"
|
||||||
android:text="완결"
|
android:text="@string/screen_home_series_complete"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|||||||
@@ -107,4 +107,17 @@
|
|||||||
<string name="day_sat_short">Sat</string>
|
<string name="day_sat_short">Sat</string>
|
||||||
<string name="day_sun_short">Sun</string>
|
<string name="day_sun_short">Sun</string>
|
||||||
<string name="day_random">Random</string>
|
<string name="day_random">Random</string>
|
||||||
|
<string name="screen_home_follow">Follow</string>
|
||||||
|
<string name="screen_home_following">Following</string>
|
||||||
|
<string name="screen_home_theme_all">All</string>
|
||||||
|
<string name="screen_home_sort_revenue">Revenue</string>
|
||||||
|
<string name="screen_home_sort_sales_count">Sales</string>
|
||||||
|
<string name="screen_home_sort_comment_count">Comments</string>
|
||||||
|
<string name="screen_home_sort_like_count">Likes</string>
|
||||||
|
<string name="screen_home_series_episode_count">Total %1$d episodes</string>
|
||||||
|
<string name="screen_home_series_popular">Popular</string>
|
||||||
|
<string name="screen_home_series_new">New</string>
|
||||||
|
<string name="screen_home_series_complete">Complete</string>
|
||||||
|
<string name="screen_home_recommend_channel_content_label">Contents</string>
|
||||||
|
<string name="screen_home_error_unknown">An unknown error occurred. Please try again.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -107,4 +107,17 @@
|
|||||||
<string name="day_sat_short">土</string>
|
<string name="day_sat_short">土</string>
|
||||||
<string name="day_sun_short">日</string>
|
<string name="day_sun_short">日</string>
|
||||||
<string name="day_random">ランダム</string>
|
<string name="day_random">ランダム</string>
|
||||||
|
<string name="screen_home_follow">フォロー</string>
|
||||||
|
<string name="screen_home_following">フォロー中</string>
|
||||||
|
<string name="screen_home_theme_all">すべて</string>
|
||||||
|
<string name="screen_home_sort_revenue">売上</string>
|
||||||
|
<string name="screen_home_sort_sales_count">販売数</string>
|
||||||
|
<string name="screen_home_sort_comment_count">コメント</string>
|
||||||
|
<string name="screen_home_sort_like_count">いいね</string>
|
||||||
|
<string name="screen_home_series_episode_count">全%1$d話</string>
|
||||||
|
<string name="screen_home_series_popular">人気</string>
|
||||||
|
<string name="screen_home_series_new">新作</string>
|
||||||
|
<string name="screen_home_series_complete">完結</string>
|
||||||
|
<string name="screen_home_recommend_channel_content_label">コンテンツ</string>
|
||||||
|
<string name="screen_home_error_unknown">不明なエラーが発生しました。もう一度お試しください。</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -106,4 +106,17 @@
|
|||||||
<string name="day_sat_short">토</string>
|
<string name="day_sat_short">토</string>
|
||||||
<string name="day_sun_short">일</string>
|
<string name="day_sun_short">일</string>
|
||||||
<string name="day_random">랜덤</string>
|
<string name="day_random">랜덤</string>
|
||||||
|
<string name="screen_home_follow">팔로우</string>
|
||||||
|
<string name="screen_home_following">팔로잉</string>
|
||||||
|
<string name="screen_home_theme_all">전체</string>
|
||||||
|
<string name="screen_home_sort_revenue">매출</string>
|
||||||
|
<string name="screen_home_sort_sales_count">판매량</string>
|
||||||
|
<string name="screen_home_sort_comment_count">댓글</string>
|
||||||
|
<string name="screen_home_sort_like_count">좋아요</string>
|
||||||
|
<string name="screen_home_series_episode_count">총 %1$d화</string>
|
||||||
|
<string name="screen_home_series_popular">인기</string>
|
||||||
|
<string name="screen_home_series_new">신작</string>
|
||||||
|
<string name="screen_home_series_complete">완결</string>
|
||||||
|
<string name="screen_home_recommend_channel_content_label">콘텐츠</string>
|
||||||
|
<string name="screen_home_error_unknown">알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user