fix(talk-tab): 채팅방 리스트
- 채팅방 사이 간격 24 - 이미지 원형으로 변경
This commit is contained in:
		@@ -6,11 +6,10 @@ import androidx.recyclerview.widget.DiffUtil
 | 
			
		||||
import androidx.recyclerview.widget.ListAdapter
 | 
			
		||||
import androidx.recyclerview.widget.RecyclerView
 | 
			
		||||
import com.bumptech.glide.Glide
 | 
			
		||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
 | 
			
		||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop
 | 
			
		||||
import com.bumptech.glide.request.RequestOptions
 | 
			
		||||
import com.orhanobut.logger.Logger
 | 
			
		||||
import kr.co.vividnext.sodalive.databinding.ItemTalkBinding
 | 
			
		||||
import kr.co.vividnext.sodalive.extensions.dpToPx
 | 
			
		||||
 | 
			
		||||
class TalkTabAdapter(
 | 
			
		||||
    private val onItemClick: (TalkRoom) -> Unit
 | 
			
		||||
@@ -46,9 +45,7 @@ class TalkTabAdapter(
 | 
			
		||||
                    .load(talkRoom.imageUrl)
 | 
			
		||||
                    .apply(
 | 
			
		||||
                        RequestOptions().transform(
 | 
			
		||||
                            RoundedCorners(
 | 
			
		||||
                                28f.dpToPx().toInt()
 | 
			
		||||
                            )
 | 
			
		||||
                            CircleCrop()
 | 
			
		||||
                        )
 | 
			
		||||
                    )
 | 
			
		||||
                    .into(ivProfile)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,16 @@
 | 
			
		||||
package kr.co.vividnext.sodalive.chat.talk
 | 
			
		||||
 | 
			
		||||
import android.graphics.Rect
 | 
			
		||||
import android.os.Bundle
 | 
			
		||||
import android.view.View
 | 
			
		||||
import android.widget.Toast
 | 
			
		||||
import androidx.recyclerview.widget.LinearLayoutManager
 | 
			
		||||
import androidx.recyclerview.widget.RecyclerView
 | 
			
		||||
import kr.co.vividnext.sodalive.base.BaseFragment
 | 
			
		||||
import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity
 | 
			
		||||
import kr.co.vividnext.sodalive.common.LoadingDialog
 | 
			
		||||
import kr.co.vividnext.sodalive.databinding.FragmentTalkTabBinding
 | 
			
		||||
import kr.co.vividnext.sodalive.extensions.dpToPx
 | 
			
		||||
import org.koin.android.ext.android.inject
 | 
			
		||||
 | 
			
		||||
class TalkTabFragment : BaseFragment<FragmentTalkTabBinding>(
 | 
			
		||||
@@ -40,7 +43,41 @@ class TalkTabFragment : BaseFragment<FragmentTalkTabBinding>(
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        binding.rvTalk.apply {
 | 
			
		||||
        val recyclerView = binding.rvTalk
 | 
			
		||||
        recyclerView.setHasFixedSize(true)
 | 
			
		||||
 | 
			
		||||
        recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
 | 
			
		||||
            override fun getItemOffsets(
 | 
			
		||||
                outRect: Rect,
 | 
			
		||||
                view: View,
 | 
			
		||||
                parent: RecyclerView,
 | 
			
		||||
                state: RecyclerView.State
 | 
			
		||||
            ) {
 | 
			
		||||
                super.getItemOffsets(outRect, view, parent, state)
 | 
			
		||||
 | 
			
		||||
                outRect.left = 24f.dpToPx().toInt()
 | 
			
		||||
                outRect.right = 24f.dpToPx().toInt()
 | 
			
		||||
 | 
			
		||||
                when (parent.getChildAdapterPosition(view)) {
 | 
			
		||||
                    0 -> {
 | 
			
		||||
                        outRect.top = 24f.dpToPx().toInt()
 | 
			
		||||
                        outRect.bottom = 12f.dpToPx().toInt()
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    adapter.itemCount - 1 -> {
 | 
			
		||||
                        outRect.top = 12f.dpToPx().toInt()
 | 
			
		||||
                        outRect.bottom = 24f.dpToPx().toInt()
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    else -> {
 | 
			
		||||
                        outRect.top = 12f.dpToPx().toInt()
 | 
			
		||||
                        outRect.bottom = 12f.dpToPx().toInt()
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        recyclerView.apply {
 | 
			
		||||
            layoutManager = LinearLayoutManager(requireContext())
 | 
			
		||||
            adapter = this@TalkTabFragment.adapter
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@
 | 
			
		||||
        android:layout_width="0dp"
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
        android:clipToPadding="false"
 | 
			
		||||
        android:padding="24dp"
 | 
			
		||||
        app:layout_constraintBottom_toBottomOf="parent"
 | 
			
		||||
        app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
        app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user