Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat/api friend] : 친구탭 기록 관련 api 연결 작업 #23

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f4fca82
[feat] : #15 친구 목록 조회 view code 정리
SsongSik May 17, 2023
987a4d7
[feat] : #15 전체 친구 목록 조회
SsongSik May 17, 2023
40cf3ca
[feat] : #15 친구 리스트 분기처리
SsongSik May 17, 2023
b32417d
[feat] : #15 더보기 바텀다이얼로그 셋팅
SsongSik May 19, 2023
321e847
[feat] : #15 게시물 숨기기 기능
SsongSik May 20, 2023
e1e6797
[feat] : #15 친구 기록 뷰 수정
SsongSik May 27, 2023
21ffecb
[feat] : #15 친구 기록 이모지 카운트 기능 추가
SsongSik May 27, 2023
e12e0a0
[feat] : #15 친구 기록에 감정리스트 뷰 추가
SsongSik May 27, 2023
9bdfe1e
[feat] : #15 친구 기록 이모지 뷰 위치 조절
SsongSik Jun 12, 2023
5b03eaf
[feat] : #15 친구 기록 my 여부 예외
SsongSik Jun 12, 2023
ac88178
[feat] : #15 Find Friend Fragment Connect
SsongSik Jun 13, 2023
ebe3667
[feat] : #15 Find Friend Fragment Back Button Add
SsongSik Jun 13, 2023
e153205
[feat] : #15 Friend List Profile Image add
SsongSik Jun 15, 2023
ccfa2f9
[feat] : #15 Friend List Selected Text Color Change
SsongSik Jun 15, 2023
70cd622
[feat] : #15 adapterPosition Deprecated -> bindingAdapterPosition Change
SsongSik Jun 15, 2023
1597df5
[feat] : #15 Friend Record ItemClick Remove
SsongSik Jun 15, 2023
69a4608
[feat] : #15 Friend's record hide
SsongSik Jun 18, 2023
b9809d7
[feat] : #15 Friend Record Profile Image HashMap Connect
SsongSik Jun 18, 2023
749a132
[feat] : #15 Test Log Remove
SsongSik Jun 18, 2023
44c7018
[feat] : #15 ViewHolder Context -> itemView.context Modify
SsongSik Jun 18, 2023
787e408
[feat] : #15 Friend Record Time implement
SsongSik Jun 18, 2023
e71355a
[feat] : #15 FriendRecordGetAdapter inner class seperate
SsongSik Jun 23, 2023
6e658ac
[feat] : #15 FriendRecord Emoji Bottom Sheet Design Modify
SsongSik Jun 23, 2023
7baa68f
[feat] : #15 FriendRecord Emoji Bottom Sheet RV Add
SsongSik Jun 23, 2023
e1dfbca
[feat] : #15 FriendRecord Emoji Bottom Sheet EmojiList Implement
SsongSik Jun 23, 2023
02a5c58
[feat] : #15 Friend Emotion Image Add, Bottom Connect
SsongSik Jul 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/debug/res/drawable/rect27_white.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/>
<corners android:radius="27dp"/>
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.teampome.pome.model.response

//친구 삭제 Response
data class DeleteFriendRecord(
val data : Boolean
)
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
13 changes: 13 additions & 0 deletions app/src/main/java/com/teampome/pome/network/AddFriendsService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.teampome.pome.model.base.BaseAllData
import com.teampome.pome.model.base.BasePomeResponse
import com.teampome.pome.model.friend.FriendData
import com.teampome.pome.model.response.DeleteFriend
import com.teampome.pome.model.response.DeleteFriendRecord
import com.teampome.pome.model.response.GetFriendRecord
import com.teampome.pome.model.response.GetFriends
import retrofit2.Response
Expand Down Expand Up @@ -37,8 +38,20 @@ interface AddFriendsService {
@Path("userId") userId: String
) : Response<BasePomeResponse<BaseAllData<GetFriendRecord>>>

//친구 삭제
@DELETE("api/v1/users/friend/{friendId}")
suspend fun deleteFriend(
@Path("friendId") friendId: String
) : Response<BasePomeResponse<DeleteFriend>>

//모든 친구 기록 조회
@GET("api/v1/records/friends")
suspend fun getAllFriendRecord() :
Response<BasePomeResponse<BaseAllData<GetFriendRecord>>>

