콘텐츠 전체보기 - 폰 언어 설정에 따라 번역 데이터를 조회하도록 수정
This commit is contained in:
@@ -22,6 +22,7 @@ import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.common.Utils
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityAudioContentBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import org.koin.android.ext.android.inject
|
||||
@@ -63,6 +64,7 @@ class AudioContentActivity : BaseActivity<ActivityAudioContentBinding>(
|
||||
}
|
||||
|
||||
bindData()
|
||||
viewModel.languageCode = Utils.getCurrentLanguageCode(applicationContext)
|
||||
viewModel.getCategoryList(userId = userId)
|
||||
viewModel.getAudioContentList(userId = userId) { finish() }
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import retrofit2.http.Query
|
||||
interface AudioContentApi {
|
||||
@GET("/audio-content/all")
|
||||
fun getAllAudioContents(
|
||||
@Query("languageCode") languageCode: String,
|
||||
@Query("isAdultContentVisible") isAdultContentVisible: Boolean,
|
||||
@Query("contentType") contentType: ContentType,
|
||||
@Query("page") page: Int,
|
||||
@@ -54,6 +55,7 @@ interface AudioContentApi {
|
||||
fun getAudioContentList(
|
||||
@Query("creator-id") id: Long,
|
||||
@Query("category-id") categoryId: Long,
|
||||
@Query("languageCode") languageCode: String,
|
||||
@Query("isAdultContentVisible") isAdultContentVisible: Boolean,
|
||||
@Query("page") page: Int,
|
||||
@Query("size") size: Int,
|
||||
@@ -185,6 +187,7 @@ interface AudioContentApi {
|
||||
fun getNewContentAllOfTheme(
|
||||
@Query("isFree") isFree: Boolean,
|
||||
@Query("theme") theme: String,
|
||||
@Query("languageCode") languageCode: String,
|
||||
@Query("isAdultContentVisible") isAdultContentVisible: Boolean,
|
||||
@Query("contentType") contentType: ContentType,
|
||||
@Query("page") page: Int,
|
||||
|
||||
@@ -18,6 +18,7 @@ class AudioContentRepository(
|
||||
fun getAudioContentList(
|
||||
id: Long,
|
||||
categoryId: Long,
|
||||
languageCode: String,
|
||||
page: Int,
|
||||
size: Int,
|
||||
sort: AudioContentViewModel.Sort,
|
||||
@@ -25,6 +26,7 @@ class AudioContentRepository(
|
||||
) = api.getAudioContentList(
|
||||
id = id,
|
||||
categoryId = categoryId,
|
||||
languageCode = languageCode,
|
||||
isAdultContentVisible = SharedPreferenceManager.isAdultContentVisible,
|
||||
page = page - 1,
|
||||
size = size,
|
||||
@@ -115,6 +117,7 @@ class AudioContentRepository(
|
||||
) = api.likeContent(request, authHeader = token)
|
||||
|
||||
fun getNewContentAllOfTheme(
|
||||
languageCode: String,
|
||||
isFree: Boolean,
|
||||
theme: String,
|
||||
page: Int,
|
||||
@@ -123,6 +126,7 @@ class AudioContentRepository(
|
||||
) = api.getNewContentAllOfTheme(
|
||||
isFree = isFree,
|
||||
theme = theme,
|
||||
languageCode = languageCode,
|
||||
isAdultContentVisible = SharedPreferenceManager.isAdultContentVisible,
|
||||
contentType = ContentType.entries[SharedPreferenceManager.contentPreference],
|
||||
page = page - 1,
|
||||
@@ -198,12 +202,14 @@ class AudioContentRepository(
|
||||
fun getAllAudioContents(
|
||||
page: Int,
|
||||
size: Int,
|
||||
languageCode: String,
|
||||
isFree: Boolean? = null,
|
||||
isPointAvailableOnly: Boolean? = null,
|
||||
sortType: AudioContentViewModel.Sort = AudioContentViewModel.Sort.NEWEST,
|
||||
theme: String? = null,
|
||||
token: String
|
||||
) = api.getAllAudioContents(
|
||||
languageCode = languageCode,
|
||||
isAdultContentVisible = SharedPreferenceManager.isAdultContentVisible,
|
||||
contentType = ContentType.entries[SharedPreferenceManager.contentPreference],
|
||||
page = page - 1,
|
||||
|
||||
@@ -49,6 +49,7 @@ class AudioContentViewModel(private val repository: AudioContentRepository) : Ba
|
||||
POPULARITY
|
||||
}
|
||||
|
||||
var languageCode: String = "ko"
|
||||
var isLast = false
|
||||
var page = 1
|
||||
private val size = 10
|
||||
@@ -61,6 +62,7 @@ class AudioContentViewModel(private val repository: AudioContentRepository) : Ba
|
||||
repository.getAudioContentList(
|
||||
id = userId,
|
||||
categoryId = selectedCategoryId,
|
||||
languageCode = languageCode,
|
||||
page = page,
|
||||
size = size,
|
||||
token = "Bearer ${SharedPreferenceManager.token}",
|
||||
|
||||
@@ -17,6 +17,7 @@ import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.GridSpacingItemDecoration
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.Utils.getCurrentLanguageCode
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityAudioContentAllBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.home.HomeContentAdapter
|
||||
@@ -43,6 +44,7 @@ class AudioContentAllActivity : BaseActivity<ActivityAudioContentAllBinding>(
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
bindData()
|
||||
viewModel.languageCode = getCurrentLanguageCode(this)
|
||||
viewModel.reset()
|
||||
viewModel.getThemeList(
|
||||
isFree = if (isFree) true else null,
|
||||
|
||||
@@ -9,8 +9,8 @@ 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.common.SodaLiveApplicationHolder
|
||||
import kr.co.vividnext.sodalive.home.AudioContentMainItem
|
||||
|
||||
class AudioContentAllViewModel(
|
||||
@@ -34,6 +34,8 @@ class AudioContentAllViewModel(
|
||||
val sortLiveData: LiveData<AudioContentViewModel.Sort>
|
||||
get() = _sortLiveData
|
||||
|
||||
var languageCode: String = "ko"
|
||||
|
||||
private var page = 1
|
||||
private val size = 20
|
||||
private var isLast = false
|
||||
@@ -92,6 +94,7 @@ class AudioContentAllViewModel(
|
||||
repository.getAllAudioContents(
|
||||
page = page,
|
||||
size = size,
|
||||
languageCode = languageCode,
|
||||
isFree = isFree,
|
||||
isPointAvailableOnly = isPointAvailableOnly,
|
||||
sortType = _sortLiveData.value!!,
|
||||
|
||||
@@ -17,6 +17,7 @@ import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.GridSpacingItemDecoration
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.Utils.getCurrentLanguageCode
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityAudioContentNewAllBinding
|
||||
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
@@ -42,6 +43,7 @@ class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBindin
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
bindData()
|
||||
viewModel.languageCode = getCurrentLanguageCode(this)
|
||||
viewModel.getThemeList()
|
||||
viewModel.getNewContentList(isFree = isFree)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ class AudioContentNewAllViewModel(
|
||||
val newContentTotalCountLiveData: LiveData<Int>
|
||||
get() = _newContentTotalCountLiveData
|
||||
|
||||
var languageCode: String = "ko"
|
||||
|
||||
private var isLast = false
|
||||
private var page = 1
|
||||
private val size = 10
|
||||
@@ -47,6 +49,7 @@ class AudioContentNewAllViewModel(
|
||||
|
||||
compositeDisposable.add(
|
||||
repository.getNewContentAllOfTheme(
|
||||
languageCode = languageCode,
|
||||
isFree = isFree,
|
||||
theme = selectedTheme,
|
||||
page = page,
|
||||
|
||||
Reference in New Issue
Block a user