Skip to content

Commit

Permalink
[feat] : #15 Friend Record Profile Image HashMap Connect
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed Jun 18, 2023
1 parent 69a4608 commit b9809d7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class FriendFragment : BaseFragment<FragmentFriendBinding>(R.layout.fragment_fri
(binding.friendListRv.adapter as FriendGetAdapter).submitList(
list
)
friendRecordGetAdapter.updateFriendsMap(list)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,13 +12,22 @@ 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(
private val clickListener: FriendDetailRecordClickListener,
private val context : Context?
) : ListAdapter<GetFriendRecord, FriendRecordGetAdapter.FriendGetRecordViewHolder>(BookDiffCallback) {

private val friendsMap: HashMap<String, GetFriends> = HashMap()

fun updateFriendsMap(friends: List<GetFriends>) {
for (friend in friends) {
friendsMap[friend.friendNickName] = friend
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendGetRecordViewHolder {
return FriendGetRecordViewHolder(
clickListener,
Expand Down Expand Up @@ -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)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,4 @@ class AddFriendsViewModel @Inject constructor(
is ApiResponse.Failure -> { null }
}
}


}

0 comments on commit b9809d7

Please sign in to comment.