Skip to content

Commit

Permalink
Merge pull request #17 from DOSOPT-CDS-APP-TEAM5/feature/#13-모임둘러보기-UI
Browse files Browse the repository at this point in the history
Feature/#13 모임둘러보기 UI
  • Loading branch information
lsakee committed Nov 29, 2023
2 parents dbafb6d + fa5d32c commit 5af15e3
Show file tree
Hide file tree
Showing 27 changed files with 945 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,63 @@ package org.sopt.carrot.presentation.exploremeeting

import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayoutMediator
import org.sopt.carrot.R
import org.sopt.carrot.core.ui.base.BindingActivity
import org.sopt.carrot.databinding.ActivityExploreMeetingBinding
import org.sopt.carrot.presentation.exploremeeting.adapter.HighlightAdapter
import org.sopt.carrot.presentation.exploremeeting.adapter.NewMeetingAdapter
import org.sopt.carrot.presentation.joinmeeting.JoinMeetingActivity

class ExploreMeetingActivity :
BindingActivity<ActivityExploreMeetingBinding>(R.layout.activity_explore_meeting) {

private lateinit var exploreMeetingCollectionAdapter: ExploreMeetingCollectionAdapter
private lateinit var viewPager: ViewPager2
private lateinit var newMeetingAdapter: NewMeetingAdapter
private lateinit var highlightAdapter: HighlightAdapter

private val viewModel by viewModels<ExploreMeetingViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initTabAdapter()
initTabAdapterSet()
initTabLayoutItem()
initMockAdapter()
binding.btnSample.setOnClickListener {
startActivity(Intent(this, JoinMeetingActivity::class.java))
}
}

private fun initTabAdapter() {
exploreMeetingCollectionAdapter = ExploreMeetingCollectionAdapter(supportFragmentManager, lifecycle)
viewPager = binding.viewpagerMeeting
viewPager.offscreenPageLimit = 6
viewPager.adapter = exploreMeetingCollectionAdapter
}

private fun initTabLayoutItem() {
val homeTabLayout = binding.tlNeighborMeeting
val test = listOf("전체","운동","동네친구","스터디","가족육아","반려동물")
TabLayoutMediator(homeTabLayout, viewPager) { tab, position ->
tab.text =test[position]
}.attach()
}

private fun initTabAdapterSet() {
exploreMeetingCollectionAdapter.setData(listOf("전체","운동","동네친구","스터디","가족육아","반려동물"))
exploreMeetingCollectionAdapter.notifyDataSetChanged()
}

