feat: 팔로워 리스트

- 프로필 이미지를 터치하면 프로필 다이얼로그 표시
This commit is contained in:
2025-06-13 19:36:38 +09:00
parent 89277c5668
commit c527f55721
4 changed files with 35 additions and 2 deletions

View File

@@ -27,7 +27,8 @@ class MemberProfileDialog(
private val activity: FragmentActivity,
private val layoutInflater: LayoutInflater,
private val memberId: Long,
private val screenWidth: Int
private val screenWidth: Int,
private val onBlockComplete: () -> Unit = {}
) : KoinComponent {
private val viewModel: UserViewModel by inject()
@@ -143,7 +144,10 @@ class MemberProfileDialog(
dialog.setTitle("사용자 차단")
dialog.setMessage(message)
dialog.setPositiveButton("차단") { _, _ ->
viewModel.memberBlock(memberId) { dismiss() }
viewModel.memberBlock(memberId) {
dismiss()
onBlockComplete()
}
}
dialog.setNegativeButton("취소") { _, _ -> }
dialog.show()

View File

@@ -10,7 +10,9 @@ 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.databinding.ActivityUserFollowerListBinding
import kr.co.vividnext.sodalive.dialog.MemberProfileDialog
import kr.co.vividnext.sodalive.explorer.profile.CreatorFollowNotifyFragment
import kr.co.vividnext.sodalive.explorer.profile.fantalk.UserProfileFantalkAllViewActivity
import kr.co.vividnext.sodalive.extensions.dpToPx
import kr.co.vividnext.sodalive.extensions.moneyFormat
import org.koin.android.ext.android.inject
@@ -51,6 +53,18 @@ class UserFollowerListActivity : BaseActivity<ActivityUserFollowerListBinding>(
binding.toolbar.tvBack.setOnClickListener { finish() }
adapter = UserFollowerListAdapter(
onClickProfile = { memberId ->
MemberProfileDialog(
activity = this@UserFollowerListActivity,
layoutInflater = layoutInflater,
memberId = memberId,
screenWidth = screenWidth,
onBlockComplete = {
adapter.removeMember(memberId)
viewModel.setTotalCountMinusOne()
}
).show()
},
onClickFollow = { creatorId, isFollow ->
if (isFollow) {
val notifyFragment = CreatorFollowNotifyFragment(

View File

@@ -11,6 +11,7 @@ import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.databinding.ItemFollowerListBinding
class UserFollowerListAdapter(
private val onClickProfile: (Long) -> Unit,
private val onClickFollow: (Long, Boolean) -> Unit
) : RecyclerView.Adapter<UserFollowerListAdapter.ViewHolder>() {
@@ -27,6 +28,10 @@ class UserFollowerListAdapter(
crossfade(true)
}
binding.ivProfile.setOnClickListener {
onClickProfile(item.userId)
}
if (item.isFollow != null && item.isNotify != null) {
if (item.isFollow) {
binding.ivFollow.setImageResource(
@@ -56,6 +61,12 @@ class UserFollowerListAdapter(
notifyDataSetChanged()
}
fun removeMember(memberId: Long) {
val filteredItem = this.items.filterNot { it.userId == memberId }
clear()
addAll(filteredItem)
}
fun clear() {
this.items.clear()
}

View File

@@ -36,6 +36,10 @@ class UserFollowerListViewModel(
private var isLast = false
private var pageSize = 10
fun setTotalCountMinusOne() {
_totalCountLiveData.value = _totalCountLiveData.value!! - 1
}
fun getFollowerList() {
if (!isLast && !_isLoading.value!!) {
_isLoading.value = true