//기록 숨기기
@DELETE("api/v1/records/hide/{recordId}")
suspend fun deleteFriendRecord(
@Path("recordId") recordId: Int
) : Response<BasePomeResponse<DeleteFriendRecord>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.viewModels
import androidx.navigation.NavArgs
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.teampome.pome.R
import com.teampome.pome.databinding.FragmentAddFriendsBinding
import com.teampome.pome.presentation.addfriends.recyclerview.AddFriendsListAdapter
import com.teampome.pome.presentation.addfriends.recyclerview.OnAddFriendClickListener
import com.teampome.pome.presentation.record.add.AddGoalContentsFragmentArgs
import com.teampome.pome.util.common.CommonUtil
import com.teampome.pome.util.base.ApiResponse
import com.teampome.pome.util.base.BaseFragment
Expand All @@ -23,6 +26,9 @@ import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class AddFriendsFragment : BaseFragment<FragmentAddFriendsBinding>(R.layout.fragment_add_friends) {

private val args: AddFriendsFragmentArgs by navArgs()

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand All @@ -42,6 +48,12 @@ class AddFriendsFragment : BaseFragment<FragmentAddFriendsBinding>(R.layout.frag
}

override fun initView() {
if(args.addFriendType) {
binding.addFriendsBackIv.visibility = View.VISIBLE
} else {
binding.addFriendsBackIv.visibility = View.GONE
}

binding.addFriendsListRv.adapter = AddFriendsListAdapter().apply {
setOnAddFriendClickListener(object : OnAddFriendClickListener {
override fun onAddFriendClick(friendId: String, position: Int) {
Expand Down Expand Up @@ -170,6 +182,10 @@ class AddFriendsFragment : BaseFragment<FragmentAddFriendsBinding>(R.layout.frag
binding.addFriendsFindDeleteAtv.setOnClickListener {
binding.addFriendsNameEt.setText("")
}

binding.addFriendsBackIv.setOnClickListener {
findNavController().popBackStack()
}
}

private fun bindEmptyFriendData() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.teampome.pome.presentation.friend

import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.teampome.pome.util.common.CommonUtil

class BottomEmojiGridSpaceItemDecoration(private val spanCount: Int) :
RecyclerView.ItemDecoration() {
// 3, 20
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
val position = parent.getChildAdapterPosition(view)

val column = position % spanCount

val spaceInPx = CommonUtil.dpToPx(parent.context, 10)

outRect.top = spaceInPx

if (column == 0) {
outRect.left = spaceInPx
} else if (column == 1) {
outRect.left = spaceInPx
} else if (column == 2) {
outRect.left = spaceInPx
}

if (position >= 3) {
outRect.top = CommonUtil.dpToPx(parent.context, 30)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.teampome.pome.presentation.friend

import com.teampome.pome.model.response.FriendEmotionResponse

//친구 기록 클릭 리스너
interface FriendDetailRecordClickListener {

fun onFriendDetailMoreClick(recordId : Int)

fun onFriendDetailEmojiClick(emojiList : List<FriendEmotionResponse>)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.teampome.pome.presentation.friend

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.teampome.pome.R
import com.teampome.pome.databinding.ItemBottomEmojiBinding
import com.teampome.pome.model.response.FriendEmotionResponse

class FriendEmotionAdapter(
private var friendEmotionList: List<FriendEmotionResponse>
) : RecyclerView.Adapter<FriendEmotionAdapter.FriendEmotionViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendEmotionViewHolder {
val binding = ItemBottomEmojiBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return FriendEmotionViewHolder(binding)
}

override fun onBindViewHolder(holder: FriendEmotionViewHolder, position: Int) {
holder.bind(friendEmotionList[position])
}

override fun getItemCount(): Int = friendEmotionList.size

fun updateData(newData: List<FriendEmotionResponse>) {
this.friendEmotionList = newData
notifyDataSetChanged()
}

inner class FriendEmotionViewHolder(
private val binding: ItemBottomEmojiBinding
) : RecyclerView.ViewHolder(binding.root) {
fun bind(friendEmotion: FriendEmotionResponse) {
with(binding) {
friendEmotionHappyTv.text = friendEmotion.nickname

val imageResource = when(friendEmotion.emotionId) {
0 -> R.drawable.emotion_happy_54
1 -> R.drawable.emotion_what_54
2 -> R.drawable.emotion_sad_54
3 -> R.drawable.emotion_funny_54
4 -> R.drawable.emotion_smile_54
else -> R.drawable.emotion_flex_54
}

friendEmotionHappyAiv.setImageResource(imageResource)
}
}
}
}
Loading