Skip to content

Commit

Permalink
[feat] : #15 친구 기록 이모지 카운트 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed May 27, 2023
1 parent e1e6797 commit 21ffecb
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@ data class GetFriendRecord(
val useComment: String,
val oneLineMind: String,
val createdAt: String,
val emotionResponse: FriendEmotion
val emotionResponse: EmotionResponse
) : Parcelable

@Parcelize
data class FriendEmotion(
data class EmotionResponse(
val firstEmotion : Int,
val secondEmotion : Int,
val myEmotion : Int,
val friendEmotion : List<Int>
val myEmotion : Int?,
val friendEmotions : List<FriendEmotionResponse>
) : Parcelable

@Parcelize
data class FriendEmotionResponse(
val nickname : String,
val emotionId : Int,
) : Parcelable

//@Parcelize
//data class FriendEmotion(
// val firstEmotion : Int,
// val secondEmotion : Int,
// val myEmotion : Int?,
// val friendEmotions : List<Int>?
//) : Parcelable

/*
"id": 3,
"nickname": "찬영짱121",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class FriendFragment : BaseFragment<FragmentFriendBinding>(R.layout.fragment_fri

//친구 기록 조회 RV
private fun friendRecordSetUpRecyclerView(){
friendRecordGetAdapter = FriendRecordGetAdapter(this)
friendRecordGetAdapter = FriendRecordGetAdapter(this, context)
binding.friendDetailRv.apply {
// setHasFixedSize(true)
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package com.teampome.pome.presentation.friend

import android.content.Context
import android.view.LayoutInflater
import android.view.View
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.R
import com.teampome.pome.databinding.ItemFriendDetailCardBinding
import com.teampome.pome.databinding.ItemFriendsListBinding
import com.teampome.pome.model.response.GetFriendRecord
import com.teampome.pome.model.response.GetFriends

//친구 기록 조회
class FriendRecordGetAdapter(
private val clickListener: FriendDetailRecordClickListener
private val clickListener: FriendDetailRecordClickListener,
private val context : Context?
) : ListAdapter<GetFriendRecord, FriendRecordGetAdapter.FriendGetRecordViewHolder>(BookDiffCallback) {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendGetRecordViewHolder {
Expand Down Expand Up @@ -47,6 +52,23 @@ class FriendRecordGetAdapter(
friendDetailMoreSettingIv.setOnClickListener {
friendDetailRecordClickListener.onFriendDetailMoreClick(getFriedRecord.id)
}

if(getFriedRecord.emotionResponse.friendEmotions.isEmpty()) {
friendDetailCardLastFriendEmotionCountTv.visibility = View.INVISIBLE
} else {
val count = getFriedRecord.emotionResponse.friendEmotions.size
if(count >= 10) {
friendDetailCardLastFriendEmotionCountTv.text = "9+"
} else {
friendDetailCardLastFriendEmotionCountTv.text = "+$count"
}
}

if(getFriedRecord.emotionResponse.myEmotion == null) {
context?.let{ context ->
Glide.with(context).load(R.drawable.emoji_mint_28).into(friendDetailCardFirstFriendEmotionAiv)
}
}
}
}

Expand Down
Binary file added app/src/main/res/drawable/emoji_mint_28.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_friend_detail_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
android:layout_width="28dp"
android:layout_height="28dp"
android:scaleType="fitXY"
android:src="@drawable/emoji_mint_fiter_what"
android:src="@drawable/emoji_mint_28"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Expand Down

0 comments on commit 21ffecb

Please sign in to comment.