diff --git a/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt b/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt index ea44d25..9856efe 100644 --- a/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt +++ b/app/src/main/java/com/teampome/pome/presentation/friend/FriendFragment.kt @@ -61,6 +61,7 @@ class FriendFragment : BaseFragment(R.layout.fragment_fri (binding.friendListRv.adapter as FriendGetAdapter).submitList( list ) + friendRecordGetAdapter.updateFriendsMap(list) } } } diff --git a/app/src/main/java/com/teampome/pome/presentation/friend/FriendRecordGetAdapter.kt b/app/src/main/java/com/teampome/pome/presentation/friend/FriendRecordGetAdapter.kt index 76ceec2..18ab9a0 100644 --- a/app/src/main/java/com/teampome/pome/presentation/friend/FriendRecordGetAdapter.kt +++ b/app/src/main/java/com/teampome/pome/presentation/friend/FriendRecordGetAdapter.kt @@ -1,6 +1,7 @@ package com.teampome.pome.presentation.friend import android.content.Context +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -11,6 +12,7 @@ import com.bumptech.glide.Glide import com.teampome.pome.R import com.teampome.pome.databinding.ItemFriendDetailCardBinding import com.teampome.pome.model.response.GetFriendRecord +import com.teampome.pome.model.response.GetFriends //친구 기록 조회 class FriendRecordGetAdapter( @@ -18,6 +20,14 @@ class FriendRecordGetAdapter( private val context : Context? ) : ListAdapter(BookDiffCallback) { + private val friendsMap: HashMap = HashMap() + + fun updateFriendsMap(friends: List) { + for (friend in friends) { + friendsMap[friend.friendNickName] = friend + } + } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendGetRecordViewHolder { return FriendGetRecordViewHolder( clickListener, @@ -79,6 +89,17 @@ class FriendRecordGetAdapter( } friendEmojiRegisterCl.layoutParams = params } + + val friend = friendsMap[getFriedRecord.nickname] + Log.d("gg1234", getFriedRecord.id.toString()) + Log.d("gg1234", friend?.imageKey.toString()) + + friend?.let { + Glide.with(itemView.context) + .load(it.imageKey) + .circleCrop() + .into(friendDetailProfileIv) + } } } diff --git a/app/src/main/java/com/teampome/pome/viewmodel/AddFriendsViewModel.kt b/app/src/main/java/com/teampome/pome/viewmodel/AddFriendsViewModel.kt index 7140b0c..72b5340 100644 --- a/app/src/main/java/com/teampome/pome/viewmodel/AddFriendsViewModel.kt +++ b/app/src/main/java/com/teampome/pome/viewmodel/AddFriendsViewModel.kt @@ -120,6 +120,4 @@ class AddFriendsViewModel @Inject constructor( is ApiResponse.Failure -> { null } } } - - } \ No newline at end of file