private fun initMockAdapter() {
newMeetingAdapter = NewMeetingAdapter()
highlightAdapter = HighlightAdapter()
binding.rvNewMeetingList.adapter = newMeetingAdapter
binding.rvMeetingHighlight.adapter = highlightAdapter
newMeetingAdapter.submitList(viewModel.newMeetingMockList)
highlightAdapter.submitList(viewModel.meetingHighlightMockList)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.sopt.carrot.presentation.exploremeeting

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter

class ExploreMeetingCollectionAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :
FragmentStateAdapter(fragmentManager, lifecycle) {
private var dataSet: List<String> = emptyList()
override fun getItemCount(): Int {
return dataSet.size
}

override fun createFragment(position: Int): Fragment {
return ScreenMeetingSlideFragment.newInstance(dataSet[position])
}

fun setData(newData: List<String>) {
dataSet = newData
notifyDataSetChanged()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package org.sopt.carrot.presentation.exploremeeting

import androidx.lifecycle.ViewModel
import org.sopt.carrot.presentation.model.Meeting
import org.sopt.carrot.presentation.model.MeetingHighlight
import org.sopt.carrot.presentation.model.NewMeeting

class ExploreMeetingViewModel : ViewModel() {
val meetingMockList = mutableListOf(
Meeting(
1,
"test",
"test",
"https://s3-alpha-sig.figma.com/img/e98d/d5fe/144a3365727aa3de5419a5a3def7a2e2?Expires=1701648000&Signature=lvBRV5K0xrWoJbDJEBW9TVkJWHjf4KK6hsEbesoF3Mf2BSDlS7o0cdzX5a78ZVkL0aKOlGKrPJRl1vLMRIBGIFGtuEpsdpm3E-jZ8JCHSeIeteFFfYgmTNCWYGPW9awjAxnahqKcXanAqiOcugmdXZLzHI39hajQrzAaIZK9wpOHH5fOAPpydrK4cb1ywbKXkGbqyYpcK6wimZjjuIOofTkDBkdAvct8YPR3XiBft~nbcTjpNnkJ2O7ecVblLaRFmeQK~VUEOMYGf~M6vACZi1ao6kJ84ZelNfM0GbbaECidMzHLJ316DbJtEArvB21z2NIRdZzC7q7EZ9yBfKGZOQ__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"",
"test",
111,
),
Meeting(
2,
"test",
"test",
"https://s3-alpha-sig.figma.com/img/e98d/d5fe/144a3365727aa3de5419a5a3def7a2e2?Expires=1701648000&Signature=lvBRV5K0xrWoJbDJEBW9TVkJWHjf4KK6hsEbesoF3Mf2BSDlS7o0cdzX5a78ZVkL0aKOlGKrPJRl1vLMRIBGIFGtuEpsdpm3E-jZ8JCHSeIeteFFfYgmTNCWYGPW9awjAxnahqKcXanAqiOcugmdXZLzHI39hajQrzAaIZK9wpOHH5fOAPpydrK4cb1ywbKXkGbqyYpcK6wimZjjuIOofTkDBkdAvct8YPR3XiBft~nbcTjpNnkJ2O7ecVblLaRFmeQK~VUEOMYGf~M6vACZi1ao6kJ84ZelNfM0GbbaECidMzHLJ316DbJtEArvB21z2NIRdZzC7q7EZ9yBfKGZOQ__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"",
"test",
111,
),
Meeting(
3,
"test",
"test",
"https://s3-alpha-sig.figma.com/img/e98d/d5fe/144a3365727aa3de5419a5a3def7a2e2?Expires=1701648000&Signature=lvBRV5K0xrWoJbDJEBW9TVkJWHjf4KK6hsEbesoF3Mf2BSDlS7o0cdzX5a78ZVkL0aKOlGKrPJRl1vLMRIBGIFGtuEpsdpm3E-jZ8JCHSeIeteFFfYgmTNCWYGPW9awjAxnahqKcXanAqiOcugmdXZLzHI39hajQrzAaIZK9wpOHH5fOAPpydrK4cb1ywbKXkGbqyYpcK6wimZjjuIOofTkDBkdAvct8YPR3XiBft~nbcTjpNnkJ2O7ecVblLaRFmeQK~VUEOMYGf~M6vACZi1ao6kJ84ZelNfM0GbbaECidMzHLJ316DbJtEArvB21z2NIRdZzC7q7EZ9yBfKGZOQ__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"",
"test",
111,
),
)
val newMeetingMockList = mutableListOf(
NewMeeting(
"https://s3-alpha-sig.figma.com/img/e98d/d5fe/144a3365727aa3de5419a5a3def7a2e2?Expires=1701648000&Signature=lvBRV5K0xrWoJbDJEBW9TVkJWHjf4KK6hsEbesoF3Mf2BSDlS7o0cdzX5a78ZVkL0aKOlGKrPJRl1vLMRIBGIFGtuEpsdpm3E-jZ8JCHSeIeteFFfYgmTNCWYGPW9awjAxnahqKcXanAqiOcugmdXZLzHI39hajQrzAaIZK9wpOHH5fOAPpydrK4cb1ywbKXkGbqyYpcK6wimZjjuIOofTkDBkdAvct8YPR3XiBft~nbcTjpNnkJ2O7ecVblLaRFmeQK~VUEOMYGf~M6vACZi1ao6kJ84ZelNfM0GbbaECidMzHLJ316DbJtEArvB21z2NIRdZzC7q7EZ9yBfKGZOQ__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"주식 투자(트레이딩)",
"다양한 기법으로 투자(트레이딩)하는 관점",
"정자동",
"투자/금융"
),
NewMeeting(
"https://s3-alpha-sig.figma.com/img/8223/d69a/0fc6bbb2b464726d781d25c89db87f04?Expires=1701648000&Signature=PhPieULim~ElKVdUWzXLLSEBGigRwpf6J7otvr-MzID-1FiUfJAh-IjDmWRHXYGamOMoBM7140zAktsB-qdl4dk1DmLilEbHxRStuImgtX79in81zcSjMio6wBQISIG3N3d0poss31JLpzcgg5Y5SL7qT2FAtRDr-Uj060zFILGHf9QsdkCR4xR18NDOIsl6kupkDvetjR~Q6H3Gt1Apk8mjkmtneeVfLwCais7gXZkQhEFDS873qir8azYoiuBmbix9IbjXPCGS2q33y6Jq8dNiHBROODpUwR8GByKPGHO5FYJJHhWBy31JwCqdHpp3uMAQ-ZaqHdH6amRHm7QS5Q__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"음악회 / 전시회 동아리",
"음악회나 전시회 같이 보러 다닐 친구 구해요",
"상현1동",
"운동"
),
NewMeeting(
"https://s3-alpha-sig.figma.com/img/3ac0/089f/72c9ce99895093fa2bff131caa59a44e?Expires=1701648000&Signature=QmpM3QLc6NaptJjsAQp5vezUWG066aqrZnx6gV3h7XBpN8rCDbJk~qBK8AfbsJXnyVZDaKzuuWfvLo7sNBHhKXsKTmtZPUJPGC1uymGkzKKZFCkvLNZ4mzaQFvopQvJVai2pgsshYHtYpBzD1MYSbR~bbQHQo7XuoZj-dvR0MLHnRSl1qZn~E-qzajHA1QtQTREdZPYPV1q3zVnlbiS5ePTWj2B6OrP-74JI-kKkxtryxYP9ydtz1Y-1qAcwmXb7I3yDF9myNOuJYfXqIfa~RTVFo6h7GssXoYoFKm6td5I8OuSDxopxRPqec8nkofXh5Xrrz0ZEyC-5LrZKlHx~2w__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"광교 드림FC",
"매주 일요일 아침 광교 또는 인근 운동",
"광교1동",
"운동"
),
)
val meetingHighlightMockList = mutableListOf(
MeetingHighlight(
"https://s3-alpha-sig.figma.com/img/46c1/1a87/d715778de93a15555427a628cfc32fd8?Expires=1701648000&Signature=Cv~-ho5v4vvzOn4dKfhpxkOAryZYS5bSf~CHTBrzDMDa2GxYxa6MN4nXX8WENwp7XxPnykKDtm9O-BqON77ur-Hjq-fZ8P10d24~lvpnkz6sQkH53Z0DaLlqq5rEb1AkLs0pFKRB6cotTWyTMkNHpRZYHux8l9A5d5PUDRI8TrhuaV0Z~IRdFCblB0fMBK~9otsQb2riIkYeWY95fkQ4swNmf8V44Y-sKHPzPJHdCSPYV6ei5PCRd-iC2Wqt~irbcm7832fuBEJLv72IC73YEitdO2dkAE9v3WXox0r7n5DsIFqj96s566E5Nj6AXCoxKbX0Ty3NQMQjjT40sz~NZg__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"러닝크루"
),
MeetingHighlight(
"https://s3-alpha-sig.figma.com/img/8f15/d2e9/c978cfc0eca29b0817d8e99974085fab?Expires=1701648000&Signature=n5zM~zetHmUOObs3uNLnrmEIKR4e5vneYWbwxXAKXtXjcb4PFuCxfeILgxyhBEPOpd-zhjUXCO0y7ucIa-WbMF2xBeG6TuLE5dvU0mWtLHk3dE4LXe3UiD5WYVrltcM~uTYMt1FDUdEypXuDepXfqFLGB9MCT3~cvrAKsqx-zMW74SsaSUy-kh~pBLjHxIuVeS24DAT2WDQC0gsOfINXYf46R3AFWl02z2~BKXtNcZo4iJ5A~Fb0g3bIlpbV8y3xjqNI6HES7-8so4Zpq029aBk9o~U0T8q25btETjovEh-qBha3LJPzTvcm4RZF~bznuPKA8Ue6VARYzqYmoTLSiA__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"원데이클라스"
),
MeetingHighlight(
"https://s3-alpha-sig.figma.com/img/ecaa/202c/06d71a9139250ecb0bb212d23342da2a?Expires=1701648000&Signature=HPJs0DIffpEhh5kX~pOexNJ5wXWn2Ou5JghJUP1xQOtJLR5~2BNOEWKXvqgtFbUumEHE-yMgnyn1rVLLE8PQLn7kf1D~BPwn4x6-CwVzxDpTQFobJ3jp7pPYCZxGy22FnpestPwV1r6pQ1yT~0kOrFjAwdejI10gHK5qRVlRjmeZ3CgM7EDaM0zBdg2ppOuy1wkhhmE5GjjWV~Yb-ByCZKbpzuThla1NA9LPbtgwqeRizn5wCGyyQUTNF9BhSv3iUYMq8zzrENlY3hFjNbUJ345l3vhOX4TesQ2CLHQ2ybNFoxSmu69R7MSHJiIW4-CBlHSQ6wN~XyP8WqQ1J0eBBA__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
"영어 회화"
)
)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.sopt.carrot.presentation.exploremeeting

import android.os.Bundle
import android.view.View
import androidx.fragment.app.viewModels
import org.sopt.carrot.R
import org.sopt.carrot.core.ui.base.BindingFragment
import org.sopt.carrot.databinding.ItemFragmentMeetingBinding
import org.sopt.carrot.presentation.exploremeeting.adapter.MeetingAdapter

class ScreenMeetingSlideFragment :
BindingFragment<ItemFragmentMeetingBinding>(R.layout.item_fragment_meeting) {

private lateinit var meetingAdapter: MeetingAdapter
private val viewModel by viewModels<ExploreMeetingViewModel>()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val data = arguments?.getString("data")
initAdapter()
}

private fun initAdapter() {
meetingAdapter = MeetingAdapter()
binding.rvMeetingList.adapter = meetingAdapter
meetingAdapter.submitList(viewModel.meetingMockList)
}

companion object {
@JvmStatic
fun newInstance(data: String): ScreenMeetingSlideFragment {
val fragment = ScreenMeetingSlideFragment()
val args = Bundle()
args.putString("data", data)
fragment.arguments = args
return fragment
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.sopt.carrot.presentation.exploremeeting.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import org.sopt.carrot.core.ui.view.ItemDiffCallback
import org.sopt.carrot.databinding.ItemMeetingHighlightBinding
import org.sopt.carrot.presentation.exploremeeting.viewholder.HighlightViewHolder
import org.sopt.carrot.presentation.model.MeetingHighlight

class HighlightAdapter(
) : ListAdapter<MeetingHighlight, HighlightViewHolder>(
HighLightDiffCalback
) {

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

override fun onBindViewHolder(holder: HighlightViewHolder, position: Int) {
holder.bind(getItem(position))
}

companion object {
private val HighLightDiffCalback =
ItemDiffCallback<MeetingHighlight>(
onItemsTheSame = { old, new -> old.title == new.title },
onContentsTheSame = { old, new -> old == new }
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.sopt.carrot.presentation.exploremeeting.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import org.sopt.carrot.core.ui.view.ItemDiffCallback
import org.sopt.carrot.databinding.ItemMeetingBinding
import org.sopt.carrot.presentation.exploremeeting.viewholder.MeetingViewHolder
import org.sopt.carrot.presentation.model.Meeting

class MeetingAdapter(
) : ListAdapter<Meeting, MeetingViewHolder>(
HighLightDiffCalback
) {

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

override fun onBindViewHolder(holder: MeetingViewHolder, position: Int) {
holder.bind(getItem(position))
}

companion object {
private val HighLightDiffCalback =
ItemDiffCallback<Meeting>(
onItemsTheSame = { old, new -> old.clubId == new.clubId },
onContentsTheSame = { old, new -> old == new }
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.sopt.carrot.presentation.exploremeeting.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import org.sopt.carrot.core.ui.view.ItemDiffCallback
import org.sopt.carrot.databinding.ItemMeetingNewBinding
import org.sopt.carrot.presentation.exploremeeting.viewholder.NewMeetingViewHolder
import org.sopt.carrot.presentation.model.NewMeeting

class NewMeetingAdapter(
) : ListAdapter<NewMeeting, NewMeetingViewHolder>(
NewMeetingDiffCalback
) {

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

override fun onBindViewHolder(holder: NewMeetingViewHolder, position: Int) {
holder.bind(getItem(position))
}

companion object {
private val NewMeetingDiffCalback =
ItemDiffCallback<NewMeeting>(
onItemsTheSame = { old, new -> old.title == new.title },
onContentsTheSame = { old, new -> old == new }
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sopt.carrot.presentation.exploremeeting.viewholder

import androidx.recyclerview.widget.RecyclerView
import org.sopt.carrot.databinding.ItemMeetingHighlightBinding
import org.sopt.carrot.presentation.model.MeetingHighlight

class HighlightViewHolder(
private val binding: ItemMeetingHighlightBinding,
) : RecyclerView.ViewHolder(binding.root) {
fun bind(data: MeetingHighlight) {
binding.highlight = data
binding.executePendingBindings()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sopt.carrot.presentation.exploremeeting.viewholder

import androidx.recyclerview.widget.RecyclerView
import org.sopt.carrot.databinding.ItemMeetingBinding
import org.sopt.carrot.presentation.model.Meeting

class MeetingViewHolder(
private val binding: ItemMeetingBinding,
) : RecyclerView.ViewHolder(binding.root) {
fun bind(data: Meeting) {
binding.meeting = data
binding.executePendingBindings()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sopt.carrot.presentation.exploremeeting.viewholder

import androidx.recyclerview.widget.RecyclerView
import org.sopt.carrot.databinding.ItemMeetingNewBinding
import org.sopt.carrot.presentation.model.NewMeeting

class NewMeetingViewHolder(
private val binding: ItemMeetingNewBinding,
) : RecyclerView.ViewHolder(binding.root) {
fun bind(data: NewMeeting) {
binding.newmeeting = data
binding.executePendingBindings()
}
}
11 changes: 11 additions & 0 deletions app/src/main/java/org/sopt/carrot/presentation/model/Meeting.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.sopt.carrot.presentation.model

data class Meeting(
val clubId: Int,
val clubTagContent: String,
val clubName: String,
val clubImg: String,
val participantsImg: String,
val town: String,
val participantsCount: Int
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.sopt.carrot.presentation.model

data class MeetingHighlight(
val img: String,
val title: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.sopt.carrot.presentation.model

data class NewMeeting(
val img: String,
val title: String,
val subMsg: String,
val place: String,
val subject: String
)
Loading

0 comments on commit 5af15e3

Please sign in to comment.