From 69ccff059ded0e4b7c9ba5bd2021a9c8ac59970e Mon Sep 17 00:00:00 2001 From: hyeumm <20221159@sungshin.ac.kr> Date: Mon, 15 Apr 2024 01:06:01 +0900 Subject: [PATCH] =?UTF-8?q?mod/#5:=20=EB=B7=B0=ED=99=80=EB=8D=94=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sopt/now/FriendViewHolder.kt | 8 --- .../main/java/com/sopt/now/HomeFragment.kt | 28 +------- .../main/java/com/sopt/now/MockFriendList.kt | 66 +++++++++++++++++++ .../main/java/com/sopt/now/UserViewHolder.kt | 12 ++++ 4 files changed, 79 insertions(+), 35 deletions(-) create mode 100644 app/src/main/java/com/sopt/now/MockFriendList.kt create mode 100644 app/src/main/java/com/sopt/now/UserViewHolder.kt diff --git a/app/src/main/java/com/sopt/now/FriendViewHolder.kt b/app/src/main/java/com/sopt/now/FriendViewHolder.kt index 5e255ee..bc292e1 100644 --- a/app/src/main/java/com/sopt/now/FriendViewHolder.kt +++ b/app/src/main/java/com/sopt/now/FriendViewHolder.kt @@ -4,16 +4,8 @@ import android.view.View import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView -import com.sopt.now.databinding.ItemFriendBinding -import com.sopt.now.databinding.ItemUserBinding - class FriendViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { val ivProfile : ImageView = view.findViewById(R.id.iv_profile) val tvName : TextView = view.findViewById(R.id.tv_name) val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description) -} -class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { - val ivProfile : ImageView = view.findViewById(R.id.iv_profile) - val tvName : TextView = view.findViewById(R.id.tv_name) - val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description) } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/HomeFragment.kt b/app/src/main/java/com/sopt/now/HomeFragment.kt index 922b00e..03a5310 100644 --- a/app/src/main/java/com/sopt/now/HomeFragment.kt +++ b/app/src/main/java/com/sopt/now/HomeFragment.kt @@ -11,32 +11,6 @@ import com.sopt.now.databinding.FragmentHomeBinding class HomeFragment : Fragment() { private lateinit var binding: FragmentHomeBinding - private val mockFriendList = listOf( - Friend( - profileImage = R.drawable.main, - name = "송혜음", - selfDescription = "멀티 뷰 리싸이클러뷰!", - 0 - ), - Friend( - profileImage = R.drawable.main, - name = "이의경", - selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^", - 1 - ), - Friend( - profileImage = R.drawable.main, - name = "우상욱", - selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐", - 1 - ), - Friend( - profileImage = R.drawable.main, - name = "배지현", - selfDescription = "표정 풀자 ^^", - 1 - ), - ) override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -51,7 +25,7 @@ class HomeFragment : Fragment() { adapter = friendAdapter layoutManager = LinearLayoutManager(requireContext()) } - friendAdapter.setFriendList(mockFriendList) + friendAdapter.setFriendList(MockFriendList.mockFriendList) } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/MockFriendList.kt b/app/src/main/java/com/sopt/now/MockFriendList.kt new file mode 100644 index 0000000..9bcb4c5 --- /dev/null +++ b/app/src/main/java/com/sopt/now/MockFriendList.kt @@ -0,0 +1,66 @@ +package com.sopt.now + +object MockFriendList { + val mockFriendList = listOf( + Friend( + profileImage = R.drawable.main, + name = "송혜음", + selfDescription = "멀티 뷰 리싸이클러뷰!", + 0 + ), + Friend( + profileImage = R.drawable.main, + name = "이의경", + selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "우상욱", + selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "배지현", + selfDescription = "표정 풀자 ^^", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "이의경", + selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "우상욱", + selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "배지현", + selfDescription = "표정 풀자 ^^", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "이의경", + selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지? ㅎㅎ 아직 반도 안왔어 ^&^", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "우상욱", + selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐", + 1 + ), + Friend( + profileImage = R.drawable.main, + name = "배지현", + selfDescription = "표정 풀자 ^^", + 1 + ) + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/UserViewHolder.kt b/app/src/main/java/com/sopt/now/UserViewHolder.kt new file mode 100644 index 0000000..315f65b --- /dev/null +++ b/app/src/main/java/com/sopt/now/UserViewHolder.kt @@ -0,0 +1,12 @@ +package com.sopt.now + +import android.view.View +import android.widget.ImageView +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView + +class UserViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { + val ivProfile : ImageView = view.findViewById(R.id.iv_profile) + val tvName : TextView = view.findViewById(R.id.tv_name) + val tvSelfDescription : TextView = view.findViewById(R.id.tv_self_description) +} \ No newline at end of file