feat: 팔로워 리스트
- 프로필 이미지를 터치하면 프로필 다이얼로그 표시
This commit is contained in:
		@@ -27,7 +27,8 @@ class MemberProfileDialog(
 | 
				
			|||||||
    private val activity: FragmentActivity,
 | 
					    private val activity: FragmentActivity,
 | 
				
			||||||
    private val layoutInflater: LayoutInflater,
 | 
					    private val layoutInflater: LayoutInflater,
 | 
				
			||||||
    private val memberId: Long,
 | 
					    private val memberId: Long,
 | 
				
			||||||
    private val screenWidth: Int
 | 
					    private val screenWidth: Int,
 | 
				
			||||||
 | 
					    private val onBlockComplete: () -> Unit = {}
 | 
				
			||||||
) : KoinComponent {
 | 
					) : KoinComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private val viewModel: UserViewModel by inject()
 | 
					    private val viewModel: UserViewModel by inject()
 | 
				
			||||||
@@ -143,7 +144,10 @@ class MemberProfileDialog(
 | 
				
			|||||||
        dialog.setTitle("사용자 차단")
 | 
					        dialog.setTitle("사용자 차단")
 | 
				
			||||||
        dialog.setMessage(message)
 | 
					        dialog.setMessage(message)
 | 
				
			||||||
        dialog.setPositiveButton("차단") { _, _ ->
 | 
					        dialog.setPositiveButton("차단") { _, _ ->
 | 
				
			||||||
            viewModel.memberBlock(memberId) { dismiss() }
 | 
					            viewModel.memberBlock(memberId) {
 | 
				
			||||||
 | 
					                dismiss()
 | 
				
			||||||
 | 
					                onBlockComplete()
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        dialog.setNegativeButton("취소") { _, _ -> }
 | 
					        dialog.setNegativeButton("취소") { _, _ -> }
 | 
				
			||||||
        dialog.show()
 | 
					        dialog.show()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,9 @@ import kr.co.vividnext.sodalive.base.BaseActivity
 | 
				
			|||||||
import kr.co.vividnext.sodalive.common.Constants
 | 
					import kr.co.vividnext.sodalive.common.Constants
 | 
				
			||||||
import kr.co.vividnext.sodalive.common.LoadingDialog
 | 
					import kr.co.vividnext.sodalive.common.LoadingDialog
 | 
				
			||||||
import kr.co.vividnext.sodalive.databinding.ActivityUserFollowerListBinding
 | 
					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.CreatorFollowNotifyFragment
 | 
				
			||||||
 | 
					import kr.co.vividnext.sodalive.explorer.profile.fantalk.UserProfileFantalkAllViewActivity
 | 
				
			||||||
import kr.co.vividnext.sodalive.extensions.dpToPx
 | 
					import kr.co.vividnext.sodalive.extensions.dpToPx
 | 
				
			||||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
 | 
					import kr.co.vividnext.sodalive.extensions.moneyFormat
 | 
				
			||||||
import org.koin.android.ext.android.inject
 | 
					import org.koin.android.ext.android.inject
 | 
				
			||||||
@@ -51,6 +53,18 @@ class UserFollowerListActivity : BaseActivity<ActivityUserFollowerListBinding>(
 | 
				
			|||||||
        binding.toolbar.tvBack.setOnClickListener { finish() }
 | 
					        binding.toolbar.tvBack.setOnClickListener { finish() }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        adapter = UserFollowerListAdapter(
 | 
					        adapter = UserFollowerListAdapter(
 | 
				
			||||||
 | 
					            onClickProfile = { memberId ->
 | 
				
			||||||
 | 
					                MemberProfileDialog(
 | 
				
			||||||
 | 
					                    activity = this@UserFollowerListActivity,
 | 
				
			||||||
 | 
					                    layoutInflater = layoutInflater,
 | 
				
			||||||
 | 
					                    memberId = memberId,
 | 
				
			||||||
 | 
					                    screenWidth = screenWidth,
 | 
				
			||||||
 | 
					                    onBlockComplete = {
 | 
				
			||||||
 | 
					                        adapter.removeMember(memberId)
 | 
				
			||||||
 | 
					                        viewModel.setTotalCountMinusOne()
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                ).show()
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            onClickFollow = { creatorId, isFollow ->
 | 
					            onClickFollow = { creatorId, isFollow ->
 | 
				
			||||||
                if (isFollow) {
 | 
					                if (isFollow) {
 | 
				
			||||||
                    val notifyFragment = CreatorFollowNotifyFragment(
 | 
					                    val notifyFragment = CreatorFollowNotifyFragment(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ import kr.co.vividnext.sodalive.R
 | 
				
			|||||||
import kr.co.vividnext.sodalive.databinding.ItemFollowerListBinding
 | 
					import kr.co.vividnext.sodalive.databinding.ItemFollowerListBinding
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class UserFollowerListAdapter(
 | 
					class UserFollowerListAdapter(
 | 
				
			||||||
 | 
					    private val onClickProfile: (Long) -> Unit,
 | 
				
			||||||
    private val onClickFollow: (Long, Boolean) -> Unit
 | 
					    private val onClickFollow: (Long, Boolean) -> Unit
 | 
				
			||||||
) : RecyclerView.Adapter<UserFollowerListAdapter.ViewHolder>() {
 | 
					) : RecyclerView.Adapter<UserFollowerListAdapter.ViewHolder>() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -27,6 +28,10 @@ class UserFollowerListAdapter(
 | 
				
			|||||||
                crossfade(true)
 | 
					                crossfade(true)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            binding.ivProfile.setOnClickListener {
 | 
				
			||||||
 | 
					                onClickProfile(item.userId)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (item.isFollow != null && item.isNotify != null) {
 | 
					            if (item.isFollow != null && item.isNotify != null) {
 | 
				
			||||||
                if (item.isFollow) {
 | 
					                if (item.isFollow) {
 | 
				
			||||||
                    binding.ivFollow.setImageResource(
 | 
					                    binding.ivFollow.setImageResource(
 | 
				
			||||||
@@ -56,6 +61,12 @@ class UserFollowerListAdapter(
 | 
				
			|||||||
        notifyDataSetChanged()
 | 
					        notifyDataSetChanged()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fun removeMember(memberId: Long) {
 | 
				
			||||||
 | 
					        val filteredItem = this.items.filterNot { it.userId == memberId }
 | 
				
			||||||
 | 
					        clear()
 | 
				
			||||||
 | 
					        addAll(filteredItem)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fun clear() {
 | 
					    fun clear() {
 | 
				
			||||||
        this.items.clear()
 | 
					        this.items.clear()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,10 @@ class UserFollowerListViewModel(
 | 
				
			|||||||
    private var isLast = false
 | 
					    private var isLast = false
 | 
				
			||||||
    private var pageSize = 10
 | 
					    private var pageSize = 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fun setTotalCountMinusOne() {
 | 
				
			||||||
 | 
					        _totalCountLiveData.value = _totalCountLiveData.value!! - 1
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fun getFollowerList() {
 | 
					    fun getFollowerList() {
 | 
				
			||||||
        if (!isLast && !_isLoading.value!!) {
 | 
					        if (!isLast && !_isLoading.value!!) {
 | 
				
			||||||
            _isLoading.value = true
 | 
					            _isLoading.value = true
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user