parent
e1028ada43
commit
2ff2c2224a
|
@ -270,6 +270,12 @@ interface AudioContentApi {
|
||||||
@Header("Authorization") authHeader: String
|
@Header("Authorization") authHeader: String
|
||||||
): Single<ApiResponse<GetSeriesListResponse>>
|
): Single<ApiResponse<GetSeriesListResponse>>
|
||||||
|
|
||||||
|
@GET("/v2/audio-content/main/series/recommend-by-genre")
|
||||||
|
fun getRecommendSeriesListByGenre(
|
||||||
|
@Query("genreId") genreId: Long,
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<List<GetSeriesListResponse.SeriesListItem>>>
|
||||||
|
|
||||||
@GET("/v2/audio-content/main/content")
|
@GET("/v2/audio-content/main/content")
|
||||||
fun getContentMainContent(
|
fun getContentMainContent(
|
||||||
@Header("Authorization") authHeader: String
|
@Header("Authorization") authHeader: String
|
||||||
|
|
|
@ -272,6 +272,9 @@ class AudioContentMainTabSeriesFragment : BaseFragment<FragmentAudioContentMainT
|
||||||
|
|
||||||
private fun setupRecommendSeriesGenre() {
|
private fun setupRecommendSeriesGenre() {
|
||||||
seriesGenreAdapter = AudioContentMainRecommendSeriesGenreAdapter {
|
seriesGenreAdapter = AudioContentMainRecommendSeriesGenreAdapter {
|
||||||
|
binding.llNoItemsSeriesByGenre.visibility = View.VISIBLE
|
||||||
|
binding.rvSeriesByGenre.visibility = View.GONE
|
||||||
|
viewModel.selectGenre(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
val recyclerView = binding.rvSeriesGenre
|
val recyclerView = binding.rvSeriesGenre
|
||||||
|
@ -378,7 +381,12 @@ class AudioContentMainTabSeriesFragment : BaseFragment<FragmentAudioContentMainT
|
||||||
recyclerView.adapter = recommendSeriesByGenreAdapter
|
recyclerView.adapter = recommendSeriesByGenreAdapter
|
||||||
|
|
||||||
viewModel.recommendSeriesListLiveData.observe(viewLifecycleOwner) {
|
viewModel.recommendSeriesListLiveData.observe(viewLifecycleOwner) {
|
||||||
recommendSeriesByGenreAdapter.addItems(it)
|
if (it.isNotEmpty()) {
|
||||||
|
binding.llNoItemsSeriesByGenre.visibility = View.GONE
|
||||||
|
binding.rvSeriesByGenre.visibility = View.VISIBLE
|
||||||
|
recommendSeriesByGenreAdapter.clear()
|
||||||
|
recommendSeriesByGenreAdapter.addItems(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,8 @@ import kr.co.vividnext.sodalive.audio_content.AudioContentApi
|
||||||
|
|
||||||
class AudioContentMainTabSeriesRepository(private val api: AudioContentApi) {
|
class AudioContentMainTabSeriesRepository(private val api: AudioContentApi) {
|
||||||
fun getContentMainSeries(token: String) = api.getContentMainSeries(authHeader = token)
|
fun getContentMainSeries(token: String) = api.getContentMainSeries(authHeader = token)
|
||||||
|
fun getRecommendSeriesListByGenre(
|
||||||
|
genreId: Long,
|
||||||
|
token: String
|
||||||
|
) = api.getRecommendSeriesListByGenre(genreId, authHeader = token)
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,4 +115,38 @@ class AudioContentMainTabSeriesViewModel(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun selectGenre(genreId: Long) {
|
||||||
|
_isLoading.value = true
|
||||||
|
compositeDisposable.add(
|
||||||
|
repository.getRecommendSeriesListByGenre(
|
||||||
|
genreId,
|
||||||
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
|
)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
if (it.success && it.data != null) {
|
||||||
|
_recommendSeriesListLiveData.value = it.data!!
|
||||||
|
} else {
|
||||||
|
if (it.message != null) {
|
||||||
|
_toastLiveData.postValue(it.message)
|
||||||
|
} else {
|
||||||
|
_toastLiveData.postValue(
|
||||||
|
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_isLoading.value = false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
it.message?.let { message -> Logger.e(message) }
|
||||||
|
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,36 @@
|
||||||
android:layout_marginTop="13.3dp"
|
android:layout_marginTop="13.3dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingHorizontal="13.3dp" />
|
android:paddingHorizontal="13.3dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_no_items_series_by_genre"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="13.3dp"
|
||||||
|
android:layout_marginTop="28.3dp"
|
||||||
|
android:background="@drawable/bg_round_corner_4_7_13181b"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingVertical="16.7dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/ic_no_item" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginVertical="10dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:gravity="center"
|
||||||
|
android:lineSpacingExtra="8dp"
|
||||||
|
android:text="마이페이지에서 본인인증을 해주세요"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="13sp"
|
||||||
|
tools:ignore="SmallSp" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
Loading…
Reference in New Issue