fix(home): 사용하지 않는 큐레이션 영역 제거
This commit is contained in:
@@ -4,7 +4,6 @@ import androidx.annotation.Keep
|
|||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentBannerResponse
|
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentBannerResponse
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentRankingItem
|
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentRankingItem
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.v2.GetContentCurationResponse
|
|
||||||
import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse
|
import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse
|
||||||
import kr.co.vividnext.sodalive.chat.character.Character
|
import kr.co.vividnext.sodalive.chat.character.Character
|
||||||
import kr.co.vividnext.sodalive.explorer.GetExplorerSectionCreatorResponse
|
import kr.co.vividnext.sodalive.explorer.GetExplorerSectionCreatorResponse
|
||||||
@@ -25,6 +24,5 @@ data class GetHomeResponse(
|
|||||||
@SerializedName("contentRanking") val contentRanking: List<GetAudioContentRankingItem>,
|
@SerializedName("contentRanking") val contentRanking: List<GetAudioContentRankingItem>,
|
||||||
@SerializedName("recommendChannelList") val recommendChannelList: List<RecommendChannelResponse>,
|
@SerializedName("recommendChannelList") val recommendChannelList: List<RecommendChannelResponse>,
|
||||||
@SerializedName("freeContentList") val freeContentList: List<AudioContentMainItem>,
|
@SerializedName("freeContentList") val freeContentList: List<AudioContentMainItem>,
|
||||||
@SerializedName("pointAvailableContentList") val pointAvailableContentList: List<AudioContentMainItem>,
|
@SerializedName("pointAvailableContentList") val pointAvailableContentList: List<AudioContentMainItem>
|
||||||
@SerializedName("curationList") val curationList: List<GetContentCurationResponse>
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
package kr.co.vividnext.sodalive.home
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Rect
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentMainItem
|
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.v2.GetContentCurationResponse
|
|
||||||
import kr.co.vividnext.sodalive.databinding.ItemHomeCurationBinding
|
|
||||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
|
||||||
|
|
||||||
class HomeCurationAdapter(
|
|
||||||
private val onClickItem: (Long) -> Unit
|
|
||||||
) : RecyclerView.Adapter<HomeCurationAdapter.ViewHolder>() {
|
|
||||||
|
|
||||||
private val items = mutableListOf<GetContentCurationResponse>()
|
|
||||||
|
|
||||||
inner class ViewHolder(
|
|
||||||
private val context: Context,
|
|
||||||
private val binding: ItemHomeCurationBinding
|
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
|
||||||
fun bind(item: GetContentCurationResponse) {
|
|
||||||
binding.tvTitle.text = item.title
|
|
||||||
setAudioContentList(item.items)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setAudioContentList(audioContents: List<GetAudioContentMainItem>) {
|
|
||||||
val adapter = HomeContentAdapter(onClickItem)
|
|
||||||
|
|
||||||
binding.rvCuration.layoutManager = LinearLayoutManager(
|
|
||||||
context,
|
|
||||||
LinearLayoutManager.HORIZONTAL,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
if (binding.rvCuration.itemDecorationCount == 0) {
|
|
||||||
binding.rvCuration.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
|
||||||
override fun getItemOffsets(
|
|
||||||
outRect: Rect,
|
|
||||||
view: View,
|
|
||||||
parent: RecyclerView,
|
|
||||||
state: RecyclerView.State
|
|
||||||
) {
|
|
||||||
super.getItemOffsets(outRect, view, parent, state)
|
|
||||||
outRect.top = 8f.dpToPx().toInt()
|
|
||||||
outRect.bottom = 8f.dpToPx().toInt()
|
|
||||||
|
|
||||||
val position = parent.getChildAdapterPosition(view)
|
|
||||||
|
|
||||||
if (position == 0) {
|
|
||||||
outRect.left = 0f.dpToPx().toInt()
|
|
||||||
} else {
|
|
||||||
outRect.left = 8f.dpToPx().toInt()
|
|
||||||
}
|
|
||||||
|
|
||||||
outRect.right = 8f.dpToPx().toInt()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
binding.rvCuration.adapter = adapter
|
|
||||||
adapter.addItems(
|
|
||||||
audioContents.map {
|
|
||||||
AudioContentMainItem(
|
|
||||||
contentId = it.contentId,
|
|
||||||
creatorId = it.creatorId,
|
|
||||||
title = it.title,
|
|
||||||
coverImageUrl = it.coverImageUrl,
|
|
||||||
creatorNickname = it.creatorNickname,
|
|
||||||
isPointAvailable = it.isPointAvailable
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
|
||||||
parent.context,
|
|
||||||
ItemHomeCurationBinding.inflate(
|
|
||||||
LayoutInflater.from(parent.context),
|
|
||||||
parent,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
|
||||||
holder.bind(items[position])
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() = items.size
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
fun addItems(items: List<GetContentCurationResponse>) {
|
|
||||||
this.items.clear()
|
|
||||||
this.items.addAll(items)
|
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -87,7 +87,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
private lateinit var recommendChannelAdapter: HomeRecommendChannelAdapter
|
private lateinit var recommendChannelAdapter: HomeRecommendChannelAdapter
|
||||||
private lateinit var homeFreeContentAdapter: HomeContentAdapter
|
private lateinit var homeFreeContentAdapter: HomeContentAdapter
|
||||||
private lateinit var homePointContentAdapter: HomeContentAdapter
|
private lateinit var homePointContentAdapter: HomeContentAdapter
|
||||||
private lateinit var curationAdapter: HomeCurationAdapter
|
|
||||||
|
|
||||||
private val handler = Handler(Looper.getMainLooper())
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
@@ -192,7 +191,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
setupRecommendChannel()
|
setupRecommendChannel()
|
||||||
setupFreeContent()
|
setupFreeContent()
|
||||||
setupPointContent()
|
setupPointContent()
|
||||||
setupCuration()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupLiveView() {
|
private fun setupLiveView() {
|
||||||
@@ -1158,67 +1156,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupCuration() {
|
|
||||||
curationAdapter = HomeCurationAdapter(
|
|
||||||
onClickItem = {
|
|
||||||
if (SharedPreferenceManager.token.isNotBlank()) {
|
|
||||||
startActivity(
|
|
||||||
Intent(requireContext(), AudioContentDetailActivity::class.java).apply {
|
|
||||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, it)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
(requireActivity() as MainActivity).showLoginActivity()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
binding.rvCuration.layoutManager = LinearLayoutManager(
|
|
||||||
context,
|
|
||||||
LinearLayoutManager.VERTICAL,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
|
|
||||||
binding.rvCuration.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
|
||||||
override fun getItemOffsets(
|
|
||||||
outRect: Rect,
|
|
||||||
view: View,
|
|
||||||
parent: RecyclerView,
|
|
||||||
state: RecyclerView.State
|
|
||||||
) {
|
|
||||||
super.getItemOffsets(outRect, view, parent, state)
|
|
||||||
|
|
||||||
when (parent.getChildAdapterPosition(view)) {
|
|
||||||
0 -> {
|
|
||||||
outRect.top = 0
|
|
||||||
outRect.bottom = 24f.dpToPx().toInt()
|
|
||||||
}
|
|
||||||
|
|
||||||
curationAdapter.itemCount - 1 -> {
|
|
||||||
outRect.top = 24f.dpToPx().toInt()
|
|
||||||
outRect.bottom = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
outRect.top = 24f.dpToPx().toInt()
|
|
||||||
outRect.bottom = 24f.dpToPx().toInt()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
binding.rvCuration.adapter = curationAdapter
|
|
||||||
|
|
||||||
viewModel.curationListLiveData.observe(viewLifecycleOwner) {
|
|
||||||
if (it.isNotEmpty()) {
|
|
||||||
binding.rvCuration.visibility = View.VISIBLE
|
|
||||||
curationAdapter.addItems(it)
|
|
||||||
} else {
|
|
||||||
binding.rvCuration.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun bindData() {
|
private fun bindData() {
|
||||||
viewModel.isLoading.observe(viewLifecycleOwner) {
|
viewModel.isLoading.observe(viewLifecycleOwner) {
|
||||||
if (it) {
|
if (it) {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
|||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentBannerResponse
|
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentBannerResponse
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentRankingItem
|
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentRankingItem
|
||||||
import kr.co.vividnext.sodalive.audio_content.main.v2.GetContentCurationResponse
|
|
||||||
import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse
|
import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse
|
||||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||||
import kr.co.vividnext.sodalive.chat.character.Character
|
import kr.co.vividnext.sodalive.chat.character.Character
|
||||||
@@ -76,10 +75,6 @@ class HomeViewModel(
|
|||||||
val freeContentListLiveData: LiveData<List<AudioContentMainItem>>
|
val freeContentListLiveData: LiveData<List<AudioContentMainItem>>
|
||||||
get() = _freeContentListLiveData
|
get() = _freeContentListLiveData
|
||||||
|
|
||||||
private var _curationListLiveData = MutableLiveData<List<GetContentCurationResponse>>()
|
|
||||||
val curationListLiveData: LiveData<List<GetContentCurationResponse>>
|
|
||||||
get() = _curationListLiveData
|
|
||||||
|
|
||||||
private var _pointAvailableContentListLiveData = MutableLiveData<List<AudioContentMainItem>>()
|
private var _pointAvailableContentListLiveData = MutableLiveData<List<AudioContentMainItem>>()
|
||||||
val pointAvailableContentListLiveData: LiveData<List<AudioContentMainItem>>
|
val pointAvailableContentListLiveData: LiveData<List<AudioContentMainItem>>
|
||||||
get() = _pointAvailableContentListLiveData
|
get() = _pointAvailableContentListLiveData
|
||||||
@@ -110,8 +105,8 @@ class HomeViewModel(
|
|||||||
_popularCharacters.value = data.popularCharacters
|
_popularCharacters.value = data.popularCharacters
|
||||||
_contentRankingLiveData.value = data.contentRanking
|
_contentRankingLiveData.value = data.contentRanking
|
||||||
_freeContentListLiveData.value = data.freeContentList
|
_freeContentListLiveData.value = data.freeContentList
|
||||||
_pointAvailableContentListLiveData.value = data.pointAvailableContentList
|
_pointAvailableContentListLiveData.value =
|
||||||
_curationListLiveData.value = data.curationList
|
data.pointAvailableContentList
|
||||||
_recommendChannelListLiveData.value = data.recommendChannelList
|
_recommendChannelListLiveData.value = data.recommendChannelList
|
||||||
} else {
|
} else {
|
||||||
if (it.message != null) {
|
if (it.message != null) {
|
||||||
|
|||||||
@@ -434,14 +434,6 @@
|
|||||||
android:paddingHorizontal="24dp" />
|
android:paddingHorizontal="24dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rv_curation"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="48dp"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<io.github.glailton.expandabletextview.ExpandableTextView
|
<io.github.glailton.expandabletextview.ExpandableTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
Reference in New Issue
Block a user