Skip to content

Commit

Permalink
feat #725: someone poke anonymous item
Browse files Browse the repository at this point in the history
  • Loading branch information
chattymin committed Jun 4, 2024
1 parent 6674c3c commit 401898d
Showing 1 changed file with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package org.sopt.official.feature.poke.notification

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.ListAdapter
Expand Down Expand Up @@ -85,19 +86,28 @@ class PokeNotificationAdapter(
) : RecyclerView.ViewHolder(viewBinding.root) {
fun onBind(item: PokeUser) {
with(viewBinding) {
item.profileImage.takeIf { it.isNotEmpty() }?.let {
imgUserProfile.load(it) { transformations(CircleCropTransformation()) }
} ?: imgUserProfile.setImageResource(R.drawable.ic_empty_profile)
if (item.isAnonymous) {
item.anonymousImage.takeIf { it.isNotEmpty() }?.let {
imgUserProfile.load(it) { transformations(CircleCropTransformation()) }
} ?: imgUserProfile.setImageResource(R.drawable.ic_empty_profile)
tvUserName.text = item.anonymousName
tvUserGeneration.visibility = View.GONE
tvUserFriendsStatus.visibility = View.GONE
} else {
item.profileImage.takeIf { it.isNotEmpty() }?.let {
imgUserProfile.load(it) { transformations(CircleCropTransformation()) }
} ?: imgUserProfile.setImageResource(R.drawable.ic_empty_profile)
tvUserName.text = item.name
tvUserGeneration.text = "${item.generation}${item.part}"
tvUserFriendsStatus.text =
if (item.isFirstMeet) {
item.mutualRelationMessage
} else {
"친한친구 ${item.pokeNum}"
}
}
imgUserProfileOutline.setRelationStrokeColor(item.relationName)
tvUserName.text = item.name
tvUserGeneration.text = "${item.generation}${item.part}"
tvUserMessage.text = item.message
tvUserFriendsStatus.text =
if (item.isFirstMeet) {
item.mutualRelationMessage
} else {
"친한친구 ${item.pokeNum}"
}
imgPoke.isEnabled = !item.isAlreadyPoke
}
}
Expand Down

0 comments on commit 401898d

Please sign in to comment.