feat(chat-character): 큐레이션 영역 제거

This commit is contained in:
2025-11-11 16:26:30 +09:00
parent 3353ebb777
commit f97f9296b6
6 changed files with 0 additions and 181 deletions

View File

@@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.chat.character
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import kr.co.vividnext.sodalive.chat.character.curation.CurationSection
import kr.co.vividnext.sodalive.chat.character.recent.RecentCharacter
@Keep
@@ -11,7 +10,6 @@ data class CharacterHomeResponse(
@SerializedName("recentCharacters") val recentCharacters: List<RecentCharacter>,
@SerializedName("popularCharacters") val popularCharacters: List<Character>,
@SerializedName("newCharacters") val newCharacters: List<Character>,
@SerializedName("curationSections") val curationSections: List<CurationSection>
)
@Keep

View File

@@ -19,7 +19,6 @@ import com.zhpan.indicator.enums.IndicatorStyle
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.base.BaseFragment
import kr.co.vividnext.sodalive.base.SodaDialog
import kr.co.vividnext.sodalive.chat.character.curation.CurationSectionAdapter
import kr.co.vividnext.sodalive.chat.character.detail.CharacterDetailActivity
import kr.co.vividnext.sodalive.chat.character.detail.CharacterDetailActivity.Companion.EXTRA_CHARACTER_ID
import kr.co.vividnext.sodalive.chat.character.newcharacters.NewCharactersAllActivity
@@ -47,7 +46,6 @@ class CharacterTabFragment : BaseFragment<FragmentCharacterTabBinding>(
private lateinit var recentCharacterAdapter: RecentCharacterAdapter
private lateinit var popularCharacterAdapter: CharacterAdapter
private lateinit var newCharacterAdapter: CharacterAdapter
private lateinit var curationSectionAdapter: CurationSectionAdapter
private lateinit var loadingDialog: LoadingDialog
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -65,7 +63,6 @@ class CharacterTabFragment : BaseFragment<FragmentCharacterTabBinding>(
setupRecentCharactersRecyclerView()
setupPopularCharactersRecyclerView()
setupNewCharactersRecyclerView()
setupCurationSectionsRecyclerView()
}
private fun setupBanner() {
@@ -311,62 +308,6 @@ class CharacterTabFragment : BaseFragment<FragmentCharacterTabBinding>(
}
}
private fun setupCurationSectionsRecyclerView() {
// 큐레이션 섹션 RecyclerView 설정
curationSectionAdapter = CurationSectionAdapter {
onCharacterClick(it)
}
val recyclerView = binding.rvCurationSections
recyclerView.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.VERTICAL,
false
)
recyclerView.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()
}
curationSectionAdapter.itemCount - 1 -> {
outRect.top = 24f.dpToPx().toInt()
outRect.bottom = 0
}
else -> {
outRect.top = 24f.dpToPx().toInt()
outRect.bottom = 24f.dpToPx().toInt()
}
}
}
})
recyclerView.adapter = curationSectionAdapter
// 큐레이션 섹션 LiveData 구독
viewModel.curationSections.observe(viewLifecycleOwner) {
if (it.isNotEmpty()) {
recyclerView.visibility = View.VISIBLE
curationSectionAdapter.updateSections(it)
} else {
recyclerView.visibility = View.GONE
}
}
}
private fun ensureLoginAndAuth(onAuthed: () -> Unit) {
if (SharedPreferenceManager.token.isBlank()) {
(requireActivity() as MainActivity).showLoginActivity()

View File

@@ -6,7 +6,6 @@ import com.orhanobut.logger.Logger
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
import kr.co.vividnext.sodalive.base.BaseViewModel
import kr.co.vividnext.sodalive.chat.character.curation.CurationSection
import kr.co.vividnext.sodalive.chat.character.recent.RecentCharacter
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
@@ -40,11 +39,6 @@ class CharacterTabViewModel(
val newCharacters: LiveData<List<Character>>
get() = _newCharacters
// 큐레이션 섹션 LiveData
private val _curationSections = MutableLiveData<List<CurationSection>>(emptyList())
val curationSections: LiveData<List<CurationSection>>
get() = _curationSections
fun fetchData() {
_isLoading.value = true
@@ -60,7 +54,6 @@ class CharacterTabViewModel(
_recentCharacters.value = data.recentCharacters
_popularCharacters.value = data.popularCharacters
_newCharacters.value = data.newCharacters
_curationSections.value = data.curationSections
} else {
_toastLiveData.value =
it.message ?: "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."

View File

@@ -1,12 +0,0 @@
package kr.co.vividnext.sodalive.chat.character.curation
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import kr.co.vividnext.sodalive.chat.character.Character
@Keep
data class CurationSection(
@SerializedName("characterCurationId") val characterCurationId: Long,
@SerializedName("title") val title: String,
@SerializedName("characters") val characters: List<Character>
)

View File

@@ -1,94 +0,0 @@
package kr.co.vividnext.sodalive.chat.character.curation
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.chat.character.CharacterAdapter
import kr.co.vividnext.sodalive.databinding.ItemCurationSectionBinding
import kr.co.vividnext.sodalive.extensions.dpToPx
class CurationSectionAdapter(
private var sections: List<CurationSection> = emptyList(),
private val onCharacterClick: (Long) -> Unit = {}
) : RecyclerView.Adapter<CurationSectionAdapter.ViewHolder>() {
inner class ViewHolder(
private val context: Context,
private val binding: ItemCurationSectionBinding
) : RecyclerView.ViewHolder(binding.root) {
fun bind(section: CurationSection) {
binding.tvSectionTitle.text = section.title
// 캐릭터 리스트 설정
val characterAdapter = CharacterAdapter(
characters = section.characters,
showRanking = false,
onCharacterClick = onCharacterClick
)
val recyclerView = binding.rvCharacters
recyclerView.layoutManager = LinearLayoutManager(
context,
LinearLayoutManager.HORIZONTAL,
false
)
recyclerView.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.left = 0
outRect.right = 8f.dpToPx().toInt()
}
characterAdapter.itemCount - 1 -> {
outRect.left = 8f.dpToPx().toInt()
outRect.right = 0
}
else -> {
outRect.left = 8f.dpToPx().toInt()
outRect.right = 8f.dpToPx().toInt()
}
}
}
})
recyclerView.adapter = characterAdapter
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
parent.context,
ItemCurationSectionBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(sections[position])
}
override fun getItemCount(): Int = sections.size
@SuppressLint("NotifyDataSetChanged")
fun updateSections(newSections: List<CurationSection>) {
sections = newSections
notifyDataSetChanged()
}
}

View File

@@ -174,12 +174,5 @@
android:paddingHorizontal="24dp" />
</LinearLayout>
<!-- 큐레이션 섹션들 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_curation_sections"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>