Skip to content

Commit

Permalink
[feat] : #15 Friend List Profile Image add
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed Jun 15, 2023
1 parent ebe3667 commit e153205
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class FriendFragment : BaseFragment<FragmentFriendBinding>(R.layout.fragment_fri

//친구 목록 조회 RV
private fun setUpRecyclerView(){
friendGetAdapter = FriendGetAdapter()
friendGetAdapter = FriendGetAdapter(context)
binding.friendListRv.apply {
// setHasFixedSize(true)
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.teampome.pome.presentation.friend

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.teampome.pome.databinding.ItemFriendsListBinding
import com.teampome.pome.model.response.GetFriends

// 친구 탭에서 친구 조회하는 친구 리스트 어댑터
class FriendGetAdapter : ListAdapter<GetFriends, FriendGetAdapter.FriendGetViewHolder>(BookDiffCallback) {
class FriendGetAdapter(
private val context : Context?
) : ListAdapter<GetFriends, FriendGetAdapter.FriendGetViewHolder>(BookDiffCallback) {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendGetViewHolder {
return FriendGetViewHolder(
Expand All @@ -34,12 +38,20 @@ class FriendGetAdapter : ListAdapter<GetFriends, FriendGetAdapter.FriendGetViewH
private val binding : ItemFriendsListBinding,
) : RecyclerView.ViewHolder(binding.root){

fun bind(getFriends: GetFriends){
binding.friendAllTv.text = if (getFriends.friendNickName.length >= 3) {
fun bind(getFriends: GetFriends) = with(binding){
friendAllTv.text = if (getFriends.friendNickName.length >= 3) {
"${getFriends.friendNickName.substring(0, 3)}..."
} else {
getFriends.friendNickName
}
friendListProfileIv.clipToOutline = true

context?.let { context ->
Glide.with(context)
.load(getFriends.imageKey)
.circleCrop()
.into(friendListProfileIv)
}
}

}
Expand Down

0 comments on commit e153205

Please sign in to comment.